path
stringlengths 5
304
| repo_name
stringlengths 6
79
| content
stringlengths 27
1.05M
|
|---|---|---|
ajax/libs/vkui/4.24.0/components/ModalRoot/useModalManager.min.js
|
cdnjs/cdnjs
|
import _extends from"@babel/runtime/helpers/extends";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectSpread from"@babel/runtime/helpers/objectSpread2";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import{createScopedElement}from"../../lib/jsxRuntime";import*as React from"react";import{ModalType}from"./types";import{warnOnce}from"../../lib/warnOnce";import{getNavId}from"../../lib/getNavId";import{useIsomorphicLayoutEffect}from"../../lib/useIsomorphicLayoutEffect";import{noop,isFunction}from"../../lib/utils";function getModals(e){return React.Children.toArray(e)}var warn=warnOnce("ModalRoot");function modalTransitionReducer(e,t){if("setActive"!==t.type||t.id===e.activeModal)return"entered"===t.type&&t.id===e.enteringModal?_objectSpread(_objectSpread({},e),{},{enteringModal:null}):"exited"===t.type&&t.id===e.exitingModal?_objectSpread(_objectSpread({},e),{},{exitingModal:null}):"inited"===t.type&&t.id===e.activeModal?_objectSpread(_objectSpread({},e),{},{enteringModal:t.id}):e;var o=t.id,n=e.exitingModal||e.activeModal,t=_toConsumableArray(e.history),e=t.includes(o);return null===o?t=[]:e?t=t.splice(0,t.indexOf(o)+1):t.push(o),{activeModal:o,enteringModal:null,exitingModal:n,history:t,isBack:e}}function useModalManager(e,t,o){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:noop,i=React.useRef({}).current;getModals(t).forEach(function(e){var t=e.props,o=getNavId(t,warn),o=i[o]||{id:o};o.onClose=e.props.onClose,o.dynamicContentHeight=!!t.dynamicContentHeight,"number"==typeof t.settlingHeight&&(o.settlingHeight=t.settlingHeight),i[o.id]=o});var a=e&&!i[e],r=a?null:e,l=React.useReducer(modalTransitionReducer,{activeModal:r,enteringModal:null,exitingModal:null,history:r?[r]:[],isBack:!1}),d=_slicedToArray(l,2),c=d[0],u=d[1];useIsomorphicLayoutEffect(function(){"development"===process.env.NODE_ENV&&a&&warn("Can't transition - modal ".concat(e," not found")),u({type:"setActive",id:r})},[e]),useIsomorphicLayoutEffect(function(){c.activeModal&&(n(i[c.activeModal]),u({type:"inited",id:c.activeModal}))},[c.activeModal]);var s=function(e){return(null===(e=i[e])||void 0===e?void 0:e.type)===ModalType.CARD},p=React.useCallback(function(e){return u({type:"entered",id:e})},[]),l=React.useCallback(function(e){return u({type:"exited",id:e})},[]),d=Boolean(c.exitingModal&&(s(e)||s(c.exitingModal))),s=React.useCallback(function(e){return i[e]},[]);return _objectSpread(_objectSpread({onEnter:p,onExit:l},c),{},{delayEnter:d,getModalState:s,closeActiveModal:function(){var e=i[c.activeModal];e&&(isFunction(e.onClose)?e.onClose():isFunction(o)?o(e.id):"development"===process.env.NODE_ENV&&warn("onClose is undefined"))}})}function withModalManager(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:noop;return function(o){return function(e){var t=useModalManager(e.activeModal,e.children,e.onClose,n);return createScopedElement(o,_extends({},e,t))}}}export{modalTransitionReducer,useModalManager,withModalManager};
|
src/ParallaxSwiperPage.js
|
zachgibson/react-native-parallax-swiper
|
import React, { Component } from 'react';
import { View, Animated, StyleSheet, Dimensions } from 'react-native';
import PropTypes from 'prop-types';
const { width: deviceWidth, height: deviceHeight } = Dimensions.get('window');
class ParallaxSwiperPage extends Component {
setPageSize = ({ nativeEvent }) => {
this.props.setScrollViewSize(
nativeEvent.layout.width,
nativeEvent.layout.height,
);
};
getParallaxStyles(i) {
const {
speed,
dividerWidth,
vertical,
animatedValue,
pageWidth,
pageHeight,
} = this.props;
const totalPageWidth = pageWidth + dividerWidth;
const horizontalSpeed =
dividerWidth === 0
? Math.abs(pageWidth * speed - pageWidth)
: Math.abs(pageWidth * speed - dividerWidth - pageWidth);
const verticalSpeed = Math.abs(pageHeight * speed - pageHeight);
const horizontalStyles = {
transform: [
{
translateX: animatedValue.interpolate({
inputRange: [
(i - 1) * totalPageWidth,
i * (pageWidth + dividerWidth),
(i + 1) * totalPageWidth,
],
outputRange: [-horizontalSpeed, 0, horizontalSpeed],
extrapolate: 'clamp',
}),
},
],
};
const verticalStyles = {
transform: [
{
translateY: animatedValue.interpolate({
inputRange: [
(i - 1) * pageHeight,
i * pageHeight,
(i + 1) * pageHeight,
],
outputRange: [-verticalSpeed, 0, verticalSpeed],
extrapolate: 'clamp',
}),
},
],
};
if (speed === 1) {
return {};
}
if (vertical) {
return verticalStyles;
}
return horizontalStyles;
}
render() {
const { index, BackgroundComponent, ForegroundComponent } = this.props;
return (
<View onLayout={this.setPageSize} style={styles.container}>
<Animated.View style={this.getParallaxStyles(index)}>
{BackgroundComponent}
</Animated.View>
<View pointerEvents="box-none" style={styles.foregroundContainer}>
{ForegroundComponent}
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
overflow: 'hidden',
flex: 1,
},
foregroundContainer: {
...StyleSheet.absoluteFillObject,
},
});
ParallaxSwiperPage.propTypes = {
index: PropTypes.number,
BackgroundComponent: PropTypes.element,
ForegroundComponent: PropTypes.element,
};
ParallaxSwiperPage.defaultProps = {};
export default ParallaxSwiperPage;
export const ParallaxSwiperPagePropTypes = ParallaxSwiperPage.propTypes;
|
app/components/ShoppingCartComponent.js
|
cdillon85/the-art-store
|
import React from 'react'
import {Table, TableBody, TableHeader, TableHeaderColumn, TableRow, TableRowColumn} from 'material-ui/Table'
import Paper from 'material-ui/Paper'
import RaisedButton from 'material-ui/RaisedButton'
export default function ShoppingCartComponent (props) {
const divStyle = {
}
const imageStyle = {
height: 100,
width: 100
}
return (
<div>
<Paper zDepth={4} style={divStyle}>
<h1 className="shopping-cart-header">Shopping Cart</h1>
<Table displayRowCheckbox={false} >
<TableHeader displaySelectAll={false}>
<TableRow>
<TableHeaderColumn>Product</TableHeaderColumn>
<TableHeaderColumn>Artist</TableHeaderColumn>
<TableHeaderColumn>Title</TableHeaderColumn>
<TableHeaderColumn>price</TableHeaderColumn>
<TableHeaderColumn>Quantity</TableHeaderColumn>
<TableHeaderColumn>Total</TableHeaderColumn>
<TableHeaderColumn />
</TableRow>
</TableHeader>
<TableBody displayRowCheckbox={false}>
{props.productLines && props.productLines.map(productLine => {
return (<TableRow key={productLine.id}>
<TableRowColumn><img src={productLine.product.url} style={imageStyle} /></TableRowColumn>
<TableRowColumn>{productLine.product.artistName}</TableRowColumn>
<TableRowColumn>{productLine.product.title}</TableRowColumn>
<TableRowColumn>${productLine.product.price}</TableRowColumn>
<TableRowColumn>{productLine.quantity}</TableRowColumn>
<TableRowColumn>${productLine.quantity * productLine.product.price}</TableRowColumn>
<TableRowColumn>
<RaisedButton label="REMOVE ITEM" onClick={() => props.onClick(productLine.id)} />
</TableRowColumn>
</TableRow>
)})}
</TableBody>
</Table>
</Paper>
</div>
)
}
|
src/svg-icons/action/view-column.js
|
ArcanisCz/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionViewColumn = (props) => (
<SvgIcon {...props}>
<path d="M10 18h5V5h-5v13zm-6 0h5V5H4v13zM16 5v13h5V5h-5z"/>
</SvgIcon>
);
ActionViewColumn = pure(ActionViewColumn);
ActionViewColumn.displayName = 'ActionViewColumn';
ActionViewColumn.muiName = 'SvgIcon';
export default ActionViewColumn;
|
app/features/settings/device/panels/SettingsDevicePanelReconnecting.js
|
squatsandsciencelabs/OpenBarbellApp
|
import React, { Component } from 'react';
import {
Text,
View,
Image
} from 'react-native';
import { SETTINGS_PANEL_STYLES } from 'app/appearance/styles/GlobalStyles';
// displays connecting device info
class SettingsDevicePanelReconnecting extends Component {
render() {
return (
<View style={ [SETTINGS_PANEL_STYLES.panel, { flex: 1 }] }>
<View style={ SETTINGS_PANEL_STYLES.header }>
<Text style={ SETTINGS_PANEL_STYLES.headerText }>
Reconnecting...
</Text>
</View>
<View style={ SETTINGS_PANEL_STYLES.content }>
<Image source={require('app/appearance/images/icon_bluetooth_connecting.png')} />
</View>
<View style={ SETTINGS_PANEL_STYLES.footer }>
<Text style={ SETTINGS_PANEL_STYLES.footerCancelText }
onPress={ () => this.props.stopReconnect() }>
CANCEL
</Text>
</View>
</View>
);
}
}
export default SettingsDevicePanelReconnecting;
|
packages/material-ui-icons/src/ClearAllOutlined.js
|
Kagami/material-ui
|
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><g><path d="M5 13h14v-2H5v2zm-2 4h14v-2H3v2zM7 7v2h14V7H7z" /></g></React.Fragment>
, 'ClearAllOutlined');
|
lib/app/public/js/app.js
|
kizerxl/exercism.io
|
/*!
* jQuery JavaScript Library v1.10.2
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2013-07-03T13:48Z
*/
(function( window, undefined ) {
// Can't do this because several apps including ASP.NET trace
// the stack via arguments.caller.callee and Firefox dies if
// you try to trace through "use strict" call chains. (#13335)
// Support: Firefox 18+
//"use strict";
var
// The deferred used on DOM ready
readyList,
// A central reference to the root jQuery(document)
rootjQuery,
// Support: IE<10
// For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`
core_strundefined = typeof undefined,
// Use the correct document accordingly with window argument (sandbox)
location = window.location,
document = window.document,
docElem = document.documentElement,
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// [[Class]] -> type pairs
class2type = {},
// List of deleted data cache ids, so we can reuse them
core_deletedIds = [],
core_version = "1.10.2",
// Save a reference to some core methods
core_concat = core_deletedIds.concat,
core_push = core_deletedIds.push,
core_slice = core_deletedIds.slice,
core_indexOf = core_deletedIds.indexOf,
core_toString = class2type.toString,
core_hasOwn = class2type.hasOwnProperty,
core_trim = core_version.trim,
// Define a local copy of jQuery
jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
},
// Used for matching numbers
core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
// Used for splitting on whitespace
core_rnotwhite = /\S+/g,
// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
// Strict HTML recognition (#11290: must start with <)
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
// JSON RegExp
rvalidchars = /^[\],:{}\s]*$/,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return letter.toUpperCase();
},
// The ready event handler
completed = function( event ) {
// readyState === "complete" is good enough for us to call the dom ready in oldIE
if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
detach();
jQuery.ready();
}
},
// Clean-up method for dom ready events
detach = function() {
if ( document.addEventListener ) {
document.removeEventListener( "DOMContentLoaded", completed, false );
window.removeEventListener( "load", completed, false );
} else {
document.detachEvent( "onreadystatechange", completed );
window.detachEvent( "onload", completed );
}
};
jQuery.fn = jQuery.prototype = {
// The current version of jQuery being used
jquery: core_version,
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem;
// HANDLE: $(""), $(null), $(undefined), $(false)
if ( !selector ) {
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
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 = rquickExpr.exec( selector );
}
// Match html or make sure no context is specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] ) {
context = context instanceof jQuery ? context[0] : context;
// scripts is true for back-compat
jQuery.merge( this, jQuery.parseHTML(
match[1],
context && context.nodeType ? context.ownerDocument || context : document,
true
) );
// HANDLE: $(html, props)
if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
for ( match in context ) {
// Properties of context are called as methods if possible
if ( jQuery.isFunction( this[ match ] ) ) {
this[ match ]( context[ match ] );
// ...and otherwise set as attributes
} else {
this.attr( match, context[ match ] );
}
}
}
return this;
// HANDLE: $(#id)
} else {
elem = document.getElementById( match[2] );
// 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: $(DOMElement)
} else if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
// 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 default length of a jQuery object is 0
length: 0,
toArray: function() {
return core_slice.call( this );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( 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 ) {
// Build a new jQuery matched element set
var ret = jQuery.merge( this.constructor(), elems );
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
// 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 ) {
// Add the callback
jQuery.ready.promise().done( fn );
return this;
},
slice: function() {
return this.pushStack( core_slice.apply( this, arguments ) );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
eq: function( i ) {
var len = this.length,
j = +i + ( i < 0 ? len : 0 );
return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
},
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: core_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 src, copyIsArray, copy, name, options, 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({
// Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery
expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
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 ) {
// Abort if there are pending holds or we're already ready
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
return;
}
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready );
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if ( wait !== true && --jQuery.readyWait > 0 ) {
return;
}
// If there are functions bound, to execute
readyList.resolveWith( document, [ jQuery ] );
// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger("ready").off("ready");
}
},
// 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 ) {
/* jshint eqeqeq: false */
return obj != null && obj == obj.window;
},
isNumeric: function( obj ) {
return !isNaN( parseFloat(obj) ) && isFinite( obj );
},
type: function( obj ) {
if ( obj == null ) {
return String( obj );
}
return typeof obj === "object" || typeof obj === "function" ?
class2type[ core_toString.call(obj) ] || "object" :
typeof obj;
},
isPlainObject: function( obj ) {
var key;
// 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 &&
!core_hasOwn.call(obj, "constructor") &&
!core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
// Support: IE<9
// Handle iteration over inherited properties before own properties.
if ( jQuery.support.ownLast ) {
for ( key in obj ) {
return core_hasOwn.call( obj, key );
}
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
for ( key in obj ) {}
return key === undefined || core_hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
var name;
for ( name in obj ) {
return false;
}
return true;
},
error: function( msg ) {
throw new Error( msg );
},
// data: string of html
// context (optional): If specified, the fragment will be created in this context, defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
parseHTML: function( data, context, keepScripts ) {
if ( !data || typeof data !== "string" ) {
return null;
}
if ( typeof context === "boolean" ) {
keepScripts = context;
context = false;
}
context = context || document;
var parsed = rsingleTag.exec( data ),
scripts = !keepScripts && [];
// Single tag
if ( parsed ) {
return [ context.createElement( parsed[1] ) ];
}
parsed = jQuery.buildFragment( [ data ], context, scripts );
if ( scripts ) {
jQuery( scripts ).remove();
}
return jQuery.merge( [], parsed.childNodes );
},
parseJSON: function( data ) {
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}
if ( data === null ) {
return data;
}
if ( typeof data === "string" ) {
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
if ( 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 ) {
var xml, tmp;
if ( !data || typeof data !== "string" ) {
return null;
}
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 && jQuery.trim( 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.toLowerCase() === name.toLowerCase();
},
// args is for internal usage only
each: function( obj, callback, args ) {
var value,
i = 0,
length = obj.length,
isArray = isArraylike( obj );
if ( args ) {
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
}
}
return obj;
},
// Use native String.trim function wherever possible
trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
function( text ) {
return text == null ?
"" :
core_trim.call( text );
} :
// Otherwise use our own trimming functionality
function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "" );
},
// results is for internal usage only
makeArray: function( arr, results ) {
var ret = results || [];
if ( arr != null ) {
if ( isArraylike( Object(arr) ) ) {
jQuery.merge( ret,
typeof arr === "string" ?
[ arr ] : arr
);
} else {
core_push.call( ret, arr );
}
}
return ret;
},
inArray: function( elem, arr, i ) {
var len;
if ( arr ) {
if ( core_indexOf ) {
return core_indexOf.call( arr, elem, i );
}
len = arr.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
// Skip accessing in sparse arrays
if ( i in arr && arr[ i ] === elem ) {
return i;
}
}
}
return -1;
},
merge: function( first, second ) {
var l = second.length,
i = first.length,
j = 0;
if ( typeof l === "number" ) {
for ( ; 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 retVal,
ret = [],
i = 0,
length = elems.length;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( ; 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,
i = 0,
length = elems.length,
isArray = isArraylike( elems ),
ret = [];
// 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 ( i in elems ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
}
// Flatten any nested arrays
return core_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 ) {
var args, proxy, tmp;
if ( typeof context === "string" ) {
tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
args = core_slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
return proxy;
},
// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
var i = 0,
length = elems.length,
bulk = key == null;
// Sets many values
if ( jQuery.type( key ) === "object" ) {
chainable = true;
for ( i in key ) {
jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
}
// Sets one value
} else if ( value !== undefined ) {
chainable = true;
if ( !jQuery.isFunction( value ) ) {
raw = true;
}
if ( bulk ) {
// Bulk operations run against the entire set
if ( raw ) {
fn.call( elems, value );
fn = null;
// ...except when executing function values
} else {
bulk = fn;
fn = function( elem, key, value ) {
return bulk.call( jQuery( elem ), value );
};
}
}
if ( fn ) {
for ( ; i < length; i++ ) {
fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
}
}
}
return chainable ?
elems :
// Gets
bulk ?
fn.call( elems ) :
length ? fn( elems[0], key ) : emptyGet;
},
now: function() {
return ( new Date() ).getTime();
},
// A method for quickly swapping in/out CSS properties to get correct calculations.
// Note: this method belongs to the css module but it's needed here for the support module.
// If support gets modularized, this method should be moved back to the css module.
swap: function( elem, options, callback, args ) {
var ret, name,
old = {};
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.apply( elem, args || [] );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
}
});
jQuery.ready.promise = function( obj ) {
if ( !readyList ) {
readyList = jQuery.Deferred();
// Catch cases where $(document).ready() is called after the browser event has already occurred.
// we once tried to use readyState "interactive" here, but it caused issues like the one
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
setTimeout( jQuery.ready );
// Standards-based browsers support DOMContentLoaded
} else if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed, false );
// A fallback to window.onload, that will always work
window.addEventListener( "load", completed, false );
// If IE event model is used
} else {
// Ensure firing before onload, maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", completed );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", completed );
// If IE and not a frame
// continually check to see if the document is ready
var top = false;
try {
top = window.frameElement == null && document.documentElement;
} catch(e) {}
if ( top && top.doScroll ) {
(function doScrollCheck() {
if ( !jQuery.isReady ) {
try {
// Use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
top.doScroll("left");
} catch(e) {
return setTimeout( doScrollCheck, 50 );
}
// detach all dom ready events
detach();
// and execute any waiting functions
jQuery.ready();
}
})();
}
}
}
return readyList.promise( obj );
};
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
function isArraylike( obj ) {
var length = obj.length,
type = jQuery.type( obj );
if ( jQuery.isWindow( obj ) ) {
return false;
}
if ( obj.nodeType === 1 && length ) {
return true;
}
return type === "array" || type !== "function" &&
( length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj );
}
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
/*!
* Sizzle CSS Selector Engine v1.10.2
* http://sizzlejs.com/
*
* Copyright 2013 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2013-07-03
*/
(function( window, undefined ) {
var i,
support,
cachedruns,
Expr,
getText,
isXML,
compile,
outermostContext,
sortInput,
// Local document vars
setDocument,
document,
docElem,
documentIsHTML,
rbuggyQSA,
rbuggyMatches,
matches,
contains,
// Instance-specific data
expando = "sizzle" + -(new Date()),
preferredDoc = window.document,
dirruns = 0,
done = 0,
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
hasDuplicate = false,
sortOrder = function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
return 0;
}
return 0;
},
// General-purpose constants
strundefined = typeof undefined,
MAX_NEGATIVE = 1 << 31,
// Instance methods
hasOwn = ({}).hasOwnProperty,
arr = [],
pop = arr.pop,
push_native = arr.push,
push = arr.push,
slice = arr.slice,
// Use a stripped-down indexOf if we can't use a native one
indexOf = arr.indexOf || function( elem ) {
var i = 0,
len = this.length;
for ( ; i < len; i++ ) {
if ( this[i] === elem ) {
return i;
}
}
return -1;
},
booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
// Regular expressions
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/TR/css3-syntax/#characters
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
// Loosely modeled on CSS identifier characters
// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier = characterEncoding.replace( "w", "w#" ),
// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
"*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
// Prefer arguments quoted,
// then not containing pseudos/brackets,
// then attribute selectors/non-parenthetical expressions,
// then anything else
// These preferences are here to reduce the number of selectors
// needing tokenize in the PSEUDO preFilter
pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
rsibling = new RegExp( whitespace + "*[+~]" ),
rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ),
rpseudo = new RegExp( pseudos ),
ridentifier = new RegExp( "^" + identifier + "$" ),
matchExpr = {
"ID": new RegExp( "^#(" + characterEncoding + ")" ),
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
"ATTR": new RegExp( "^" + attributes ),
"PSEUDO": new RegExp( "^" + pseudos ),
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
// For use in libraries implementing .is()
// We use this for POS matching in `select`
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
},
rnative = /^[^{]+\{\s*\[native \w/,
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
rinputs = /^(?:input|select|textarea|button)$/i,
rheader = /^h\d$/i,
rescape = /'|\\/g,
// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
funescape = function( _, escaped, escapedWhitespace ) {
var high = "0x" + escaped - 0x10000;
// NaN means non-codepoint
// Support: Firefox
// Workaround erroneous numeric interpretation of +"0x"
return high !== high || escapedWhitespace ?
escaped :
// BMP codepoint
high < 0 ?
String.fromCharCode( high + 0x10000 ) :
// Supplemental Plane codepoint (surrogate pair)
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
};
// Optimize for push.apply( _, NodeList )
try {
push.apply(
(arr = slice.call( preferredDoc.childNodes )),
preferredDoc.childNodes
);
// Support: Android<4.0
// Detect silently failing push.apply
arr[ preferredDoc.childNodes.length ].nodeType;
} catch ( e ) {
push = { apply: arr.length ?
// Leverage slice if possible
function( target, els ) {
push_native.apply( target, slice.call(els) );
} :
// Support: IE<9
// Otherwise append directly
function( target, els ) {
var j = target.length,
i = 0;
// Can't trust NodeList.length
while ( (target[j++] = els[i++]) ) {}
target.length = j - 1;
}
};
}
function Sizzle( selector, context, results, seed ) {
var match, elem, m, nodeType,
// QSA vars
i, groups, old, nid, newContext, newSelector;
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
setDocument( context );
}
context = context || document;
results = results || [];
if ( !selector || typeof selector !== "string" ) {
return results;
}
if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
return [];
}
if ( documentIsHTML && !seed ) {
// Shortcuts
if ( (match = rquickExpr.exec( selector )) ) {
// Speed-up: Sizzle("#ID")
if ( (m = match[1]) ) {
if ( nodeType === 9 ) {
elem = context.getElementById( m );
// 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, Opera, and Webkit return items
// by name instead of ID
if ( elem.id === m ) {
results.push( elem );
return results;
}
} else {
return results;
}
} else {
// Context is not a document
if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
contains( context, elem ) && elem.id === m ) {
results.push( elem );
return results;
}
}
// Speed-up: Sizzle("TAG")
} else if ( match[2] ) {
push.apply( results, context.getElementsByTagName( selector ) );
return results;
// Speed-up: Sizzle(".CLASS")
} else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
push.apply( results, context.getElementsByClassName( m ) );
return results;
}
}
// QSA path
if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
nid = old = expando;
newContext = context;
newSelector = nodeType === 9 && selector;
// 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
if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
groups = tokenize( selector );
if ( (old = context.getAttribute("id")) ) {
nid = old.replace( rescape, "\\$&" );
} else {
context.setAttribute( "id", nid );
}
nid = "[id='" + nid + "'] ";
i = groups.length;
while ( i-- ) {
groups[i] = nid + toSelector( groups[i] );
}
newContext = rsibling.test( selector ) && context.parentNode || context;
newSelector = groups.join(",");
}
if ( newSelector ) {
try {
push.apply( results,
newContext.querySelectorAll( newSelector )
);
return results;
} catch(qsaError) {
} finally {
if ( !old ) {
context.removeAttribute("id");
}
}
}
}
}
// All others
return select( selector.replace( rtrim, "$1" ), context, results, seed );
}
/**
* Create key-value caches of limited size
* @returns {Function(string, Object)} Returns the Object data after storing it on itself with
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
* deleting the oldest entry
*/
function createCache() {
var keys = [];
function cache( key, value ) {
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
if ( keys.push( key += " " ) > Expr.cacheLength ) {
// Only keep the most recent entries
delete cache[ keys.shift() ];
}
return (cache[ key ] = value);
}
return cache;
}
/**
* Mark a function for special use by Sizzle
* @param {Function} fn The function to mark
*/
function markFunction( fn ) {
fn[ expando ] = true;
return fn;
}
/**
* Support testing using an element
* @param {Function} fn Passed the created div and expects a boolean result
*/
function assert( fn ) {
var div = document.createElement("div");
try {
return !!fn( div );
} catch (e) {
return false;
} finally {
// Remove from its parent by default
if ( div.parentNode ) {
div.parentNode.removeChild( div );
}
// release memory in IE
div = null;
}
}
/**
* Adds the same handler for all of the specified attrs
* @param {String} attrs Pipe-separated list of attributes
* @param {Function} handler The method that will be applied
*/
function addHandle( attrs, handler ) {
var arr = attrs.split("|"),
i = attrs.length;
while ( i-- ) {
Expr.attrHandle[ arr[i] ] = handler;
}
}
/**
* Checks document order of two siblings
* @param {Element} a
* @param {Element} b
* @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
*/
function siblingCheck( a, b ) {
var cur = b && a,
diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
( ~b.sourceIndex || MAX_NEGATIVE ) -
( ~a.sourceIndex || MAX_NEGATIVE );
// Use IE sourceIndex if available on both nodes
if ( diff ) {
return diff;
}
// Check if b follows a
if ( cur ) {
while ( (cur = cur.nextSibling) ) {
if ( cur === b ) {
return -1;
}
}
}
return a ? 1 : -1;
}
/**
* Returns a function to use in pseudos for input types
* @param {String} type
*/
function createInputPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for buttons
* @param {String} type
*/
function createButtonPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for positionals
* @param {Function} fn
*/
function createPositionalPseudo( fn ) {
return markFunction(function( argument ) {
argument = +argument;
return markFunction(function( seed, matches ) {
var j,
matchIndexes = fn( [], seed.length, argument ),
i = matchIndexes.length;
// Match elements found at the specified indexes
while ( i-- ) {
if ( seed[ (j = matchIndexes[i]) ] ) {
seed[j] = !(matches[j] = seed[j]);
}
}
});
});
}
/**
* Detect xml
* @param {Element|Object} elem An element or a document
*/
isXML = Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = elem && (elem.ownerDocument || elem).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
// Expose support vars for convenience
support = Sizzle.support = {};
/**
* Sets document-related variables once based on the current document
* @param {Element|Object} [doc] An element or document object to use to set the document
* @returns {Object} Returns the current document
*/
setDocument = Sizzle.setDocument = function( node ) {
var doc = node ? node.ownerDocument || node : preferredDoc,
parent = doc.defaultView;
// If no document and documentElement is available, return
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
return document;
}
// Set our document
document = doc;
docElem = doc.documentElement;
// Support tests
documentIsHTML = !isXML( doc );
// Support: IE>8
// If iframe document is assigned to "document" variable and if iframe has been reloaded,
// IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
// IE6-8 do not support the defaultView property so parent will be undefined
if ( parent && parent.attachEvent && parent !== parent.top ) {
parent.attachEvent( "onbeforeunload", function() {
setDocument();
});
}
/* Attributes
---------------------------------------------------------------------- */
// Support: IE<8
// Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
support.attributes = assert(function( div ) {
div.className = "i";
return !div.getAttribute("className");
});
/* getElement(s)By*
---------------------------------------------------------------------- */
// Check if getElementsByTagName("*") returns only elements
support.getElementsByTagName = assert(function( div ) {
div.appendChild( doc.createComment("") );
return !div.getElementsByTagName("*").length;
});
// Check if getElementsByClassName can be trusted
support.getElementsByClassName = assert(function( div ) {
div.innerHTML = "<div class='a'></div><div class='a i'></div>";
// Support: Safari<4
// Catch class over-caching
div.firstChild.className = "i";
// Support: Opera<10
// Catch gEBCN failure to find non-leading classes
return div.getElementsByClassName("i").length === 2;
});
// Support: IE<10
// Check if getElementById returns elements by name
// The broken getElementById methods don't pick up programatically-set names,
// so use a roundabout getElementsByName test
support.getById = assert(function( div ) {
docElem.appendChild( div ).id = expando;
return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
});
// ID find and filter
if ( support.getById ) {
Expr.find["ID"] = function( id, context ) {
if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
var m = context.getElementById( id );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
};
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
return elem.getAttribute("id") === attrId;
};
};
} else {
// Support: IE6/7
// getElementById is not reliable as a find shortcut
delete Expr.find["ID"];
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
return node && node.value === attrId;
};
};
}
// Tag
Expr.find["TAG"] = support.getElementsByTagName ?
function( tag, context ) {
if ( typeof context.getElementsByTagName !== strundefined ) {
return context.getElementsByTagName( tag );
}
} :
function( tag, context ) {
var elem,
tmp = [],
i = 0,
results = context.getElementsByTagName( tag );
// Filter out possible comments
if ( tag === "*" ) {
while ( (elem = results[i++]) ) {
if ( elem.nodeType === 1 ) {
tmp.push( elem );
}
}
return tmp;
}
return results;
};
// Class
Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {
return context.getElementsByClassName( className );
}
};
/* QSA/matchesSelector
---------------------------------------------------------------------- */
// QSA and matchesSelector support
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
rbuggyMatches = [];
// qSa(:focus) reports false when true (Chrome 21)
// We allow this because of a bug in IE8/9 that throws an error
// whenever `document.activeElement` is accessed on an iframe
// So, we allow :focus to pass through QSA all the time to avoid the IE error
// See http://bugs.jquery.com/ticket/13378
rbuggyQSA = [];
if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
// Build QSA regex
// Regex strategy adopted from Diego Perini
assert(function( div ) {
// Select is set to empty string on purpose
// This is to test IE's treatment of not explicitly
// setting a boolean content attribute,
// since its presence should be enough
// http://bugs.jquery.com/ticket/12359
div.innerHTML = "<select><option selected=''></option></select>";
// Support: IE8
// Boolean attributes and "value" are not treated correctly
if ( !div.querySelectorAll("[selected]").length ) {
rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
}
// Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
// IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":checked").length ) {
rbuggyQSA.push(":checked");
}
});
assert(function( div ) {
// Support: Opera 10-12/IE8
// ^= $= *= and empty values
// Should not select anything
// Support: Windows 8 Native Apps
// The type attribute is restricted during .innerHTML assignment
var input = doc.createElement("input");
input.setAttribute( "type", "hidden" );
div.appendChild( input ).setAttribute( "t", "" );
if ( div.querySelectorAll("[t^='']").length ) {
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
}
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":enabled").length ) {
rbuggyQSA.push( ":enabled", ":disabled" );
}
// Opera 10-11 does not throw on post-comma invalid pseudos
div.querySelectorAll("*,:x");
rbuggyQSA.push(",.*:");
});
}
if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector ||
docElem.mozMatchesSelector ||
docElem.oMatchesSelector ||
docElem.msMatchesSelector) )) ) {
assert(function( div ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
support.disconnectedMatch = matches.call( div, "div" );
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( div, "[s!='']:x" );
rbuggyMatches.push( "!=", pseudos );
});
}
rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
/* Contains
---------------------------------------------------------------------- */
// Element contains another
// Purposefully does not implement inclusive descendent
// As in, an element does not contain itself
contains = rnative.test( docElem.contains ) || docElem.compareDocumentPosition ?
function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && (
adown.contains ?
adown.contains( bup ) :
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
));
} :
function( a, b ) {
if ( b ) {
while ( (b = b.parentNode) ) {
if ( b === a ) {
return true;
}
}
}
return false;
};
/* Sorting
---------------------------------------------------------------------- */
// Document order sorting
sortOrder = docElem.compareDocumentPosition ?
function( a, b ) {
// Flag for duplicate removal
if ( a === b ) {
hasDuplicate = true;
return 0;
}
var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b );
if ( compare ) {
// Disconnected nodes
if ( compare & 1 ||
(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
// Choose the first element that is related to our preferred document
if ( a === doc || contains(preferredDoc, a) ) {
return -1;
}
if ( b === doc || contains(preferredDoc, b) ) {
return 1;
}
// Maintain original order
return sortInput ?
( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
0;
}
return compare & 4 ? -1 : 1;
}
// Not directly comparable, sort on existence of method
return a.compareDocumentPosition ? -1 : 1;
} :
function( a, b ) {
var cur,
i = 0,
aup = a.parentNode,
bup = b.parentNode,
ap = [ a ],
bp = [ b ];
// Exit early if the nodes are identical
if ( a === b ) {
hasDuplicate = true;
return 0;
// Parentless nodes are either documents or disconnected
} else if ( !aup || !bup ) {
return a === doc ? -1 :
b === doc ? 1 :
aup ? -1 :
bup ? 1 :
sortInput ?
( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
0;
// If the nodes are siblings, we can do a quick check
} else if ( aup === bup ) {
return siblingCheck( a, b );
}
// Otherwise we need full lists of their ancestors for comparison
cur = a;
while ( (cur = cur.parentNode) ) {
ap.unshift( cur );
}
cur = b;
while ( (cur = cur.parentNode) ) {
bp.unshift( cur );
}
// Walk down the tree looking for a discrepancy
while ( ap[i] === bp[i] ) {
i++;
}
return i ?
// Do a sibling check if the nodes have a common ancestor
siblingCheck( ap[i], bp[i] ) :
// Otherwise nodes in our document sort first
ap[i] === preferredDoc ? -1 :
bp[i] === preferredDoc ? 1 :
0;
};
return doc;
};
Sizzle.matches = function( expr, elements ) {
return Sizzle( expr, null, null, elements );
};
Sizzle.matchesSelector = function( elem, expr ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
// Make sure that attribute selectors are quoted
expr = expr.replace( rattributeQuotes, "='$1']" );
if ( support.matchesSelector && documentIsHTML &&
( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
try {
var ret = matches.call( elem, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || support.disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9
elem.document && elem.document.nodeType !== 11 ) {
return ret;
}
} catch(e) {}
}
return Sizzle( expr, document, null, [elem] ).length > 0;
};
Sizzle.contains = function( context, elem ) {
// Set document vars if needed
if ( ( context.ownerDocument || context ) !== document ) {
setDocument( context );
}
return contains( context, elem );
};
Sizzle.attr = function( elem, name ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
var fn = Expr.attrHandle[ name.toLowerCase() ],
// Don't get fooled by Object.prototype properties (jQuery #13807)
val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
fn( elem, name, !documentIsHTML ) :
undefined;
return val === undefined ?
support.attributes || !documentIsHTML ?
elem.getAttribute( name ) :
(val = elem.getAttributeNode(name)) && val.specified ?
val.value :
null :
val;
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
/**
* Document sorting and removing duplicates
* @param {ArrayLike} results
*/
Sizzle.uniqueSort = function( results ) {
var elem,
duplicates = [],
j = 0,
i = 0;
// Unless we *know* we can detect duplicates, assume their presence
hasDuplicate = !support.detectDuplicates;
sortInput = !support.sortStable && results.slice( 0 );
results.sort( sortOrder );
if ( hasDuplicate ) {
while ( (elem = results[i++]) ) {
if ( elem === results[ i ] ) {
j = duplicates.push( i );
}
}
while ( j-- ) {
results.splice( duplicates[ j ], 1 );
}
}
return results;
};
/**
* Utility function for retrieving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
getText = Sizzle.getText = function( elem ) {
var node,
ret = "",
i = 0,
nodeType = elem.nodeType;
if ( !nodeType ) {
// If no nodeType, this is expected to be an array
for ( ; (node = elem[i]); i++ ) {
// Do not traverse comment nodes
ret += getText( node );
}
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
// Use textContent for elements
// innerText usage removed for consistency of new lines (see #11153)
if ( typeof elem.textContent === "string" ) {
return elem.textContent;
} else {
// Traverse its children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
// Do not include comment or processing instruction nodes
return ret;
};
Expr = Sizzle.selectors = {
// Can be adjusted by the user
cacheLength: 50,
createPseudo: markFunction,
match: matchExpr,
attrHandle: {},
find: {},
relative: {
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" }
},
preFilter: {
"ATTR": function( match ) {
match[1] = match[1].replace( runescape, funescape );
// Move the given value to match[3] whether quoted or unquoted
match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
if ( match[2] === "~=" ) {
match[3] = " " + match[3] + " ";
}
return match.slice( 0, 4 );
},
"CHILD": function( match ) {
/* matches from matchExpr["CHILD"]
1 type (only|nth|...)
2 what (child|of-type)
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
4 xn-component of xn+y argument ([+-]?\d*n|)
5 sign of xn-component
6 x of xn-component
7 sign of y-component
8 y of y-component
*/
match[1] = match[1].toLowerCase();
if ( match[1].slice( 0, 3 ) === "nth" ) {
// nth-* requires argument
if ( !match[3] ) {
Sizzle.error( match[0] );
}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
// other types prohibit arguments
} else if ( match[3] ) {
Sizzle.error( match[0] );
}
return match;
},
"PSEUDO": function( match ) {
var excess,
unquoted = !match[5] && match[2];
if ( matchExpr["CHILD"].test( match[0] ) ) {
return null;
}
// Accept quoted arguments as-is
if ( match[3] && match[4] !== undefined ) {
match[2] = match[4];
// Strip excess characters from unquoted arguments
} else if ( unquoted && rpseudo.test( unquoted ) &&
// Get excess from tokenize (recursively)
(excess = tokenize( unquoted, true )) &&
// advance to the next closing parenthesis
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
// excess is a negative index
match[0] = match[0].slice( 0, excess );
match[2] = unquoted.slice( 0, excess );
}
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice( 0, 3 );
}
},
filter: {
"TAG": function( nodeNameSelector ) {
var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
return nodeNameSelector === "*" ?
function() { return true; } :
function( elem ) {
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
};
},
"CLASS": function( className ) {
var pattern = classCache[ className + " " ];
return pattern ||
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
classCache( className, function( elem ) {
return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );
});
},
"ATTR": function( name, operator, check ) {
return function( elem ) {
var result = Sizzle.attr( elem, name );
if ( result == null ) {
return operator === "!=";
}
if ( !operator ) {
return true;
}
result += "";
return operator === "=" ? result === check :
operator === "!=" ? result !== check :
operator === "^=" ? check && result.indexOf( check ) === 0 :
operator === "*=" ? check && result.indexOf( check ) > -1 :
operator === "$=" ? check && result.slice( -check.length ) === check :
operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
false;
};
},
"CHILD": function( type, what, argument, first, last ) {
var simple = type.slice( 0, 3 ) !== "nth",
forward = type.slice( -4 ) !== "last",
ofType = what === "of-type";
return first === 1 && last === 0 ?
// Shortcut for :nth-*(n)
function( elem ) {
return !!elem.parentNode;
} :
function( elem, context, xml ) {
var cache, outerCache, node, diff, nodeIndex, start,
dir = simple !== forward ? "nextSibling" : "previousSibling",
parent = elem.parentNode,
name = ofType && elem.nodeName.toLowerCase(),
useCache = !xml && !ofType;
if ( parent ) {
// :(first|last|only)-(child|of-type)
if ( simple ) {
while ( dir ) {
node = elem;
while ( (node = node[ dir ]) ) {
if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
return false;
}
}
// Reverse direction for :only-* (if we haven't yet done so)
start = dir = type === "only" && !start && "nextSibling";
}
return true;
}
start = [ forward ? parent.firstChild : parent.lastChild ];
// non-xml :nth-child(...) stores cache data on `parent`
if ( forward && useCache ) {
// Seek `elem` from a previously-cached index
outerCache = parent[ expando ] || (parent[ expando ] = {});
cache = outerCache[ type ] || [];
nodeIndex = cache[0] === dirruns && cache[1];
diff = cache[0] === dirruns && cache[2];
node = nodeIndex && parent.childNodes[ nodeIndex ];
while ( (node = ++nodeIndex && node && node[ dir ] ||
// Fallback to seeking `elem` from the start
(diff = nodeIndex = 0) || start.pop()) ) {
// When found, cache indexes on `parent` and break
if ( node.nodeType === 1 && ++diff && node === elem ) {
outerCache[ type ] = [ dirruns, nodeIndex, diff ];
break;
}
}
// Use previously-cached element index if available
} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
diff = cache[1];
// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
} else {
// Use the same loop as above to seek `elem` from the start
while ( (node = ++nodeIndex && node && node[ dir ] ||
(diff = nodeIndex = 0) || start.pop()) ) {
if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
// Cache the index of each encountered element
if ( useCache ) {
(node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
}
if ( node === elem ) {
break;
}
}
}
}
// Incorporate the offset, then check against cycle size
diff -= last;
return diff === first || ( diff % first === 0 && diff / first >= 0 );
}
};
},
"PSEUDO": function( pseudo, argument ) {
// pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
// Remember that setFilters inherits from pseudos
var args,
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
Sizzle.error( "unsupported pseudo: " + pseudo );
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
// just as Sizzle does
if ( fn[ expando ] ) {
return fn( argument );
}
// But maintain support for old signatures
if ( fn.length > 1 ) {
args = [ pseudo, pseudo, "", argument ];
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
markFunction(function( seed, matches ) {
var idx,
matched = fn( seed, argument ),
i = matched.length;
while ( i-- ) {
idx = indexOf.call( seed, matched[i] );
seed[ idx ] = !( matches[ idx ] = matched[i] );
}
}) :
function( elem ) {
return fn( elem, 0, args );
};
}
return fn;
}
},
pseudos: {
// Potentially complex pseudos
"not": markFunction(function( selector ) {
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var input = [],
results = [],
matcher = compile( selector.replace( rtrim, "$1" ) );
return matcher[ expando ] ?
markFunction(function( seed, matches, context, xml ) {
var elem,
unmatched = matcher( seed, null, xml, [] ),
i = seed.length;
// Match elements unmatched by `matcher`
while ( i-- ) {
if ( (elem = unmatched[i]) ) {
seed[i] = !(matches[i] = elem);
}
}
}) :
function( elem, context, xml ) {
input[0] = elem;
matcher( input, null, xml, results );
return !results.pop();
};
}),
"has": markFunction(function( selector ) {
return function( elem ) {
return Sizzle( selector, elem ).length > 0;
};
}),
"contains": markFunction(function( text ) {
return function( elem ) {
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
};
}),
// "Whether an element is represented by a :lang() selector
// is based solely on the element's language value
// being equal to the identifier C,
// or beginning with the identifier C immediately followed by "-".
// The matching of C against the element's language value is performed case-insensitively.
// The identifier C does not have to be a valid language name."
// http://www.w3.org/TR/selectors/#lang-pseudo
"lang": markFunction( function( lang ) {
// lang value must be a valid identifier
if ( !ridentifier.test(lang || "") ) {
Sizzle.error( "unsupported lang: " + lang );
}
lang = lang.replace( runescape, funescape ).toLowerCase();
return function( elem ) {
var elemLang;
do {
if ( (elemLang = documentIsHTML ?
elem.lang :
elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
elemLang = elemLang.toLowerCase();
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
}
} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
return false;
};
}),
// Miscellaneous
"target": function( elem ) {
var hash = window.location && window.location.hash;
return hash && hash.slice( 1 ) === elem.id;
},
"root": function( elem ) {
return elem === docElem;
},
"focus": function( elem ) {
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
},
// Boolean properties
"enabled": function( elem ) {
return elem.disabled === false;
},
"disabled": function( elem ) {
return elem.disabled === true;
},
"checked": function( elem ) {
// In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName = elem.nodeName.toLowerCase();
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
},
"selected": function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
// Contents
"empty": function( elem ) {
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
// not comment, processing instructions, or others
// Thanks to Diego Perini for the nodeName shortcut
// Greater than "@" means alpha characters (specifically not starting with "#" or "?")
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
return false;
}
}
return true;
},
"parent": function( elem ) {
return !Expr.pseudos["empty"]( elem );
},
// Element/input types
"header": function( elem ) {
return rheader.test( elem.nodeName );
},
"input": function( elem ) {
return rinputs.test( elem.nodeName );
},
"button": function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === "button" || name === "button";
},
"text": function( elem ) {
var attr;
// 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" &&
elem.type === "text" &&
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
},
// Position-in-collection
"first": createPositionalPseudo(function() {
return [ 0 ];
}),
"last": createPositionalPseudo(function( matchIndexes, length ) {
return [ length - 1 ];
}),
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
return [ argument < 0 ? argument + length : argument ];
}),
"even": createPositionalPseudo(function( matchIndexes, length ) {
var i = 0;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"odd": createPositionalPseudo(function( matchIndexes, length ) {
var i = 1;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; --i >= 0; ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; ++i < length; ) {
matchIndexes.push( i );
}
return matchIndexes;
})
}
};
Expr.pseudos["nth"] = Expr.pseudos["eq"];
// Add button/input type pseudos
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
Expr.pseudos[ i ] = createInputPseudo( i );
}
for ( i in { submit: true, reset: true } ) {
Expr.pseudos[ i ] = createButtonPseudo( i );
}
// Easy API for creating new setFilters
function setFilters() {}
setFilters.prototype = Expr.filters = Expr.pseudos;
Expr.setFilters = new setFilters();
function tokenize( selector, parseOnly ) {
var matched, match, tokens, type,
soFar, groups, preFilters,
cached = tokenCache[ selector + " " ];
if ( cached ) {
return parseOnly ? 0 : cached.slice( 0 );
}
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while ( soFar ) {
// Comma and first run
if ( !matched || (match = rcomma.exec( soFar )) ) {
if ( match ) {
// Don't consume trailing commas as valid
soFar = soFar.slice( match[0].length ) || soFar;
}
groups.push( tokens = [] );
}
matched = false;
// Combinators
if ( (match = rcombinators.exec( soFar )) ) {
matched = match.shift();
tokens.push({
value: matched,
// Cast descendant combinators to space
type: match[0].replace( rtrim, " " )
});
soFar = soFar.slice( matched.length );
}
// Filters
for ( type in Expr.filter ) {
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
(match = preFilters[ type ]( match ))) ) {
matched = match.shift();
tokens.push({
value: matched,
type: type,
matches: match
});
soFar = soFar.slice( matched.length );
}
}
if ( !matched ) {
break;
}
}
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
return parseOnly ?
soFar.length :
soFar ?
Sizzle.error( selector ) :
// Cache the tokens
tokenCache( selector, groups ).slice( 0 );
}
function toSelector( tokens ) {
var i = 0,
len = tokens.length,
selector = "";
for ( ; i < len; i++ ) {
selector += tokens[i].value;
}
return selector;
}
function addCombinator( matcher, combinator, base ) {
var dir = combinator.dir,
checkNonElements = base && dir === "parentNode",
doneName = done++;
return combinator.first ?
// Check against closest ancestor/preceding element
function( elem, context, xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
return matcher( elem, context, xml );
}
}
} :
// Check against all ancestor/preceding elements
function( elem, context, xml ) {
var data, cache, outerCache,
dirkey = dirruns + " " + doneName;
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
if ( xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
if ( matcher( elem, context, xml ) ) {
return true;
}
}
}
} else {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
outerCache = elem[ expando ] || (elem[ expando ] = {});
if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
if ( (data = cache[1]) === true || data === cachedruns ) {
return data === true;
}
} else {
cache = outerCache[ dir ] = [ dirkey ];
cache[1] = matcher( elem, context, xml ) || cachedruns;
if ( cache[1] === true ) {
return true;
}
}
}
}
}
};
}
function elementMatcher( matchers ) {
return matchers.length > 1 ?
function( elem, context, xml ) {
var i = matchers.length;
while ( i-- ) {
if ( !matchers[i]( elem, context, xml ) ) {
return false;
}
}
return true;
} :
matchers[0];
}
function condense( unmatched, map, filter, context, xml ) {
var elem,
newUnmatched = [],
i = 0,
len = unmatched.length,
mapped = map != null;
for ( ; i < len; i++ ) {
if ( (elem = unmatched[i]) ) {
if ( !filter || filter( elem, context, xml ) ) {
newUnmatched.push( elem );
if ( mapped ) {
map.push( i );
}
}
}
}
return newUnmatched;
}
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
if ( postFilter && !postFilter[ expando ] ) {
postFilter = setMatcher( postFilter );
}
if ( postFinder && !postFinder[ expando ] ) {
postFinder = setMatcher( postFinder, postSelector );
}
return markFunction(function( seed, results, context, xml ) {
var temp, i, elem,
preMap = [],
postMap = [],
preexisting = results.length,
// Get initial elements from seed or context
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn = preFilter && ( seed || !selector ) ?
condense( elems, preMap, preFilter, context, xml ) :
elems,
matcherOut = matcher ?
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
// ...intermediate processing is necessary
[] :
// ...otherwise use results directly
results :
matcherIn;
// Find primary matches
if ( matcher ) {
matcher( matcherIn, matcherOut, context, xml );
}
// Apply postFilter
if ( postFilter ) {
temp = condense( matcherOut, postMap );
postFilter( temp, [], context, xml );
// Un-match failing elements by moving them back to matcherIn
i = temp.length;
while ( i-- ) {
if ( (elem = temp[i]) ) {
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
}
}
}
if ( seed ) {
if ( postFinder || preFilter ) {
if ( postFinder ) {
// Get the final matcherOut by condensing this intermediate into postFinder contexts
temp = [];
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) ) {
// Restore matcherIn since elem is not yet a final match
temp.push( (matcherIn[i] = elem) );
}
}
postFinder( null, (matcherOut = []), temp, xml );
}
// Move matched elements from seed to results to keep them synchronized
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) &&
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
seed[temp] = !(results[temp] = elem);
}
}
}
// Add elements to results, through postFinder if defined
} else {
matcherOut = condense(
matcherOut === results ?
matcherOut.splice( preexisting, matcherOut.length ) :
matcherOut
);
if ( postFinder ) {
postFinder( null, results, matcherOut, xml );
} else {
push.apply( results, matcherOut );
}
}
});
}
function matcherFromTokens( tokens ) {
var checkContext, matcher, j,
len = tokens.length,
leadingRelative = Expr.relative[ tokens[0].type ],
implicitRelative = leadingRelative || Expr.relative[" "],
i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable from top-level context(s)
matchContext = addCombinator( function( elem ) {
return elem === checkContext;
}, implicitRelative, true ),
matchAnyContext = addCombinator( function( elem ) {
return indexOf.call( checkContext, elem ) > -1;
}, implicitRelative, true ),
matchers = [ function( elem, context, xml ) {
return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
(checkContext = context).nodeType ?
matchContext( elem, context, xml ) :
matchAnyContext( elem, context, xml ) );
} ];
for ( ; i < len; i++ ) {
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
} else {
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
// Return special upon seeing a positional matcher
if ( matcher[ expando ] ) {
// Find the next relative operator (if any) for proper handling
j = ++i;
for ( ; j < len; j++ ) {
if ( Expr.relative[ tokens[j].type ] ) {
break;
}
}
return setMatcher(
i > 1 && elementMatcher( matchers ),
i > 1 && toSelector(
// If the preceding token was a descendant combinator, insert an implicit any-element `*`
tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
).replace( rtrim, "$1" ),
matcher,
i < j && matcherFromTokens( tokens.slice( i, j ) ),
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
j < len && toSelector( tokens )
);
}
matchers.push( matcher );
}
}
return elementMatcher( matchers );
}
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
// A counter to specify which element is currently being matched
var matcherCachedRuns = 0,
bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, expandContext ) {
var elem, j, matcher,
setMatched = [],
matchedCount = 0,
i = "0",
unmatched = seed && [],
outermost = expandContext != null,
contextBackup = outermostContext,
// We must always have either seed elements or context
elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
if ( outermost ) {
outermostContext = context !== document && context;
cachedruns = matcherCachedRuns;
}
// Add elements passing elementMatchers directly to results
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
for ( ; (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) {
j = 0;
while ( (matcher = elementMatchers[j++]) ) {
if ( matcher( elem, context, xml ) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsUnique;
cachedruns = ++matcherCachedRuns;
}
}
// Track unmatched elements for set filters
if ( bySet ) {
// They will have gone through all possible matchers
if ( (elem = !matcher && elem) ) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if ( seed ) {
unmatched.push( elem );
}
}
}
// Apply set filters to unmatched elements
matchedCount += i;
if ( bySet && i !== matchedCount ) {
j = 0;
while ( (matcher = setMatchers[j++]) ) {
matcher( unmatched, setMatched, context, xml );
}
if ( seed ) {
// Reintegrate element matches to eliminate the need for sorting
if ( matchedCount > 0 ) {
while ( i-- ) {
if ( !(unmatched[i] || setMatched[i]) ) {
setMatched[i] = pop.call( results );
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense( setMatched );
}
// Add matches to results
push.apply( results, setMatched );
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if ( outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1 ) {
Sizzle.uniqueSort( results );
}
}
// Override manipulation of globals by nested matchers
if ( outermost ) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
return bySet ?
markFunction( superMatcher ) :
superMatcher;
}
compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
var i,
setMatchers = [],
elementMatchers = [],
cached = compilerCache[ selector + " " ];
if ( !cached ) {
// Generate a function of recursive functions that can be used to check each element
if ( !group ) {
group = tokenize( selector );
}
i = group.length;
while ( i-- ) {
cached = matcherFromTokens( group[i] );
if ( cached[ expando ] ) {
setMatchers.push( cached );
} else {
elementMatchers.push( cached );
}
}
// Cache the compiled function
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
}
return cached;
};
function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
Sizzle( selector, contexts[i], results );
}
return results;
}
function select( selector, context, results, seed ) {
var i, tokens, token, type, find,
match = tokenize( selector );
if ( !seed ) {
// Try to minimize operations if there is only one group
if ( match.length === 1 ) {
// Take a shortcut and set the context if the root selector is an ID
tokens = match[0] = match[0].slice( 0 );
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
support.getById && context.nodeType === 9 && documentIsHTML &&
Expr.relative[ tokens[1].type ] ) {
context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
if ( !context ) {
return results;
}
selector = selector.slice( tokens.shift().value.length );
}
// Fetch a seed set for right-to-left matching
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
while ( i-- ) {
token = tokens[i];
// Abort if we hit a combinator
if ( Expr.relative[ (type = token.type) ] ) {
break;
}
if ( (find = Expr.find[ type ]) ) {
// Search, expanding context for leading sibling combinators
if ( (seed = find(
token.matches[0].replace( runescape, funescape ),
rsibling.test( tokens[0].type ) && context.parentNode || context
)) ) {
// If seed is empty or no tokens remain, we can return early
tokens.splice( i, 1 );
selector = seed.length && toSelector( tokens );
if ( !selector ) {
push.apply( results, seed );
return results;
}
break;
}
}
}
}
}
// Compile and execute a filtering function
// Provide `match` to avoid retokenization if we modified the selector above
compile( selector, match )(
seed,
context,
!documentIsHTML,
results,
rsibling.test( selector )
);
return results;
}
// One-time assignments
// Sort stability
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
// Support: Chrome<14
// Always assume duplicates if they aren't passed to the comparison function
support.detectDuplicates = hasDuplicate;
// Initialize against the default document
setDocument();
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
// Detached nodes confoundingly follow *each other*
support.sortDetached = assert(function( div1 ) {
// Should return 1, but returns 4 (following)
return div1.compareDocumentPosition( document.createElement("div") ) & 1;
});
// Support: IE<8
// Prevent attribute/property "interpolation"
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !assert(function( div ) {
div.innerHTML = "<a href='#'></a>";
return div.firstChild.getAttribute("href") === "#" ;
}) ) {
addHandle( "type|href|height|width", function( elem, name, isXML ) {
if ( !isXML ) {
return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
}
});
}
// Support: IE<9
// Use defaultValue in place of getAttribute("value")
if ( !support.attributes || !assert(function( div ) {
div.innerHTML = "<input/>";
div.firstChild.setAttribute( "value", "" );
return div.firstChild.getAttribute( "value" ) === "";
}) ) {
addHandle( "value", function( elem, name, isXML ) {
if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
return elem.defaultValue;
}
});
}
// Support: IE<9
// Use getAttributeNode to fetch booleans when getAttribute lies
if ( !assert(function( div ) {
return div.getAttribute("disabled") == null;
}) ) {
addHandle( booleans, function( elem, name, isXML ) {
var val;
if ( !isXML ) {
return (val = elem.getAttributeNode( name )) && val.specified ?
val.value :
elem[ name ] === true ? name.toLowerCase() : null;
}
});
}
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.pseudos;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
})( window );
// String to Object options format cache
var optionsCache = {};
// Convert String-formatted options into Object-formatted ones and store in cache
function createOptions( options ) {
var object = optionsCache[ options ] = {};
jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
object[ flag ] = true;
});
return object;
}
/*
* Create a callback list using the following parameters:
*
* options: an optional list of space-separated options that will change how
* the callback list behaves or a more traditional option object
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible options:
*
* once: will ensure the callback list can only be fired once (like a Deferred)
*
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a Deferred)
*
* unique: will ensure a callback can only be added once (no duplicate in the list)
*
* stopOnFalse: interrupt callings when a callback returns false
*
*/
jQuery.Callbacks = function( options ) {
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options = typeof options === "string" ?
( optionsCache[ options ] || createOptions( options ) ) :
jQuery.extend( {}, options );
var // Flag to know if list is currently firing
firing,
// Last fire value (for non-forgettable lists)
memory,
// Flag to know if list was already fired
fired,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// First callback to fire (used internally by add and fireWith)
firingStart,
// Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = !options.once && [],
// Fire callbacks
fire = function( data ) {
memory = options.memory && data;
fired = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
firing = true;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
memory = false; // To prevent further calls using add
break;
}
}
firing = false;
if ( list ) {
if ( stack ) {
if ( stack.length ) {
fire( stack.shift() );
}
} else if ( memory ) {
list = [];
} else {
self.disable();
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
// First, we save the current length
var start = list.length;
(function add( args ) {
jQuery.each( args, function( _, arg ) {
var type = jQuery.type( arg );
if ( type === "function" ) {
if ( !options.unique || !self.has( arg ) ) {
list.push( arg );
}
} else if ( arg && arg.length && type !== "string" ) {
// Inspect recursively
add( arg );
}
});
})( 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
} else if ( memory ) {
firingStart = start;
fire( memory );
}
}
return this;
},
// Remove a callback from the list
remove: function() {
if ( list ) {
jQuery.each( arguments, function( _, arg ) {
var index;
while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
list.splice( index, 1 );
// Handle firing indexes
if ( firing ) {
if ( index <= firingLength ) {
firingLength--;
}
if ( index <= firingIndex ) {
firingIndex--;
}
}
}
});
}
return this;
},
// Check if a given callback is in the list.
// If no argument is given, return whether or not list has callbacks attached.
has: function( fn ) {
return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
},
// Remove all callbacks from the list
empty: function() {
list = [];
firingLength = 0;
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 ) {
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 ( list && ( !fired || stack ) ) {
args = args || [];
args = [ context, args.slice ? args.slice() : args ];
if ( firing ) {
stack.push( args );
} else {
fire( 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;
};
jQuery.extend({
Deferred: function( func ) {
var tuples = [
// action, add listener, listener list, final state
[ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
[ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
[ "notify", "progress", jQuery.Callbacks("memory") ]
],
state = "pending",
promise = {
state: function() {
return state;
},
always: function() {
deferred.done( arguments ).fail( arguments );
return this;
},
then: function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
return jQuery.Deferred(function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
var action = tuple[ 0 ],
fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
// deferred[ done | fail | progress ] for forwarding actions to newDefer
deferred[ tuple[1] ](function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise()
.done( newDefer.resolve )
.fail( newDefer.reject )
.progress( newDefer.notify );
} else {
newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
}
});
});
fns = null;
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
return obj != null ? jQuery.extend( obj, promise ) : promise;
}
},
deferred = {};
// Keep pipe for back-compat
promise.pipe = promise.then;
// Add list-specific methods
jQuery.each( tuples, function( i, tuple ) {
var list = tuple[ 2 ],
stateString = tuple[ 3 ];
// promise[ done | fail | progress ] = list.add
promise[ tuple[1] ] = list.add;
// Handle state
if ( stateString ) {
list.add(function() {
// state = [ resolved | rejected ]
state = stateString;
// [ reject_list | resolve_list ].disable; progress_list.lock
}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
}
// deferred[ resolve | reject | notify ]
deferred[ tuple[0] ] = function() {
deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
return this;
};
deferred[ tuple[0] + "With" ] = list.fireWith;
});
// Make the deferred a promise
promise.promise( deferred );
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// All done!
return deferred;
},
// Deferred helper
when: function( subordinate /* , ..., subordinateN */ ) {
var i = 0,
resolveValues = core_slice.call( arguments ),
length = resolveValues.length,
// the count of uncompleted subordinates
remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
// Update function for both resolve and progress values
updateFunc = function( i, contexts, values ) {
return function( value ) {
contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
if( values === progressValues ) {
deferred.notifyWith( contexts, values );
} else if ( !( --remaining ) ) {
deferred.resolveWith( contexts, values );
}
};
},
progressValues, progressContexts, resolveContexts;
// add listeners to Deferred subordinates; treat others as resolved
if ( length > 1 ) {
progressValues = new Array( length );
progressContexts = new Array( length );
resolveContexts = new Array( length );
for ( ; i < length; i++ ) {
if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
resolveValues[ i ].promise()
.done( updateFunc( i, resolveContexts, resolveValues ) )
.fail( deferred.reject )
.progress( updateFunc( i, progressContexts, progressValues ) );
} else {
--remaining;
}
}
}
// if we're not waiting on anything, resolve the master
if ( !remaining ) {
deferred.resolveWith( resolveContexts, resolveValues );
}
return deferred.promise();
}
});
jQuery.support = (function( support ) {
var all, a, input, select, fragment, opt, eventName, isSupported, i,
div = document.createElement("div");
// Setup
div.setAttribute( "className", "t" );
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
// Finish early in limited (non-browser) environments
all = div.getElementsByTagName("*") || [];
a = div.getElementsByTagName("a")[ 0 ];
if ( !a || !a.style || !all.length ) {
return support;
}
// First batch of tests
select = document.createElement("select");
opt = select.appendChild( document.createElement("option") );
input = div.getElementsByTagName("input")[ 0 ];
a.style.cssText = "top:1px;float:left;opacity:.5";
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
support.getSetAttribute = div.className !== "t";
// IE strips leading whitespace when .innerHTML is used
support.leadingWhitespace = div.firstChild.nodeType === 3;
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
support.tbody = !div.getElementsByTagName("tbody").length;
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
support.htmlSerialize = !!div.getElementsByTagName("link").length;
// Get the style information from getAttribute
// (IE uses .cssText instead)
support.style = /top/.test( a.getAttribute("style") );
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
support.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
support.opacity = /^0.5/.test( a.style.opacity );
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
support.cssFloat = !!a.style.cssFloat;
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
support.checkOn = !!input.value;
// 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)
support.optSelected = opt.selected;
// Tests for enctype support on a form (#6743)
support.enctype = !!document.createElement("form").enctype;
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>";
// Will be defined later
support.inlineBlockNeedsLayout = false;
support.shrinkWrapBlocks = false;
support.pixelPosition = false;
support.deleteExpando = true;
support.noCloneEvent = true;
support.reliableMarginRight = true;
support.boxSizingReliable = true;
// 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;
// Support: IE<9
try {
delete div.test;
} catch( e ) {
support.deleteExpando = false;
}
// Check if we can trust getAttribute("value")
input = document.createElement("input");
input.setAttribute( "value", "" );
support.input = input.getAttribute( "value" ) === "";
// Check if an input maintains its value after becoming a radio
input.value = "t";
input.setAttribute( "type", "radio" );
support.radioValue = input.value === "t";
// #11217 - WebKit loses check when the name is after the checked attribute
input.setAttribute( "checked", "t" );
input.setAttribute( "name", "t" );
fragment = document.createDocumentFragment();
fragment.appendChild( input );
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
// WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Support: IE<9
// Opera does not clone events (and typeof div.attachEvent === undefined).
// IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
if ( div.attachEvent ) {
div.attachEvent( "onclick", function() {
support.noCloneEvent = false;
});
div.cloneNode( true ).click();
}
// Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
for ( i in { submit: true, change: true, focusin: true }) {
div.setAttribute( eventName = "on" + i, "t" );
support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
}
div.style.backgroundClip = "content-box";
div.cloneNode( true ).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";
// Support: IE<9
// Iteration over object's inherited properties before its own.
for ( i in jQuery( support ) ) {
break;
}
support.ownLast = i !== "0";
// Run tests that need a body at doc ready
jQuery(function() {
var container, marginDiv, tds,
divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
body = document.getElementsByTagName("body")[0];
if ( !body ) {
// Return for frameset docs that don't have a body
return;
}
container = document.createElement("div");
container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
body.appendChild( container ).appendChild( div );
// Support: IE8
// 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).
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
tds = div.getElementsByTagName("td");
tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
isSupported = ( tds[ 0 ].offsetHeight === 0 );
tds[ 0 ].style.display = "";
tds[ 1 ].style.display = "none";
// Support: IE8
// Check if empty table cells still have offsetWidth/Height
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
// Check box-sizing and margin behavior.
div.innerHTML = "";
div.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%;";
// Workaround failing boxSizing test due to offsetWidth returning wrong value
// with some non-1 values of body zoom, ticket #13543
jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {
support.boxSizing = div.offsetWidth === 4;
});
// Use window.getComputedStyle because jsdom on node.js will break without it.
if ( window.getComputedStyle ) {
support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. (#3333)
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
marginDiv = div.appendChild( document.createElement("div") );
marginDiv.style.cssText = div.style.cssText = divReset;
marginDiv.style.marginRight = marginDiv.style.width = "0";
div.style.width = "1px";
support.reliableMarginRight =
!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
}
if ( typeof div.style.zoom !== core_strundefined ) {
// Support: IE<8
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
div.innerHTML = "";
div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
// Support: IE6
// Check if elements with layout shrink-wrap their children
div.style.display = "block";
div.innerHTML = "<div></div>";
div.firstChild.style.width = "5px";
support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
if ( support.inlineBlockNeedsLayout ) {
// Prevent IE 6 from affecting layout for positioned elements #11048
// Prevent IE from shrinking the body in IE 7 mode #12869
// Support: IE<8
body.style.zoom = 1;
}
}
body.removeChild( container );
// Null elements to avoid leaks in IE
container = div = tds = marginDiv = null;
});
// Null elements to avoid leaks in IE
all = select = fragment = opt = a = input = null;
return support;
})({});
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
rmultiDash = /([A-Z])/g;
function internalData( elem, name, data, pvt /* Internal Use Only */ ){
if ( !jQuery.acceptData( elem ) ) {
return;
}
var ret, thisCache,
internalKey = jQuery.expando,
// 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;
// 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] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
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 ) {
id = elem[ internalKey ] = core_deletedIds.pop() || jQuery.guid++;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
// Avoid exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
cache[ id ] = isNode ? {} : { 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 );
}
}
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;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( typeof name === "string" ) {
// 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;
}
function internalRemoveData( elem, name, pvt ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, i,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
// 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(" ");
}
}
} else {
// If "name" is an array of keys...
// When data is initially created, via ("key", "val") signature,
// keys will be converted to camelCase.
// Since there is no way to tell _how_ a key was added, remove
// both plain key and camelCase key. #12786
// This will only penalize the array argument path.
name = name.concat( jQuery.map( name, jQuery.camelCase ) );
}
i = name.length;
while ( 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(thisCache) : !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;
}
}
// Destroy the cache
if ( isNode ) {
jQuery.cleanData( [ elem ], true );
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
/* jshint eqeqeq: false */
} else if ( jQuery.support.deleteExpando || cache != cache.window ) {
/* jshint eqeqeq: true */
delete cache[ id ];
// When all else fails, null
} else {
cache[ id ] = null;
}
}
jQuery.extend({
cache: {},
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"applet": true,
"embed": true,
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
},
hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
data: function( elem, name, data ) {
return internalData( elem, name, data );
},
removeData: function( elem, name ) {
return internalRemoveData( elem, name );
},
// For internal use only.
_data: function( elem, name, data ) {
return internalData( elem, name, data, true );
},
_removeData: function( elem, name ) {
return internalRemoveData( elem, name, true );
},
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
// Do not set data on non-element because it will not be cleared (#8335).
if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
return false;
}
var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
// nodes accept data unless otherwise specified; rejection can be conditional
return !noData || noData !== true && elem.getAttribute("classid") === noData;
}
});
jQuery.fn.extend({
data: function( key, value ) {
var attrs, name,
data = null,
i = 0,
elem = this[0];
// Special expections of .data basically thwart jQuery.access,
// so implement the relevant behavior ourselves
// Gets all values
if ( key === undefined ) {
if ( this.length ) {
data = jQuery.data( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
attrs = elem.attributes;
for ( ; i < attrs.length; i++ ) {
name = attrs[i].name;
if ( name.indexOf("data-") === 0 ) {
name = jQuery.camelCase( name.slice(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 );
});
}
return arguments.length > 1 ?
// Sets one value
this.each(function() {
jQuery.data( this, key, value );
}) :
// Gets one value
// Try to fetch any internally stored data first
elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
},
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 :
// Only convert to a number if it doesn't change the string
+data + "" === 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 ) {
var name;
for ( 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;
}
jQuery.extend({
queue: function( elem, type, data ) {
var queue;
if ( elem ) {
type = ( type || "fx" ) + "queue";
queue = jQuery._data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || jQuery.isArray(data) ) {
queue = jQuery._data( elem, type, jQuery.makeArray(data) );
} else {
queue.push( data );
}
}
return queue || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
startLength = queue.length,
fn = queue.shift(),
hooks = jQuery._queueHooks( elem, type ),
next = function() {
jQuery.dequeue( elem, type );
};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
startLength--;
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
// clear up the last queue stop function
delete hooks.stop;
fn.call( elem, next, hooks );
}
if ( !startLength && hooks ) {
hooks.empty.fire();
}
},
// not intended for public consumption - generates a queueHooks object, or returns the current one
_queueHooks: function( elem, type ) {
var key = type + "queueHooks";
return jQuery._data( elem, key ) || jQuery._data( elem, key, {
empty: jQuery.Callbacks("once memory").add(function() {
jQuery._removeData( elem, type + "queue" );
jQuery._removeData( elem, key );
})
});
}
});
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 );
// ensure a hooks for this queue
jQuery._queueHooks( this, type );
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, obj ) {
var tmp,
count = 1,
defer = jQuery.Deferred(),
elements = this,
i = this.length,
resolve = function() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
};
if ( typeof type !== "string" ) {
obj = type;
type = undefined;
}
type = type || "fx";
while( i-- ) {
tmp = jQuery._data( elements[ i ], type + "queueHooks" );
if ( tmp && tmp.empty ) {
count++;
tmp.empty.add( resolve );
}
}
resolve();
return defer.promise( obj );
}
});
var nodeHook, boolHook,
rclass = /[\t\r\n\f]/g,
rreturn = /\r/g,
rfocusable = /^(?:input|select|textarea|button|object)$/i,
rclickable = /^(?:a|area)$/i,
ruseDefault = /^(?:checked|selected)$/i,
getSetAttribute = jQuery.support.getSetAttribute,
getSetInput = jQuery.support.input;
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 classes, elem, cur, clazz, j,
i = 0,
len = this.length,
proceed = typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).addClass( value.call( this, j, this.className ) );
});
}
if ( proceed ) {
// The disjunction here is for better compressibility (see removeClass)
classes = ( value || "" ).match( core_rnotwhite ) || [];
for ( ; i < len; i++ ) {
elem = this[ i ];
cur = elem.nodeType === 1 && ( elem.className ?
( " " + elem.className + " " ).replace( rclass, " " ) :
" "
);
if ( cur ) {
j = 0;
while ( (clazz = classes[j++]) ) {
if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
cur += clazz + " ";
}
}
elem.className = jQuery.trim( cur );
}
}
}
return this;
},
removeClass: function( value ) {
var classes, elem, cur, clazz, j,
i = 0,
len = this.length,
proceed = arguments.length === 0 || typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).removeClass( value.call( this, j, this.className ) );
});
}
if ( proceed ) {
classes = ( value || "" ).match( core_rnotwhite ) || [];
for ( ; i < len; i++ ) {
elem = this[ i ];
// This expression is here for better compressibility (see addClass)
cur = elem.nodeType === 1 && ( elem.className ?
( " " + elem.className + " " ).replace( rclass, " " ) :
""
);
if ( cur ) {
j = 0;
while ( (clazz = classes[j++]) ) {
// Remove *all* instances
while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
cur = cur.replace( " " + clazz + " ", " " );
}
}
elem.className = value ? jQuery.trim( cur ) : "";
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value;
if ( typeof stateVal === "boolean" && type === "string" ) {
return stateVal ? this.addClass( value ) : this.removeClass( value );
}
if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className,
i = 0,
self = jQuery( this ),
classNames = value.match( core_rnotwhite ) || [];
while ( (className = classNames[ i++ ]) ) {
// check each className given, space separated list
if ( self.hasClass( className ) ) {
self.removeClass( className );
} else {
self.addClass( className );
}
}
// Toggle whole class name
} else if ( type === core_strundefined || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery._data( this, "__className__", this.className );
}
// If the element has a class name or if we're passed "false",
// then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored.
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 ) >= 0 ) {
return true;
}
}
return false;
},
val: function( value ) {
var ret, hooks, 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 val;
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, jQuery( this ).val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( 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 ) {
// Use proper attribute retrieval(#6932, #12072)
var val = jQuery.find.attr( elem, "value" );
return val != null ?
val :
elem.text;
}
},
select: {
get: function( elem ) {
var value, option,
options = elem.options,
index = elem.selectedIndex,
one = elem.type === "select-one" || index < 0,
values = one ? null : [],
max = one ? index + 1 : options.length,
i = index < 0 ?
max :
one ? index : 0;
// Loop through all the selected options
for ( ; i < max; i++ ) {
option = options[ i ];
// oldIE doesn't update selected after form reset (#2551)
if ( ( option.selected || i === index ) &&
// Don't return options that are disabled or in a disabled optgroup
( 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 );
}
}
return values;
},
set: function( elem, value ) {
var optionSet, option,
options = elem.options,
values = jQuery.makeArray( value ),
i = options.length;
while ( i-- ) {
option = options[ i ];
if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) {
optionSet = true;
}
}
// force browsers to behave consistently when non-matching value is set
if ( !optionSet ) {
elem.selectedIndex = -1;
}
return values;
}
}
},
attr: function( elem, name, value ) {
var hooks, ret,
nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
// Fallback to prop when attributes are not supported
if ( typeof elem.getAttribute === core_strundefined ) {
return jQuery.prop( elem, name, value );
}
// All attributes are lowercase
// Grab necessary hook if one is defined
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] ||
( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
} else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
elem.setAttribute( name, value + "" );
return value;
}
} else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
ret = jQuery.find.attr( elem, name );
// Non-existent attributes return null, we normalize to undefined
return ret == null ?
undefined :
ret;
}
},
removeAttr: function( elem, value ) {
var name, propName,
i = 0,
attrNames = value && value.match( core_rnotwhite );
if ( attrNames && elem.nodeType === 1 ) {
while ( (name = attrNames[i++]) ) {
propName = jQuery.propFix[ name ] || name;
// Boolean attributes get special treatment (#10870)
if ( jQuery.expr.match.bool.test( name ) ) {
// Set corresponding property to false
if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
elem[ propName ] = false;
// Support: IE<9
// Also clear defaultChecked/defaultSelected (if appropriate)
} else {
elem[ jQuery.camelCase( "default-" + name ) ] =
elem[ propName ] = false;
}
// See #9699 for explanation of this approach (setting first, then removal)
} else {
jQuery.attr( elem, name, "" );
}
elem.removeAttribute( getSetAttribute ? name : propName );
}
}
},
attrHooks: {
type: {
set: function( elem, value ) {
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 default in case type is set after value during creation
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
}
},
propFix: {
"for": "htmlFor",
"class": "className"
},
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 ) {
return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
ret :
( elem[ name ] = value );
} else {
return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
ret :
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/
// Use proper attribute retrieval(#12072)
var tabindex = jQuery.find.attr( elem, "tabindex" );
return tabindex ?
parseInt( tabindex, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
-1;
}
}
}
});
// Hooks for boolean attributes
boolHook = {
set: function( elem, value, name ) {
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
// IE<8 needs the *property* name
elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
// Use defaultChecked and defaultSelected for oldIE
} else {
elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
}
return name;
}
};
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr;
jQuery.expr.attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ?
function( elem, name, isXML ) {
var fn = jQuery.expr.attrHandle[ name ],
ret = isXML ?
undefined :
/* jshint eqeqeq: false */
(jQuery.expr.attrHandle[ name ] = undefined) !=
getter( elem, name, isXML ) ?
name.toLowerCase() :
null;
jQuery.expr.attrHandle[ name ] = fn;
return ret;
} :
function( elem, name, isXML ) {
return isXML ?
undefined :
elem[ jQuery.camelCase( "default-" + name ) ] ?
name.toLowerCase() :
null;
};
});
// fix oldIE attroperties
if ( !getSetInput || !getSetAttribute ) {
jQuery.attrHooks.value = {
set: function( elem, value, name ) {
if ( jQuery.nodeName( elem, "input" ) ) {
// Does not return so that setAttribute is also used
elem.defaultValue = value;
} else {
// Use nodeHook if defined (#1954); otherwise setAttribute is fine
return nodeHook && nodeHook.set( elem, value, name );
}
}
};
}
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = {
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
elem.setAttributeNode(
(ret = elem.ownerDocument.createAttribute( name ))
);
}
ret.value = value += "";
// Break association with cloned elements by also using setAttribute (#9646)
return name === "value" || value === elem.getAttribute( name ) ?
value :
undefined;
}
};
jQuery.expr.attrHandle.id = jQuery.expr.attrHandle.name = jQuery.expr.attrHandle.coords =
// Some attributes are constructed with empty-string values when not defined
function( elem, name, isXML ) {
var ret;
return isXML ?
undefined :
(ret = elem.getAttributeNode( name )) && ret.value !== "" ?
ret.value :
null;
};
jQuery.valHooks.button = {
get: function( elem, name ) {
var ret = elem.getAttributeNode( name );
return ret && ret.specified ?
ret.value :
undefined;
},
set: nodeHook.set
};
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
set: function( elem, value, name ) {
nodeHook.set( elem, value === "" ? false : value, name );
}
};
// 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 ] = {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
};
});
}
// Some attributes require a special call on IE
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !jQuery.support.hrefNormalized ) {
// href/src property should get the full normalized URL (#10299/#12915)
jQuery.each([ "href", "src" ], function( i, name ) {
jQuery.propHooks[ name ] = {
get: function( elem ) {
return elem.getAttribute( name, 4 );
}
};
});
}
if ( !jQuery.support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Note: IE uppercases css property names, but if we were to .toLowerCase()
// .cssText, that would destroy case senstitivity in URL's, like in "background"
return elem.style.cssText || 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 = {
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;
}
};
}
jQuery.each([
"tabIndex",
"readOnly",
"maxLength",
"cellSpacing",
"cellPadding",
"rowSpan",
"colSpan",
"useMap",
"frameBorder",
"contentEditable"
], function() {
jQuery.propFix[ this.toLowerCase() ] = this;
});
// IE6/7 call enctype encoding
if ( !jQuery.support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
// Radios and checkboxes getter/setter
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
}
}
};
if ( !jQuery.support.checkOn ) {
jQuery.valHooks[ this ].get = function( elem ) {
// Support: Webkit
// "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
};
}
});
var rformElems = /^(?:input|select|textarea)$/i,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
function returnTrue() {
return true;
}
function returnFalse() {
return false;
}
function safeActiveElement() {
try {
return document.activeElement;
} catch ( err ) { }
}
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
global: {},
add: function( elem, types, handler, data, selector ) {
var tmp, events, t, handleObjIn,
special, eventHandle, handleObj,
handlers, type, namespaces, origType,
elemData = jQuery._data( elem );
// Don't attach events to noData or text/comment nodes (but allow plain objects)
if ( !elemData ) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
// Make sure that the handler has a unique ID, used to find/remove it later
if ( !handler.guid ) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure and main handler, if this is the first
if ( !(events = elemData.events) ) {
events = elemData.events = {};
}
if ( !(eventHandle = elemData.handle) ) {
eventHandle = elemData.handle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== core_strundefined && (!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
types = ( types || "" ).match( core_rnotwhite ) || [""];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[t] ) || [];
type = origType = tmp[1];
namespaces = ( tmp[2] || "" ).split( "." ).sort();
// There *must* be a type, no attaching namespace-only handlers
if ( !type ) {
continue;
}
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[ type ] || {};
// If selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegateType : special.bindType ) || type;
// Update special based on newly reset type
special = jQuery.event.special[ type ] || {};
// handleObj is passed to all event handlers
handleObj = jQuery.extend({
type: type,
origType: origType,
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
namespace: namespaces.join(".")
}, handleObjIn );
// Init the event handler queue if we're the first
if ( !(handlers = events[ type ]) ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener/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;
},
// Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) {
var j, handleObj, tmp,
origCount, t, events,
special, handlers, type,
namespaces, origType,
elemData = jQuery.hasData( elem ) && jQuery._data( elem );
if ( !elemData || !(events = elemData.events) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = ( types || "" ).match( core_rnotwhite ) || [""];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[t] ) || [];
type = origType = tmp[1];
namespaces = ( tmp[2] || "" ).split( "." ).sort();
// Unbind all events (on this namespace, if provided) for the element
if ( !type ) {
for ( type in events ) {
jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
}
continue;
}
special = jQuery.event.special[ type ] || {};
type = ( selector ? special.delegateType : special.bindType ) || type;
handlers = events[ type ] || [];
tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
// Remove matching events
origCount = j = handlers.length;
while ( j-- ) {
handleObj = handlers[ j ];
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !tmp || tmp.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
handlers.splice( j, 1 );
if ( handleObj.selector ) {
handlers.delegateCount--;
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
}
// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if ( origCount && !handlers.length ) {
if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
delete elemData.handle;
// removeData also checks for emptiness and clears the expando if empty
// so use it instead of delete
jQuery._removeData( elem, "events" );
}
},
trigger: function( event, data, elem, onlyHandlers ) {
var handle, ontype, cur,
bubbleType, special, tmp, i,
eventPath = [ elem || document ],
type = core_hasOwn.call( event, "type" ) ? event.type : event,
namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
cur = tmp = elem = elem || document;
// Don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
return;
}
if ( type.indexOf(".") >= 0 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
ontype = type.indexOf(":") < 0 && "on" + type;
// Caller can pass in a jQuery.Event object, Object, or just an event type string
event = event[ jQuery.expando ] ?
event :
new jQuery.Event( type, typeof event === "object" && event );
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
event.isTrigger = onlyHandlers ? 2 : 3;
event.namespace = namespaces.join(".");
event.namespace_re = event.namespace ?
new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
null;
// Clean up the event in case it is being reused
event.result = undefined;
if ( !event.target ) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data == null ?
[ event ] :
jQuery.makeArray( data, [ event ] );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
if ( !rfocusMorph.test( bubbleType + type ) ) {
cur = cur.parentNode;
}
for ( ; cur; cur = cur.parentNode ) {
eventPath.push( cur );
tmp = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( tmp === (elem.ownerDocument || document) ) {
eventPath.push( tmp.defaultView || tmp.parentWindow || window );
}
}
// Fire handlers on the event path
i = 0;
while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
event.type = i > 1 ?
bubbleType :
special.bindType || type;
// jQuery handler
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Native handler
handle = ontype && cur[ ontype ];
if ( handle && jQuery.acceptData( cur ) && handle.apply && 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( eventPath.pop(), data ) === false) &&
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)
if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
tmp = elem[ ontype ];
if ( tmp ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
try {
elem[ type ]();
} catch ( e ) {
// IE<9 dies on focus/blur to hidden element (#1486,#12518)
// only reproducible on winXP IE8 native, not IE9 in IE8 mode
}
jQuery.event.triggered = undefined;
if ( tmp ) {
elem[ ontype ] = tmp;
}
}
}
}
return event.result;
},
dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event );
var i, ret, handleObj, matched, j,
handlerQueue = [],
args = core_slice.call( arguments ),
handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
special = jQuery.event.special[ event.type ] || {};
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event;
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
return;
}
// Determine handlers
handlerQueue = jQuery.event.handlers.call( this, event, handlers );
// Run delegates first; they may want to stop propagation beneath us
i = 0;
while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
event.currentTarget = matched.elem;
j = 0;
while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
// Triggered event must either 1) have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
event.handleObj = handleObj;
event.data = handleObj.data;
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
.apply( matched.elem, args );
if ( ret !== undefined ) {
if ( (event.result = ret) === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
// Call the postDispatch hook for the mapped type
if ( special.postDispatch ) {
special.postDispatch.call( this, event );
}
return event.result;
},
handlers: function( event, handlers ) {
var sel, handleObj, matches, i,
handlerQueue = [],
delegateCount = handlers.delegateCount,
cur = event.target;
// Find delegate handlers
// Black-hole SVG <use> instance trees (#13180)
// Avoid non-left-click bubbling in Firefox (#3861)
if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
/* jshint eqeqeq: false */
for ( ; cur != this; cur = cur.parentNode || this ) {
/* jshint eqeqeq: true */
// Don't check non-elements (#13208)
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
matches = [];
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
// Don't conflict with Object.prototype properties (#13203)
sel = handleObj.selector + " ";
if ( matches[ sel ] === undefined ) {
matches[ sel ] = handleObj.needsContext ?
jQuery( sel, this ).index( cur ) >= 0 :
jQuery.find( sel, this, null, [ cur ] ).length;
}
if ( matches[ sel ] ) {
matches.push( handleObj );
}
}
if ( matches.length ) {
handlerQueue.push({ elem: cur, handlers: matches });
}
}
}
}
// Add the remaining (directly-bound) handlers
if ( delegateCount < handlers.length ) {
handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
}
return handlerQueue;
},
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop, copy,
type = event.type,
originalEvent = event,
fixHook = this.fixHooks[ type ];
if ( !fixHook ) {
this.fixHooks[ type ] = fixHook =
rmouseEvent.test( type ) ? this.mouseHooks :
rkeyEvent.test( type ) ? this.keyHooks :
{};
}
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
event = new jQuery.Event( originalEvent );
i = copy.length;
while ( i-- ) {
prop = copy[ i ];
event[ prop ] = originalEvent[ prop ];
}
// Support: IE<9
// Fix target property (#1925)
if ( !event.target ) {
event.target = originalEvent.srcElement || document;
}
// Support: Chrome 23+, Safari?
// Target should not be a text node (#504, #13143)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// Support: IE<9
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
event.metaKey = !!event.metaKey;
return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
},
// Includes some event props shared by KeyEvent and MouseEvent
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( 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 body, eventDoc, doc,
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;
}
},
special: {
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
focus: {
// Fire native event if possible so blur/focus sequence is correct
trigger: function() {
if ( this !== safeActiveElement() && this.focus ) {
try {
this.focus();
return false;
} catch ( e ) {
// Support: IE<9
// If we error on focus to hidden element (#1486, #12518),
// let .trigger() run the handlers
}
}
},
delegateType: "focusin"
},
blur: {
trigger: function() {
if ( this === safeActiveElement() && this.blur ) {
this.blur();
return false;
}
},
delegateType: "focusout"
},
click: {
// For checkbox, fire native event so checked state will be right
trigger: function() {
if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
this.click();
return false;
}
},
// For cross-browser consistency, don't fire native .click() on links
_default: function( event ) {
return jQuery.nodeName( event.target, "a" );
}
},
beforeunload: {
postDispatch: function( event ) {
// Even when returnValue equals to undefined Firefox will still show alert
if ( event.result !== undefined ) {
event.originalEvent.returnValue = event.result;
}
}
}
},
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();
}
}
};
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false );
}
} :
function( elem, type, handle ) {
var name = "on" + type;
if ( elem.detachEvent ) {
// #8545, #7054, preventing memory leaks for custom events in IE6-8
// detachEvent needed property on element, by name of that event, to properly expose it to GC
if ( typeof elem[ name ] === core_strundefined ) {
elem[ name ] = null;
}
elem.detachEvent( name, 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;
};
// 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 = {
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse,
preventDefault: function() {
var e = this.originalEvent;
this.isDefaultPrevented = returnTrue;
if ( !e ) {
return;
}
// If preventDefault exists, run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// Support: IE
// Otherwise set the returnValue property of the original event to false
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
var e = this.originalEvent;
this.isPropagationStopped = returnTrue;
if ( !e ) {
return;
}
// If stopPropagation exists, run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// Support: IE
// Set the cancelBubble property of the original event to true
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
}
};
// 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 ret,
target = this,
related = event.relatedTarget,
handleObj = event.handleObj;
// 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 && !jQuery._data( form, "submitBubbles" ) ) {
jQuery.event.add( form, "submit._submit", function( event ) {
event._submit_bubble = true;
});
jQuery._data( form, "submitBubbles", 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;
}
// Allow triggered, simulated change events (#11500)
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 ) && !jQuery._data( elem, "changeBubbles" ) ) {
jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
jQuery.event.simulate( "change", this.parentNode, event, true );
}
});
jQuery._data( elem, "changeBubbles", 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 type, origFn;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) {
// ( 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 ) {
var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( type in types ) {
this.off( type, selector, types[ type ] );
}
return this;
}
if ( selector === false || typeof selector === "function" ) {
// ( types [, fn] )
fn = selector;
selector = undefined;
}
if ( fn === false ) {
fn = returnFalse;
}
return this.each(function() {
jQuery.event.remove( this, types, fn, selector );
});
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
var elem = this[0];
if ( elem ) {
return jQuery.event.trigger( type, data, elem, true );
}
}
});
var isSimple = /^.[^:#\[\.,]*$/,
rparentsprev = /^(?:parents|prev(?:Until|All))/,
rneedsContext = jQuery.expr.match.needsContext,
// 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 i,
ret = [],
self = this,
len = self.length;
if ( typeof selector !== "string" ) {
return this.pushStack( jQuery( selector ).filter(function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
}) );
}
for ( i = 0; i < len; i++ ) {
jQuery.find( selector, self[ i ], ret );
}
// Needed because $( selector, context ) becomes $( context ).find( selector )
ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
ret.selector = this.selector ? this.selector + " " + selector : selector;
return ret;
},
has: function( target ) {
var i,
targets = jQuery( target, this ),
len = targets.length;
return this.filter(function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) {
return true;
}
}
});
},
not: function( selector ) {
return this.pushStack( winnow(this, selector || [], true) );
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector || [], false) );
},
is: function( selector ) {
return !!winnow(
this,
// If this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
typeof selector === "string" && rneedsContext.test( selector ) ?
jQuery( selector ) :
selector || [],
false
).length;
},
closest: function( selectors, context ) {
var cur,
i = 0,
l = this.length,
ret = [],
pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( ; i < l; i++ ) {
for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
// Always skip document fragments
if ( cur.nodeType < 11 && (pos ?
pos.index(cur) > -1 :
// Don't pass non-elements to Sizzle
cur.nodeType === 1 &&
jQuery.find.matchesSelector(cur, selectors)) ) {
cur = ret.push( cur );
break;
}
}
}
return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
},
// 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.first().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( jQuery.unique(all) );
},
addBack: function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter(selector)
);
}
});
function sibling( cur, dir ) {
do {
cur = cur[ dir ];
} while ( cur && cur.nodeType !== 1 );
return cur;
}
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 sibling( elem, "nextSibling" );
},
prev: function( elem ) {
return sibling( elem, "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.merge( [], elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
if ( this.length > 1 ) {
// Remove duplicates
if ( !guaranteedUnique[ name ] ) {
ret = jQuery.unique( ret );
}
// Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
ret = ret.reverse();
}
}
return this.pushStack( ret );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
var elem = elems[ 0 ];
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 && elem.nodeType === 1 ?
jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
return elem.nodeType === 1;
}));
},
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;
},
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, not ) {
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep( elements, function( elem, i ) {
/* jshint -W018 */
return !!qualifier.call( elem, i, elem ) !== not;
});
}
if ( qualifier.nodeType ) {
return jQuery.grep( elements, function( elem ) {
return ( elem === qualifier ) !== not;
});
}
if ( typeof qualifier === "string" ) {
if ( isSimple.test( qualifier ) ) {
return jQuery.filter( qualifier, elements, not );
}
qualifier = jQuery.filter( qualifier, elements );
}
return jQuery.grep( elements, function( elem ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not;
});
}
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+="(?:null|\d+)"/g,
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style|link)/i,
manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /^$|\/(?:java|ecma)script/i,
rscriptTypeMasked = /^true\/(.*)/,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
// We have to close these tags to support XHTML (#13200)
wrapMap = {
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>" ],
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
// unless wrapped in a div with non-breaking characters in front of it.
_default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
},
safeFragment = createSafeFragment( document ),
fragmentDiv = safeFragment.appendChild( document.createElement("div") );
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
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 );
},
append: function() {
return this.domManip( arguments, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
var target = manipulationTarget( this, elem );
target.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip( arguments, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
var target = manipulationTarget( this, elem );
target.insertBefore( elem, target.firstChild );
}
});
},
before: function() {
return this.domManip( arguments, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this );
}
});
},
after: function() {
return this.domManip( arguments, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this.nextSibling );
}
});
},
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
var elem,
elems = selector ? jQuery.filter( selector, this ) : this,
i = 0;
for ( ; (elem = elems[i]) != null; i++ ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem ) );
}
if ( elem.parentNode ) {
if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
setGlobalEval( getAll( elem, "script" ) );
}
elem.parentNode.removeChild( elem );
}
}
return this;
},
empty: function() {
var elem,
i = 0;
for ( ; (elem = this[i]) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
// If this is a select, ensure that it displays empty (#12336)
// Support: IE<9
if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
elem.options.length = 0;
}
}
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, "" ) :
undefined;
}
// See if we can take a shortcut and just use innerHTML
if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
( jQuery.support.htmlSerialize || !rnoshimcache.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( getAll( elem, false ) );
elem.innerHTML = value;
}
}
elem = 0;
// If using innerHTML throws an exception, use the fallback method
} catch(e) {}
}
if ( elem ) {
this.empty().append( value );
}
}, null, value, arguments.length );
},
replaceWith: function() {
var
// Snapshot the DOM in case .domManip sweeps something relevant into its fragment
args = jQuery.map( this, function( elem ) {
return [ elem.nextSibling, elem.parentNode ];
}),
i = 0;
// Make the changes, replacing each context element with the new content
this.domManip( arguments, function( elem ) {
var next = args[ i++ ],
parent = args[ i++ ];
if ( parent ) {
// Don't use the snapshot next if it has moved (#13810)
if ( next && next.parentNode !== parent ) {
next = this.nextSibling;
}
jQuery( this ).remove();
parent.insertBefore( elem, next );
}
// Allow new content to include elements from the context set
}, true );
// Force removal if there was no new content (e.g., from empty arguments)
return i ? this : this.remove();
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, callback, allowIntersection ) {
// Flatten any nested arrays
args = core_concat.apply( [], args );
var first, node, hasScripts,
scripts, doc, fragment,
i = 0,
l = this.length,
set = this,
iNoClone = l - 1,
value = args[0],
isFunction = jQuery.isFunction( value );
// We can't cloneNode fragments that contain checked, in WebKit
if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
return this.each(function( index ) {
var self = set.eq( index );
if ( isFunction ) {
args[0] = value.call( this, index, self.html() );
}
self.domManip( args, callback, allowIntersection );
});
}
if ( l ) {
fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this );
first = fragment.firstChild;
if ( fragment.childNodes.length === 1 ) {
fragment = first;
}
if ( first ) {
scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
hasScripts = scripts.length;
// Use the original fragment for the last item instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070).
for ( ; i < l; i++ ) {
node = fragment;
if ( i !== iNoClone ) {
node = jQuery.clone( node, true, true );
// Keep references to cloned scripts for later restoration
if ( hasScripts ) {
jQuery.merge( scripts, getAll( node, "script" ) );
}
}
callback.call( this[i], node, i );
}
if ( hasScripts ) {
doc = scripts[ scripts.length - 1 ].ownerDocument;
// Reenable scripts
jQuery.map( scripts, restoreScript );
// Evaluate executable scripts on first document insertion
for ( i = 0; i < hasScripts; i++ ) {
node = scripts[ i ];
if ( rscriptType.test( node.type || "" ) &&
!jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
if ( node.src ) {
// Hope ajax is available...
jQuery._evalUrl( node.src );
} else {
jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
}
}
}
}
// Fix #11809: Avoid leaking memory
fragment = first = null;
}
}
return this;
}
});
// Support: IE<8
// Manipulating tables requires a tbody
function manipulationTarget( elem, content ) {
return jQuery.nodeName( elem, "table" ) &&
jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ?
elem.getElementsByTagName("tbody")[0] ||
elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
elem;
}
// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) {
elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type;
return elem;
}
function restoreScript( elem ) {
var match = rscriptTypeMasked.exec( elem.type );
if ( match ) {
elem.type = match[1];
} else {
elem.removeAttribute("type");
}
return elem;
}
// Mark scripts as having already been evaluated
function setGlobalEval( elems, refElements ) {
var elem,
i = 0;
for ( ; (elem = elems[i]) != null; i++ ) {
jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
}
}
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 fixCloneNodeIssues( src, dest ) {
var nodeName, e, data;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
nodeName = dest.nodeName.toLowerCase();
// IE6-8 copies events bound via attachEvent when using cloneNode.
if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
data = jQuery._data( dest );
for ( e in data.events ) {
jQuery.removeEvent( dest, e, data.handle );
}
// Event data gets referenced instead of copied if the expando gets copied too
dest.removeAttribute( jQuery.expando );
}
// IE blanks contents when cloning scripts, and tries to evaluate newly-set text
if ( nodeName === "script" && dest.text !== src.text ) {
disableScript( dest ).text = src.text;
restoreScript( dest );
// IE6-10 improperly clones children of object elements using classid.
// IE10 throws NoModificationAllowedError if parent is null, #12132.
} else if ( nodeName === "object" ) {
if ( dest.parentNode ) {
dest.outerHTML = src.outerHTML;
}
// This path appears unavoidable for IE9. When cloning an object
// element in IE9, the outerHTML strategy above is not sufficient.
// If the src has innerHTML and the destination does not,
// copy the src.innerHTML into the dest.innerHTML. #10324
if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
dest.innerHTML = src.innerHTML;
}
} else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
// 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
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.defaultSelected = 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;
}
}
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var elems,
i = 0,
ret = [],
insert = jQuery( selector ),
last = insert.length - 1;
for ( ; i <= last; i++ ) {
elems = i === last ? this : this.clone(true);
jQuery( insert[i] )[ original ]( elems );
// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
core_push.apply( ret, elems.get() );
}
return this.pushStack( ret );
};
});
function getAll( context, tag ) {
var elems, elem,
i = 0,
found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
undefined;
if ( !found ) {
for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
if ( !tag || jQuery.nodeName( elem, tag ) ) {
found.push( elem );
} else {
jQuery.merge( found, getAll( elem, tag ) );
}
}
}
return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
jQuery.merge( [ context ], found ) :
found;
}
// Used in buildFragment, fixes the defaultChecked property
function fixDefaultChecked( elem ) {
if ( manipulation_rcheckableType.test( elem.type ) ) {
elem.defaultChecked = elem.checked;
}
}
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var destElements, node, clone, i, srcElements,
inPage = jQuery.contains( elem.ownerDocument, elem );
if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
clone = elem.cloneNode( true );
// IE<=8 does not properly clone detached, unknown element nodes
} else {
fragmentDiv.innerHTML = elem.outerHTML;
fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
}
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
destElements = getAll( clone );
srcElements = getAll( elem );
// Fix all IE cloning issues
for ( i = 0; (node = srcElements[i]) != null; ++i ) {
// Ensure that the destination node is not null; Fixes #9587
if ( destElements[i] ) {
fixCloneNodeIssues( node, destElements[i] );
}
}
}
// Copy the events from the original to the clone
if ( dataAndEvents ) {
if ( deepDataAndEvents ) {
srcElements = srcElements || getAll( elem );
destElements = destElements || getAll( clone );
for ( i = 0; (node = srcElements[i]) != null; i++ ) {
cloneCopyEvent( node, destElements[i] );
}
} else {
cloneCopyEvent( elem, clone );
}
}
// Preserve script evaluation history
destElements = getAll( clone, "script" );
if ( destElements.length > 0 ) {
setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
}
destElements = srcElements = node = null;
// Return the cloned set
return clone;
},
buildFragment: function( elems, context, scripts, selection ) {
var j, elem, contains,
tmp, tag, tbody, wrap,
l = elems.length,
// Ensure a safe fragment
safe = createSafeFragment( context ),
nodes = [],
i = 0;
for ( ; i < l; i++ ) {
elem = elems[ i ];
if ( elem || elem === 0 ) {
// Add nodes directly
if ( jQuery.type( elem ) === "object" ) {
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
// Convert non-html into a text node
} else if ( !rhtml.test( elem ) ) {
nodes.push( context.createTextNode( elem ) );
// Convert html into DOM nodes
} else {
tmp = tmp || safe.appendChild( context.createElement("div") );
// Deserialize a standard representation
tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default;
tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
// Descend through wrappers to the right content
j = wrap[0];
while ( j-- ) {
tmp = tmp.lastChild;
}
// Manually add leading whitespace removed by IE
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
elem = tag === "table" && !rtbody.test( elem ) ?
tmp.firstChild :
// String was a bare <thead> or <tfoot>
wrap[1] === "<table>" && !rtbody.test( elem ) ?
tmp :
0;
j = elem && elem.childNodes.length;
while ( j-- ) {
if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
elem.removeChild( tbody );
}
}
}
jQuery.merge( nodes, tmp.childNodes );
// Fix #12392 for WebKit and IE > 9
tmp.textContent = "";
// Fix #12392 for oldIE
while ( tmp.firstChild ) {
tmp.removeChild( tmp.firstChild );
}
// Remember the top-level container for proper cleanup
tmp = safe.lastChild;
}
}
}
// Fix #11356: Clear elements from fragment
if ( tmp ) {
safe.removeChild( tmp );
}
// Reset defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
if ( !jQuery.support.appendChecked ) {
jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
}
i = 0;
while ( (elem = nodes[ i++ ]) ) {
// #4087 - If origin and destination elements are the same, and this is
// that element, do not do anything
if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
continue;
}
contains = jQuery.contains( elem.ownerDocument, elem );
// Append to fragment
tmp = getAll( safe.appendChild( elem ), "script" );
// Preserve script evaluation history
if ( contains ) {
setGlobalEval( tmp );
}
// Capture executables
if ( scripts ) {
j = 0;
while ( (elem = tmp[ j++ ]) ) {
if ( rscriptType.test( elem.type || "" ) ) {
scripts.push( elem );
}
}
}
}
tmp = null;
return safe;
},
cleanData: function( elems, /* internal */ acceptData ) {
var elem, type, id, data,
i = 0,
internalKey = jQuery.expando,
cache = jQuery.cache,
deleteExpando = jQuery.support.deleteExpando,
special = jQuery.event.special;
for ( ; (elem = elems[i]) != null; i++ ) {
if ( acceptData || jQuery.acceptData( elem ) ) {
id = elem[ internalKey ];
data = id && cache[ id ];
if ( data ) {
if ( data.events ) {
for ( type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent( elem, type, data.handle );
}
}
}
// Remove cache only if it was not already removed by jQuery.event.remove
if ( cache[ id ] ) {
delete cache[ id ];
// 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 ( deleteExpando ) {
delete elem[ internalKey ];
} else if ( typeof elem.removeAttribute !== core_strundefined ) {
elem.removeAttribute( internalKey );
} else {
elem[ internalKey ] = null;
}
core_deletedIds.push( id );
}
}
}
}
},
_evalUrl: function( url ) {
return jQuery.ajax({
url: url,
type: "GET",
dataType: "script",
async: false,
global: false,
"throws": true
});
}
});
jQuery.fn.extend({
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();
}
});
var iframe, getStyles, curCSS,
ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity\s*=\s*([^)]*)/,
rposition = /^(top|right|bottom|left)$/,
// swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
rmargin = /^margin/,
rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
elemdisplay = { BODY: "block" },
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssNormalTransform = {
letterSpacing: 0,
fontWeight: 400
},
cssExpand = [ "Top", "Right", "Bottom", "Left" ],
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
// return a css property mapped to a potentially vendor prefixed property
function vendorPropName( style, name ) {
// shortcut for names that are not vendor prefixed
if ( name in style ) {
return name;
}
// check for vendor prefixed names
var capName = name.charAt(0).toUpperCase() + name.slice(1),
origName = name,
i = cssPrefixes.length;
while ( i-- ) {
name = cssPrefixes[ i ] + capName;
if ( name in style ) {
return name;
}
}
return origName;
}
function isHidden( elem, el ) {
// isHidden might be called from jQuery#filter function;
// in that case, element will be second argument
elem = el || elem;
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
}
function showHide( elements, show ) {
var display, elem, hidden,
values = [],
index = 0,
length = elements.length;
for ( ; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
values[ index ] = jQuery._data( elem, "olddisplay" );
display = elem.style.display;
if ( show ) {
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !values[ index ] && display === "none" ) {
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 ( elem.style.display === "" && isHidden( elem ) ) {
values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
}
} else {
if ( !values[ index ] ) {
hidden = isHidden( elem );
if ( display && display !== "none" || !hidden ) {
jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
}
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( index = 0; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
elem.style.display = show ? values[ index ] || "" : "none";
}
}
return elements;
}
jQuery.fn.extend({
css: function( name, value ) {
return jQuery.access( this, function( elem, name, value ) {
var len, styles,
map = {},
i = 0;
if ( jQuery.isArray( name ) ) {
styles = getStyles( elem );
len = name.length;
for ( ; i < len; i++ ) {
map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
}
return map;
}
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
}, name, value, arguments.length > 1 );
},
show: function() {
return showHide( this, true );
},
hide: function() {
return showHide( this );
},
toggle: function( state ) {
if ( typeof state === "boolean" ) {
return state ? this.show() : this.hide();
}
return this.each(function() {
if ( isHidden( this ) ) {
jQuery( this ).show();
} else {
jQuery( this ).hide();
}
});
}
});
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;
}
}
}
},
// Don't automatically add "px" to these possibly-unitless properties
cssNumber: {
"columnCount": true,
"fillOpacity": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"order": true,
"orphans": true,
"widows": true,
"zIndex": true,
"zoom": true
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
// 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, hooks,
origName = jQuery.camelCase( name ),
style = elem.style;
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ 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";
}
// Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
// but it would mean to define eight (for every problematic property) identical functions
if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
style[ name ] = "inherit";
}
// If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
// 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, styles ) {
var num, val, hooks,
origName = jQuery.camelCase( name );
// Make sure that we're working with the right name
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks ) {
val = hooks.get( elem, true, extra );
}
// Otherwise, if a way to get the computed value exists, use that
if ( val === undefined ) {
val = curCSS( elem, name, styles );
}
//convert "normal" to computed value
if ( val === "normal" && name in cssNormalTransform ) {
val = cssNormalTransform[ name ];
}
// Return, converting to number if forced or a qualifier was provided and val looks numeric
if ( extra === "" || extra ) {
num = parseFloat( val );
return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
}
return val;
}
});
// NOTE: we've included the "window" in window.getComputedStyle
// because jsdom on node.js will break without it.
if ( window.getComputedStyle ) {
getStyles = function( elem ) {
return window.getComputedStyle( elem, null );
};
curCSS = function( elem, name, _computed ) {
var width, minWidth, maxWidth,
computed = _computed || getStyles( elem ),
// getPropertyValue is only needed for .css('filter') in IE9, see #12537
ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
style = elem.style;
if ( computed ) {
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
ret = jQuery.style( elem, name );
}
// A tribute to the "awesome hack by Dean Edwards"
// Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
// Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
// Remember the original values
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
// Put in the new values to get a computed value out
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
// Revert the changed values
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
}
}
return ret;
};
} else if ( document.documentElement.currentStyle ) {
getStyles = function( elem ) {
return elem.currentStyle;
};
curCSS = function( elem, name, _computed ) {
var left, rs, rsLeft,
computed = _computed || getStyles( elem ),
ret = computed ? computed[ name ] : undefined,
style = elem.style;
// Avoid setting ret to empty string here
// so we don't default to auto
if ( ret == null && style && style[ name ] ) {
ret = style[ name ];
}
// 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
// but not position css attributes, as those are proportional to the parent element instead
// and we can't measure the parent instead because it might trigger a "stacking dolls" problem
if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
// Remember the original values
left = style.left;
rs = elem.runtimeStyle;
rsLeft = rs && rs.left;
// Put in the new values to get a computed value out
if ( rsLeft ) {
rs.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : ret;
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
if ( rsLeft ) {
rs.left = rsLeft;
}
}
return ret === "" ? "auto" : ret;
};
}
function setPositiveNumber( elem, value, subtract ) {
var matches = rnumsplit.exec( value );
return matches ?
// Guard against undefined "subtract", e.g., when used as in cssHooks
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
value;
}
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
var i = extra === ( isBorderBox ? "border" : "content" ) ?
// If we already have the right measurement, avoid augmentation
4 :
// Otherwise initialize for horizontal or vertical properties
name === "width" ? 1 : 0,
val = 0;
for ( ; i < 4; i += 2 ) {
// both box models exclude margin, so add it if we want it
if ( extra === "margin" ) {
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
}
if ( isBorderBox ) {
// border-box includes padding, so remove it if we want content
if ( extra === "content" ) {
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
}
// at this point, extra isn't border nor margin, so remove border
if ( extra !== "margin" ) {
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
} else {
// at this point, extra isn't content, so add padding
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
// at this point, extra isn't content nor padding, so add border
if ( extra !== "padding" ) {
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
}
}
return val;
}
function getWidthOrHeight( elem, name, extra ) {
// Start with offset property, which is equivalent to the border-box value
var valueIsBorderBox = true,
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
styles = getStyles( elem ),
isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
// some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
if ( val <= 0 || val == null ) {
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, styles );
if ( val < 0 || val == null ) {
val = elem.style[ name ];
}
// Computed unit is not pixels. Stop here and return.
if ( rnumnonpx.test(val) ) {
return val;
}
// we need the check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
}
// use the active box-sizing model to add/subtract irrelevant styles
return ( val +
augmentWidthOrHeight(
elem,
name,
extra || ( isBorderBox ? "border" : "content" ),
valueIsBorderBox,
styles
)
) + "px";
}
// Try to determine the default display value of an element
function css_defaultDisplay( nodeName ) {
var doc = document,
display = elemdisplay[ nodeName ];
if ( !display ) {
display = actualDisplay( nodeName, doc );
// If the simple way fails, read from inside an iframe
if ( display === "none" || !display ) {
// Use the already-created iframe if possible
iframe = ( iframe ||
jQuery("<iframe frameborder='0' width='0' height='0'/>")
.css( "cssText", "display:block !important" )
).appendTo( doc.documentElement );
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
doc.write("<!doctype html><html><body>");
doc.close();
display = actualDisplay( nodeName, doc );
iframe.detach();
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
}
return display;
}
// Called ONLY from within css_defaultDisplay
function actualDisplay( name, doc ) {
var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
display = jQuery.css( elem[0], "display" );
elem.remove();
return display;
}
jQuery.each([ "height", "width" ], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
if ( computed ) {
// certain elements can have dimension info if we invisibly show them
// however, it must have a current display style that would benefit from this
return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
jQuery.swap( elem, cssShow, function() {
return getWidthOrHeight( elem, name, extra );
}) :
getWidthOrHeight( elem, name, extra );
}
},
set: function( elem, value, extra ) {
var styles = extra && getStyles( elem );
return setPositiveNumber( elem, value, extra ?
augmentWidthOrHeight(
elem,
name,
extra,
jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
styles
) : 0
);
}
};
});
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) || "" ) ?
( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
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 === "", then remove inline opacity #12685
if ( ( value >= 1 || value === "" ) &&
jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
style.removeAttribute ) {
// 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 is no filter style applied in a css rule or unset inline opacity, we are done
if ( value === "" || currentStyle && !currentStyle.filter ) {
return;
}
}
// otherwise, set new filter values
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
}
};
}
// These hooks cannot be added until DOM ready because the support test
// for it is not run until after DOM ready
jQuery(function() {
if ( !jQuery.support.reliableMarginRight ) {
jQuery.cssHooks.marginRight = {
get: function( elem, computed ) {
if ( 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" },
curCSS, [ elem, "marginRight" ] );
}
}
};
}
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// getComputedStyle returns percent when specified for top/left/bottom/right
// rather than make the css module depend on the offset module, we just check for it here
if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
jQuery.each( [ "top", "left" ], function( i, prop ) {
jQuery.cssHooks[ prop ] = {
get: function( elem, computed ) {
if ( computed ) {
computed = curCSS( elem, prop );
// if curCSS returns percentage, fallback to offset
return rnumnonpx.test( computed ) ?
jQuery( elem ).position()[ prop ] + "px" :
computed;
}
}
};
});
}
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
// Support: Opera <= 12.12
// Opera reports offsetWidths and offsetHeights less than zero on some elements
return elem.offsetWidth <= 0 && elem.offsetHeight <= 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 = 0,
expanded = {},
// assumes a single number if not a string
parts = typeof value === "string" ? value.split(" ") : [ value ];
for ( ; i < 4; i++ ) {
expanded[ prefix + cssExpand[ i ] + suffix ] =
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
}
return expanded;
}
};
if ( !rmargin.test( prefix ) ) {
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
}
});
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
rsubmittable = /^(?:input|select|textarea|keygen)/i;
jQuery.fn.extend({
serialize: function() {
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
return this.map(function(){
// Can add propHook for "elements" to filter or add form elements
var elements = jQuery.prop( this, "elements" );
return elements ? jQuery.makeArray( elements ) : this;
})
.filter(function(){
var type = this.type;
// Use .is(":disabled") so that fieldset[disabled] works
return this.name && !jQuery( this ).is( ":disabled" ) &&
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
( this.checked || !manipulation_rcheckableType.test( type ) );
})
.map(function( i, elem ){
var val = jQuery( this ).val();
return val == null ?
null :
jQuery.isArray( val ) ?
jQuery.map( val, function( val ){
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}).get();
}
});
//Serialize an array of form elements or a set of
//key/values into a query string
jQuery.param = function( a, traditional ) {
var prefix,
s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings && 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 ( prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" ).replace( r20, "+" );
};
function buildParams( prefix, obj, traditional, add ) {
var name;
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 {
// Item is non-scalar (array or object), encode its numeric index.
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
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 ) {
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
});
jQuery.fn.extend({
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
},
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
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 );
}
});
var
// Document location
ajaxLocParts,
ajaxLocation,
ajax_nonce = jQuery.now(),
ajax_rquery = /\?/,
rhash = /#.*$/,
rts = /([?&])_=[^&]*/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
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 = {},
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = "*/".concat("*");
// #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 = "*";
}
var dataType,
i = 0,
dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
if ( jQuery.isFunction( func ) ) {
// For each dataType in the dataTypeExpression
while ( (dataType = dataTypes[i++]) ) {
// Prepend if requested
if ( dataType[0] === "+" ) {
dataType = dataType.slice( 1 ) || "*";
(structure[ dataType ] = structure[ dataType ] || []).unshift( func );
// Otherwise append
} else {
(structure[ dataType ] = structure[ dataType ] || []).push( func );
}
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
var inspected = {},
seekingTransport = ( structure === transports );
function inspect( dataType ) {
var selected;
inspected[ dataType ] = true;
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
options.dataTypes.unshift( dataTypeOrTransport );
inspect( dataTypeOrTransport );
return false;
} else if ( seekingTransport ) {
return !( selected = dataTypeOrTransport );
}
});
return selected;
}
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
var deep, key,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for ( key in src ) {
if ( src[ key ] !== undefined ) {
( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
}
}
if ( deep ) {
jQuery.extend( true, target, deep );
}
return target;
}
jQuery.fn.load = function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
}
var selector, response, type,
self = this,
off = url.indexOf(" ");
if ( off >= 0 ) {
selector = url.slice( off, url.length );
url = url.slice( 0, off );
}
// If it's a function
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
params = undefined;
// Otherwise, build a param string
} else if ( params && typeof params === "object" ) {
type = "POST";
}
// If we have elements to modify, make the request
if ( self.length > 0 ) {
jQuery.ajax({
url: url,
// if "type" variable is undefined, then "GET" method will be used
type: type,
dataType: "html",
data: params
}).done(function( responseText ) {
// Save response for use in complete callback
response = arguments;
self.html( selector ?
// If a selector was specified, locate the right elements in a dummy div
// Exclude scripts to avoid IE 'Permission Denied' errors
jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
// Otherwise use the full result
responseText );
}).complete( callback && function( jqXHR, status ) {
self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
});
}
return this;
};
// Attach a bunch of functions for handling common AJAX events
jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
jQuery.fn[ type ] = function( fn ){
return this.on( type, fn );
};
});
jQuery.extend({
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {},
ajaxSettings: {
url: ajaxLocation,
type: "GET",
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
global: true,
processData: true,
async: true,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
throws: false,
traditional: false,
headers: {},
*/
accepts: {
"*": allTypes,
text: "text/plain",
html: "text/html",
xml: "application/xml, text/xml",
json: "application/json, text/javascript"
},
contents: {
xml: /xml/,
html: /html/,
json: /json/
},
responseFields: {
xml: "responseXML",
text: "responseText",
json: "responseJSON"
},
// Data converters
// Keys separate source (or catchall "*") and destination types with a single space
converters: {
// Convert anything to text
"* text": String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": 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: {
url: true,
context: true
}
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function( target, settings ) {
return settings ?
// Building a settings object
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
// Extending ajaxSettings
ajaxExtend( jQuery.ajaxSettings, target );
},
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
ajaxTransport: addToPrefiltersOrTransports( transports ),
// Main method
ajax: function( 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 // Cross-domain detection vars
parts,
// Loop variable
i,
// URL without anti-cache param
cacheURL,
// Response headers as string
responseHeadersString,
// timeout handle
timeoutTimer,
// To know if global events are to be dispatched
fireGlobals,
transport,
// Response headers
responseHeaders,
// Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events is callbackContext if it is a DOM node or jQuery collection
globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
jQuery( callbackContext ) :
jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks("once memory"),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// The jqXHR state
state = 0,
// Default abort message
strAbort = "canceled",
// Fake xhr
jqXHR = {
readyState: 0,
// 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 == null ? null : match;
},
// Raw string
getAllResponseHeaders: function() {
return state === 2 ? responseHeadersString : null;
},
// Caches the header
setRequestHeader: function( name, value ) {
var lname = name.toLowerCase();
if ( !state ) {
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
requestHeaders[ name ] = value;
}
return this;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( !state ) {
s.mimeType = type;
}
return this;
},
// Status-dependent callbacks
statusCode: function( map ) {
var code;
if ( map ) {
if ( state < 2 ) {
for ( code in map ) {
// Lazy-add the new callback in a way that preserves old ones
statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
}
} else {
// Execute the appropriate callbacks
jqXHR.always( map[ jqXHR.status ] );
}
}
return this;
},
// Cancel the request
abort: function( statusText ) {
var finalText = statusText || strAbort;
if ( transport ) {
transport.abort( finalText );
}
done( 0, finalText );
return this;
}
};
// Attach deferreds
deferred.promise( jqXHR ).complete = completeDeferred.add;
jqXHR.success = jqXHR.done;
jqXHR.error = jqXHR.fail;
// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// Handle falsy url in the settings object (#10093: consistency with old signature)
// We also use the url parameter if available
s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Alias method option to type as per ticket #12004
s.type = options.method || options.type || s.method || s.type;
// Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
// A cross-domain request is in order when we have a protocol:host:port mismatch
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 jqXHR;
}
// We can fire global events as of now if asked to
fireGlobals = s.global;
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger("ajaxStart");
}
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Save the URL in case we're toying with the If-Modified-Since
// and/or If-None-Match header later on
cacheURL = s.url;
// More options handling for requests with no content
if ( !s.hasContent ) {
// If data is available, append data to url
if ( s.data ) {
cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Add anti-cache in url if needed
if ( s.cache === false ) {
s.url = rts.test( cacheURL ) ?
// If there is already a '_' parameter, set its value
cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
// Otherwise add one to the end
cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
}
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
if ( jQuery.lastModified[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
}
if ( jQuery.etag[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
}
}
// Set the correct header, if data is being sent
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
jqXHR.setRequestHeader( "Content-Type", s.contentType );
}
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ]
);
// Check for headers option
for ( i in s.headers ) {
jqXHR.setRequestHeader( i, s.headers[ i ] );
}
// Allow custom headers/mimetypes and early abort
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
// Abort if not done already and return
return jqXHR.abort();
}
// aborting is no longer a cancellation
strAbort = "abort";
// 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;
}
}
}
// Callback for when everything is done
function done( status, nativeStatusText, responses, headers ) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// 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;
// Determine if successful
isSuccess = status >= 200 && status < 300 || status === 304;
// Get response data
if ( responses ) {
response = ajaxHandleResponses( s, jqXHR, responses );
}
// Convert no matter what (that way responseXXX fields are always set)
response = ajaxConvert( s, response, jqXHR, isSuccess );
// If successful, handle type chaining
if ( isSuccess ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
modified = jqXHR.getResponseHeader("Last-Modified");
if ( modified ) {
jQuery.lastModified[ cacheURL ] = modified;
}
modified = jqXHR.getResponseHeader("etag");
if ( modified ) {
jQuery.etag[ cacheURL ] = modified;
}
}
// if no content
if ( status === 204 || s.type === "HEAD" ) {
statusText = "nocontent";
// if not modified
} else if ( status === 304 ) {
statusText = "notmodified";
// If we have data, let's convert it
} else {
statusText = response.state;
success = response.data;
error = response.error;
isSuccess = !error;
}
} else {
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
if ( status || !statusText ) {
statusText = "error";
if ( status < 0 ) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
// Success/Error
if ( isSuccess ) {
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
[ jqXHR, s, isSuccess ? success : error ] );
}
// Complete
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger("ajaxStop");
}
}
}
return jqXHR;
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
},
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
}
});
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
return jQuery.ajax({
url: url,
type: method,
dataType: type,
data: data,
success: callback
});
};
});
/* Handles responses to an ajax request:
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var firstDataType, ct, finalDataType, type,
contents = s.contents,
dataTypes = s.dataTypes;
// Remove auto dataType and get content-type in the process
while( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
}
}
}
// Check to see if we have a response for the expected dataType
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
// Try convertible dataTypes
for ( type in responses ) {
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
finalDataType = type;
break;
}
if ( !firstDataType ) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType ) {
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
}
return responses[ finalDataType ];
}
}
/* Chain conversions given the request and the original response
* Also sets the responseXXX fields on the jqXHR instance
*/
function ajaxConvert( s, response, jqXHR, isSuccess ) {
var conv2, current, conv, tmp, prev,
converters = {},
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice();
// Create converters map with lowercased keys
if ( dataTypes[ 1 ] ) {
for ( conv in s.converters ) {
converters[ conv.toLowerCase() ] = s.converters[ conv ];
}
}
current = dataTypes.shift();
// Convert to each sequential dataType
while ( current ) {
if ( s.responseFields[ current ] ) {
jqXHR[ s.responseFields[ current ] ] = response;
}
// Apply the dataFilter if provided
if ( !prev && isSuccess && s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
prev = current;
current = dataTypes.shift();
if ( current ) {
// There's only work to do if current dataType is non-auto
if ( current === "*" ) {
current = prev;
// Convert response if prev dataType is non-auto and differs from current
} else if ( prev !== "*" && prev !== current ) {
// Seek a direct converter
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
// If none found, seek a pair
if ( !conv ) {
for ( conv2 in converters ) {
// If conv2 outputs current
tmp = conv2.split( " " );
if ( tmp[ 1 ] === current ) {
// If prev can be converted to accepted input
conv = converters[ prev + " " + tmp[ 0 ] ] ||
converters[ "* " + tmp[ 0 ] ];
if ( conv ) {
// Condense equivalence converters
if ( conv === true ) {
conv = converters[ conv2 ];
// Otherwise, insert the intermediate dataType
} else if ( converters[ conv2 ] !== true ) {
current = tmp[ 0 ];
dataTypes.unshift( tmp[ 1 ] );
}
break;
}
}
}
}
// Apply converter (if not an equivalence)
if ( conv !== true ) {
// Unless errors are allowed to bubble, catch and return them
if ( conv && s[ "throws" ] ) {
response = conv( response );
} else {
try {
response = conv( response );
} catch ( e ) {
return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
}
}
}
}
}
}
return { state: "success", data: response };
}
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /(?:java|ecma)script/
},
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 || jQuery("head")[0] || document.documentElement;
return {
send: function( _, callback ) {
script = document.createElement("script");
script.async = true;
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 ( script.parentNode ) {
script.parentNode.removeChild( script );
}
// Dereference the script
script = null;
// Callback if not abort
if ( !isAbort ) {
callback( 200, "success" );
}
}
};
// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
// Use native DOM manipulation to avoid our domManip AJAX trickery
head.insertBefore( script, head.firstChild );
},
abort: function() {
if ( script ) {
script.onload( undefined, true );
}
}
};
}
});
var oldCallbacks = [],
rjsonp = /(=)\?(?=&|$)|\?\?/;
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
this[ callback ] = true;
return callback;
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var callbackName, overwritten, responseContainer,
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
"url" :
typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
);
// Handle iff the expected data type is "jsonp" or we have a parameter to set
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
// Get callback name, remembering preexisting value associated with it
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
s.jsonpCallback() :
s.jsonpCallback;
// Insert callback into url or form data
if ( jsonProp ) {
s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
} else if ( s.jsonp !== false ) {
s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
}
// Use data converter to retrieve json after script execution
s.converters["script json"] = function() {
if ( !responseContainer ) {
jQuery.error( callbackName + " was not called" );
}
return responseContainer[ 0 ];
};
// force json dataType
s.dataTypes[ 0 ] = "json";
// Install callback
overwritten = window[ callbackName ];
window[ callbackName ] = function() {
responseContainer = arguments;
};
// Clean-up function (fires after converters)
jqXHR.always(function() {
// Restore preexisting value
window[ callbackName ] = overwritten;
// Save back as free
if ( s[ callbackName ] ) {
// make sure that re-using the options doesn't screw things around
s.jsonpCallback = originalSettings.jsonpCallback;
// save the callback name for future use
oldCallbacks.push( callbackName );
}
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( overwritten ) ) {
overwritten( responseContainer[ 0 ] );
}
responseContainer = overwritten = undefined;
});
// Delegate to script
return "script";
}
});
var xhrCallbacks, xhrSupported,
xhrId = 0,
// #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort = window.ActiveXObject && function() {
// Abort all pending requests
var key;
for ( key in xhrCallbacks ) {
xhrCallbacks[ key ]( undefined, true );
}
};
// 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
xhrSupported = jQuery.ajaxSettings.xhr();
jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
xhrSupported = jQuery.support.ajax = !!xhrSupported;
// Create transport if the browser can provide an xhr
if ( xhrSupported ) {
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 handle, i,
xhr = s.xhr();
// 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( err ) {}
// 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, responseHeaders, statusText, responses;
// Firefox throws exceptions when accessing properties
// of an xhr when a network error occurred
// 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 {
responses = {};
status = xhr.status;
responseHeaders = xhr.getAllResponseHeaders();
// When requesting binary data, IE6-9 will throw an exception
// on any attempt to access responseText (#11426)
if ( typeof xhr.responseText === "string" ) {
responses.text = xhr.responseText;
}
// 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 ( !s.async ) {
// if we're in sync mode we fire the callback
callback();
} else if ( xhr.readyState === 4 ) {
// (IE6 & IE7) if it's in cache and has been
// retrieved directly we need to fire the callback
setTimeout( 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( undefined, true );
}
}
};
}
});
}
var fxNow, timerId,
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
rrun = /queueHooks$/,
animationPrefilters = [ defaultPrefilter ],
tweeners = {
"*": [function( prop, value ) {
var tween = this.createTween( prop, value ),
target = tween.cur(),
parts = rfxnum.exec( value ),
unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
// Starting value computation is required for potential unit mismatches
start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
rfxnum.exec( jQuery.css( tween.elem, prop ) ),
scale = 1,
maxIterations = 20;
if ( start && start[ 3 ] !== unit ) {
// Trust units reported by jQuery.css
unit = unit || start[ 3 ];
// Make sure we update the tween properties later on
parts = parts || [];
// Iteratively approximate from a nonzero starting point
start = +target || 1;
do {
// If previous iteration zeroed out, double until we get *something*
// Use a string for doubling factor so we don't accidentally see scale as unchanged below
scale = scale || ".5";
// Adjust and apply
start = start / scale;
jQuery.style( tween.elem, prop, start + unit );
// Update scale, tolerating zero or NaN from tween.cur()
// And breaking the loop if scale is unchanged or perfect, or if we've just had enough
} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
}
// Update tween properties
if ( parts ) {
start = tween.start = +start || +target || 0;
tween.unit = unit;
// If a +=/-= token was provided, we're doing a relative animation
tween.end = parts[ 1 ] ?
start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
+parts[ 2 ];
}
return tween;
}]
};
// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout(function() {
fxNow = undefined;
});
return ( fxNow = jQuery.now() );
}
function createTween( value, prop, animation ) {
var tween,
collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
index = 0,
length = collection.length;
for ( ; index < length; index++ ) {
if ( (tween = collection[ index ].call( animation, prop, value )) ) {
// we're done with this property
return tween;
}
}
}
function Animation( elem, properties, options ) {
var result,
stopped,
index = 0,
length = animationPrefilters.length,
deferred = jQuery.Deferred().always( function() {
// don't match elem in the :animated selector
delete tick.elem;
}),
tick = function() {
if ( stopped ) {
return false;
}
var currentTime = fxNow || createFxNow(),
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
index = 0,
length = animation.tweens.length;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( percent );
}
deferred.notifyWith( elem, [ animation, percent, remaining ]);
if ( percent < 1 && length ) {
return remaining;
} else {
deferred.resolveWith( elem, [ animation ] );
return false;
}
},
animation = deferred.promise({
elem: elem,
props: jQuery.extend( {}, properties ),
opts: jQuery.extend( true, { specialEasing: {} }, options ),
originalProperties: properties,
originalOptions: options,
startTime: fxNow || createFxNow(),
duration: options.duration,
tweens: [],
createTween: function( prop, end ) {
var tween = jQuery.Tween( elem, animation.opts, prop, end,
animation.opts.specialEasing[ prop ] || animation.opts.easing );
animation.tweens.push( tween );
return tween;
},
stop: function( gotoEnd ) {
var index = 0,
// if we are going to the end, we want to run all the tweens
// otherwise we skip this part
length = gotoEnd ? animation.tweens.length : 0;
if ( stopped ) {
return this;
}
stopped = true;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( 1 );
}
// resolve when we played the last frame
// otherwise, reject
if ( gotoEnd ) {
deferred.resolveWith( elem, [ animation, gotoEnd ] );
} else {
deferred.rejectWith( elem, [ animation, gotoEnd ] );
}
return this;
}
}),
props = animation.props;
propFilter( props, animation.opts.specialEasing );
for ( ; index < length ; index++ ) {
result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
if ( result ) {
return result;
}
}
jQuery.map( props, createTween, animation );
if ( jQuery.isFunction( animation.opts.start ) ) {
animation.opts.start.call( elem, animation );
}
jQuery.fx.timer(
jQuery.extend( tick, {
elem: elem,
anim: animation,
queue: animation.opts.queue
})
);
// attach callbacks from options
return animation.progress( animation.opts.progress )
.done( animation.opts.done, animation.opts.complete )
.fail( animation.opts.fail )
.always( animation.opts.always );
}
function propFilter( props, specialEasing ) {
var index, name, easing, value, hooks;
// camelCase, specialEasing and expand cssHook pass
for ( index in props ) {
name = jQuery.camelCase( index );
easing = specialEasing[ name ];
value = props[ index ];
if ( jQuery.isArray( value ) ) {
easing = value[ 1 ];
value = props[ index ] = value[ 0 ];
}
if ( index !== name ) {
props[ name ] = value;
delete props[ index ];
}
hooks = jQuery.cssHooks[ name ];
if ( hooks && "expand" in hooks ) {
value = hooks.expand( value );
delete props[ name ];
// not quite $.extend, this wont overwrite keys already present.
// also - reusing 'index' from above because we have the correct "name"
for ( index in value ) {
if ( !( index in props ) ) {
props[ index ] = value[ index ];
specialEasing[ index ] = easing;
}
}
} else {
specialEasing[ name ] = easing;
}
}
}
jQuery.Animation = jQuery.extend( Animation, {
tweener: function( props, callback ) {
if ( jQuery.isFunction( props ) ) {
callback = props;
props = [ "*" ];
} else {
props = props.split(" ");
}
var prop,
index = 0,
length = props.length;
for ( ; index < length ; index++ ) {
prop = props[ index ];
tweeners[ prop ] = tweeners[ prop ] || [];
tweeners[ prop ].unshift( callback );
}
},
prefilter: function( callback, prepend ) {
if ( prepend ) {
animationPrefilters.unshift( callback );
} else {
animationPrefilters.push( callback );
}
}
});
function defaultPrefilter( elem, props, opts ) {
/* jshint validthis: true */
var prop, value, toggle, tween, hooks, oldfire,
anim = this,
orig = {},
style = elem.style,
hidden = elem.nodeType && isHidden( elem ),
dataShow = jQuery._data( elem, "fxshow" );
// handle queue: false promises
if ( !opts.queue ) {
hooks = jQuery._queueHooks( elem, "fx" );
if ( hooks.unqueued == null ) {
hooks.unqueued = 0;
oldfire = hooks.empty.fire;
hooks.empty.fire = function() {
if ( !hooks.unqueued ) {
oldfire();
}
};
}
hooks.unqueued++;
anim.always(function() {
// doing this makes sure that the complete handler will be called
// before this completes
anim.always(function() {
hooks.unqueued--;
if ( !jQuery.queue( elem, "fx" ).length ) {
hooks.empty.fire();
}
});
});
}
// height/width overflow pass
if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
// 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
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
if ( jQuery.css( elem, "display" ) === "inline" &&
jQuery.css( elem, "float" ) === "none" ) {
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
style.display = "inline-block";
} else {
style.zoom = 1;
}
}
}
if ( opts.overflow ) {
style.overflow = "hidden";
if ( !jQuery.support.shrinkWrapBlocks ) {
anim.always(function() {
style.overflow = opts.overflow[ 0 ];
style.overflowX = opts.overflow[ 1 ];
style.overflowY = opts.overflow[ 2 ];
});
}
}
// show/hide pass
for ( prop in props ) {
value = props[ prop ];
if ( rfxtypes.exec( value ) ) {
delete props[ prop ];
toggle = toggle || value === "toggle";
if ( value === ( hidden ? "hide" : "show" ) ) {
continue;
}
orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
}
}
if ( !jQuery.isEmptyObject( orig ) ) {
if ( dataShow ) {
if ( "hidden" in dataShow ) {
hidden = dataShow.hidden;
}
} else {
dataShow = jQuery._data( elem, "fxshow", {} );
}
// store state if its toggle - enables .stop().toggle() to "reverse"
if ( toggle ) {
dataShow.hidden = !hidden;
}
if ( hidden ) {
jQuery( elem ).show();
} else {
anim.done(function() {
jQuery( elem ).hide();
});
}
anim.done(function() {
var prop;
jQuery._removeData( elem, "fxshow" );
for ( prop in orig ) {
jQuery.style( elem, prop, orig[ prop ] );
}
});
for ( prop in orig ) {
tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
if ( !( prop in dataShow ) ) {
dataShow[ prop ] = tween.start;
if ( hidden ) {
tween.end = tween.start;
tween.start = prop === "width" || prop === "height" ? 1 : 0;
}
}
}
}
}
function Tween( elem, options, prop, end, easing ) {
return new Tween.prototype.init( elem, options, prop, end, easing );
}
jQuery.Tween = Tween;
Tween.prototype = {
constructor: Tween,
init: function( elem, options, prop, end, easing, unit ) {
this.elem = elem;
this.prop = prop;
this.easing = easing || "swing";
this.options = options;
this.start = this.now = this.cur();
this.end = end;
this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
},
cur: function() {
var hooks = Tween.propHooks[ this.prop ];
return hooks && hooks.get ?
hooks.get( this ) :
Tween.propHooks._default.get( this );
},
run: function( percent ) {
var eased,
hooks = Tween.propHooks[ this.prop ];
if ( this.options.duration ) {
this.pos = eased = jQuery.easing[ this.easing ](
percent, this.options.duration * percent, 0, 1, this.options.duration
);
} else {
this.pos = eased = percent;
}
this.now = ( this.end - this.start ) * eased + this.start;
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
if ( hooks && hooks.set ) {
hooks.set( this );
} else {
Tween.propHooks._default.set( this );
}
return this;
}
};
Tween.prototype.init.prototype = Tween.prototype;
Tween.propHooks = {
_default: {
get: function( tween ) {
var result;
if ( tween.elem[ tween.prop ] != null &&
(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
return tween.elem[ tween.prop ];
}
// passing an empty string as a 3rd parameter to .css will automatically
// attempt a parseFloat and fallback to a string if the parse fails
// so, simple values such as "10px" are parsed to Float.
// complex values such as "rotate(1rad)" are returned as is.
result = jQuery.css( tween.elem, tween.prop, "" );
// Empty strings, null, undefined and "auto" are converted to 0.
return !result || result === "auto" ? 0 : result;
},
set: function( tween ) {
// use step hook for back compat - use cssHook if its there - use .style if its
// available and use plain properties where available
if ( jQuery.fx.step[ tween.prop ] ) {
jQuery.fx.step[ tween.prop ]( tween );
} else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
} else {
tween.elem[ tween.prop ] = tween.now;
}
}
}
};
// Support: IE <=9
// Panic based approach to setting things on disconnected nodes
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
set: function( tween ) {
if ( tween.elem.nodeType && tween.elem.parentNode ) {
tween.elem[ tween.prop ] = tween.now;
}
}
};
jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
var cssFn = jQuery.fn[ name ];
jQuery.fn[ name ] = function( speed, easing, callback ) {
return speed == null || typeof speed === "boolean" ?
cssFn.apply( this, arguments ) :
this.animate( genFx( name, true ), speed, easing, callback );
};
});
jQuery.fn.extend({
fadeTo: function( speed, to, easing, callback ) {
// show any hidden elements after setting opacity to 0
return this.filter( isHidden ).css( "opacity", 0 ).show()
// animate to the value specified
.end().animate({ opacity: to }, speed, easing, callback );
},
animate: function( prop, speed, easing, callback ) {
var empty = jQuery.isEmptyObject( prop ),
optall = jQuery.speed( speed, easing, callback ),
doAnimation = function() {
// Operate on a copy of prop so per-property easing won't be lost
var anim = Animation( this, jQuery.extend( {}, prop ), optall );
// Empty animations, or finishing resolves immediately
if ( empty || jQuery._data( this, "finish" ) ) {
anim.stop( true );
}
};
doAnimation.finish = doAnimation;
return empty || optall.queue === false ?
this.each( doAnimation ) :
this.queue( optall.queue, doAnimation );
},
stop: function( type, clearQueue, gotoEnd ) {
var stopQueue = function( hooks ) {
var stop = hooks.stop;
delete hooks.stop;
stop( gotoEnd );
};
if ( typeof type !== "string" ) {
gotoEnd = clearQueue;
clearQueue = type;
type = undefined;
}
if ( clearQueue && type !== false ) {
this.queue( type || "fx", [] );
}
return this.each(function() {
var dequeue = true,
index = type != null && type + "queueHooks",
timers = jQuery.timers,
data = jQuery._data( this );
if ( index ) {
if ( data[ index ] && data[ index ].stop ) {
stopQueue( data[ index ] );
}
} else {
for ( index in data ) {
if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
stopQueue( data[ index ] );
}
}
}
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
timers[ index ].anim.stop( gotoEnd );
dequeue = false;
timers.splice( index, 1 );
}
}
// start the next in the queue if the last step wasn't forced
// timers currently will call their complete callbacks, which will dequeue
// but only if they were gotoEnd
if ( dequeue || !gotoEnd ) {
jQuery.dequeue( this, type );
}
});
},
finish: function( type ) {
if ( type !== false ) {
type = type || "fx";
}
return this.each(function() {
var index,
data = jQuery._data( this ),
queue = data[ type + "queue" ],
hooks = data[ type + "queueHooks" ],
timers = jQuery.timers,
length = queue ? queue.length : 0;
// enable finishing flag on private data
data.finish = true;
// empty the queue first
jQuery.queue( this, type, [] );
if ( hooks && hooks.stop ) {
hooks.stop.call( this, true );
}
// look for any active animations, and finish them
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
timers[ index ].anim.stop( true );
timers.splice( index, 1 );
}
}
// look for any animations in the old queue and finish them
for ( index = 0; index < length; index++ ) {
if ( queue[ index ] && queue[ index ].finish ) {
queue[ index ].finish.call( this );
}
}
// turn off finishing flag
delete data.finish;
});
}
});
// Generate parameters to create a standard animation
function genFx( type, includeWidth ) {
var which,
attrs = { height: type },
i = 0;
// if we include width, step value is 1 to do all cssExpand values,
// if we don't include width, step value is 2 to skip over Left and Right
includeWidth = includeWidth? 1 : 0;
for( ; i < 4 ; i += 2 - includeWidth ) {
which = cssExpand[ i ];
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
}
if ( includeWidth ) {
attrs.opacity = attrs.width = type;
}
return attrs;
}
// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx("show"),
slideUp: genFx("hide"),
slideToggle: genFx("toggle"),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
jQuery.fn[ name ] = function( speed, easing, callback ) {
return this.animate( props, speed, easing, callback );
};
});
jQuery.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() {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
if ( opt.queue ) {
jQuery.dequeue( this, opt.queue );
}
};
return opt;
};
jQuery.easing = {
linear: function( p ) {
return p;
},
swing: function( p ) {
return 0.5 - Math.cos( p*Math.PI ) / 2;
}
};
jQuery.timers = [];
jQuery.fx = Tween.prototype.init;
jQuery.fx.tick = function() {
var timer,
timers = jQuery.timers,
i = 0;
fxNow = jQuery.now();
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();
}
fxNow = undefined;
};
jQuery.fx.timer = function( timer ) {
if ( timer() && jQuery.timers.push( timer ) ) {
jQuery.fx.start();
}
};
jQuery.fx.interval = 13;
jQuery.fx.start = function() {
if ( !timerId ) {
timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
}
};
jQuery.fx.stop = function() {
clearInterval( timerId );
timerId = null;
};
jQuery.fx.speeds = {
slow: 600,
fast: 200,
// Default speed
_default: 400
};
// Back Compat <1.8 extension point
jQuery.fx.step = {};
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.animated = function( elem ) {
return jQuery.grep(jQuery.timers, function( fn ) {
return elem === fn.elem;
}).length;
};
}
jQuery.fn.offset = function( options ) {
if ( arguments.length ) {
return options === undefined ?
this :
this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
var docElem, win,
box = { top: 0, left: 0 },
elem = this[ 0 ],
doc = elem && elem.ownerDocument;
if ( !doc ) {
return;
}
docElem = doc.documentElement;
// Make sure it's not a disconnected DOM node
if ( !jQuery.contains( docElem, elem ) ) {
return box;
}
// If we don't have gBCR, just use 0,0 rather than error
// BlackBerry 5, iOS 3 (original iPhone)
if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
box = elem.getBoundingClientRect();
}
win = getWindow( doc );
return {
top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
};
};
jQuery.offset = {
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;
}
var offsetParent, offset,
parentOffset = { top: 0, left: 0 },
elem = this[ 0 ];
// fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
if ( jQuery.css( elem, "position" ) === "fixed" ) {
// we assume that getBoundingClientRect is available when computed position is fixed
offset = elem.getBoundingClientRect();
} else {
// Get *real* offsetParent
offsetParent = this.offsetParent();
// Get correct offsets
offset = this.offset();
if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
parentOffset = offsetParent.offset();
}
// Add offsetParent borders
parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
}
// Subtract parent offsets and 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
return {
top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
};
},
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent || docElem;
while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || docElem;
});
}
});
// 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 ] :
win.document.documentElement[ 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 innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
// margin is only for outerHeight, outerWidth
jQuery.fn[ funcName ] = function( margin, value ) {
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
return jQuery.access( this, function( elem, type, value ) {
var doc;
if ( jQuery.isWindow( elem ) ) {
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
// isn't a whole lot we can do. See pull request at this URL for discussion:
// https://github.com/jquery/jquery/pull/764
return elem.document.documentElement[ "client" + name ];
}
// Get document width or height
if ( elem.nodeType === 9 ) {
doc = elem.documentElement;
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
return Math.max(
elem.body[ "scroll" + name ], doc[ "scroll" + name ],
elem.body[ "offset" + name ], doc[ "offset" + name ],
doc[ "client" + name ]
);
}
return value === undefined ?
// Get width or height on the element, requesting but not forcing parseFloat
jQuery.css( elem, type, extra ) :
// Set width or height on the element
jQuery.style( elem, type, value, extra );
}, type, chainable ? margin : undefined, chainable, null );
};
});
});
// Limit scope pollution from any deprecated API
// (function() {
// The number of elements contained in the matched element set
jQuery.fn.size = function() {
return this.length;
};
jQuery.fn.andSelf = jQuery.fn.addBack;
// })();
if ( typeof module === "object" && module && typeof module.exports === "object" ) {
// Expose jQuery as module.exports in loaders that implement the Node
// module pattern (including browserify). Do not create the global, since
// the user will be storing it themselves locally, and globals are frowned
// upon in the Node module world.
module.exports = jQuery;
} else {
// Otherwise expose jQuery to the global object as usual
window.jQuery = window.$ = jQuery;
// Register as a named AMD module, since jQuery can be concatenated with other
// files that may use define, but not via a proper concatenation script that
// understands anonymous AMD modules. A named AMD is safest and most robust
// way to register. Lowercase jquery is used because AMD module names are
// derived from file names, and jQuery is normally delivered in a lowercase
// file name. Do this after creating the global so that if an AMD module wants
// to call noConflict to hide this version of jQuery, it will work.
if ( typeof define === "function" && define.amd ) {
define( "jquery", [], function () { return jQuery; } );
}
}
})( window );
(function(){!function(a){return"function"==typeof define&&define.amd?define(["jquery"],a):a(window.jQuery)}(function(a){var b,c,d,e,f,g,h,i,j,k=[].slice;d=function(){function b(b){this.current_flag=null,this.controllers={},this.alias_maps={},this.$inputor=a(b),this.iframe=null,this.setIframe(),this.listen()}return b.prototype.setIframe=function(a){var b;if(a)return this.window=a.contentWindow,this.document=a.contentDocument||this.window.document,this.iframe=a,this;this.document=this.$inputor[0].ownerDocument,this.window=this.document.defaultView||this.document.parentWindow;try{return this.iframe=this.window.frameElement}catch(c){b=c}},b.prototype.controller=function(a){var b,c,d,e;if(this.alias_maps[a])c=this.controllers[this.alias_maps[a]];else{e=this.controllers;for(d in e)if(b=e[d],d===a){c=b;break}}return c?c:this.controllers[this.current_flag]},b.prototype.set_context_for=function(a){return this.current_flag=a,this},b.prototype.reg=function(a,b){var c,d;return c=(d=this.controllers)[a]||(d[a]=new f(this,a)),b.alias&&(this.alias_maps[b.alias]=a),c.init(b),this},b.prototype.listen=function(){return this.$inputor.on("keyup.atwhoInner",function(a){return function(b){return a.on_keyup(b)}}(this)).on("keydown.atwhoInner",function(a){return function(b){return a.on_keydown(b)}}(this)).on("scroll.atwhoInner",function(a){return function(b){var c;return null!=(c=a.controller())?c.view.hide(b):void 0}}(this)).on("blur.atwhoInner",function(a){return function(b){var c;return(c=a.controller())?c.view.hide(b,c.get_opt("display_timeout")):void 0}}(this))},b.prototype.shutdown=function(){var a,b,c;c=this.controllers;for(b in c)a=c[b],a.destroy(),delete this.controllers[b];return this.$inputor.off(".atwhoInner")},b.prototype.dispatch=function(){return a.map(this.controllers,function(a){return function(b){var c;return(c=b.get_opt("delay"))?(clearTimeout(a.delayedCallback),a.delayedCallback=setTimeout(function(){return b.look_up()?a.set_context_for(b.at):void 0},c)):b.look_up()?a.set_context_for(b.at):void 0}}(this))},b.prototype.on_keyup=function(b){var c;switch(b.keyCode){case h.ESC:b.preventDefault(),null!=(c=this.controller())&&c.view.hide();break;case h.DOWN:case h.UP:case h.CTRL:a.noop();break;case h.P:case h.N:b.ctrlKey||this.dispatch();break;default:this.dispatch()}},b.prototype.on_keydown=function(b){var c,d;if(c=null!=(d=this.controller())?d.view:void 0,c&&c.visible())switch(b.keyCode){case h.ESC:b.preventDefault(),c.hide(b);break;case h.UP:b.preventDefault(),c.prev();break;case h.DOWN:b.preventDefault(),c.next();break;case h.P:if(!b.ctrlKey)return;b.preventDefault(),c.prev();break;case h.N:if(!b.ctrlKey)return;b.preventDefault(),c.next();break;case h.TAB:case h.ENTER:if(!c.visible())return;b.preventDefault(),c.choosing=!0,c.choose(b);break;default:a.noop()}},b}(),f=function(){function c(c,d){this.app=c,this.at=d,this.$inputor=this.app.$inputor,this.id=this.$inputor[0].id||this.uid(),this.setting=null,this.query=null,this.pos=0,this.cur_rect=null,this.range=null,b.append(this.$el=a("<div id='atwho-ground-"+this.id+"'></div>")),this.model=new i(this),this.view=new j(this)}return c.prototype.uid=function(){return(Math.random().toString(16)+"000000000").substr(2,8)+(new Date).getTime()},c.prototype.init=function(b){return this.setting=a.extend({},this.setting||a.fn.atwho["default"],b),this.view.init(),this.model.reload(this.setting.data)},c.prototype.destroy=function(){return this.trigger("beforeDestroy"),this.model.destroy(),this.view.destroy(),this.$el.remove()},c.prototype.call_default=function(){var b,c,d;d=arguments[0],b=2<=arguments.length?k.call(arguments,1):[];try{return g[d].apply(this,b)}catch(e){return c=e,a.error(""+c+" Or maybe At.js doesn't have function "+d)}},c.prototype.trigger=function(a,b){var c,d;return null==b&&(b=[]),b.push(this),c=this.get_opt("alias"),d=c?""+a+"-"+c+".atwho":""+a+".atwho",this.$inputor.trigger(d,b)},c.prototype.callbacks=function(a){return this.get_opt("callbacks")[a]||g[a]},c.prototype.get_opt=function(a){var b;try{return this.setting[a]}catch(c){return b=c,null}},c.prototype.content=function(){return this.$inputor.is("textarea, input")?this.$inputor.val():this.$inputor.text()},c.prototype.catch_query=function(){var a,b,c,d,e,f;return b=this.content(),a=this.$inputor.caret("pos"),f=b.slice(0,a),d=this.callbacks("matcher").call(this,this.at,f,this.get_opt("start_with_space")),"string"==typeof d&&d.length<=this.get_opt("max_len",20)?(e=a-d.length,c=e+d.length,this.pos=e,d={text:d,head_pos:e,end_pos:c},this.trigger("matched",[this.at,d.text])):(d=null,this.view.hide()),this.query=d},c.prototype.rect=function(){var a,b;if(a=this.$inputor.caret({iframe:this.app.iframe}).caret("offset",this.pos-1))return"true"===this.$inputor.attr("contentEditable")&&(a=this.cur_rect||(this.cur_rect=a)||a),b=this.app.document.selection?0:2,{left:a.left,top:a.top,bottom:a.top+a.height+b}},c.prototype.reset_rect=function(){return"true"===this.$inputor.attr("contentEditable")?this.cur_rect=null:void 0},c.prototype.mark_range=function(){return"true"===this.$inputor.attr("contentEditable")&&(this.app.window.getSelection&&(this.range=this.app.window.getSelection().getRangeAt(0)),this.app.document.selection)?this.ie8_range=this.app.document.selection.createRange():void 0},c.prototype.insert_content_for=function(b){var c,d,e;return d=b.data("value"),e=this.get_opt("insert_tpl"),this.$inputor.is("textarea, input")||!e?d:(c=a.extend({},b.data("item-data"),{"atwho-data-value":d,"atwho-at":this.at}),this.callbacks("tpl_eval").call(this,e,c))},c.prototype.insert=function(b,c){var d,e,f,g,h,i,j,k,l,m,n;return d=this.$inputor,"true"===d.attr("contentEditable")&&(f="atwho-view-flag atwho-view-flag-"+(this.get_opt("alias")||this.at),g=""+b+"<span contenteditable='false'> <span>",h="<span contenteditable='false' class='"+f+"'>"+g+"</span>",e=a(h,this.app.document).data("atwho-data-item",c.data("item-data")),this.app.document.selection&&(e=a("<span contenteditable='true'></span>",this.app.document).html(e))),d.is("textarea, input")?(b=this.get_opt("space_after")?b+" ":""+b,l=d.val(),m=l.slice(0,Math.max(this.query.head_pos-this.at.length,0)),n=""+m+b+l.slice(this.query.end_pos||0),d.val(n),d.caret("pos",m.length+b.length)):(j=this.range)?(i=j.startOffset-(this.query.end_pos-this.query.head_pos)-this.at.length,j.setStart(j.endContainer,Math.max(i,0)),j.setEnd(j.endContainer,j.endOffset),j.deleteContents(),j.insertNode(e[0]),j.collapse(!1),k=this.app.window.getSelection(),k.removeAllRanges(),k.addRange(j)):(j=this.ie8_range)&&(j.moveStart("character",this.query.end_pos-this.query.head_pos-this.at.length),j.pasteHTML(g),j.collapse(!1),j.select()),d.is(":focus")||d.focus(),d.change()},c.prototype.render_view=function(a){var b;return b=this.get_opt("search_key"),a=this.callbacks("sorter").call(this,this.query.text,a.slice(0,1001),b),this.view.render(a.slice(0,this.get_opt("limit")))},c.prototype.look_up=function(){var b,c;if(b=this.catch_query())return c=function(a){return a&&a.length>0?this.render_view(a):this.view.hide()},this.model.query(b.text,a.proxy(c,this)),b},c}(),i=function(){function b(a){this.context=a,this.at=this.context.at,this.storage=this.context.$inputor}return b.prototype.destroy=function(){return this.storage.data(this.at,null)},b.prototype.saved=function(){return this.fetch()>0},b.prototype.query=function(a,b){var c,d,e;return c=this.fetch(),d=this.context.get_opt("search_key"),c=this.context.callbacks("filter").call(this.context,a,c,d)||[],e=this.context.callbacks("remote_filter"),c.length>0||!e&&0===c.length?b(c):e.call(this.context,a,b)},b.prototype.fetch=function(){return this.storage.data(this.at)||[]},b.prototype.save=function(a){return this.storage.data(this.at,this.context.callbacks("before_save").call(this.context,a||[]))},b.prototype.load=function(a){return!this.saved()&&a?this._load(a):void 0},b.prototype.reload=function(a){return this._load(a)},b.prototype._load=function(b){return"string"==typeof b?a.ajax(b,{dataType:"json"}).done(function(a){return function(b){return a.save(b)}}(this)):this.save(b)},b}(),j=function(){function b(b){this.context=b,this.$el=a("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>"),this.timeout_id=null,this.context.$el.append(this.$el),this.bind_event()}return b.prototype.init=function(){var a;return a=this.context.get_opt("alias")||this.context.at.charCodeAt(0),this.$el.attr({id:"at-view-"+a})},b.prototype.destroy=function(){return this.$el.remove()},b.prototype.bind_event=function(){var b;return b=this.$el.find("ul"),b.on("mouseenter.atwho-view","li",function(c){return b.find(".cur").removeClass("cur"),a(c.currentTarget).addClass("cur")}).on("click",function(a){return function(b){return a.choose(b),b.preventDefault()}}(this))},b.prototype.visible=function(){return this.$el.is(":visible")},b.prototype.choose=function(a){var b,c;return(b=this.$el.find(".cur")).length?(c=this.context.insert_content_for(b),this.context.insert(this.context.callbacks("before_insert").call(this.context,c,b),b),this.context.trigger("inserted",[b,a]),this.hide(a)):void 0},b.prototype.reposition=function(b){var c,d;return b.bottom+this.$el.height()-a(window).scrollTop()>a(window).height()&&(b.bottom=b.top-this.$el.height()),c={left:b.left,top:b.bottom},null!=(d=this.context.callbacks("before_reposition"))&&d.call(this.context,c),this.$el.offset(c),this.context.trigger("reposition",[c])},b.prototype.next=function(){var a,b;return a=this.$el.find(".cur").removeClass("cur"),b=a.next(),b.length||(b=this.$el.find("li:first")),b.addClass("cur")},b.prototype.prev=function(){var a,b;return a=this.$el.find(".cur").removeClass("cur"),b=a.prev(),b.length||(b=this.$el.find("li:last")),b.addClass("cur")},b.prototype.show=function(){var a;return this.choosing?void(this.choosing=!1):(this.context.mark_range(),this.visible()||(this.$el.show(),this.context.trigger("shown")),(a=this.context.rect())?this.reposition(a):void 0)},b.prototype.hide=function(a,b){var c;if(this.visible())return isNaN(b)?(this.context.reset_rect(),this.$el.hide(),this.context.trigger("hidden",[a])):(c=function(a){return function(){return a.hide()}}(this),clearTimeout(this.timeout_id),this.timeout_id=setTimeout(c,b))},b.prototype.render=function(b){var c,d,e,f,g,h,i;if(!(a.isArray(b)&&b.length>0))return void this.hide();for(this.$el.find("ul").empty(),d=this.$el.find("ul"),g=this.context.get_opt("tpl"),h=0,i=b.length;i>h;h++)e=b[h],e=a.extend({},e,{"atwho-at":this.context.at}),f=this.context.callbacks("tpl_eval").call(this.context,g,e),c=a(this.context.callbacks("highlighter").call(this.context,f,this.context.query.text)),c.data("item-data",e),d.append(c);return this.show(),this.context.get_opt("highlight_first")?d.find("li:first").addClass("cur"):void 0},b}(),h={DOWN:40,UP:38,ESC:27,TAB:9,ENTER:13,CTRL:17,P:80,N:78},g={before_save:function(b){var c,d,e,f;if(!a.isArray(b))return b;for(f=[],d=0,e=b.length;e>d;d++)c=b[d],f.push(a.isPlainObject(c)?c:{name:c});return f},matcher:function(a,b,c){var d,e;return a=a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),c&&(a="(?:^|\\s)"+a),e=new RegExp(a+"([A-Za-z0-9_+-]*)$|"+a+"([^\\x00-\\xff]*)$","gi"),d=e.exec(b),d?d[2]||d[1]:null},filter:function(a,b,c){var d,e,f,g;for(g=[],e=0,f=b.length;f>e;e++)d=b[e],~d[c].toLowerCase().indexOf(a.toLowerCase())&&g.push(d);return g},remote_filter:null,sorter:function(a,b,c){var d,e,f,g;if(!a)return b;for(g=[],e=0,f=b.length;f>e;e++)d=b[e],d.atwho_order=d[c].toLowerCase().indexOf(a.toLowerCase()),d.atwho_order>-1&&g.push(d);return g.sort(function(a,b){return a.atwho_order-b.atwho_order})},tpl_eval:function(a,b){var c;try{return a.replace(/\$\{([^\}]*)\}/g,function(a,c){return b[c]})}catch(d){return c=d,""}},highlighter:function(a,b){var c;return b?(c=new RegExp(">\\s*(\\w*?)("+b.replace("+","\\+")+")(\\w*)\\s*<","ig"),a.replace(c,function(a,b,c,d){return"> "+b+"<strong>"+c+"</strong>"+d+" <"})):a},before_insert:function(a){return a}},c={load:function(a,b){var c;return(c=this.controller(a))?c.model.load(b):void 0},getInsertedItemsWithIDs:function(b){var c,d,e;return(c=this.controller(b))?(b&&(b="-"+(c.get_opt("alias")||c.at)),d=[],e=a.map(this.$inputor.find("span.atwho-view-flag"+(b||"")),function(b){var c;return c=a(b).data("atwho-data-item"),d.indexOf(c.id)>-1?void 0:(c.id&&(d.push=c.id),c)}),[d,e]):[null,null]},getInsertedItems:function(a){return c.getInsertedItemsWithIDs.apply(this,[a])[1]},getInsertedIDs:function(a){return c.getInsertedItemsWithIDs.apply(this,[a])[0]},setIframe:function(a){return this.setIframe(a)},run:function(){return this.dispatch()},destroy:function(){return this.shutdown(),this.$inputor.data("atwho",null)}},e={init:function(b){var c,e;return e=(c=a(this)).data("atwho"),e||c.data("atwho",e=new d(this)),e.reg(b.at,b),this}},b=a("<div id='atwho-container'></div>"),a.fn.atwho=function(d){var f,g;return g=arguments,a("body").append(b),f=null,this.filter("textarea, input, [contenteditable=true]").each(function(){var b;return"object"!=typeof d&&d?c[d]?(b=a(this).data("atwho"))?f=c[d].apply(b,Array.prototype.slice.call(g,1)):void 0:a.error("Method "+d+" does not exist on jQuery.caret"):e.init.apply(this,g)}),f||this},a.fn.atwho["default"]={at:void 0,alias:void 0,space_after:!0,data:null,tpl:"<li data-value='${atwho-at}${name}'>${name}</li>",insert_tpl:"<span>${atwho-data-value}</span>",callbacks:g,search_key:"name",start_with_space:!0,highlight_first:!0,limit:5,max_len:20,display_timeout:300,delay:null}})}).call(this);
/*! jquery.caret 2014-06-13 */
(function(){!function(a){return"function"==typeof define&&define.amd?define(["jquery"],a):a(window.jQuery)}(function(a){"use strict";var b,c,d,e,f,g,h,i,j,k,l;return k="caret",b=function(){function b(a){this.$inputor=a,this.domInputor=this.$inputor[0]}return b.prototype.setPos=function(){return this.domInputor},b.prototype.getIEPosition=function(){return a.noop()},b.prototype.getPosition=function(){return a.noop()},b.prototype.getOldIEPos=function(){var a,b;return b=h.selection.createRange(),a=h.body.createTextRange(),a.moveToElementText(this.domInputor),a.setEndPoint("EndToEnd",b),a.text.length},b.prototype.getPos=function(){var a,b,c;return(c=this.range())?(a=c.cloneRange(),a.selectNodeContents(this.domInputor),a.setEnd(c.endContainer,c.endOffset),b=a.toString().length,a.detach(),b):h.selection?this.getOldIEPos():void 0},b.prototype.getOldIEOffset=function(){var a,b;return a=h.selection.createRange().duplicate(),a.moveStart("character",-1),b=a.getBoundingClientRect(),{height:b.bottom-b.top,left:b.left,top:b.top}},b.prototype.getOffset=function(){var b,c,d,e;if(j.getSelection&&(d=this.range())){if(d.endOffset-1<0)return null;b=d.cloneRange(),b.setStart(d.endContainer,d.endOffset-1),b.setEnd(d.endContainer,d.endOffset),e=b.getBoundingClientRect(),c={height:e.height,left:e.left+e.width,top:e.top},b.detach()}else h.selection&&(c=this.getOldIEOffset());return c&&!i&&(c.top+=a(j).scrollTop(),c.left+=a(j).scrollLeft()),c},b.prototype.range=function(){var a;if(j.getSelection)return a=j.getSelection(),a.rangeCount>0?a.getRangeAt(0):null},b}(),c=function(){function b(a){this.$inputor=a,this.domInputor=this.$inputor[0]}return b.prototype.getIEPos=function(){var a,b,c,d,e,f,g;return b=this.domInputor,f=h.selection.createRange(),e=0,f&&f.parentElement()===b&&(d=b.value.replace(/\r\n/g,"\n"),c=d.length,g=b.createTextRange(),g.moveToBookmark(f.getBookmark()),a=b.createTextRange(),a.collapse(!1),e=g.compareEndPoints("StartToEnd",a)>-1?c:-g.moveStart("character",-c)),e},b.prototype.getPos=function(){return h.selection?this.getIEPos():this.domInputor.selectionStart},b.prototype.setPos=function(a){var b,c;return b=this.domInputor,h.selection?(c=b.createTextRange(),c.move("character",a),c.select()):b.setSelectionRange&&b.setSelectionRange(a,a),b},b.prototype.getIEOffset=function(a){var b,c,d,e;return c=this.domInputor.createTextRange(),a||(a=this.getPos()),c.move("character",a),d=c.boundingLeft,e=c.boundingTop,b=c.boundingHeight,{left:d,top:e,height:b}},b.prototype.getOffset=function(b){var c,d,e;return c=this.$inputor,h.selection?(d=this.getIEOffset(b),d.top+=a(j).scrollTop()+c.scrollTop(),d.left+=a(j).scrollLeft()+c.scrollLeft(),d):(d=c.offset(),e=this.getPosition(b),d={left:d.left+e.left-c.scrollLeft(),top:d.top+e.top-c.scrollTop(),height:e.height})},b.prototype.getPosition=function(a){var b,c,e,f,g,h;return b=this.$inputor,e=function(a){return a.replace(/</g,"<").replace(/>/g,">").replace(/`/g,"`").replace(/"/g,""").replace(/\r\n|\r|\n/g,"<br />")},void 0===a&&(a=this.getPos()),h=b.val().slice(0,a),f="<span>"+e(h)+"</span>",f+="<span id='caret'>|</span>",g=new d(b),c=g.create(f).rect()},b.prototype.getIEPosition=function(a){var b,c,d,e,f;return d=this.getIEOffset(a),c=this.$inputor.offset(),e=d.left-c.left,f=d.top-c.top,b=d.height,{left:e,top:f,height:b}},b}(),d=function(){function b(a){this.$inputor=a}return b.prototype.css_attr=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle","borderTopWidth","boxSizing","fontFamily","fontSize","fontWeight","height","letterSpacing","lineHeight","marginBottom","marginLeft","marginRight","marginTop","outlineWidth","overflow","overflowX","overflowY","paddingBottom","paddingLeft","paddingRight","paddingTop","textAlign","textOverflow","textTransform","whiteSpace","wordBreak","wordWrap"],b.prototype.mirrorCss=function(){var b,c=this;return b={position:"absolute",left:-9999,top:0,zIndex:-2e4},"TEXTAREA"===this.$inputor.prop("tagName")&&this.css_attr.push("width"),a.each(this.css_attr,function(a,d){return b[d]=c.$inputor.css(d)}),b},b.prototype.create=function(b){return this.$mirror=a("<div></div>"),this.$mirror.css(this.mirrorCss()),this.$mirror.html(b),this.$inputor.after(this.$mirror),this},b.prototype.rect=function(){var a,b,c;return a=this.$mirror.find("#caret"),b=a.position(),c={left:b.left,top:b.top,height:a.height()},this.$mirror.remove(),c},b}(),e={contentEditable:function(a){return!(!a[0].contentEditable||"true"!==a[0].contentEditable)}},g={pos:function(a){return a||0===a?this.setPos(a):this.getPos()},position:function(a){return h.selection?this.getIEPosition(a):this.getPosition(a)},offset:function(b){var c,d;return d=this.getOffset(b),i&&(c=a(i).offset(),d.top+=c.top,d.left+=c.left),d}},h=null,j=null,i=null,l=function(a){return i=a,j=a.contentWindow,h=a.contentDocument||j.document},f=function(b,c){var d,e;if(a.isPlainObject(c)&&(e=c.iframe))return b.data("caret-iframe",e),l(e);if(e=b.data("caret-iframe"))return l(e);h=b[0].ownerDocument,j=h.defaultView||h.parentWindow;try{return i=j.frameElement}catch(f){d=f}},a.fn.caret=function(d){var h;return"object"==typeof d?(f(this,d),this):g[d]?(f(this),h=e.contentEditable(this)?new b(this):new c(this),g[d].apply(h,Array.prototype.slice.call(arguments,1))):a.error("Method "+d+" does not exist on jQuery.caret")},a.fn.caret.EditableCaret=b,a.fn.caret.InputCaret=c,a.fn.caret.Utils=e,a.fn.caret.apis=g})}).call(this);
/*!
* jQuery Cookie Plugin v1.4.1
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2006, 2014 Klaus Hartl
* Released under the MIT license
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// CommonJS
factory(require('jquery'));
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
var pluses = /\+/g;
function encode(s) {
return config.raw ? s : encodeURIComponent(s);
}
function decode(s) {
return config.raw ? s : decodeURIComponent(s);
}
function stringifyCookieValue(value) {
return encode(config.json ? JSON.stringify(value) : String(value));
}
function parseCookieValue(s) {
if (s.indexOf('"') === 0) {
// This is a quoted cookie as according to RFC2068, unescape...
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}
try {
// Replace server-side written pluses with spaces.
// If we can't decode the cookie, ignore it, it's unusable.
// If we can't parse the cookie, ignore it, it's unusable.
s = decodeURIComponent(s.replace(pluses, ' '));
return config.json ? JSON.parse(s) : s;
} catch(e) {}
}
function read(s, converter) {
var value = config.raw ? s : parseCookieValue(s);
return $.isFunction(converter) ? converter(value) : value;
}
var config = $.cookie = function (key, value, options) {
// Write
if (arguments.length > 1 && !$.isFunction(value)) {
options = $.extend({}, config.defaults, options);
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setTime(+t + days * 864e+5);
}
return (document.cookie = [
encode(key), '=', stringifyCookieValue(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// Read
var result = key ? undefined : {};
// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when
// calling $.cookie().
var cookies = document.cookie ? document.cookie.split('; ') : [];
for (var i = 0, l = cookies.length; i < l; i++) {
var parts = cookies[i].split('=');
var name = decode(parts.shift());
var cookie = parts.join('=');
if (key && key === name) {
// If second argument (value) is a function it's a converter...
result = read(cookie, value);
break;
}
// Prevent storing a cookie that we couldn't decode.
if (!key && (cookie = read(cookie)) !== undefined) {
result[name] = cookie;
}
}
return result;
};
config.defaults = {};
$.removeCookie = function (key, options) {
if ($.cookie(key) === undefined) {
return false;
}
// Must not alter options, thus extending a fresh object...
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
return !$.cookie(key);
};
}));
// Underscore.js 1.3.3
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore is freely distributable under the MIT license.
// Portions of Underscore are inspired or borrowed from Prototype,
// Oliver Steele's Functional, and John Resig's Micro-Templating.
// For all details and documentation:
// http://documentcloud.github.com/underscore
(function() {
// Baseline setup
// --------------
// Establish the root object, `window` in the browser, or `global` on the server.
var root = this;
// Save the previous value of the `_` variable.
var previousUnderscore = root._;
// Establish the object that gets returned to break out of a loop iteration.
var breaker = {};
// 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 slice = ArrayProto.slice,
unshift = ArrayProto.unshift,
toString = ObjProto.toString,
hasOwnProperty = ObjProto.hasOwnProperty;
// All **ECMAScript 5** native function implementations that we hope to use
// are declared here.
var
nativeForEach = ArrayProto.forEach,
nativeMap = ArrayProto.map,
nativeReduce = ArrayProto.reduce,
nativeReduceRight = ArrayProto.reduceRight,
nativeFilter = ArrayProto.filter,
nativeEvery = ArrayProto.every,
nativeSome = ArrayProto.some,
nativeIndexOf = ArrayProto.indexOf,
nativeLastIndexOf = ArrayProto.lastIndexOf,
nativeIsArray = Array.isArray,
nativeKeys = Object.keys,
nativeBind = FuncProto.bind;
// Create a safe reference to the Underscore object for use below.
var _ = function(obj) { return new wrapper(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 via a string identifier,
// for Closure Compiler "advanced" mode.
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = _;
}
exports._ = _;
} else {
root['_'] = _;
}
// Current version.
_.VERSION = '1.3.3';
// Collection Functions
// --------------------
// The cornerstone, an `each` implementation, aka `forEach`.
// Handles objects with the built-in `forEach`, arrays, and raw objects.
// Delegates to **ECMAScript 5**'s native `forEach` if available.
var each = _.each = _.forEach = function(obj, iterator, context) {
if (obj == null) return;
if (nativeForEach && obj.forEach === nativeForEach) {
obj.forEach(iterator, context);
} else if (obj.length === +obj.length) {
for (var i = 0, l = obj.length; i < l; i++) {
if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return;
}
} else {
for (var key in obj) {
if (_.has(obj, key)) {
if (iterator.call(context, obj[key], key, obj) === breaker) return;
}
}
}
};
// Return the results of applying the iterator to each element.
// Delegates to **ECMAScript 5**'s native `map` if available.
_.map = _.collect = function(obj, iterator, context) {
var results = [];
if (obj == null) return results;
if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
each(obj, function(value, index, list) {
results[results.length] = iterator.call(context, value, index, list);
});
if (obj.length === +obj.length) results.length = obj.length;
return results;
};
// **Reduce** builds up a single result from a list of values, aka `inject`,
// or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
_.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
var initial = arguments.length > 2;
if (obj == null) obj = [];
if (nativeReduce && obj.reduce === nativeReduce) {
if (context) iterator = _.bind(iterator, context);
return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);
}
each(obj, function(value, index, list) {
if (!initial) {
memo = value;
initial = true;
} else {
memo = iterator.call(context, memo, value, index, list);
}
});
if (!initial) throw new TypeError('Reduce of empty array with no initial value');
return memo;
};
// The right-associative version of reduce, also known as `foldr`.
// Delegates to **ECMAScript 5**'s native `reduceRight` if available.
_.reduceRight = _.foldr = function(obj, iterator, memo, context) {
var initial = arguments.length > 2;
if (obj == null) obj = [];
if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
if (context) iterator = _.bind(iterator, context);
return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
}
var reversed = _.toArray(obj).reverse();
if (context && !initial) iterator = _.bind(iterator, context);
return initial ? _.reduce(reversed, iterator, memo, context) : _.reduce(reversed, iterator);
};
// Return the first value which passes a truth test. Aliased as `detect`.
_.find = _.detect = function(obj, iterator, context) {
var result;
any(obj, function(value, index, list) {
if (iterator.call(context, value, index, list)) {
result = value;
return true;
}
});
return result;
};
// Return all the elements that pass a truth test.
// Delegates to **ECMAScript 5**'s native `filter` if available.
// Aliased as `select`.
_.filter = _.select = function(obj, iterator, context) {
var results = [];
if (obj == null) return results;
if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context);
each(obj, function(value, index, list) {
if (iterator.call(context, value, index, list)) results[results.length] = value;
});
return results;
};
// Return all the elements for which a truth test fails.
_.reject = function(obj, iterator, context) {
var results = [];
if (obj == null) return results;
each(obj, function(value, index, list) {
if (!iterator.call(context, value, index, list)) results[results.length] = value;
});
return results;
};
// Determine whether all of the elements match a truth test.
// Delegates to **ECMAScript 5**'s native `every` if available.
// Aliased as `all`.
_.every = _.all = function(obj, iterator, context) {
var result = true;
if (obj == null) return result;
if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context);
each(obj, function(value, index, list) {
if (!(result = result && iterator.call(context, value, index, list))) return breaker;
});
return !!result;
};
// Determine if at least one element in the object matches a truth test.
// Delegates to **ECMAScript 5**'s native `some` if available.
// Aliased as `any`.
var any = _.some = _.any = function(obj, iterator, context) {
iterator || (iterator = _.identity);
var result = false;
if (obj == null) return result;
if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context);
each(obj, function(value, index, list) {
if (result || (result = iterator.call(context, value, index, list))) return breaker;
});
return !!result;
};
// Determine if a given value is included in the array or object using `===`.
// Aliased as `contains`.
_.include = _.contains = function(obj, target) {
var found = false;
if (obj == null) return found;
if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
found = any(obj, function(value) {
return value === target;
});
return found;
};
// Invoke a method (with arguments) on every item in a collection.
_.invoke = function(obj, method) {
var args = slice.call(arguments, 2);
return _.map(obj, function(value) {
return (_.isFunction(method) ? method || value : value[method]).apply(value, args);
});
};
// Convenience version of a common use case of `map`: fetching a property.
_.pluck = function(obj, key) {
return _.map(obj, function(value){ return value[key]; });
};
// Return the maximum element or (element-based computation).
_.max = function(obj, iterator, context) {
if (!iterator && _.isArray(obj) && obj[0] === +obj[0]) return Math.max.apply(Math, obj);
if (!iterator && _.isEmpty(obj)) return -Infinity;
var result = {computed : -Infinity};
each(obj, function(value, index, list) {
var computed = iterator ? iterator.call(context, value, index, list) : value;
computed >= result.computed && (result = {value : value, computed : computed});
});
return result.value;
};
// Return the minimum element (or element-based computation).
_.min = function(obj, iterator, context) {
if (!iterator && _.isArray(obj) && obj[0] === +obj[0]) return Math.min.apply(Math, obj);
if (!iterator && _.isEmpty(obj)) return Infinity;
var result = {computed : Infinity};
each(obj, function(value, index, list) {
var computed = iterator ? iterator.call(context, value, index, list) : value;
computed < result.computed && (result = {value : value, computed : computed});
});
return result.value;
};
// Shuffle an array.
_.shuffle = function(obj) {
var shuffled = [], rand;
each(obj, function(value, index, list) {
rand = Math.floor(Math.random() * (index + 1));
shuffled[index] = shuffled[rand];
shuffled[rand] = value;
});
return shuffled;
};
// Sort the object's values by a criterion produced by an iterator.
_.sortBy = function(obj, val, context) {
var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; };
return _.pluck(_.map(obj, function(value, index, list) {
return {
value : value,
criteria : iterator.call(context, value, index, list)
};
}).sort(function(left, right) {
var a = left.criteria, b = right.criteria;
if (a === void 0) return 1;
if (b === void 0) return -1;
return a < b ? -1 : a > b ? 1 : 0;
}), 'value');
};
// Groups the object's values by a criterion. Pass either a string attribute
// to group by, or a function that returns the criterion.
_.groupBy = function(obj, val) {
var result = {};
var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; };
each(obj, function(value, index) {
var key = iterator(value, index);
(result[key] || (result[key] = [])).push(value);
});
return result;
};
// Use a comparator function to figure out at what index an object should
// be inserted so as to maintain order. Uses binary search.
_.sortedIndex = function(array, obj, iterator) {
iterator || (iterator = _.identity);
var low = 0, high = array.length;
while (low < high) {
var mid = (low + high) >> 1;
iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid;
}
return low;
};
// Safely convert anything iterable into a real, live array.
_.toArray = function(obj) {
if (!obj) return [];
if (_.isArray(obj)) return slice.call(obj);
if (_.isArguments(obj)) return slice.call(obj);
if (obj.toArray && _.isFunction(obj.toArray)) return obj.toArray();
return _.values(obj);
};
// Return the number of elements in an object.
_.size = function(obj) {
return _.isArray(obj) ? obj.length : _.keys(obj).length;
};
// 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) {
return (n != null) && !guard ? slice.call(array, 0, n) : array[0];
};
// Returns everything but the last entry of the array. Especcialy 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, 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 ((n != null) && !guard) {
return slice.call(array, Math.max(array.length - n, 0));
} else {
return array[array.length - 1];
}
};
// Returns everything but the first entry of the array. Aliased as `tail`.
// Especially useful on the arguments object. Passing an **index** will return
// the rest of the values in the array from that index onward. The **guard**
// check allows it to work with `_.map`.
_.rest = _.tail = function(array, index, guard) {
return slice.call(array, (index == null) || guard ? 1 : index);
};
// Trim out all falsy values from an array.
_.compact = function(array) {
return _.filter(array, function(value){ return !!value; });
};
// Return a completely flattened version of an array.
_.flatten = function(array, shallow) {
return _.reduce(array, function(memo, value) {
if (_.isArray(value)) return memo.concat(shallow ? value : _.flatten(value));
memo[memo.length] = value;
return memo;
}, []);
};
// 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, iterator) {
var initial = iterator ? _.map(array, iterator) : array;
var results = [];
// The `isSorted` flag is irrelevant if the array only contains two elements.
if (array.length < 3) isSorted = true;
_.reduce(initial, function (memo, value, index) {
if (isSorted ? _.last(memo) !== value || !memo.length : !_.include(memo, value)) {
memo.push(value);
results.push(array[index]);
}
return memo;
}, []);
return results;
};
// Produce an array that contains the union: each distinct element from all of
// the passed-in arrays.
_.union = function() {
return _.uniq(_.flatten(arguments, true));
};
// Produce an array that contains every item shared between all the
// passed-in arrays. (Aliased as "intersect" for back-compat.)
_.intersection = _.intersect = function(array) {
var rest = slice.call(arguments, 1);
return _.filter(_.uniq(array), function(item) {
return _.every(rest, function(other) {
return _.indexOf(other, item) >= 0;
});
});
};
// 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);
return _.filter(array, function(value){ return !_.include(rest, value); });
};
// Zip together multiple lists into a single array -- elements that share
// an index go together.
_.zip = function() {
var args = slice.call(arguments);
var length = _.max(_.pluck(args, 'length'));
var results = new Array(length);
for (var i = 0; i < length; i++) results[i] = _.pluck(args, "" + i);
return results;
};
// If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),
// we need this function. Return the position of the first occurrence of an
// item in an array, or -1 if the item is not included in the array.
// Delegates to **ECMAScript 5**'s native `indexOf` if available.
// 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, l;
if (isSorted) {
i = _.sortedIndex(array, item);
return array[i] === item ? i : -1;
}
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);
for (i = 0, l = array.length; i < l; i++) if (i in array && array[i] === item) return i;
return -1;
};
// Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
_.lastIndexOf = function(array, item) {
if (array == null) return -1;
if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item);
var i = array.length;
while (i--) if (i in array && array[i] === item) return i;
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 = arguments[2] || 1;
var len = Math.max(Math.ceil((stop - start) / step), 0);
var idx = 0;
var range = new Array(len);
while(idx < len) {
range[idx++] = start;
start += step;
}
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). Binding with arguments is also known as `curry`.
// Delegates to **ECMAScript 5**'s native `Function.bind` if available.
// We check for `func.bind` first, to fail fast when `func` is undefined.
_.bind = function bind(func, context) {
var bound, args;
if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
if (!_.isFunction(func)) throw new TypeError;
args = slice.call(arguments, 2);
return bound = function() {
if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
ctor.prototype = func.prototype;
var self = new ctor;
var result = func.apply(self, args.concat(slice.call(arguments)));
if (Object(result) === result) return result;
return self;
};
};
// Bind all of an object's methods to that object. Useful for ensuring that
// all callbacks defined on an object belong to it.
_.bindAll = function(obj) {
var funcs = slice.call(arguments, 1);
if (funcs.length == 0) funcs = _.functions(obj);
each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
return obj;
};
// Memoize an expensive function by storing its results.
_.memoize = function(func, hasher) {
var memo = {};
hasher || (hasher = _.identity);
return function() {
var key = hasher.apply(this, arguments);
return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
};
};
// 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.
_.throttle = function(func, wait) {
var context, args, timeout, throttling, more, result;
var whenDone = _.debounce(function(){ more = throttling = false; }, wait);
return function() {
context = this; args = arguments;
var later = function() {
timeout = null;
if (more) func.apply(context, args);
whenDone();
};
if (!timeout) timeout = setTimeout(later, wait);
if (throttling) {
more = true;
} else {
result = func.apply(context, args);
}
whenDone();
throttling = true;
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;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
if (immediate && !timeout) func.apply(context, args);
clearTimeout(timeout);
timeout = setTimeout(later, wait);
};
};
// Returns a function that will be executed at most one time, no matter how
// often you call it. Useful for lazy initialization.
_.once = function(func) {
var ran = false, memo;
return function() {
if (ran) return memo;
ran = true;
return memo = func.apply(this, arguments);
};
};
// 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 function() {
var args = [func].concat(slice.call(arguments, 0));
return wrapper.apply(this, args);
};
};
// 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 funcs = arguments;
return function() {
var args = arguments;
for (var i = funcs.length - 1; i >= 0; i--) {
args = [funcs[i].apply(this, args)];
}
return args[0];
};
};
// Returns a function that will only be executed after being called N times.
_.after = function(times, func) {
if (times <= 0) return func();
return function() {
if (--times < 1) { return func.apply(this, arguments); }
};
};
// Object Functions
// ----------------
// Retrieve the names of an object's properties.
// Delegates to **ECMAScript 5**'s native `Object.keys`
_.keys = nativeKeys || function(obj) {
if (obj !== Object(obj)) throw new TypeError('Invalid object');
var keys = [];
for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key;
return keys;
};
// Retrieve the values of an object's properties.
_.values = function(obj) {
return _.map(obj, _.identity);
};
// 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) {
each(slice.call(arguments, 1), function(source) {
for (var prop in source) {
obj[prop] = source[prop];
}
});
return obj;
};
// Return a copy of the object only containing the whitelisted properties.
_.pick = function(obj) {
var result = {};
each(_.flatten(slice.call(arguments, 1)), function(key) {
if (key in obj) result[key] = obj[key];
});
return result;
};
// Fill in a given object with default properties.
_.defaults = function(obj) {
each(slice.call(arguments, 1), function(source) {
for (var prop in source) {
if (obj[prop] == null) 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.
function eq(a, b, stack) {
// 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._chain) a = a._wrapped;
if (b._chain) b = b._wrapped;
// Invoke a custom `isEqual` method if one is provided.
if (a.isEqual && _.isFunction(a.isEqual)) return a.isEqual(b);
if (b.isEqual && _.isFunction(b.isEqual)) return b.isEqual(a);
// Compare `[[Class]]` names.
var className = toString.call(a);
if (className != toString.call(b)) return false;
switch (className) {
// Strings, numbers, dates, and booleans are compared by value.
case '[object String]':
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
// equivalent to `new String("5")`.
return a == String(b);
case '[object Number]':
// `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
// other numeric values.
return a != +a ? b != +b : (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;
// RegExps are compared by their source patterns and flags.
case '[object RegExp]':
return a.source == b.source &&
a.global == b.global &&
a.multiline == b.multiline &&
a.ignoreCase == b.ignoreCase;
}
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 = stack.length;
while (length--) {
// Linear search. Performance is inversely proportional to the number of
// unique nested structures.
if (stack[length] == a) return true;
}
// Add the first object to the stack of traversed objects.
stack.push(a);
var size = 0, result = true;
// 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--) {
// Ensure commutative equality for sparse arrays.
if (!(result = size in a == size in b && eq(a[size], b[size], stack))) break;
}
}
} else {
// Objects with different constructors are not equivalent.
if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) return false;
// Deep compare objects.
for (var key in a) {
if (_.has(a, key)) {
// Count the expected number of properties.
size++;
// Deep compare each member.
if (!(result = _.has(b, key) && eq(a[key], b[key], stack))) break;
}
}
// Ensure that both objects contain the same number of properties.
if (result) {
for (key in b) {
if (_.has(b, key) && !(size--)) break;
}
result = !size;
}
}
// Remove the first object from the stack of traversed objects.
stack.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)) 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) {
return obj === Object(obj);
};
// Is a given variable an arguments object?
_.isArguments = function(obj) {
return toString.call(obj) == '[object Arguments]';
};
if (!_.isArguments(arguments)) {
_.isArguments = function(obj) {
return !!(obj && _.has(obj, 'callee'));
};
}
// Is a given value a function?
_.isFunction = function(obj) {
return toString.call(obj) == '[object Function]';
};
// Is a given value a string?
_.isString = function(obj) {
return toString.call(obj) == '[object String]';
};
// Is a given value a number?
_.isNumber = function(obj) {
return toString.call(obj) == '[object Number]';
};
// Is a given object a finite number?
_.isFinite = function(obj) {
return _.isNumber(obj) && isFinite(obj);
};
// Is the given value `NaN`?
_.isNaN = function(obj) {
// `NaN` is the only value for which `===` is not reflexive.
return 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 a date?
_.isDate = function(obj) {
return toString.call(obj) == '[object Date]';
};
// Is the given value a regular expression?
_.isRegExp = function(obj) {
return toString.call(obj) == '[object RegExp]';
};
// 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;
};
// Has own property?
_.has = function(obj, key) {
return 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 iterators.
_.identity = function(value) {
return value;
};
// Run a function **n** times.
_.times = function (n, iterator, context) {
for (var i = 0; i < n; i++) iterator.call(context, i);
};
// Escape a string for HTML interpolation.
_.escape = function(string) {
return (''+string).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\//g,'/');
};
// If the value of the named property is a function then invoke it;
// otherwise, return it.
_.result = function(object, property) {
if (object == null) return null;
var value = object[property];
return _.isFunction(value) ? value.call(object) : value;
};
// Add your own custom functions to the Underscore object, ensuring that
// they're correctly added to the OOP wrapper as well.
_.mixin = function(obj) {
each(_.functions(obj), function(name){
addToWrapper(name, _[name] = obj[name]);
});
};
// 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',
't': '\t',
'u2028': '\u2028',
'u2029': '\u2029'
};
for (var p in escapes) escapes[escapes[p]] = p;
var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g;
var unescaper = /\\(\\|'|r|n|t|u2028|u2029)/g;
// Within an interpolation, evaluation, or escaping, remove HTML escaping
// that had been previously added.
var unescape = function(code) {
return code.replace(unescaper, function(match, escape) {
return escapes[escape];
});
};
// JavaScript micro-templating, similar to John Resig's implementation.
// Underscore templating handles arbitrary delimiters, preserves whitespace,
// and correctly escapes quotes within interpolated code.
_.template = function(text, data, settings) {
settings = _.defaults(settings || {}, _.templateSettings);
// Compile the template source, taking care to escape characters that
// cannot be included in a string literal and then unescape them in code
// blocks.
var source = "__p+='" + text
.replace(escaper, function(match) {
return '\\' + escapes[match];
})
.replace(settings.escape || noMatch, function(match, code) {
return "'+\n_.escape(" + unescape(code) + ")+\n'";
})
.replace(settings.interpolate || noMatch, function(match, code) {
return "'+\n(" + unescape(code) + ")+\n'";
})
.replace(settings.evaluate || noMatch, function(match, code) {
return "';\n" + unescape(code) + "\n;__p+='";
}) + "';\n";
// If a variable is not specified, place data values in local scope.
if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
source = "var __p='';" +
"var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n" +
source + "return __p;\n";
var render = new Function(settings.variable || 'obj', '_', source);
if (data) return render(data, _);
var template = function(data) {
return render.call(this, data, _);
};
// Provide the compiled function source as a convenience for build time
// precompilation.
template.source = 'function(' + (settings.variable || 'obj') + '){\n' +
source + '}';
return template;
};
// Add a "chain" function, which will delegate to the wrapper.
_.chain = function(obj) {
return _(obj).chain();
};
// The OOP Wrapper
// ---------------
// 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.
var wrapper = function(obj) { this._wrapped = obj; };
// Expose `wrapper.prototype` as `_.prototype`
_.prototype = wrapper.prototype;
// Helper function to continue chaining intermediate results.
var result = function(obj, chain) {
return chain ? _(obj).chain() : obj;
};
// A method to easily add functions to the OOP wrapper.
var addToWrapper = function(name, func) {
wrapper.prototype[name] = function() {
var args = slice.call(arguments);
unshift.call(args, this._wrapped);
return result(func.apply(_, args), this._chain);
};
};
// 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];
wrapper.prototype[name] = function() {
var wrapped = this._wrapped;
method.apply(wrapped, arguments);
var length = wrapped.length;
if ((name == 'shift' || name == 'splice') && length === 0) delete wrapped[0];
return result(wrapped, this._chain);
};
});
// Add all accessor Array functions to the wrapper.
each(['concat', 'join', 'slice'], function(name) {
var method = ArrayProto[name];
wrapper.prototype[name] = function() {
return result(method.apply(this._wrapped, arguments), this._chain);
};
});
// Start chaining a wrapped Underscore object.
wrapper.prototype.chain = function() {
this._chain = true;
return this;
};
// Extracts the result from a wrapped and chained object.
wrapper.prototype.value = function() {
return this._wrapped;
};
}).call(this);
/**
* @license AngularJS v1.0.7
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, document, undefined) {
'use strict';
////////////////////////////////////
/**
* @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 String.fromCharCode(ch.charCodeAt(0) | 32);})
: s;
};
var manualUppercase = function(s) {
return isString(s)
? s.replace(/[a-z]/g, function(ch) {return String.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;
}
var /** 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'];
/**
* @private
* @param {*} obj
* @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments, ...)
*/
function isArrayLike(obj) {
if (!obj || (typeof obj.length !== 'number')) return false;
// We have on object which has length property. Should we treat it as array?
if (typeof obj.hasOwnProperty != 'function' &&
typeof obj.constructor != 'function') {
// This is here for IE8: it is a bogus object treat it as array;
return true;
} else {
return obj instanceof JQLite || // JQLite
(jQuery && obj instanceof jQuery) || // jQuery
toString.call(obj) !== '[object Object]' || // some browser native object
typeof obj.callee === 'function'; // arguments (on IE8 looks like regular obj)
}
}
/**
* @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 (isArrayLike(obj)) {
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 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('');
}
/**
* Set or clear the hashkey for an object.
* @param obj object
* @param h the hashkey (!truthy to delete the hashkey)
*/
function setHashKey(obj, h) {
if (h) {
obj.$$hashKey = h;
}
else {
delete obj.$$hashKey;
}
}
/**
* @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).
* @returns {Object} Reference to `dst`.
*/
function extend(dst) {
var h = dst.$$hashKey;
forEach(arguments, function(obj){
if (obj !== dst) {
forEach(obj, function(value, key){
dst[key] = value;
});
}
});
setHashKey(dst,h);
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)) {
destination.length = 0;
for ( var i = 0; i < source.length; i++) {
destination.push(copy(source[i]));
}
} else {
var h = destination.$$hashKey;
forEach(destination, function(value, key){
delete destination[key];
});
for ( var key in source) {
destination[key] = copy(source[key]);
}
setHashKey(destination,h);
}
}
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 by 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 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) {}
// As Per DOM Standards
var TEXT_NODE = 3;
var elemHtml = jqLite('<div>').append(element).html();
try {
return element[0].nodeType === TEXT_NODE ? lowercase(elemHtml) :
elemHtml.
match(/^(<[^>]+>)/)[1].
replace(/^<([\w\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); });
} catch(e) {
return lowercase(elemHtml);
}
}
/////////////////////////////////////////////////
/**
* 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(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
}
/**
* @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 an application. Only
* one directive can be used per HTML document. The directive
* designates the root of the application and is typically placed
* at 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) {
var resumeBootstrapInternal = function() {
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 NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;
if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {
return resumeBootstrapInternal();
}
window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');
angular.resumeBootstrap = function(extraModules) {
forEach(extraModules, function(module) {
modules.push(module);
});
resumeBootstrapInternal();
};
}
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 if 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.7', // all of these placeholder strings will be replaced by grunt's
major: 1, // package task
minor: 0,
dot: 7,
codeName: 'monochromatic-rainbow'
};
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/) - Does not support namespaces
* - [children()](http://api.jquery.com/children/) - Does not support selectors
* - [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/) - Does not support selectors
* - [parent()](http://api.jquery.com/parent/) - Does not support selectors
* - [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/) - Does not support namespaces
* - [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 contains = document.body.contains || document.body.compareDocumentPosition ?
function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && (
adown.contains ?
adown.contains( bup ) :
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
));
} :
function( a, b ) {
if ( b ) {
while ( (b = b.parentNode) ) {
if ( b === a ) {
return true;
}
}
}
return false;
};
events[type] = [];
// Refer to jQuery's implementation of mouseenter & mouseleave
// Read about mouseenter and mouseleave:
// http://www.quirksmode.org/js/events_mouse.html#link8
var eventmap = { mouseleave : "mouseout", mouseenter : "mouseover"}
bindFn(element, eventmap[type], function(event) {
var ret, target = this, related = event.relatedTarget;
// 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 && !contains(target, related)) ){
handle(event, type);
}
});
} 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 are all valid ways of annotating function with injection arguments and are equivalent.
*
* <pre>
* // inferred (only works if code not minified/obfuscated)
* $injector.invoke(function(serviceA){});
*
* // annotated
* function explicit(serviceA) {};
* explicit.$inject = ['serviceA'];
* $injector.invoke(explicit);
*
* // inline
* $injector.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 `$inject` 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(tmpFn);
*
* // 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 `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
* instantiated. 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;
// Check if Type is annotated and use just the given function at n-1 as parameter
// e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);
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?\:\/\/[^\/]*/, '') : '';
};
//////////////////////////////////////////////////////////////
// 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
var name = unescape(cookie.substring(0, index));
// the first value that is seen for a cookie is the most
// specific one. values for the same cookie name that
// follow are for less specific paths.
if (lastCookies[name] === undefined) {
lastCookies[name] = 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: ',
urlSanitizationWhitelist = /^\s*(https?|ftp|mailto|file):/;
/**
* @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;
};
/**
* @ngdoc function
* @name ng.$compileProvider#urlSanitizationWhitelist
* @methodOf ng.$compileProvider
* @function
*
* @description
* Retrieves or overrides the default regular expression that is used for whitelisting of safe
* urls during a[href] sanitization.
*
* The sanitization is a security measure aimed at prevent XSS attacks via html links.
*
* Any url about to be assigned to a[href] via data-binding is first normalized and turned into an
* absolute url. Afterwards the url is matched against the `urlSanitizationWhitelist` regular
* expression. If a match is found the original url is written into the dom. Otherwise the
* absolute url is prefixed with `'unsafe:'` string and only then it is written into the DOM.
*
* @param {RegExp=} regexp New regexp to whitelist urls with.
* @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
* chaining otherwise.
*/
this.urlSanitizationWhitelist = function(regexp) {
if (isDefined(regexp)) {
urlSanitizationWhitelist = regexp;
return this;
}
return urlSanitizationWhitelist;
};
this.$get = [
'$injector', '$interpolate', '$exceptionHandler', '$http', '$templateCache', '$parse',
'$controller', '$rootScope', '$document',
function($injector, $interpolate, $exceptionHandler, $http, $templateCache, $parse,
$controller, $rootScope, $document) {
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,
normalizedVal;
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, '-');
}
}
// sanitize a[href] values
if (nodeName_(this.$$element[0]) === 'A' && key === 'href') {
urlSanitizationNode.setAttribute('href', value);
// href property always returns normalized absolute url, so we can match against that
normalizedVal = urlSanitizationNode.href;
if (!normalizedVal.match(urlSanitizationWhitelist)) {
this[key] = value = 'unsafe:' + normalizedVal;
}
}
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 urlSanitizationNode = $document[0].createElement('a'),
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, whereas 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;
// Attach scope only to non-text nodes.
for(var i = 0, ii = $linkNode.length; i<ii; i++) {
var node = $linkNode[i];
if (node.nodeType == 1 /* element */ || node.nodeType == 9 /* document */) {
$linkNode.eq(i).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 or NodeList 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 || !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();
transcludeScope.$$transcluded = true;
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 are 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 {JQLite} jqCollection If we are working on the root of the compile tree then this
* argument has the root jqLite array so that we can replace nodes on it.
* @returns linkFn
*/
function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn, jqCollection) {
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(jqCollection, 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(jqCollection, $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, jqCollection, 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;
scope.$$isolateBindings[scopeName] = mode + attrName;
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[0].childNodes, 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 a 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 && !isUndefined(match.hash) &&
match.hash.indexOf(hashPrefix) === 0) {
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) {
if ($rootScope.$broadcast('$locationChangeStart', newUrl, $location.absUrl()).defaultPrevented) {
$browser.url($location.absUrl());
return;
}
$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, ch;
while (index < text.length) {
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) {
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(scope, locals){
return left.assign(scope, right(scope, 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(scope, locals, self) {
return getter(self || object(scope, locals), locals);
},
{
assign:function(scope, value, locals) {
return setter(object(scope, 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(scope, locals){
var args = [],
context = contextGetter ? contextGetter(scope, locals) : scope;
for ( var i = 0; i < argsFn.length; i++) {
args.push(argsFn[i](scope, locals));
}
var fnPtr = fn(scope, locals, context) || 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];
object[keyValue.key] = keyValue.value(self, locals);
}
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` – `{object}` – an object against which any expressions embedded in the strings
* are evaluated against (tipically a scope object).
* * `locals` – `{object=}` – 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 its 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 than $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
* deferred.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 an 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 promise of the passed value or promise
*/
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 corresponding 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 {Object} angularEvent Synthetic event object.
* @param {Route} current Current route information.
* @param {Route|Undefined} previous Previous route information, or undefined if current is first route entered.
*/
/**
* @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 are 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 in terms of speed as well as memory:
* - No closures, instead use 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 beginning (shift) instead of at the end (push)
*
* Child scopes are created and removed often
* - Using an array would be slow since inserts in middle 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 iterations 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 = {};
this.$$isolateBindings = {};
}
/**
* @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
* Processes 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.
*
* 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.
*
* @param {string} name Event name to listen on.
* @param {function(event, args...)} listener Function to call when the event is emitted.
* @returns {function()} Returns a deregistration function for this listener.
*/
$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 emitted 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 broadcast.
* @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 unique 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>
<script>
function Ctrl($scope, $window) {
$scope.$window = $window;
$scope.greeting = 'Hello, World!';
}
</script>
<div ng-controller="Ctrl">
<input type="text" ng-model="greeting" />
<button ng-click="$window.alert(greeting)">ALERT</button>
</div>
</doc:source>
<doc:scenario>
it('should display the greeting in the input box', function() {
input('greeting').enter('Hello, E2E Tests');
// If we click the button it will block the test runner
// element(':button').click();
});
</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 the 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 patterns this doesn't matter much, for advanced usage
* it is important to familiarize yourself with these APIs and the 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`, 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 between 200 and 299 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 invocations of the $http service require passing in an HTTP method and URL, and
* POST/PUT requests require request data to be provided as well, shortcut methods
* were created:
*
* <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 POST requests)
* - `Content-Type: application/json`
* - `$httpProvider.defaults.headers.put` (header defaults for PUT requests)
* - `Content-Type: application/json`
*
* To add or overwrite these defaults, simply add or remove a property from these configuration
* objects. To add headers for an HTTP method other than POST or PUT, simply add a new object
* with the lowercased HTTP method name as the key, e.g.
* `$httpProvider.defaults.headers.get['My-Header']='value'`.
*
* Additionally, the defaults can be set at runtime via the `$http.defaults` object in the same
* fashion.
*
*
* # 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 configuration 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 globally augment or override the default transforms, modify the `$httpProvider.defaults.transformRequest` and
* `$httpProvider.defaults.transformResponse` properties. These properties are by default an
* array of transform functions, which allows you to `push` or `unshift` a new transformation function into the
* transformation chain. You can also decide to completely override any default transformations by assigning your
* transformation functions to these properties directly without the array wrapper.
*
* Similarly, to locally override the request/response transforms, augment the `transformRequest` and/or
* `transformResponse` properties of the configuration object passed into `$http`.
*
*
* # 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 from 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 website to turn your JSON resource URL into
* {@link http://en.wikipedia.org/wiki/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 a 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 the first HTTP GET request. On subsequent XHR 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 sent the request. The token must be
* unique for each user and must be verifiable by the server (to prevent the JavaScript from making
* up its own tokens). We recommend that the token is a digest of your site's authentication
* cookie with a {@link https://en.wikipedia.org/wiki/Salt_(cryptography) 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) {
var responseHeaders = xhr.getAllResponseHeaders();
// TODO(vojta): remove once Firefox 21 gets released.
// begin: workaround to overcome Firefox CORS http response headers bug
// https://bugzilla.mozilla.org/show_bug.cgi?id=608735
// Firefox already patched in nightly. Should land in Firefox 21.
// CORS "simple response headers" http://www.w3.org/TR/cors/
var value,
simpleHeaders = ["Cache-Control", "Content-Language", "Content-Type",
"Expires", "Last-Modified", "Pragma"];
if (!responseHeaders) {
responseHeaders = "";
forEach(simpleHeaders, function (header) {
var value = xhr.getResponseHeader(header);
if (value) {
responseHeaders += header + ": " + value + "\n";
}
});
}
// end of the workaround.
completeRequest(callback, status || xhr.status, xhr.responseText,
responseHeaders);
}
};
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 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, whose 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 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[:parameter_value] ... ] }}
*
* @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 (!isArray(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 && fractionSize !== "0") 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) {
offset = offset || 0;
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 zone = -1 * date.getTimezoneOffset();
var paddedZone = (zone >= 0) ? "+" : "";
paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +
padNumber(Math.abs(zone % 60), 2);
return paddedZone;
}
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 its
* shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is
* specified in the string input, the time is considered to be in the local timezone.
* @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 (!isArray(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) {
if (msie <= 8) {
// turn <a href ng-click="..">link</a> into a stylable link in IE
// but only if it doesn't have name attribute, in which case it's an anchor
if (!attr.href && !attr.name) {
attr.$set('href', '');
}
// add a comment node to anchors to workaround IE bug that causes element content to be reset
// to new attribute content if attribute is updated with value containing @ and element also
// contains value with @
// see issue #1949
element.append(document.createComment('IE fix'));
}
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(undefined);
});
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.
// we use attr[attrName] value since $set can sanitize the url.
if (msie) element.prop(attrName, attr[attrName]);
});
}
};
};
});
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 than `min`.
* @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
* @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 = 'me@example.com';
}
</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('me@example.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 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;
var deferListener = function() {
if (!timeout) {
timeout = $browser.defer(function() {
listener();
timeout = null;
});
}
};
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;
deferListener();
});
// if user paste into input using mouse, we need "change" event to catch it
element.bind('change', listener);
// if user modifies input value using context menu in IE, we need "paste" and "cut" events to catch it
if ($sniffer.hasEvent('paste')) {
element.bind('paste cut', deferListener);
}
}
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.lastName.$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 `parsers` 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.
*
* One scenario in which the use of `ngBind` is preferred 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) {
var oldVal = undefined;
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 & 1;
if (mod !== old$index & 1) {
if (mod === selector) {
addClass(scope.$eval(attr[name]));
} else {
removeClass(scope.$eval(attr[name]));
}
}
});
}
function ngClassWatchAction(newVal) {
if (selector === true || scope.$index % 2 === selector) {
if (oldVal && !equals(newVal,oldVal)) {
removeClass(oldVal);
}
addClass(newVal);
}
oldVal = copy(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
* 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` 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} 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], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-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 $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:'john.smith@example.org'} ];
$scope.greet = function() {
alert(this.name);
};
$scope.addContact = function() {
this.contacts.push({type:'email', value:'yourname@example.org'});
};
$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('john.smith@example.org');
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('yourname@example.org');
});
</doc:scenario>
</doc:example>
*/
var ngControllerDirective = [function() {
return {
scope: true,
controller: '@'
};
}];
/**
* @ngdoc directive
* @name ng.directive:ngCsp
* @priority 1000
*
* @element html
* @description
* Enables [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) support.
*
* This is necessary when developing things like Google Chrome Extensions.
*
* CSP forbids apps to use `eval` or `Function(string)` generated functions (among other things).
* For us to be compatible, we just need to implement the "getterFn" in $parse without violating
* any of these restrictions.
*
* AngularJS uses `Function(string)` generated functions as a speed optimization. By applying `ngCsp`
* it is be possible to opt into the CSP compatible mode. When this mode is on AngularJS will
* evaluate all expressions up to 30% slower than in non-CSP mode, but no security violations will
* be raised.
*
* In order to use this feature put `ngCsp` directive on the root element of the application.
*
* @example
* This example shows how to apply the `ngCsp` directive to the `html` tag.
<pre>
<!doctype html>
<html ng-app ng-csp>
...
...
</html>
</pre>
*/
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 (!(value in whens)) 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(),
arrayBound,
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 || [];
}
arrayBound = array.length-1;
// 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 === arrayBound);
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.
*
* @usage
* <ANY ng-switch="expression">
* <ANY ng-switch-when="matchValue1">...</ANY>
* <ANY ng-switch-when="matchValue2">...</ANY>
* ...
* <ANY ng-switch-default>...</ANY>
* </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',
// asks for $scope to fool the BC controller module
controller: ['$scope', 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.children().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} 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 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) {
//0000111110000000000022220000000000000000000000333300000000000000444444444444444440000000005555555555555555500000006666666666666666600000000000000077770
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);
}
// 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) {
if (nullOption || modelValue === null) {
// insert null option if we have a placeholder, or the model is null
optionGroups[''].unshift({id:'', label:'', selected:!selectedSet});
} else if (!selectedSet) {
// option could not be found, 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);
}
// lastElement.prop('selected') provided by jQuery has side-effects
if (lastElement[0].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
});
//try to bind to jquery now so that one can write angular.element().read()
//but we will rebind on bootstrap again.
bindJQuery();
publishExternalAPI(angular);
jqLite(document).ready(function() {
angularInit(document, bootstrap);
});
})(window, document);
angular.element(document).find('head').append('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak{display:none;}ng\\:form{display:block;}</style>');
var Chart=function(s){function v(a,c,b){a=A((a-c.graphMin)/(c.steps*c.stepValue),1,0);return b*c.steps*a}function x(a,c,b,e){function h(){g+=f;var k=a.animation?A(d(g),null,0):1;e.clearRect(0,0,q,u);a.scaleOverlay?(b(k),c()):(c(),b(k));if(1>=g)D(h);else if("function"==typeof a.onAnimationComplete)a.onAnimationComplete()}var f=a.animation?1/A(a.animationSteps,Number.MAX_VALUE,1):1,d=B[a.animationEasing],g=a.animation?0:1;"function"!==typeof c&&(c=function(){});D(h)}function C(a,c,b,e,h,f){var d;a=
Math.floor(Math.log(e-h)/Math.LN10);h=Math.floor(h/(1*Math.pow(10,a)))*Math.pow(10,a);e=Math.ceil(e/(1*Math.pow(10,a)))*Math.pow(10,a)-h;a=Math.pow(10,a);for(d=Math.round(e/a);d<b||d>c;)a=d<b?a/2:2*a,d=Math.round(e/a);c=[];z(f,c,d,h,a);return{steps:d,stepValue:a,graphMin:h,labels:c}}function z(a,c,b,e,h){if(a)for(var f=1;f<b+1;f++)c.push(E(a,{value:(e+h*f).toFixed(0!=h%1?h.toString().split(".")[1].length:0)}))}function A(a,c,b){return!isNaN(parseFloat(c))&&isFinite(c)&&a>c?c:!isNaN(parseFloat(b))&&
isFinite(b)&&a<b?b:a}function y(a,c){var b={},e;for(e in a)b[e]=a[e];for(e in c)b[e]=c[e];return b}function E(a,c){var b=!/\W/.test(a)?F[a]=F[a]||E(document.getElementById(a).innerHTML):new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+a.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');");return c?
b(c):b}var r=this,B={linear:function(a){return a},easeInQuad:function(a){return a*a},easeOutQuad:function(a){return-1*a*(a-2)},easeInOutQuad:function(a){return 1>(a/=0.5)?0.5*a*a:-0.5*(--a*(a-2)-1)},easeInCubic:function(a){return a*a*a},easeOutCubic:function(a){return 1*((a=a/1-1)*a*a+1)},easeInOutCubic:function(a){return 1>(a/=0.5)?0.5*a*a*a:0.5*((a-=2)*a*a+2)},easeInQuart:function(a){return a*a*a*a},easeOutQuart:function(a){return-1*((a=a/1-1)*a*a*a-1)},easeInOutQuart:function(a){return 1>(a/=0.5)?
0.5*a*a*a*a:-0.5*((a-=2)*a*a*a-2)},easeInQuint:function(a){return 1*(a/=1)*a*a*a*a},easeOutQuint:function(a){return 1*((a=a/1-1)*a*a*a*a+1)},easeInOutQuint:function(a){return 1>(a/=0.5)?0.5*a*a*a*a*a:0.5*((a-=2)*a*a*a*a+2)},easeInSine:function(a){return-1*Math.cos(a/1*(Math.PI/2))+1},easeOutSine:function(a){return 1*Math.sin(a/1*(Math.PI/2))},easeInOutSine:function(a){return-0.5*(Math.cos(Math.PI*a/1)-1)},easeInExpo:function(a){return 0==a?1:1*Math.pow(2,10*(a/1-1))},easeOutExpo:function(a){return 1==
a?1:1*(-Math.pow(2,-10*a/1)+1)},easeInOutExpo:function(a){return 0==a?0:1==a?1:1>(a/=0.5)?0.5*Math.pow(2,10*(a-1)):0.5*(-Math.pow(2,-10*--a)+2)},easeInCirc:function(a){return 1<=a?a:-1*(Math.sqrt(1-(a/=1)*a)-1)},easeOutCirc:function(a){return 1*Math.sqrt(1-(a=a/1-1)*a)},easeInOutCirc:function(a){return 1>(a/=0.5)?-0.5*(Math.sqrt(1-a*a)-1):0.5*(Math.sqrt(1-(a-=2)*a)+1)},easeInElastic:function(a){var c=1.70158,b=0,e=1;if(0==a)return 0;if(1==(a/=1))return 1;b||(b=0.3);e<Math.abs(1)?(e=1,c=b/4):c=b/(2*
Math.PI)*Math.asin(1/e);return-(e*Math.pow(2,10*(a-=1))*Math.sin((1*a-c)*2*Math.PI/b))},easeOutElastic:function(a){var c=1.70158,b=0,e=1;if(0==a)return 0;if(1==(a/=1))return 1;b||(b=0.3);e<Math.abs(1)?(e=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/e);return e*Math.pow(2,-10*a)*Math.sin((1*a-c)*2*Math.PI/b)+1},easeInOutElastic:function(a){var c=1.70158,b=0,e=1;if(0==a)return 0;if(2==(a/=0.5))return 1;b||(b=1*0.3*1.5);e<Math.abs(1)?(e=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/e);return 1>a?-0.5*e*Math.pow(2,10*
(a-=1))*Math.sin((1*a-c)*2*Math.PI/b):0.5*e*Math.pow(2,-10*(a-=1))*Math.sin((1*a-c)*2*Math.PI/b)+1},easeInBack:function(a){return 1*(a/=1)*a*(2.70158*a-1.70158)},easeOutBack:function(a){return 1*((a=a/1-1)*a*(2.70158*a+1.70158)+1)},easeInOutBack:function(a){var c=1.70158;return 1>(a/=0.5)?0.5*a*a*(((c*=1.525)+1)*a-c):0.5*((a-=2)*a*(((c*=1.525)+1)*a+c)+2)},easeInBounce:function(a){return 1-B.easeOutBounce(1-a)},easeOutBounce:function(a){return(a/=1)<1/2.75?1*7.5625*a*a:a<2/2.75?1*(7.5625*(a-=1.5/2.75)*
a+0.75):a<2.5/2.75?1*(7.5625*(a-=2.25/2.75)*a+0.9375):1*(7.5625*(a-=2.625/2.75)*a+0.984375)},easeInOutBounce:function(a){return 0.5>a?0.5*B.easeInBounce(2*a):0.5*B.easeOutBounce(2*a-1)+0.5}},q=s.canvas.width,u=s.canvas.height;window.devicePixelRatio&&(s.canvas.style.width=q+"px",s.canvas.style.height=u+"px",s.canvas.height=u*window.devicePixelRatio,s.canvas.width=q*window.devicePixelRatio,s.scale(window.devicePixelRatio,window.devicePixelRatio));this.PolarArea=function(a,c){r.PolarArea.defaults={scaleOverlay:!0,
scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleShowLine:!0,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleFontFamily:"'Arial'",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",scaleShowLabelBackdrop:!0,scaleBackdropColor:"rgba(255,255,255,0.75)",scaleBackdropPaddingY:2,scaleBackdropPaddingX:2,segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,animation:!0,animationSteps:100,animationEasing:"easeOutBounce",
animateRotate:!0,animateScale:!1,onAnimationComplete:null};var b=c?y(r.PolarArea.defaults,c):r.PolarArea.defaults;return new G(a,b,s)};this.Radar=function(a,c){r.Radar.defaults={scaleOverlay:!1,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleShowLine:!0,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!1,scaleLabel:"<%=value%>",scaleFontFamily:"'Arial'",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",scaleShowLabelBackdrop:!0,scaleBackdropColor:"rgba(255,255,255,0.75)",
scaleBackdropPaddingY:2,scaleBackdropPaddingX:2,angleShowLineOut:!0,angleLineColor:"rgba(0,0,0,.1)",angleLineWidth:1,pointLabelFontFamily:"'Arial'",pointLabelFontStyle:"normal",pointLabelFontSize:12,pointLabelFontColor:"#666",pointDot:!0,pointDotRadius:3,pointDotStrokeWidth:1,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,animation:!0,animationSteps:60,animationEasing:"easeOutQuart",onAnimationComplete:null};var b=c?y(r.Radar.defaults,c):r.Radar.defaults;return new H(a,b,s)};this.Pie=function(a,
c){r.Pie.defaults={segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,animation:!0,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,onAnimationComplete:null};var b=c?y(r.Pie.defaults,c):r.Pie.defaults;return new I(a,b,s)};this.Doughnut=function(a,c){r.Doughnut.defaults={segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,percentageInnerCutout:50,animation:!0,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,
onAnimationComplete:null};var b=c?y(r.Doughnut.defaults,c):r.Doughnut.defaults;return new J(a,b,s)};this.Line=function(a,c){r.Line.defaults={scaleOverlay:!1,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleFontFamily:"'Arial'",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,bezierCurve:!0,
pointDot:!0,pointDotRadius:4,pointDotStrokeWidth:2,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,animation:!0,animationSteps:60,animationEasing:"easeOutQuart",onAnimationComplete:null};var b=c?y(r.Line.defaults,c):r.Line.defaults;return new K(a,b,s)};this.Bar=function(a,c){r.Bar.defaults={scaleOverlay:!1,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleFontFamily:"'Arial'",
scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,barShowStroke:!0,barStrokeWidth:2,barValueSpacing:5,barDatasetSpacing:1,animation:!0,animationSteps:60,animationEasing:"easeOutQuart",onAnimationComplete:null};var b=c?y(r.Bar.defaults,c):r.Bar.defaults;return new L(a,b,s)};var G=function(a,c,b){var e,h,f,d,g,k,j,l,m;g=Math.min.apply(Math,[q,u])/2;g-=Math.max.apply(Math,[0.5*c.scaleFontSize,0.5*c.scaleLineWidth]);
d=2*c.scaleFontSize;c.scaleShowLabelBackdrop&&(d+=2*c.scaleBackdropPaddingY,g-=1.5*c.scaleBackdropPaddingY);l=g;d=d?d:5;e=Number.MIN_VALUE;h=Number.MAX_VALUE;for(f=0;f<a.length;f++)a[f].value>e&&(e=a[f].value),a[f].value<h&&(h=a[f].value);f=Math.floor(l/(0.66*d));d=Math.floor(0.5*(l/d));m=c.scaleShowLabels?c.scaleLabel:null;c.scaleOverride?(j={steps:c.scaleSteps,stepValue:c.scaleStepWidth,graphMin:c.scaleStartValue,labels:[]},z(m,j.labels,j.steps,c.scaleStartValue,c.scaleStepWidth)):j=C(l,f,d,e,h,
m);k=g/j.steps;x(c,function(){for(var a=0;a<j.steps;a++)if(c.scaleShowLine&&(b.beginPath(),b.arc(q/2,u/2,k*(a+1),0,2*Math.PI,!0),b.strokeStyle=c.scaleLineColor,b.lineWidth=c.scaleLineWidth,b.stroke()),c.scaleShowLabels){b.textAlign="center";b.font=c.scaleFontStyle+" "+c.scaleFontSize+"px "+c.scaleFontFamily;var e=j.labels[a];if(c.scaleShowLabelBackdrop){var d=b.measureText(e).width;b.fillStyle=c.scaleBackdropColor;b.beginPath();b.rect(Math.round(q/2-d/2-c.scaleBackdropPaddingX),Math.round(u/2-k*(a+
1)-0.5*c.scaleFontSize-c.scaleBackdropPaddingY),Math.round(d+2*c.scaleBackdropPaddingX),Math.round(c.scaleFontSize+2*c.scaleBackdropPaddingY));b.fill()}b.textBaseline="middle";b.fillStyle=c.scaleFontColor;b.fillText(e,q/2,u/2-k*(a+1))}},function(e){var d=-Math.PI/2,g=2*Math.PI/a.length,f=1,h=1;c.animation&&(c.animateScale&&(f=e),c.animateRotate&&(h=e));for(e=0;e<a.length;e++)b.beginPath(),b.arc(q/2,u/2,f*v(a[e].value,j,k),d,d+h*g,!1),b.lineTo(q/2,u/2),b.closePath(),b.fillStyle=a[e].color,b.fill(),
c.segmentShowStroke&&(b.strokeStyle=c.segmentStrokeColor,b.lineWidth=c.segmentStrokeWidth,b.stroke()),d+=h*g},b)},H=function(a,c,b){var e,h,f,d,g,k,j,l,m;a.labels||(a.labels=[]);g=Math.min.apply(Math,[q,u])/2;d=2*c.scaleFontSize;for(e=l=0;e<a.labels.length;e++)b.font=c.pointLabelFontStyle+" "+c.pointLabelFontSize+"px "+c.pointLabelFontFamily,h=b.measureText(a.labels[e]).width,h>l&&(l=h);g-=Math.max.apply(Math,[l,1.5*(c.pointLabelFontSize/2)]);g-=c.pointLabelFontSize;l=g=A(g,null,0);d=d?d:5;e=Number.MIN_VALUE;
h=Number.MAX_VALUE;for(f=0;f<a.datasets.length;f++)for(m=0;m<a.datasets[f].data.length;m++)a.datasets[f].data[m]>e&&(e=a.datasets[f].data[m]),a.datasets[f].data[m]<h&&(h=a.datasets[f].data[m]);f=Math.floor(l/(0.66*d));d=Math.floor(0.5*(l/d));m=c.scaleShowLabels?c.scaleLabel:null;c.scaleOverride?(j={steps:c.scaleSteps,stepValue:c.scaleStepWidth,graphMin:c.scaleStartValue,labels:[]},z(m,j.labels,j.steps,c.scaleStartValue,c.scaleStepWidth)):j=C(l,f,d,e,h,m);k=g/j.steps;x(c,function(){var e=2*Math.PI/
a.datasets[0].data.length;b.save();b.translate(q/2,u/2);if(c.angleShowLineOut){b.strokeStyle=c.angleLineColor;b.lineWidth=c.angleLineWidth;for(var d=0;d<a.datasets[0].data.length;d++)b.rotate(e),b.beginPath(),b.moveTo(0,0),b.lineTo(0,-g),b.stroke()}for(d=0;d<j.steps;d++){b.beginPath();if(c.scaleShowLine){b.strokeStyle=c.scaleLineColor;b.lineWidth=c.scaleLineWidth;b.moveTo(0,-k*(d+1));for(var f=0;f<a.datasets[0].data.length;f++)b.rotate(e),b.lineTo(0,-k*(d+1));b.closePath();b.stroke()}c.scaleShowLabels&&
(b.textAlign="center",b.font=c.scaleFontStyle+" "+c.scaleFontSize+"px "+c.scaleFontFamily,b.textBaseline="middle",c.scaleShowLabelBackdrop&&(f=b.measureText(j.labels[d]).width,b.fillStyle=c.scaleBackdropColor,b.beginPath(),b.rect(Math.round(-f/2-c.scaleBackdropPaddingX),Math.round(-k*(d+1)-0.5*c.scaleFontSize-c.scaleBackdropPaddingY),Math.round(f+2*c.scaleBackdropPaddingX),Math.round(c.scaleFontSize+2*c.scaleBackdropPaddingY)),b.fill()),b.fillStyle=c.scaleFontColor,b.fillText(j.labels[d],0,-k*(d+
1)))}for(d=0;d<a.labels.length;d++){b.font=c.pointLabelFontStyle+" "+c.pointLabelFontSize+"px "+c.pointLabelFontFamily;b.fillStyle=c.pointLabelFontColor;var f=Math.sin(e*d)*(g+c.pointLabelFontSize),h=Math.cos(e*d)*(g+c.pointLabelFontSize);b.textAlign=e*d==Math.PI||0==e*d?"center":e*d>Math.PI?"right":"left";b.textBaseline="middle";b.fillText(a.labels[d],f,-h)}b.restore()},function(d){var e=2*Math.PI/a.datasets[0].data.length;b.save();b.translate(q/2,u/2);for(var g=0;g<a.datasets.length;g++){b.beginPath();
b.moveTo(0,d*-1*v(a.datasets[g].data[0],j,k));for(var f=1;f<a.datasets[g].data.length;f++)b.rotate(e),b.lineTo(0,d*-1*v(a.datasets[g].data[f],j,k));b.closePath();b.fillStyle=a.datasets[g].fillColor;b.strokeStyle=a.datasets[g].strokeColor;b.lineWidth=c.datasetStrokeWidth;b.fill();b.stroke();if(c.pointDot){b.fillStyle=a.datasets[g].pointColor;b.strokeStyle=a.datasets[g].pointStrokeColor;b.lineWidth=c.pointDotStrokeWidth;for(f=0;f<a.datasets[g].data.length;f++)b.rotate(e),b.beginPath(),b.arc(0,d*-1*
v(a.datasets[g].data[f],j,k),c.pointDotRadius,2*Math.PI,!1),b.fill(),b.stroke()}b.rotate(e)}b.restore()},b)},I=function(a,c,b){for(var e=0,h=Math.min.apply(Math,[u/2,q/2])-5,f=0;f<a.length;f++)e+=a[f].value;x(c,null,function(d){var g=-Math.PI/2,f=1,j=1;c.animation&&(c.animateScale&&(f=d),c.animateRotate&&(j=d));for(d=0;d<a.length;d++){var l=j*a[d].value/e*2*Math.PI;b.beginPath();b.arc(q/2,u/2,f*h,g,g+l);b.lineTo(q/2,u/2);b.closePath();b.fillStyle=a[d].color;b.fill();c.segmentShowStroke&&(b.lineWidth=
c.segmentStrokeWidth,b.strokeStyle=c.segmentStrokeColor,b.stroke());g+=l}},b)},J=function(a,c,b){for(var e=0,h=Math.min.apply(Math,[u/2,q/2])-5,f=h*(c.percentageInnerCutout/100),d=0;d<a.length;d++)e+=a[d].value;x(c,null,function(d){var k=-Math.PI/2,j=1,l=1;c.animation&&(c.animateScale&&(j=d),c.animateRotate&&(l=d));for(d=0;d<a.length;d++){var m=l*a[d].value/e*2*Math.PI;b.beginPath();b.arc(q/2,u/2,j*h,k,k+m,!1);b.arc(q/2,u/2,j*f,k+m,k,!0);b.closePath();b.fillStyle=a[d].color;b.fill();c.segmentShowStroke&&
(b.lineWidth=c.segmentStrokeWidth,b.strokeStyle=c.segmentStrokeColor,b.stroke());k+=m}},b)},K=function(a,c,b){var e,h,f,d,g,k,j,l,m,t,r,n,p,s=0;g=u;b.font=c.scaleFontStyle+" "+c.scaleFontSize+"px "+c.scaleFontFamily;t=1;for(d=0;d<a.labels.length;d++)e=b.measureText(a.labels[d]).width,t=e>t?e:t;q/a.labels.length<t?(s=45,q/a.labels.length<Math.cos(s)*t?(s=90,g-=t):g-=Math.sin(s)*t):g-=c.scaleFontSize;d=c.scaleFontSize;g=g-5-d;e=Number.MIN_VALUE;h=Number.MAX_VALUE;for(f=0;f<a.datasets.length;f++)for(l=
0;l<a.datasets[f].data.length;l++)a.datasets[f].data[l]>e&&(e=a.datasets[f].data[l]),a.datasets[f].data[l]<h&&(h=a.datasets[f].data[l]);f=Math.floor(g/(0.66*d));d=Math.floor(0.5*(g/d));l=c.scaleShowLabels?c.scaleLabel:"";c.scaleOverride?(j={steps:c.scaleSteps,stepValue:c.scaleStepWidth,graphMin:c.scaleStartValue,labels:[]},z(l,j.labels,j.steps,c.scaleStartValue,c.scaleStepWidth)):j=C(g,f,d,e,h,l);k=Math.floor(g/j.steps);d=1;if(c.scaleShowLabels){b.font=c.scaleFontStyle+" "+c.scaleFontSize+"px "+c.scaleFontFamily;
for(e=0;e<j.labels.length;e++)h=b.measureText(j.labels[e]).width,d=h>d?h:d;d+=10}r=q-d-t;m=Math.floor(r/(a.labels.length-1));n=q-t/2-r;p=g+c.scaleFontSize/2;x(c,function(){b.lineWidth=c.scaleLineWidth;b.strokeStyle=c.scaleLineColor;b.beginPath();b.moveTo(q-t/2+5,p);b.lineTo(q-t/2-r-5,p);b.stroke();0<s?(b.save(),b.textAlign="right"):b.textAlign="center";b.fillStyle=c.scaleFontColor;for(var d=0;d<a.labels.length;d++)b.save(),0<s?(b.translate(n+d*m,p+c.scaleFontSize),b.rotate(-(s*(Math.PI/180))),b.fillText(a.labels[d],
0,0),b.restore()):b.fillText(a.labels[d],n+d*m,p+c.scaleFontSize+3),b.beginPath(),b.moveTo(n+d*m,p+3),c.scaleShowGridLines&&0<d?(b.lineWidth=c.scaleGridLineWidth,b.strokeStyle=c.scaleGridLineColor,b.lineTo(n+d*m,5)):b.lineTo(n+d*m,p+3),b.stroke();b.lineWidth=c.scaleLineWidth;b.strokeStyle=c.scaleLineColor;b.beginPath();b.moveTo(n,p+5);b.lineTo(n,5);b.stroke();b.textAlign="right";b.textBaseline="middle";for(d=0;d<j.steps;d++)b.beginPath(),b.moveTo(n-3,p-(d+1)*k),c.scaleShowGridLines?(b.lineWidth=c.scaleGridLineWidth,
b.strokeStyle=c.scaleGridLineColor,b.lineTo(n+r+5,p-(d+1)*k)):b.lineTo(n-0.5,p-(d+1)*k),b.stroke(),c.scaleShowLabels&&b.fillText(j.labels[d],n-8,p-(d+1)*k)},function(d){function e(b,c){return p-d*v(a.datasets[b].data[c],j,k)}for(var f=0;f<a.datasets.length;f++){b.strokeStyle=a.datasets[f].strokeColor;b.lineWidth=c.datasetStrokeWidth;b.beginPath();b.moveTo(n,p-d*v(a.datasets[f].data[0],j,k));for(var g=1;g<a.datasets[f].data.length;g++)c.bezierCurve?b.bezierCurveTo(n+m*(g-0.5),e(f,g-1),n+m*(g-0.5),
e(f,g),n+m*g,e(f,g)):b.lineTo(n+m*g,e(f,g));b.stroke();c.datasetFill?(b.lineTo(n+m*(a.datasets[f].data.length-1),p),b.lineTo(n,p),b.closePath(),b.fillStyle=a.datasets[f].fillColor,b.fill()):b.closePath();if(c.pointDot){b.fillStyle=a.datasets[f].pointColor;b.strokeStyle=a.datasets[f].pointStrokeColor;b.lineWidth=c.pointDotStrokeWidth;for(g=0;g<a.datasets[f].data.length;g++)b.beginPath(),b.arc(n+m*g,p-d*v(a.datasets[f].data[g],j,k),c.pointDotRadius,0,2*Math.PI,!0),b.fill(),b.stroke()}}},b)},L=function(a,
c,b){var e,h,f,d,g,k,j,l,m,t,r,n,p,s,w=0;g=u;b.font=c.scaleFontStyle+" "+c.scaleFontSize+"px "+c.scaleFontFamily;t=1;for(d=0;d<a.labels.length;d++)e=b.measureText(a.labels[d]).width,t=e>t?e:t;q/a.labels.length<t?(w=45,q/a.labels.length<Math.cos(w)*t?(w=90,g-=t):g-=Math.sin(w)*t):g-=c.scaleFontSize;d=c.scaleFontSize;g=g-5-d;e=Number.MIN_VALUE;h=Number.MAX_VALUE;for(f=0;f<a.datasets.length;f++)for(l=0;l<a.datasets[f].data.length;l++)a.datasets[f].data[l]>e&&(e=a.datasets[f].data[l]),a.datasets[f].data[l]<
h&&(h=a.datasets[f].data[l]);f=Math.floor(g/(0.66*d));d=Math.floor(0.5*(g/d));l=c.scaleShowLabels?c.scaleLabel:"";c.scaleOverride?(j={steps:c.scaleSteps,stepValue:c.scaleStepWidth,graphMin:c.scaleStartValue,labels:[]},z(l,j.labels,j.steps,c.scaleStartValue,c.scaleStepWidth)):j=C(g,f,d,e,h,l);k=Math.floor(g/j.steps);d=1;if(c.scaleShowLabels){b.font=c.scaleFontStyle+" "+c.scaleFontSize+"px "+c.scaleFontFamily;for(e=0;e<j.labels.length;e++)h=b.measureText(j.labels[e]).width,d=h>d?h:d;d+=10}r=q-d-t;m=
Math.floor(r/a.labels.length);s=(m-2*c.scaleGridLineWidth-2*c.barValueSpacing-(c.barDatasetSpacing*a.datasets.length-1)-(c.barStrokeWidth/2*a.datasets.length-1))/a.datasets.length;n=q-t/2-r;p=g+c.scaleFontSize/2;x(c,function(){b.lineWidth=c.scaleLineWidth;b.strokeStyle=c.scaleLineColor;b.beginPath();b.moveTo(q-t/2+5,p);b.lineTo(q-t/2-r-5,p);b.stroke();0<w?(b.save(),b.textAlign="right"):b.textAlign="center";b.fillStyle=c.scaleFontColor;for(var d=0;d<a.labels.length;d++)b.save(),0<w?(b.translate(n+
d*m,p+c.scaleFontSize),b.rotate(-(w*(Math.PI/180))),b.fillText(a.labels[d],0,0),b.restore()):b.fillText(a.labels[d],n+d*m+m/2,p+c.scaleFontSize+3),b.beginPath(),b.moveTo(n+(d+1)*m,p+3),b.lineWidth=c.scaleGridLineWidth,b.strokeStyle=c.scaleGridLineColor,b.lineTo(n+(d+1)*m,5),b.stroke();b.lineWidth=c.scaleLineWidth;b.strokeStyle=c.scaleLineColor;b.beginPath();b.moveTo(n,p+5);b.lineTo(n,5);b.stroke();b.textAlign="right";b.textBaseline="middle";for(d=0;d<j.steps;d++)b.beginPath(),b.moveTo(n-3,p-(d+1)*
k),c.scaleShowGridLines?(b.lineWidth=c.scaleGridLineWidth,b.strokeStyle=c.scaleGridLineColor,b.lineTo(n+r+5,p-(d+1)*k)):b.lineTo(n-0.5,p-(d+1)*k),b.stroke(),c.scaleShowLabels&&b.fillText(j.labels[d],n-8,p-(d+1)*k)},function(d){b.lineWidth=c.barStrokeWidth;for(var e=0;e<a.datasets.length;e++){b.fillStyle=a.datasets[e].fillColor;b.strokeStyle=a.datasets[e].strokeColor;for(var f=0;f<a.datasets[e].data.length;f++){var g=n+c.barValueSpacing+m*f+s*e+c.barDatasetSpacing*e+c.barStrokeWidth*e;b.beginPath();
b.moveTo(g,p);b.lineTo(g,p-d*v(a.datasets[e].data[f],j,k)+c.barStrokeWidth/2);b.lineTo(g+s,p-d*v(a.datasets[e].data[f],j,k)+c.barStrokeWidth/2);b.lineTo(g+s,p);c.barShowStroke&&b.stroke();b.closePath();b.fill()}}},b)},D=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)},F={}};
/*!
* Bootstrap v3.3.1 (http://getbootstrap.com)
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
if (typeof jQuery === 'undefined') {
throw new Error('Bootstrap\'s JavaScript requires jQuery')
}
+function ($) {
var version = $.fn.jquery.split(' ')[0].split('.')
if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) {
throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher')
}
}(jQuery);
/* ========================================================================
* Bootstrap: transition.js v3.3.1
* http://getbootstrap.com/javascript/#transitions
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
// ============================================================
function transitionEnd() {
var el = document.createElement('bootstrap')
var transEndEventNames = {
WebkitTransition : 'webkitTransitionEnd',
MozTransition : 'transitionend',
OTransition : 'oTransitionEnd otransitionend',
transition : 'transitionend'
}
for (var name in transEndEventNames) {
if (el.style[name] !== undefined) {
return { end: transEndEventNames[name] }
}
}
return false // explicit for ie8 ( ._.)
}
// http://blog.alexmaccaw.com/css-transitions
$.fn.emulateTransitionEnd = function (duration) {
var called = false
var $el = this
$(this).one('bsTransitionEnd', function () { called = true })
var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
setTimeout(callback, duration)
return this
}
$(function () {
$.support.transition = transitionEnd()
if (!$.support.transition) return
$.event.special.bsTransitionEnd = {
bindType: $.support.transition.end,
delegateType: $.support.transition.end,
handle: function (e) {
if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
}
}
})
}(jQuery);
/* ========================================================================
* Bootstrap: alert.js v3.3.1
* http://getbootstrap.com/javascript/#alerts
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// ALERT CLASS DEFINITION
// ======================
var dismiss = '[data-dismiss="alert"]'
var Alert = function (el) {
$(el).on('click', dismiss, this.close)
}
Alert.VERSION = '3.3.1'
Alert.TRANSITION_DURATION = 150
Alert.prototype.close = function (e) {
var $this = $(this)
var selector = $this.attr('data-target')
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
var $parent = $(selector)
if (e) e.preventDefault()
if (!$parent.length) {
$parent = $this.closest('.alert')
}
$parent.trigger(e = $.Event('close.bs.alert'))
if (e.isDefaultPrevented()) return
$parent.removeClass('in')
function removeElement() {
// detach from parent, fire event then clean up data
$parent.detach().trigger('closed.bs.alert').remove()
}
$.support.transition && $parent.hasClass('fade') ?
$parent
.one('bsTransitionEnd', removeElement)
.emulateTransitionEnd(Alert.TRANSITION_DURATION) :
removeElement()
}
// ALERT PLUGIN DEFINITION
// =======================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.alert')
if (!data) $this.data('bs.alert', (data = new Alert(this)))
if (typeof option == 'string') data[option].call($this)
})
}
var old = $.fn.alert
$.fn.alert = Plugin
$.fn.alert.Constructor = Alert
// ALERT NO CONFLICT
// =================
$.fn.alert.noConflict = function () {
$.fn.alert = old
return this
}
// ALERT DATA-API
// ==============
$(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
}(jQuery);
/* ========================================================================
* Bootstrap: button.js v3.3.1
* http://getbootstrap.com/javascript/#buttons
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// BUTTON PUBLIC CLASS DEFINITION
// ==============================
var Button = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, Button.DEFAULTS, options)
this.isLoading = false
}
Button.VERSION = '3.3.1'
Button.DEFAULTS = {
loadingText: 'loading...'
}
Button.prototype.setState = function (state) {
var d = 'disabled'
var $el = this.$element
var val = $el.is('input') ? 'val' : 'html'
var data = $el.data()
state = state + 'Text'
if (data.resetText == null) $el.data('resetText', $el[val]())
// push to event loop to allow forms to submit
setTimeout($.proxy(function () {
$el[val](data[state] == null ? this.options[state] : data[state])
if (state == 'loadingText') {
this.isLoading = true
$el.addClass(d).attr(d, d)
} else if (this.isLoading) {
this.isLoading = false
$el.removeClass(d).removeAttr(d)
}
}, this), 0)
}
Button.prototype.toggle = function () {
var changed = true
var $parent = this.$element.closest('[data-toggle="buttons"]')
if ($parent.length) {
var $input = this.$element.find('input')
if ($input.prop('type') == 'radio') {
if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
else $parent.find('.active').removeClass('active')
}
if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
} else {
this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
}
if (changed) this.$element.toggleClass('active')
}
// BUTTON PLUGIN DEFINITION
// ========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.button')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.button', (data = new Button(this, options)))
if (option == 'toggle') data.toggle()
else if (option) data.setState(option)
})
}
var old = $.fn.button
$.fn.button = Plugin
$.fn.button.Constructor = Button
// BUTTON NO CONFLICT
// ==================
$.fn.button.noConflict = function () {
$.fn.button = old
return this
}
// BUTTON DATA-API
// ===============
$(document)
.on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
Plugin.call($btn, 'toggle')
e.preventDefault()
})
.on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
$(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
})
}(jQuery);
/* ========================================================================
* Bootstrap: carousel.js v3.3.1
* http://getbootstrap.com/javascript/#carousel
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// CAROUSEL CLASS DEFINITION
// =========================
var Carousel = function (element, options) {
this.$element = $(element)
this.$indicators = this.$element.find('.carousel-indicators')
this.options = options
this.paused =
this.sliding =
this.interval =
this.$active =
this.$items = null
this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
.on('mouseenter.bs.carousel', $.proxy(this.pause, this))
.on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
}
Carousel.VERSION = '3.3.1'
Carousel.TRANSITION_DURATION = 600
Carousel.DEFAULTS = {
interval: 5000,
pause: 'hover',
wrap: true,
keyboard: true
}
Carousel.prototype.keydown = function (e) {
if (/input|textarea/i.test(e.target.tagName)) return
switch (e.which) {
case 37: this.prev(); break
case 39: this.next(); break
default: return
}
e.preventDefault()
}
Carousel.prototype.cycle = function (e) {
e || (this.paused = false)
this.interval && clearInterval(this.interval)
this.options.interval
&& !this.paused
&& (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
return this
}
Carousel.prototype.getItemIndex = function (item) {
this.$items = item.parent().children('.item')
return this.$items.index(item || this.$active)
}
Carousel.prototype.getItemForDirection = function (direction, active) {
var delta = direction == 'prev' ? -1 : 1
var activeIndex = this.getItemIndex(active)
var itemIndex = (activeIndex + delta) % this.$items.length
return this.$items.eq(itemIndex)
}
Carousel.prototype.to = function (pos) {
var that = this
var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
if (pos > (this.$items.length - 1) || pos < 0) return
if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
if (activeIndex == pos) return this.pause().cycle()
return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
}
Carousel.prototype.pause = function (e) {
e || (this.paused = true)
if (this.$element.find('.next, .prev').length && $.support.transition) {
this.$element.trigger($.support.transition.end)
this.cycle(true)
}
this.interval = clearInterval(this.interval)
return this
}
Carousel.prototype.next = function () {
if (this.sliding) return
return this.slide('next')
}
Carousel.prototype.prev = function () {
if (this.sliding) return
return this.slide('prev')
}
Carousel.prototype.slide = function (type, next) {
var $active = this.$element.find('.item.active')
var $next = next || this.getItemForDirection(type, $active)
var isCycling = this.interval
var direction = type == 'next' ? 'left' : 'right'
var fallback = type == 'next' ? 'first' : 'last'
var that = this
if (!$next.length) {
if (!this.options.wrap) return
$next = this.$element.find('.item')[fallback]()
}
if ($next.hasClass('active')) return (this.sliding = false)
var relatedTarget = $next[0]
var slideEvent = $.Event('slide.bs.carousel', {
relatedTarget: relatedTarget,
direction: direction
})
this.$element.trigger(slideEvent)
if (slideEvent.isDefaultPrevented()) return
this.sliding = true
isCycling && this.pause()
if (this.$indicators.length) {
this.$indicators.find('.active').removeClass('active')
var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
$nextIndicator && $nextIndicator.addClass('active')
}
var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
if ($.support.transition && this.$element.hasClass('slide')) {
$next.addClass(type)
$next[0].offsetWidth // force reflow
$active.addClass(direction)
$next.addClass(direction)
$active
.one('bsTransitionEnd', function () {
$next.removeClass([type, direction].join(' ')).addClass('active')
$active.removeClass(['active', direction].join(' '))
that.sliding = false
setTimeout(function () {
that.$element.trigger(slidEvent)
}, 0)
})
.emulateTransitionEnd(Carousel.TRANSITION_DURATION)
} else {
$active.removeClass('active')
$next.addClass('active')
this.sliding = false
this.$element.trigger(slidEvent)
}
isCycling && this.cycle()
return this
}
// CAROUSEL PLUGIN DEFINITION
// ==========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.carousel')
var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
var action = typeof option == 'string' ? option : options.slide
if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
if (typeof option == 'number') data.to(option)
else if (action) data[action]()
else if (options.interval) data.pause().cycle()
})
}
var old = $.fn.carousel
$.fn.carousel = Plugin
$.fn.carousel.Constructor = Carousel
// CAROUSEL NO CONFLICT
// ====================
$.fn.carousel.noConflict = function () {
$.fn.carousel = old
return this
}
// CAROUSEL DATA-API
// =================
var clickHandler = function (e) {
var href
var $this = $(this)
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
if (!$target.hasClass('carousel')) return
var options = $.extend({}, $target.data(), $this.data())
var slideIndex = $this.attr('data-slide-to')
if (slideIndex) options.interval = false
Plugin.call($target, options)
if (slideIndex) {
$target.data('bs.carousel').to(slideIndex)
}
e.preventDefault()
}
$(document)
.on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
.on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
$(window).on('load', function () {
$('[data-ride="carousel"]').each(function () {
var $carousel = $(this)
Plugin.call($carousel, $carousel.data())
})
})
}(jQuery);
/* ========================================================================
* Bootstrap: collapse.js v3.3.1
* http://getbootstrap.com/javascript/#collapse
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// COLLAPSE PUBLIC CLASS DEFINITION
// ================================
var Collapse = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, Collapse.DEFAULTS, options)
this.$trigger = $(this.options.trigger).filter('[href="#' + element.id + '"], [data-target="#' + element.id + '"]')
this.transitioning = null
if (this.options.parent) {
this.$parent = this.getParent()
} else {
this.addAriaAndCollapsedClass(this.$element, this.$trigger)
}
if (this.options.toggle) this.toggle()
}
Collapse.VERSION = '3.3.1'
Collapse.TRANSITION_DURATION = 350
Collapse.DEFAULTS = {
toggle: true,
trigger: '[data-toggle="collapse"]'
}
Collapse.prototype.dimension = function () {
var hasWidth = this.$element.hasClass('width')
return hasWidth ? 'width' : 'height'
}
Collapse.prototype.show = function () {
if (this.transitioning || this.$element.hasClass('in')) return
var activesData
var actives = this.$parent && this.$parent.find('> .panel').children('.in, .collapsing')
if (actives && actives.length) {
activesData = actives.data('bs.collapse')
if (activesData && activesData.transitioning) return
}
var startEvent = $.Event('show.bs.collapse')
this.$element.trigger(startEvent)
if (startEvent.isDefaultPrevented()) return
if (actives && actives.length) {
Plugin.call(actives, 'hide')
activesData || actives.data('bs.collapse', null)
}
var dimension = this.dimension()
this.$element
.removeClass('collapse')
.addClass('collapsing')[dimension](0)
.attr('aria-expanded', true)
this.$trigger
.removeClass('collapsed')
.attr('aria-expanded', true)
this.transitioning = 1
var complete = function () {
this.$element
.removeClass('collapsing')
.addClass('collapse in')[dimension]('')
this.transitioning = 0
this.$element
.trigger('shown.bs.collapse')
}
if (!$.support.transition) return complete.call(this)
var scrollSize = $.camelCase(['scroll', dimension].join('-'))
this.$element
.one('bsTransitionEnd', $.proxy(complete, this))
.emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
}
Collapse.prototype.hide = function () {
if (this.transitioning || !this.$element.hasClass('in')) return
var startEvent = $.Event('hide.bs.collapse')
this.$element.trigger(startEvent)
if (startEvent.isDefaultPrevented()) return
var dimension = this.dimension()
this.$element[dimension](this.$element[dimension]())[0].offsetHeight
this.$element
.addClass('collapsing')
.removeClass('collapse in')
.attr('aria-expanded', false)
this.$trigger
.addClass('collapsed')
.attr('aria-expanded', false)
this.transitioning = 1
var complete = function () {
this.transitioning = 0
this.$element
.removeClass('collapsing')
.addClass('collapse')
.trigger('hidden.bs.collapse')
}
if (!$.support.transition) return complete.call(this)
this.$element
[dimension](0)
.one('bsTransitionEnd', $.proxy(complete, this))
.emulateTransitionEnd(Collapse.TRANSITION_DURATION)
}
Collapse.prototype.toggle = function () {
this[this.$element.hasClass('in') ? 'hide' : 'show']()
}
Collapse.prototype.getParent = function () {
return $(this.options.parent)
.find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
.each($.proxy(function (i, element) {
var $element = $(element)
this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
}, this))
.end()
}
Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
var isOpen = $element.hasClass('in')
$element.attr('aria-expanded', isOpen)
$trigger
.toggleClass('collapsed', !isOpen)
.attr('aria-expanded', isOpen)
}
function getTargetFromTrigger($trigger) {
var href
var target = $trigger.attr('data-target')
|| (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
return $(target)
}
// COLLAPSE PLUGIN DEFINITION
// ==========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.collapse')
var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data && options.toggle && option == 'show') options.toggle = false
if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.collapse
$.fn.collapse = Plugin
$.fn.collapse.Constructor = Collapse
// COLLAPSE NO CONFLICT
// ====================
$.fn.collapse.noConflict = function () {
$.fn.collapse = old
return this
}
// COLLAPSE DATA-API
// =================
$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
var $this = $(this)
if (!$this.attr('data-target')) e.preventDefault()
var $target = getTargetFromTrigger($this)
var data = $target.data('bs.collapse')
var option = data ? 'toggle' : $.extend({}, $this.data(), { trigger: this })
Plugin.call($target, option)
})
}(jQuery);
/* ========================================================================
* Bootstrap: dropdown.js v3.3.1
* http://getbootstrap.com/javascript/#dropdowns
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// DROPDOWN CLASS DEFINITION
// =========================
var backdrop = '.dropdown-backdrop'
var toggle = '[data-toggle="dropdown"]'
var Dropdown = function (element) {
$(element).on('click.bs.dropdown', this.toggle)
}
Dropdown.VERSION = '3.3.1'
Dropdown.prototype.toggle = function (e) {
var $this = $(this)
if ($this.is('.disabled, :disabled')) return
var $parent = getParent($this)
var isActive = $parent.hasClass('open')
clearMenus()
if (!isActive) {
if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
// if mobile we use a backdrop because click events don't delegate
$('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
}
var relatedTarget = { relatedTarget: this }
$parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
if (e.isDefaultPrevented()) return
$this
.trigger('focus')
.attr('aria-expanded', 'true')
$parent
.toggleClass('open')
.trigger('shown.bs.dropdown', relatedTarget)
}
return false
}
Dropdown.prototype.keydown = function (e) {
if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
var $this = $(this)
e.preventDefault()
e.stopPropagation()
if ($this.is('.disabled, :disabled')) return
var $parent = getParent($this)
var isActive = $parent.hasClass('open')
if ((!isActive && e.which != 27) || (isActive && e.which == 27)) {
if (e.which == 27) $parent.find(toggle).trigger('focus')
return $this.trigger('click')
}
var desc = ' li:not(.divider):visible a'
var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
if (!$items.length) return
var index = $items.index(e.target)
if (e.which == 38 && index > 0) index-- // up
if (e.which == 40 && index < $items.length - 1) index++ // down
if (!~index) index = 0
$items.eq(index).trigger('focus')
}
function clearMenus(e) {
if (e && e.which === 3) return
$(backdrop).remove()
$(toggle).each(function () {
var $this = $(this)
var $parent = getParent($this)
var relatedTarget = { relatedTarget: this }
if (!$parent.hasClass('open')) return
$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
if (e.isDefaultPrevented()) return
$this.attr('aria-expanded', 'false')
$parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
})
}
function getParent($this) {
var selector = $this.attr('data-target')
if (!selector) {
selector = $this.attr('href')
selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
var $parent = selector && $(selector)
return $parent && $parent.length ? $parent : $this.parent()
}
// DROPDOWN PLUGIN DEFINITION
// ==========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.dropdown')
if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
if (typeof option == 'string') data[option].call($this)
})
}
var old = $.fn.dropdown
$.fn.dropdown = Plugin
$.fn.dropdown.Constructor = Dropdown
// DROPDOWN NO CONFLICT
// ====================
$.fn.dropdown.noConflict = function () {
$.fn.dropdown = old
return this
}
// APPLY TO STANDARD DROPDOWN ELEMENTS
// ===================================
$(document)
.on('click.bs.dropdown.data-api', clearMenus)
.on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
.on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
.on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
.on('keydown.bs.dropdown.data-api', '[role="menu"]', Dropdown.prototype.keydown)
.on('keydown.bs.dropdown.data-api', '[role="listbox"]', Dropdown.prototype.keydown)
}(jQuery);
/* ========================================================================
* Bootstrap: modal.js v3.3.1
* http://getbootstrap.com/javascript/#modals
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// MODAL CLASS DEFINITION
// ======================
var Modal = function (element, options) {
this.options = options
this.$body = $(document.body)
this.$element = $(element)
this.$backdrop =
this.isShown = null
this.scrollbarWidth = 0
if (this.options.remote) {
this.$element
.find('.modal-content')
.load(this.options.remote, $.proxy(function () {
this.$element.trigger('loaded.bs.modal')
}, this))
}
}
Modal.VERSION = '3.3.1'
Modal.TRANSITION_DURATION = 300
Modal.BACKDROP_TRANSITION_DURATION = 150
Modal.DEFAULTS = {
backdrop: true,
keyboard: true,
show: true
}
Modal.prototype.toggle = function (_relatedTarget) {
return this.isShown ? this.hide() : this.show(_relatedTarget)
}
Modal.prototype.show = function (_relatedTarget) {
var that = this
var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
this.$element.trigger(e)
if (this.isShown || e.isDefaultPrevented()) return
this.isShown = true
this.checkScrollbar()
this.setScrollbar()
this.$body.addClass('modal-open')
this.escape()
this.resize()
this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
this.backdrop(function () {
var transition = $.support.transition && that.$element.hasClass('fade')
if (!that.$element.parent().length) {
that.$element.appendTo(that.$body) // don't move modals dom position
}
that.$element
.show()
.scrollTop(0)
if (that.options.backdrop) that.adjustBackdrop()
that.adjustDialog()
if (transition) {
that.$element[0].offsetWidth // force reflow
}
that.$element
.addClass('in')
.attr('aria-hidden', false)
that.enforceFocus()
var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
transition ?
that.$element.find('.modal-dialog') // wait for modal to slide in
.one('bsTransitionEnd', function () {
that.$element.trigger('focus').trigger(e)
})
.emulateTransitionEnd(Modal.TRANSITION_DURATION) :
that.$element.trigger('focus').trigger(e)
})
}
Modal.prototype.hide = function (e) {
if (e) e.preventDefault()
e = $.Event('hide.bs.modal')
this.$element.trigger(e)
if (!this.isShown || e.isDefaultPrevented()) return
this.isShown = false
this.escape()
this.resize()
$(document).off('focusin.bs.modal')
this.$element
.removeClass('in')
.attr('aria-hidden', true)
.off('click.dismiss.bs.modal')
$.support.transition && this.$element.hasClass('fade') ?
this.$element
.one('bsTransitionEnd', $.proxy(this.hideModal, this))
.emulateTransitionEnd(Modal.TRANSITION_DURATION) :
this.hideModal()
}
Modal.prototype.enforceFocus = function () {
$(document)
.off('focusin.bs.modal') // guard against infinite focus loop
.on('focusin.bs.modal', $.proxy(function (e) {
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
this.$element.trigger('focus')
}
}, this))
}
Modal.prototype.escape = function () {
if (this.isShown && this.options.keyboard) {
this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
e.which == 27 && this.hide()
}, this))
} else if (!this.isShown) {
this.$element.off('keydown.dismiss.bs.modal')
}
}
Modal.prototype.resize = function () {
if (this.isShown) {
$(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
} else {
$(window).off('resize.bs.modal')
}
}
Modal.prototype.hideModal = function () {
var that = this
this.$element.hide()
this.backdrop(function () {
that.$body.removeClass('modal-open')
that.resetAdjustments()
that.resetScrollbar()
that.$element.trigger('hidden.bs.modal')
})
}
Modal.prototype.removeBackdrop = function () {
this.$backdrop && this.$backdrop.remove()
this.$backdrop = null
}
Modal.prototype.backdrop = function (callback) {
var that = this
var animate = this.$element.hasClass('fade') ? 'fade' : ''
if (this.isShown && this.options.backdrop) {
var doAnimate = $.support.transition && animate
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
.prependTo(this.$element)
.on('click.dismiss.bs.modal', $.proxy(function (e) {
if (e.target !== e.currentTarget) return
this.options.backdrop == 'static'
? this.$element[0].focus.call(this.$element[0])
: this.hide.call(this)
}, this))
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
this.$backdrop.addClass('in')
if (!callback) return
doAnimate ?
this.$backdrop
.one('bsTransitionEnd', callback)
.emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
callback()
} else if (!this.isShown && this.$backdrop) {
this.$backdrop.removeClass('in')
var callbackRemove = function () {
that.removeBackdrop()
callback && callback()
}
$.support.transition && this.$element.hasClass('fade') ?
this.$backdrop
.one('bsTransitionEnd', callbackRemove)
.emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
callbackRemove()
} else if (callback) {
callback()
}
}
// these following methods are used to handle overflowing modals
Modal.prototype.handleUpdate = function () {
if (this.options.backdrop) this.adjustBackdrop()
this.adjustDialog()
}
Modal.prototype.adjustBackdrop = function () {
this.$backdrop
.css('height', 0)
.css('height', this.$element[0].scrollHeight)
}
Modal.prototype.adjustDialog = function () {
var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
this.$element.css({
paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
})
}
Modal.prototype.resetAdjustments = function () {
this.$element.css({
paddingLeft: '',
paddingRight: ''
})
}
Modal.prototype.checkScrollbar = function () {
this.bodyIsOverflowing = document.body.scrollHeight > document.documentElement.clientHeight
this.scrollbarWidth = this.measureScrollbar()
}
Modal.prototype.setScrollbar = function () {
var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
}
Modal.prototype.resetScrollbar = function () {
this.$body.css('padding-right', '')
}
Modal.prototype.measureScrollbar = function () { // thx walsh
var scrollDiv = document.createElement('div')
scrollDiv.className = 'modal-scrollbar-measure'
this.$body.append(scrollDiv)
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
this.$body[0].removeChild(scrollDiv)
return scrollbarWidth
}
// MODAL PLUGIN DEFINITION
// =======================
function Plugin(option, _relatedTarget) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.modal')
var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
if (typeof option == 'string') data[option](_relatedTarget)
else if (options.show) data.show(_relatedTarget)
})
}
var old = $.fn.modal
$.fn.modal = Plugin
$.fn.modal.Constructor = Modal
// MODAL NO CONFLICT
// =================
$.fn.modal.noConflict = function () {
$.fn.modal = old
return this
}
// MODAL DATA-API
// ==============
$(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
var $this = $(this)
var href = $this.attr('href')
var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
if ($this.is('a')) e.preventDefault()
$target.one('show.bs.modal', function (showEvent) {
if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
$target.one('hidden.bs.modal', function () {
$this.is(':visible') && $this.trigger('focus')
})
})
Plugin.call($target, option, this)
})
}(jQuery);
/* ========================================================================
* Bootstrap: tooltip.js v3.3.1
* http://getbootstrap.com/javascript/#tooltip
* Inspired by the original jQuery.tipsy by Jason Frame
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// TOOLTIP PUBLIC CLASS DEFINITION
// ===============================
var Tooltip = function (element, options) {
this.type =
this.options =
this.enabled =
this.timeout =
this.hoverState =
this.$element = null
this.init('tooltip', element, options)
}
Tooltip.VERSION = '3.3.1'
Tooltip.TRANSITION_DURATION = 150
Tooltip.DEFAULTS = {
animation: true,
placement: 'top',
selector: false,
template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
trigger: 'hover focus',
title: '',
delay: 0,
html: false,
container: false,
viewport: {
selector: 'body',
padding: 0
}
}
Tooltip.prototype.init = function (type, element, options) {
this.enabled = true
this.type = type
this.$element = $(element)
this.options = this.getOptions(options)
this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)
var triggers = this.options.trigger.split(' ')
for (var i = triggers.length; i--;) {
var trigger = triggers[i]
if (trigger == 'click') {
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
} else if (trigger != 'manual') {
var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
}
}
this.options.selector ?
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
this.fixTitle()
}
Tooltip.prototype.getDefaults = function () {
return Tooltip.DEFAULTS
}
Tooltip.prototype.getOptions = function (options) {
options = $.extend({}, this.getDefaults(), this.$element.data(), options)
if (options.delay && typeof options.delay == 'number') {
options.delay = {
show: options.delay,
hide: options.delay
}
}
return options
}
Tooltip.prototype.getDelegateOptions = function () {
var options = {}
var defaults = this.getDefaults()
this._options && $.each(this._options, function (key, value) {
if (defaults[key] != value) options[key] = value
})
return options
}
Tooltip.prototype.enter = function (obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget).data('bs.' + this.type)
if (self && self.$tip && self.$tip.is(':visible')) {
self.hoverState = 'in'
return
}
if (!self) {
self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self)
}
clearTimeout(self.timeout)
self.hoverState = 'in'
if (!self.options.delay || !self.options.delay.show) return self.show()
self.timeout = setTimeout(function () {
if (self.hoverState == 'in') self.show()
}, self.options.delay.show)
}
Tooltip.prototype.leave = function (obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self)
}
clearTimeout(self.timeout)
self.hoverState = 'out'
if (!self.options.delay || !self.options.delay.hide) return self.hide()
self.timeout = setTimeout(function () {
if (self.hoverState == 'out') self.hide()
}, self.options.delay.hide)
}
Tooltip.prototype.show = function () {
var e = $.Event('show.bs.' + this.type)
if (this.hasContent() && this.enabled) {
this.$element.trigger(e)
var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
if (e.isDefaultPrevented() || !inDom) return
var that = this
var $tip = this.tip()
var tipId = this.getUID(this.type)
this.setContent()
$tip.attr('id', tipId)
this.$element.attr('aria-describedby', tipId)
if (this.options.animation) $tip.addClass('fade')
var placement = typeof this.options.placement == 'function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) :
this.options.placement
var autoToken = /\s?auto?\s?/i
var autoPlace = autoToken.test(placement)
if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
$tip
.detach()
.css({ top: 0, left: 0, display: 'block' })
.addClass(placement)
.data('bs.' + this.type, this)
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
var pos = this.getPosition()
var actualWidth = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (autoPlace) {
var orgPlacement = placement
var $container = this.options.container ? $(this.options.container) : this.$element.parent()
var containerDim = this.getPosition($container)
placement = placement == 'bottom' && pos.bottom + actualHeight > containerDim.bottom ? 'top' :
placement == 'top' && pos.top - actualHeight < containerDim.top ? 'bottom' :
placement == 'right' && pos.right + actualWidth > containerDim.width ? 'left' :
placement == 'left' && pos.left - actualWidth < containerDim.left ? 'right' :
placement
$tip
.removeClass(orgPlacement)
.addClass(placement)
}
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
this.applyPlacement(calculatedOffset, placement)
var complete = function () {
var prevHoverState = that.hoverState
that.$element.trigger('shown.bs.' + that.type)
that.hoverState = null
if (prevHoverState == 'out') that.leave(that)
}
$.support.transition && this.$tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
complete()
}
}
Tooltip.prototype.applyPlacement = function (offset, placement) {
var $tip = this.tip()
var width = $tip[0].offsetWidth
var height = $tip[0].offsetHeight
// manually read margins because getBoundingClientRect includes difference
var marginTop = parseInt($tip.css('margin-top'), 10)
var marginLeft = parseInt($tip.css('margin-left'), 10)
// we must check for NaN for ie 8/9
if (isNaN(marginTop)) marginTop = 0
if (isNaN(marginLeft)) marginLeft = 0
offset.top = offset.top + marginTop
offset.left = offset.left + marginLeft
// $.fn.offset doesn't round pixel values
// so we use setOffset directly with our own function B-0
$.offset.setOffset($tip[0], $.extend({
using: function (props) {
$tip.css({
top: Math.round(props.top),
left: Math.round(props.left)
})
}
}, offset), 0)
$tip.addClass('in')
// check to see if placing tip in new offset caused the tip to resize itself
var actualWidth = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (placement == 'top' && actualHeight != height) {
offset.top = offset.top + height - actualHeight
}
var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
if (delta.left) offset.left += delta.left
else offset.top += delta.top
var isVertical = /top|bottom/.test(placement)
var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
$tip.offset(offset)
this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
}
Tooltip.prototype.replaceArrow = function (delta, dimension, isHorizontal) {
this.arrow()
.css(isHorizontal ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
.css(isHorizontal ? 'top' : 'left', '')
}
Tooltip.prototype.setContent = function () {
var $tip = this.tip()
var title = this.getTitle()
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
$tip.removeClass('fade in top bottom left right')
}
Tooltip.prototype.hide = function (callback) {
var that = this
var $tip = this.tip()
var e = $.Event('hide.bs.' + this.type)
function complete() {
if (that.hoverState != 'in') $tip.detach()
that.$element
.removeAttr('aria-describedby')
.trigger('hidden.bs.' + that.type)
callback && callback()
}
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
$tip.removeClass('in')
$.support.transition && this.$tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
complete()
this.hoverState = null
return this
}
Tooltip.prototype.fixTitle = function () {
var $e = this.$element
if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') {
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
}
}
Tooltip.prototype.hasContent = function () {
return this.getTitle()
}
Tooltip.prototype.getPosition = function ($element) {
$element = $element || this.$element
var el = $element[0]
var isBody = el.tagName == 'BODY'
var elRect = el.getBoundingClientRect()
if (elRect.width == null) {
// width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
}
var elOffset = isBody ? { top: 0, left: 0 } : $element.offset()
var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
return $.extend({}, elRect, scroll, outerDims, elOffset)
}
Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
/* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
}
Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
var delta = { top: 0, left: 0 }
if (!this.$viewport) return delta
var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
var viewportDimensions = this.getPosition(this.$viewport)
if (/right|left/.test(placement)) {
var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
if (topEdgeOffset < viewportDimensions.top) { // top overflow
delta.top = viewportDimensions.top - topEdgeOffset
} else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
}
} else {
var leftEdgeOffset = pos.left - viewportPadding
var rightEdgeOffset = pos.left + viewportPadding + actualWidth
if (leftEdgeOffset < viewportDimensions.left) { // left overflow
delta.left = viewportDimensions.left - leftEdgeOffset
} else if (rightEdgeOffset > viewportDimensions.width) { // right overflow
delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
}
}
return delta
}
Tooltip.prototype.getTitle = function () {
var title
var $e = this.$element
var o = this.options
title = $e.attr('data-original-title')
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
return title
}
Tooltip.prototype.getUID = function (prefix) {
do prefix += ~~(Math.random() * 1000000)
while (document.getElementById(prefix))
return prefix
}
Tooltip.prototype.tip = function () {
return (this.$tip = this.$tip || $(this.options.template))
}
Tooltip.prototype.arrow = function () {
return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
}
Tooltip.prototype.enable = function () {
this.enabled = true
}
Tooltip.prototype.disable = function () {
this.enabled = false
}
Tooltip.prototype.toggleEnabled = function () {
this.enabled = !this.enabled
}
Tooltip.prototype.toggle = function (e) {
var self = this
if (e) {
self = $(e.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(e.currentTarget, this.getDelegateOptions())
$(e.currentTarget).data('bs.' + this.type, self)
}
}
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
}
Tooltip.prototype.destroy = function () {
var that = this
clearTimeout(this.timeout)
this.hide(function () {
that.$element.off('.' + that.type).removeData('bs.' + that.type)
})
}
// TOOLTIP PLUGIN DEFINITION
// =========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.tooltip')
var options = typeof option == 'object' && option
var selector = options && options.selector
if (!data && option == 'destroy') return
if (selector) {
if (!data) $this.data('bs.tooltip', (data = {}))
if (!data[selector]) data[selector] = new Tooltip(this, options)
} else {
if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
}
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.tooltip
$.fn.tooltip = Plugin
$.fn.tooltip.Constructor = Tooltip
// TOOLTIP NO CONFLICT
// ===================
$.fn.tooltip.noConflict = function () {
$.fn.tooltip = old
return this
}
}(jQuery);
/* ========================================================================
* Bootstrap: popover.js v3.3.1
* http://getbootstrap.com/javascript/#popovers
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// POPOVER PUBLIC CLASS DEFINITION
// ===============================
var Popover = function (element, options) {
this.init('popover', element, options)
}
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
Popover.VERSION = '3.3.1'
Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
placement: 'right',
trigger: 'click',
content: '',
template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
})
// NOTE: POPOVER EXTENDS tooltip.js
// ================================
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
Popover.prototype.constructor = Popover
Popover.prototype.getDefaults = function () {
return Popover.DEFAULTS
}
Popover.prototype.setContent = function () {
var $tip = this.tip()
var title = this.getTitle()
var content = this.getContent()
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
$tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
](content)
$tip.removeClass('fade top bottom left right in')
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
// this manually by checking the contents.
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
}
Popover.prototype.hasContent = function () {
return this.getTitle() || this.getContent()
}
Popover.prototype.getContent = function () {
var $e = this.$element
var o = this.options
return $e.attr('data-content')
|| (typeof o.content == 'function' ?
o.content.call($e[0]) :
o.content)
}
Popover.prototype.arrow = function () {
return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
}
Popover.prototype.tip = function () {
if (!this.$tip) this.$tip = $(this.options.template)
return this.$tip
}
// POPOVER PLUGIN DEFINITION
// =========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.popover')
var options = typeof option == 'object' && option
var selector = options && options.selector
if (!data && option == 'destroy') return
if (selector) {
if (!data) $this.data('bs.popover', (data = {}))
if (!data[selector]) data[selector] = new Popover(this, options)
} else {
if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
}
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.popover
$.fn.popover = Plugin
$.fn.popover.Constructor = Popover
// POPOVER NO CONFLICT
// ===================
$.fn.popover.noConflict = function () {
$.fn.popover = old
return this
}
}(jQuery);
/* ========================================================================
* Bootstrap: scrollspy.js v3.3.1
* http://getbootstrap.com/javascript/#scrollspy
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// SCROLLSPY CLASS DEFINITION
// ==========================
function ScrollSpy(element, options) {
var process = $.proxy(this.process, this)
this.$body = $('body')
this.$scrollElement = $(element).is('body') ? $(window) : $(element)
this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
this.selector = (this.options.target || '') + ' .nav li > a'
this.offsets = []
this.targets = []
this.activeTarget = null
this.scrollHeight = 0
this.$scrollElement.on('scroll.bs.scrollspy', process)
this.refresh()
this.process()
}
ScrollSpy.VERSION = '3.3.1'
ScrollSpy.DEFAULTS = {
offset: 10
}
ScrollSpy.prototype.getScrollHeight = function () {
return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
}
ScrollSpy.prototype.refresh = function () {
var offsetMethod = 'offset'
var offsetBase = 0
if (!$.isWindow(this.$scrollElement[0])) {
offsetMethod = 'position'
offsetBase = this.$scrollElement.scrollTop()
}
this.offsets = []
this.targets = []
this.scrollHeight = this.getScrollHeight()
var self = this
this.$body
.find(this.selector)
.map(function () {
var $el = $(this)
var href = $el.data('target') || $el.attr('href')
var $href = /^#./.test(href) && $(href)
return ($href
&& $href.length
&& $href.is(':visible')
&& [[$href[offsetMethod]().top + offsetBase, href]]) || null
})
.sort(function (a, b) { return a[0] - b[0] })
.each(function () {
self.offsets.push(this[0])
self.targets.push(this[1])
})
}
ScrollSpy.prototype.process = function () {
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
var scrollHeight = this.getScrollHeight()
var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
var offsets = this.offsets
var targets = this.targets
var activeTarget = this.activeTarget
var i
if (this.scrollHeight != scrollHeight) {
this.refresh()
}
if (scrollTop >= maxScroll) {
return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
}
if (activeTarget && scrollTop < offsets[0]) {
this.activeTarget = null
return this.clear()
}
for (i = offsets.length; i--;) {
activeTarget != targets[i]
&& scrollTop >= offsets[i]
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
&& this.activate(targets[i])
}
}
ScrollSpy.prototype.activate = function (target) {
this.activeTarget = target
this.clear()
var selector = this.selector +
'[data-target="' + target + '"],' +
this.selector + '[href="' + target + '"]'
var active = $(selector)
.parents('li')
.addClass('active')
if (active.parent('.dropdown-menu').length) {
active = active
.closest('li.dropdown')
.addClass('active')
}
active.trigger('activate.bs.scrollspy')
}
ScrollSpy.prototype.clear = function () {
$(this.selector)
.parentsUntil(this.options.target, '.active')
.removeClass('active')
}
// SCROLLSPY PLUGIN DEFINITION
// ===========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.scrollspy')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.scrollspy
$.fn.scrollspy = Plugin
$.fn.scrollspy.Constructor = ScrollSpy
// SCROLLSPY NO CONFLICT
// =====================
$.fn.scrollspy.noConflict = function () {
$.fn.scrollspy = old
return this
}
// SCROLLSPY DATA-API
// ==================
$(window).on('load.bs.scrollspy.data-api', function () {
$('[data-spy="scroll"]').each(function () {
var $spy = $(this)
Plugin.call($spy, $spy.data())
})
})
}(jQuery);
/* ========================================================================
* Bootstrap: tab.js v3.3.1
* http://getbootstrap.com/javascript/#tabs
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// TAB CLASS DEFINITION
// ====================
var Tab = function (element) {
this.element = $(element)
}
Tab.VERSION = '3.3.1'
Tab.TRANSITION_DURATION = 150
Tab.prototype.show = function () {
var $this = this.element
var $ul = $this.closest('ul:not(.dropdown-menu)')
var selector = $this.data('target')
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
if ($this.parent('li').hasClass('active')) return
var $previous = $ul.find('.active:last a')
var hideEvent = $.Event('hide.bs.tab', {
relatedTarget: $this[0]
})
var showEvent = $.Event('show.bs.tab', {
relatedTarget: $previous[0]
})
$previous.trigger(hideEvent)
$this.trigger(showEvent)
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
var $target = $(selector)
this.activate($this.closest('li'), $ul)
this.activate($target, $target.parent(), function () {
$previous.trigger({
type: 'hidden.bs.tab',
relatedTarget: $this[0]
})
$this.trigger({
type: 'shown.bs.tab',
relatedTarget: $previous[0]
})
})
}
Tab.prototype.activate = function (element, container, callback) {
var $active = container.find('> .active')
var transition = callback
&& $.support.transition
&& (($active.length && $active.hasClass('fade')) || !!container.find('> .fade').length)
function next() {
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', false)
element
.addClass('active')
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
if (transition) {
element[0].offsetWidth // reflow for transition
element.addClass('in')
} else {
element.removeClass('fade')
}
if (element.parent('.dropdown-menu')) {
element
.closest('li.dropdown')
.addClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
}
callback && callback()
}
$active.length && transition ?
$active
.one('bsTransitionEnd', next)
.emulateTransitionEnd(Tab.TRANSITION_DURATION) :
next()
$active.removeClass('in')
}
// TAB PLUGIN DEFINITION
// =====================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.tab')
if (!data) $this.data('bs.tab', (data = new Tab(this)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.tab
$.fn.tab = Plugin
$.fn.tab.Constructor = Tab
// TAB NO CONFLICT
// ===============
$.fn.tab.noConflict = function () {
$.fn.tab = old
return this
}
// TAB DATA-API
// ============
var clickHandler = function (e) {
e.preventDefault()
Plugin.call($(this), 'show')
}
$(document)
.on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
.on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
}(jQuery);
/* ========================================================================
* Bootstrap: affix.js v3.3.1
* http://getbootstrap.com/javascript/#affix
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// AFFIX CLASS DEFINITION
// ======================
var Affix = function (element, options) {
this.options = $.extend({}, Affix.DEFAULTS, options)
this.$target = $(this.options.target)
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
this.$element = $(element)
this.affixed =
this.unpin =
this.pinnedOffset = null
this.checkPosition()
}
Affix.VERSION = '3.3.1'
Affix.RESET = 'affix affix-top affix-bottom'
Affix.DEFAULTS = {
offset: 0,
target: window
}
Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
var scrollTop = this.$target.scrollTop()
var position = this.$element.offset()
var targetHeight = this.$target.height()
if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
if (this.affixed == 'bottom') {
if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
}
var initializing = this.affixed == null
var colliderTop = initializing ? scrollTop : position.top
var colliderHeight = initializing ? targetHeight : height
if (offsetTop != null && colliderTop <= offsetTop) return 'top'
if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
return false
}
Affix.prototype.getPinnedOffset = function () {
if (this.pinnedOffset) return this.pinnedOffset
this.$element.removeClass(Affix.RESET).addClass('affix')
var scrollTop = this.$target.scrollTop()
var position = this.$element.offset()
return (this.pinnedOffset = position.top - scrollTop)
}
Affix.prototype.checkPositionWithEventLoop = function () {
setTimeout($.proxy(this.checkPosition, this), 1)
}
Affix.prototype.checkPosition = function () {
if (!this.$element.is(':visible')) return
var height = this.$element.height()
var offset = this.options.offset
var offsetTop = offset.top
var offsetBottom = offset.bottom
var scrollHeight = $('body').height()
if (typeof offset != 'object') offsetBottom = offsetTop = offset
if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
if (this.affixed != affix) {
if (this.unpin != null) this.$element.css('top', '')
var affixType = 'affix' + (affix ? '-' + affix : '')
var e = $.Event(affixType + '.bs.affix')
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
this.affixed = affix
this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
this.$element
.removeClass(Affix.RESET)
.addClass(affixType)
.trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
}
if (affix == 'bottom') {
this.$element.offset({
top: scrollHeight - height - offsetBottom
})
}
}
// AFFIX PLUGIN DEFINITION
// =======================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.affix')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.affix
$.fn.affix = Plugin
$.fn.affix.Constructor = Affix
// AFFIX NO CONFLICT
// =================
$.fn.affix.noConflict = function () {
$.fn.affix = old
return this
}
// AFFIX DATA-API
// ==============
$(window).on('load', function () {
$('[data-spy="affix"]').each(function () {
var $spy = $(this)
var data = $spy.data()
data.offset = data.offset || {}
if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
if (data.offsetTop != null) data.offset.top = data.offsetTop
Plugin.call($spy, data)
})
})
}(jQuery);
(function (global) {
var emojify = (function () {
var document = global.window.document;
var findText = function (element, pattern, callback) {
for (var childi = element.childNodes.length; childi-- > 0;) {
var child = element.childNodes[childi];
if (child.nodeType == 1) {
var tag = child.tagName.toLowerCase(),
classname;
if (child.hasAttribute('class')) classname = child.getAttribute('class').toLowerCase();
if (classname) {
if (tag !== 'script' && tag !== 'style' && tag !== 'textarea' && classname !== 'no-emojify') findText(child, pattern, callback);
}
else {
if (tag !== 'script' && tag !== 'style' && tag !== 'textarea') findText(child, pattern, callback);
}
}
else if (child.nodeType == 3) {
var matches = [];
if (typeof pattern === 'string') {
console.error('Accepts regex only');
} else {
var match;
while (match = pattern.exec(child.data))
matches.push(match);
}
for (var i = matches.length; i-- > 0;)
callback.call(window, child, matches[i]);
}
}
};
return {
config: {
emojify_tag_type: 'img',
cdn_host: 'http://www.tortue.me/emoji',
emoji_image_extension: 'png',
emoticons_enabled: true,
people_enabled: true,
nature_enabled: true,
objects_enabled: true,
places_enabled: true,
symbols_enabled: true
},
setConfig: function (newConfig) {
this.config.emojify_tag_type = typeof newConfig.emojify_tag_type !== 'undefined' ? newConfig.emojify_tag_type : this.config.emojify_tag_type;
this.config.emoticons_enabled = typeof newConfig.emoticons_enabled !== 'undefined' ? newConfig.emoticons_enabled : this.config.emoticons_enabled;
this.config.people_enabled = typeof newConfig.people_enabled !== 'undefined' ? newConfig.people_enabled : this.config.people_enabled;
this.config.nature_enabled = typeof newConfig.nature_enabled !== 'undefined' ? newConfig.nature_enabled : this.config.nature_enabled;
this.config.objects_enabled = typeof newConfig.objects_enabled !== 'undefined' ? newConfig.objects_enabled : this.config.objects_enabled;
this.config.places_enabled = typeof newConfig.places_enabled !== 'undefined' ? newConfig.places_enabled : this.config.places_enabled;
this.config.symbols_enabled = typeof newConfig.symbols_enabled !== 'undefined' ? newConfig.symbols_enabled : this.config.symbols_enabled;
this.config.cdn_host = typeof newConfig.cdn_host !== 'undefined' ? newConfig.cdn_host : this.config.cdn_host;
this.config.emoji_image_extension = typeof newConfig.emoji_image_extension !== 'undefined' ? newConfig.emoji_image_extension : this.config.emoji_image_extension;
},
run: function (el) {
el = el ? el : document.body
var selected_sets = []
if (this.config.people_enabled) selected_sets.push(PEOPLE);
if (this.config.nature_enabled) selected_sets.push(NATURE);
if (this.config.objects_enabled) selected_sets.push(OBJECTS);
if (this.config.places_enabled) selected_sets.push(PLACES);
if (this.config.symbols_enabled) selected_sets.push(SYMBOLS);
if (this.config.emoticons_enabled) selected_sets.push(EMOTICONS);
for (var index = 0; index < selected_sets.length; index++) {
var r;
while (r = selected_sets[index].shift()) {
findText(el, r[0], function (node, match) {
var wrap = document.createElement(this.emojify.config.emojify_tag_type);
wrap.setAttribute('class', r[1]);
title = r[1].replace(/emojify /g, '');
wrap.setAttribute('src', this.emojify.config.cdn_host + "/" + title + "." + this.emojify.config.emoji_image_extension)
wrap.setAttribute('title', ':' + title + ':');
node.splitText(match.index);
node.nextSibling.nodeValue = node.nextSibling.nodeValue.substr(match[0].length, node.nextSibling.nodeValue.length);
wrap.appendChild(node.splitText(match.index));
node.parentNode.insertBefore(wrap, node.nextSibling);
});
}
}
}
};
})();
global.emojify = emojify;
var EMOTICONS = [
[/:-*\)/g, 'emojify blush'],
[/:-*o/gi, 'emojify scream'],
[/(:|;)-*]/g, 'emojify smirk'],
[/(:|;)-*d/gi, 'emojify smiley'],
[/xd/gi, 'emojify stuck_out_tongue_closed_eyes'],
[/:-*p/gi, 'emojify stuck_out_tongue_winking_eye'],
[/:-*(\[|@)/g, 'emojify rage'],
[/:-*\(/g, 'emojify disappointed'],
[/:('|’)-*\(/g, 'emojify sob'],
[/:-*\*/g, 'emojify kissing_heart'],
[/;-*\)/g, 'emojify wink'],
[/:-*\//g, 'emojify pensive'],
[/:-*s/gi, 'emojify confounded'],
[/:-*\|/g, 'emojify flushed'],
[/:-*\$/g, 'emojify relaxed'],
[/:-*x/gi, 'emojify mask'],
[/<3/g, 'emojify heart'],
[/<\/3/g, 'emojify broken_heart']
];
var PEOPLE = [
[/:bowtie:/g, 'emojify bowtie'],
[/:smile:/g, 'emojify smile'],
[/:laughing:/g, 'emojify laughing'],
[/:blush:/g, 'emojify blush'],
[/:smiley:/g, 'emojify smiley'],
[/:relaxed:/g, 'emojify relaxed'],
[/:smirk:/g, 'emojify smirk'],
[/:heart_eyes:/g, 'emojify heart_eyes'],
[/:kissing_heart:/g, 'emojify kissing_heart'],
[/:kissing_closed_eyes:/g, 'emojify kissing_closed_eyes'],
[/:flushed:/g, 'emojify flushed'],
[/:relieved:/g, 'emojify relieved'],
[/:satisfied:/g, 'emojify satisfied'],
[/:grin:/g, 'emojify grin'],
[/:wink:/g, 'emojify wink'],
[/:wink2:/g, 'emojify wink2'],
[/:stuck_out_tongue_winking_eye:/g, 'emojify stuck_out_tongue_winking_eye'],
[/:stuck_out_tongue_closed_eyes:/g, 'emojify stuck_out_tongue_closed_eyes'],
[/:grinning:/g, 'emojify grinning'],
[/:kissing:/g, 'emojify kissing'],
[/:kissing_smiling_eyes:/g, 'emojify kissing_smiling_eyes'],
[/:stuck_out_tongue:/g, 'emojify stuck_out_tongue'],
[/:sleeping:/g, 'emojify sleeping'],
[/:worried:/g, 'emojify worried'],
[/:frowning:/g, 'emojify frowning'],
[/:anguished:/g, 'emojify anguished'],
[/:open_mouth:/g, 'emojify open_mouth'],
[/:grimacing:/g, 'emojify grimacing'],
[/:confused:/g, 'emojify confused'],
[/:hushed:/g, 'emojify hushed'],
[/:expressionless:/g, 'emojify expressionless'],
[/:unamused:/g, 'emojify unamused'],
[/:sweat_smile:/g, 'emojify sweat_smile'],
[/:sweat:/g, 'emojify sweat'],
[/:weary:/g, 'emojify weary'],
[/:pensive:/g, 'emojify pensive'],
[/:disappointed:/g, 'emojify disappointed'],
[/:confounded:/g, 'emojify confounded'],
[/:fearful:/g, 'emojify fearful'],
[/:cold_sweat:/g, 'emojify cold_sweat'],
[/:persevere:/g, 'emojify persevere'],
[/:cry:/g, 'emojify cry'],
[/:sob:/g, 'emojify sob'],
[/:joy:/g, 'emojify joy'],
[/:scream:/g, 'emojify scream'],
[/:astonished:/g, 'emojify astonished'],
[/:neckbeard:/g, 'emojify neckbeard'],
[/:tired_face:/g, 'emojify tired_face'],
[/:angry:/g, 'emojify angry'],
[/:rage:/g, 'emojify rage'],
[/:triumph:/g, 'emojify triumph'],
[/:sleepy:/g, 'emojify sleepy'],
[/:yum:/g, 'emojify yum'],
[/:mask:/g, 'emojify mask'],
[/:sunglasses:/g, 'emojify sunglasses'],
[/:dizzy_face:/g, 'emojify dizzy_face'],
[/:imp:/g, 'emojify imp'],
[/:smiling_imp:/g, 'emojify smiling_imp'],
[/:neutral_face:/g, 'emojify neutral_face'],
[/:no_mouth:/g, 'emojify no_mouth'],
[/:innocent:/g, 'emojify innocent'],
[/:alien:/g, 'emojify alien'],
[/:yellow_heart:/g, 'emojify yellow_heart'],
[/:blue_heart:/g, 'emojify blue_heart'],
[/:purple_heart:/g, 'emojify purple_heart'],
[/:heart:/g, 'emojify heart'],
[/:green_heart:/g, 'emojify green_heart'],
[/:broken_heart:/g, 'emojify broken_heart'],
[/:heartbeat:/g, 'emojify heartbeat'],
[/:heartpulse:/g, 'emojify heartpulse'],
[/:two_hearts:/g, 'emojify two_hearts'],
[/:revolving_hearts:/g, 'emojify revolving_hearts'],
[/:cupid:/g, 'emojify cupid'],
[/:sparkling_heart:/g, 'emojify sparkling_heart'],
[/:sparkles:/g, 'emojify sparkles'],
[/:star:/g, 'emojify star'],
[/:star2:/g, 'emojify star2'],
[/:dizzy:/g, 'emojify dizzy'],
[/:boom:/g, 'emojify boom'],
[/:collision:/g, 'emojify collision'],
[/:anger:/g, 'emojify anger'],
[/:exclamation:/g, 'emojify exclamation'],
[/:question:/g, 'emojify question'],
[/:grey_exclamation:/g, 'emojify grey_exclamation'],
[/:grey_question:/g, 'emojify grey_question'],
[/:zzz:/g, 'emojify zzz'],
[/:dash:/g, 'emojify dash'],
[/:sweat_drops:/g, 'emojify sweat_drops'],
[/:notes:/g, 'emojify notes'],
[/:musical_note:/g, 'emojify musical_note'],
[/:fire:/g, 'emojify fire'],
[/:hankey:/g, 'emojify hankey'],
[/:poop:/g, 'emojify poop'],
[/:shit:/g, 'emojify shit'],
[/:thumbsup:|:\+1:/g, 'emojify thumbsup'],
[/:thumbsdown:|:-1:/g, 'emojify thumbsdown'],
[/:ok_hand:/g, 'emojify ok_hand'],
[/:punch:/g, 'emojify punch'],
[/:facepunch:/g, 'emojify facepunch'],
[/:fist:/g, 'emojify fist'],
[/:v:/g, 'emojify v'],
[/:wave:/g, 'emojify wave'],
[/:hand:/g, 'emojify hand'],
[/:open_hands:/g, 'emojify open_hands'],
[/:point_up:/g, 'emojify point_up'],
[/:point_down:/g, 'emojify point_down'],
[/:point_left:/g, 'emojify point_left'],
[/:point_right:/g, 'emojify point_right'],
[/:raised_hands:/g, 'emojify raised_hands'],
[/:pray:/g, 'emojify pray'],
[/:point_up_2:/g, 'emojify point_up_2'],
[/:clap:/g, 'emojify clap'],
[/:muscle:/g, 'emojify muscle'],
[/:metal:/g, 'emojify metal'],
[/:walking:/g, 'emojify walking'],
[/:runner:/g, 'emojify runner'],
[/:running:/g, 'emojify running'],
[/:couple:/g, 'emojify couple'],
[/:family:/g, 'emojify family'],
[/:two_men_holding_hands:/g, 'emojify two_men_holding_hands'],
[/:two_women_holding_hands:/g, 'emojify two_women_holding_hands'],
[/:dancer:/g, 'emojify dancer'],
[/:dancers:/g, 'emojify dancers'],
[/:ok_woman:/g, 'emojify ok_woman'],
[/:no_good:/g, 'emojify no_good'],
[/:information_desk_person:/g, 'emojify information_desk_person'],
[/:raised_hand:/g, 'emojify raised_hand'],
[/:bride_with_veil:/g, 'emojify bride_with_veil'],
[/:person_with_pouting_face:/g, 'emojify person_with_pouting_face'],
[/:person_frowning:/g, 'emojify person_frowning'],
[/:bow:/g, 'emojify bow'],
[/:couplekiss:/g, 'emojify couplekiss'],
[/:couple_with_heart:/g, 'emojify couple_with_heart'],
[/:massage:/g, 'emojify massage'],
[/:haircut:/g, 'emojify haircut'],
[/:nail_care:/g, 'emojify nail_care'],
[/:boy:/g, 'emojify boy'],
[/:girl:/g, 'emojify girl'],
[/:woman:/g, 'emojify woman'],
[/:man:/g, 'emojify man'],
[/:baby:/g, 'emojify baby'],
[/:older_woman:/g, 'emojify older_woman'],
[/:older_man:/g, 'emojify older_man'],
[/:person_with_blond_hair:/g, 'emojify person_with_blond_hair'],
[/:man_with_gua_pi_mao:/g, 'emojify man_with_gua_pi_mao'],
[/:man_with_turban:/g, 'emojify man_with_turban'],
[/:construction_worker:/g, 'emojify construction_worker'],
[/:cop:/g, 'emojify cop'],
[/:angel:/g, 'emojify angel'],
[/:princess:/g, 'emojify princess'],
[/:smiley_cat:/g, 'emojify smiley_cat'],
[/:smile_cat:/g, 'emojify smile_cat'],
[/:heart_eyes_cat:/g, 'emojify heart_eyes_cat'],
[/:kissing_cat:/g, 'emojify kissing_cat'],
[/:smirk_cat:/g, 'emojify smirk_cat'],
[/:scream_cat:/g, 'emojify scream_cat'],
[/:crying_cat_face:/g, 'emojify crying_cat_face'],
[/:joy_cat:/g, 'emojify joy_cat'],
[/:pouting_cat:/g, 'emojify pouting_cat'],
[/:japanese_ogre:/g, 'emojify japanese_ogre'],
[/:japanese_goblin:/g, 'emojify japanese_goblin'],
[/:see_no_evil:/g, 'emojify see_no_evil'],
[/:hear_no_evil:/g, 'emojify hear_no_evil'],
[/:speak_no_evil:/g, 'emojify speak_no_evil'],
[/:guardsman:/g, 'emojify guardsman'],
[/:skull:/g, 'emojify skull'],
[/:feet:/g, 'emojify feet'],
[/:lips:/g, 'emojify lips'],
[/:kiss:/g, 'emojify kiss'],
[/:droplet:/g, 'emojify droplet'],
[/:ear:/g, 'emojify ear'],
[/:eyes:/g, 'emojify eyes'],
[/:nose:/g, 'emojify nose'],
[/:tongue:/g, 'emojify tongue'],
[/:love_letter:/g, 'emojify love_letter'],
[/:bust_in_silhouette:/g, 'emojify bust_in_silhouette'],
[/:busts_in_silhouette:/g, 'emojify busts_in_silhouette'],
[/:speech_balloon:/g, 'emojify speech_balloon'],
[/:thought_balloon:/g, 'emojify thought_balloon'],
[/:feelsgood:/g, 'emojify feelsgood'],
[/:finnadie:/g, 'emojify finnadie'],
[/:goberserk:/g, 'emojify goberserk'],
[/:godmode:/g, 'emojify godmode'],
[/:hurtrealbad:/g, 'emojify hurtrealbad'],
[/:rage1:/g, 'emojify rage1'],
[/:rage2:/g, 'emojify rage2'],
[/:rage3:/g, 'emojify rage3'],
[/:rage4:/g, 'emojify rage4'],
[/:suspect:/g, 'emojify suspect'],
[/:trollface:/g, 'emojify trollface']
];
var NATURE = [
[/:sunny:/g, 'emojify sunny'],
[/:umbrella:/g, 'emojify umbrella'],
[/:cloud:/g, 'emojify cloud'],
[/:snowflake:/g, 'emojify snowflake'],
[/:snowman:/g, 'emojify snowman'],
[/:zap:/g, 'emojify zap'],
[/:cyclone:/g, 'emojify cyclone'],
[/:foggy:/g, 'emojify foggy'],
[/:ocean:/g, 'emojify ocean'],
[/:cat:/g, 'emojify cat'],
[/:dog:/g, 'emojify dog'],
[/:mouse:/g, 'emojify mouse'],
[/:hamster:/g, 'emojify hamster'],
[/:rabbit:/g, 'emojify rabbit'],
[/:wolf:/g, 'emojify wolf'],
[/:frog:/g, 'emojify frog'],
[/:tiger:/g, 'emojify tiger'],
[/:koala:/g, 'emojify koala'],
[/:bear:/g, 'emojify bear'],
[/:pig:/g, 'emojify pig'],
[/:pig_nose:/g, 'emojify pig_nose'],
[/:cow:/g, 'emojify cow'],
[/:boar:/g, 'emojify boar'],
[/:monkey_face:/g, 'emojify monkey_face'],
[/:monkey:/g, 'emojify monkey'],
[/:horse:/g, 'emojify horse'],
[/:racehorse:/g, 'emojify racehorse'],
[/:camel:/g, 'emojify camel'],
[/:sheep:/g, 'emojify sheep'],
[/:elephant:/g, 'emojify elephant'],
[/:panda_face:/g, 'emojify panda_face'],
[/:snake:/g, 'emojify snake'],
[/:bird:/g, 'emojify bird'],
[/:baby_chick:/g, 'emojify baby_chick'],
[/:hatched_chick:/g, 'emojify hatched_chick'],
[/:hatching_chick:/g, 'emojify hatching_chick'],
[/:chicken:/g, 'emojify chicken'],
[/:penguin:/g, 'emojify penguin'],
[/:turtle:/g, 'emojify turtle'],
[/:bug:/g, 'emojify bug'],
[/:honeybee:/g, 'emojify honeybee'],
[/:ant:/g, 'emojify ant'],
[/:beetle:/g, 'emojify beetle'],
[/:snail:/g, 'emojify snail'],
[/:octopus:/g, 'emojify octopus'],
[/:tropical_fish:/g, 'emojify tropical_fish'],
[/:fish:/g, 'emojify fish'],
[/:whale:/g, 'emojify whale'],
[/:whale2:/g, 'emojify whale2'],
[/:dolphin:/g, 'emojify dolphin'],
[/:cow2:/g, 'emojify cow2'],
[/:ram:/g, 'emojify ram'],
[/:rat:/g, 'emojify rat'],
[/:water_buffalo:/g, 'emojify water_buffalo'],
[/:tiger2:/g, 'emojify tiger2'],
[/:rabbit2:/g, 'emojify rabbit2'],
[/:dragon:/g, 'emojify dragon'],
[/:goat:/g, 'emojify goat'],
[/:rooster:/g, 'emojify rooster'],
[/:dog2:/g, 'emojify dog2'],
[/:pig2:/g, 'emojify pig2'],
[/:mouse2:/g, 'emojify mouse2'],
[/:ox:/g, 'emojify ox'],
[/:dragon_face:/g, 'emojify dragon_face'],
[/:blowfish:/g, 'emojify blowfish'],
[/:crocodile:/g, 'emojify crocodile'],
[/:dromedary_camel:/g, 'emojify dromedary_camel'],
[/:leopard:/g, 'emojify leopard'],
[/:cat2:/g, 'emojify cat2'],
[/:poodle:/g, 'emojify poodle'],
[/:paw_prints:/g, 'emojify paw_prints'],
[/:bouquet:/g, 'emojify bouquet'],
[/:cherry_blossom:/g, 'emojify cherry_blossom'],
[/:tulip:/g, 'emojify tulip'],
[/:four_leaf_clover:/g, 'emojify four_leaf_clover'],
[/:rose:/g, 'emojify rose'],
[/:sunflower:/g, 'emojify sunflower'],
[/:hibiscus:/g, 'emojify hibiscus'],
[/:maple_leaf:/g, 'emojify maple_leaf'],
[/:leaves:/g, 'emojify leaves'],
[/:fallen_leaf:/g, 'emojify fallen_leaf'],
[/:herb:/g, 'emojify herb'],
[/:mushroom:/g, 'emojify mushroom'],
[/:cactus:/g, 'emojify cactus'],
[/:palm_tree:/g, 'emojify palm_tree'],
[/:evergreen_tree:/g, 'emojify evergreen_tree'],
[/:deciduous_tree:/g, 'emojify deciduous_tree'],
[/:chestnut:/g, 'emojify chestnut'],
[/:seedling:/g, 'emojify seedling'],
[/:blossom:/g, 'emojify blossom'],
[/:ear_of_rice:/g, 'emojify ear_of_rice'],
[/:shell:/g, 'emojify shell'],
[/:globe_with_meridians:/g, 'emojify globe_with_meridians'],
[/:sun_with_face:/g, 'emojify sun_with_face'],
[/:full_moon_with_face:/g, 'emojify full_moon_with_face'],
[/:new_moon_with_face:/g, 'emojify new_moon_with_face'],
[/:new_moon:/g, 'emojify new_moon'],
[/:waxing_crescent_moon:/g, 'emojify waxing_crescent_moon'],
[/:first_quarter_moon:/g, 'emojify first_quarter_moon'],
[/:waxing_gibbous_moon:/g, 'emojify waxing_gibbous_moon'],
[/:full_moon:/g, 'emojify full_moon'],
[/:waning_gibbous_moon:/g, 'emojify waning_gibbous_moon'],
[/:last_quarter_moon:/g, 'emojify last_quarter_moon'],
[/:waning_crescent_moon:/g, 'emojify waning_crescent_moon'],
[/:last_quarter_moon_with_face:/g, 'emojify last_quarter_moon_with_face'],
[/:first_quarter_moon_with_face:/g, 'emojify first_quarter_moon_with_face'],
[/:moon:/g, 'emojify moon'],
[/:earth_africa:/g, 'emojify earth_africa'],
[/:earth_americas:/g, 'emojify earth_americas'],
[/:earth_asia:/g, 'emojify earth_asia'],
[/:volcano:/g, 'emojify volcano'],
[/:milky_way:/g, 'emojify milky_way'],
[/:partly_sunny:/g, 'emojify partly_sunny'],
[/:octocat:/g, 'emojify octocat'],
[/:squirrel:/g, 'emojify squirrel']
];
var OBJECTS = [
[/:bamboo:/g, 'emojify bamboo'],
[/:gift_heart:/g, 'emojify gift_heart'],
[/:dolls:/g, 'emojify dolls'],
[/:school_satchel:/g, 'emojify school_satchel'],
[/:mortar_board:/g, 'emojify mortar_board'],
[/:flags:/g, 'emojify flags'],
[/:fireworks:/g, 'emojify fireworks'],
[/:sparkler:/g, 'emojify sparkler'],
[/:wind_chime:/g, 'emojify wind_chime'],
[/:rice_scene:/g, 'emojify rice_scene'],
[/:jack_o_lantern:/g, 'emojify jack_o_lantern'],
[/:ghost:/g, 'emojify ghost'],
[/:santa:/g, 'emojify santa'],
[/:christmas_tree:/g, 'emojify christmas_tree'],
[/:gift:/g, 'emojify gift'],
[/:bell:/g, 'emojify bell'],
[/:no_bell:/g, 'emojify no_bell'],
[/:tanabata_tree:/g, 'emojify tanabata_tree'],
[/:tada:/g, 'emojify tada'],
[/:confetti_ball:/g, 'emojify confetti_ball'],
[/:balloon:/g, 'emojify balloon'],
[/:crystal_ball:/g, 'emojify crystal_ball'],
[/:cd:/g, 'emojify cd'],
[/:dvd:/g, 'emojify dvd'],
[/:floppy_disk:/g, 'emojify floppy_disk'],
[/:camera:/g, 'emojify camera'],
[/:video_camera:/g, 'emojify video_camera'],
[/:movie_camera:/g, 'emojify movie_camera'],
[/:computer:/g, 'emojify computer'],
[/:tv:/g, 'emojify tv'],
[/:iphone:/g, 'emojify iphone'],
[/:phone:/g, 'emojify phone'],
[/:telephone:/g, 'emojify telephone'],
[/:telephone_receiver:/g, 'emojify telephone_receiver'],
[/:pager:/g, 'emojify pager'],
[/:fax:/g, 'emojify fax'],
[/:minidisc:/g, 'emojify minidisc'],
[/:vhs:/g, 'emojify vhs'],
[/:sound:/g, 'emojify sound'],
[/:speaker:/g, 'emojify speaker'],
[/:mute:/g, 'emojify mute'],
[/:loudspeaker:/g, 'emojify loudspeaker'],
[/:mega:/g, 'emojify mega'],
[/:hourglass:/g, 'emojify hourglass'],
[/:hourglass_flowing_sand:/g, 'emojify hourglass_flowing_sand'],
[/:alarm_clock:/g, 'emojify alarm_clock'],
[/:watch:/g, 'emojify watch'],
[/:radio:/g, 'emojify radio'],
[/:satellite:/g, 'emojify satellite'],
[/:loop:/g, 'emojify loop'],
[/:mag:/g, 'emojify mag'],
[/:mag_right:/g, 'emojify mag_right'],
[/:unlock:/g, 'emojify unlock'],
[/:lock:/g, 'emojify lock'],
[/:lock_with_ink_pen:/g, 'emojify lock_with_ink_pen'],
[/:closed_lock_with_key:/g, 'emojify closed_lock_with_key'],
[/:key:/g, 'emojify key'],
[/:bulb:/g, 'emojify bulb'],
[/:flashlight:/g, 'emojify flashlight'],
[/:high_brightness:/g, 'emojify high_brightness'],
[/:low_brightness:/g, 'emojify low_brightness'],
[/:electric_plug:/g, 'emojify electric_plug'],
[/:battery:/g, 'emojify battery'],
[/:calling:/g, 'emojify calling'],
[/:email:/g, 'emojify email'],
[/:mailbox:/g, 'emojify mailbox'],
[/:postbox:/g, 'emojify postbox'],
[/:bath:/g, 'emojify bath'],
[/:bathtub:/g, 'emojify bathtub'],
[/:shower:/g, 'emojify shower'],
[/:toilet:/g, 'emojify toilet'],
[/:wrench:/g, 'emojify wrench'],
[/:nut_and_bolt:/g, 'emojify nut_and_bolt'],
[/:hammer:/g, 'emojify hammer'],
[/:seat:/g, 'emojify seat'],
[/:moneybag:/g, 'emojify moneybag'],
[/:yen:/g, 'emojify yen'],
[/:dollar:/g, 'emojify dollar'],
[/:pound:/g, 'emojify pound'],
[/:euro:/g, 'emojify euro'],
[/:credit_card:/g, 'emojify credit_card'],
[/:money_with_wings:/g, 'emojify money_with_wings'],
[/:e-mail:/g, 'emojify e-mail'],
[/:inbox_tray:/g, 'emojify inbox_tray'],
[/:outbox_tray:/g, 'emojify outbox_tray'],
[/:envelope:/g, 'emojify envelope'],
[/:incoming_envelope:/g, 'emojify incoming_envelope'],
[/:postal_horn:/g, 'emojify postal_horn'],
[/:mailbox_closed:/g, 'emojify mailbox_closed'],
[/:mailbox_with_mail:/g, 'emojify mailbox_with_mail'],
[/:mailbox_with_no_mail:/g, 'emojify mailbox_with_no_mail'],
[/:door:/g, 'emojify door'],
[/:smoking:/g, 'emojify smoking'],
[/:bomb:/g, 'emojify bomb'],
[/:gun:/g, 'emojify gun'],
[/:hocho:/g, 'emojify hocho'],
[/:pill:/g, 'emojify pill'],
[/:syringe:/g, 'emojify syringe'],
[/:page_facing_up:/g, 'emojify page_facing_up'],
[/:page_with_curl:/g, 'emojify page_with_curl'],
[/:bookmark_tabs:/g, 'emojify bookmark_tabs'],
[/:bar_chart:/g, 'emojify bar_chart'],
[/:chart_with_upwards_trend:/g, 'emojify chart_with_upwards_trend'],
[/:chart_with_downwards_trend:/g, 'emojify chart_with_downwards_trend'],
[/:scroll:/g, 'emojify scroll'],
[/:clipboard:/g, 'emojify clipboard'],
[/:calendar:/g, 'emojify calendar'],
[/:date:/g, 'emojify date'],
[/:card_index:/g, 'emojify card_index'],
[/:file_folder:/g, 'emojify file_folder'],
[/:open_file_folder:/g, 'emojify open_file_folder'],
[/:scissors:/g, 'emojify scissors'],
[/:pushpin:/g, 'emojify pushpin'],
[/:paperclip:/g, 'emojify paperclip'],
[/:black_nib:/g, 'emojify black_nib'],
[/:pencil2:/g, 'emojify pencil2'],
[/:straight_ruler:/g, 'emojify straight_ruler'],
[/:triangular_ruler:/g, 'emojify triangular_ruler'],
[/:closed_book:/g, 'emojify closed_book'],
[/:green_book:/g, 'emojify green_book'],
[/:blue_book:/g, 'emojify blue_book'],
[/:orange_book:/g, 'emojify orange_book'],
[/:notebook:/g, 'emojify notebook'],
[/:notebook_with_decorative_cover:/g, 'emojify notebook_with_decorative_cover'],
[/:ledger:/g, 'emojify ledger'],
[/:books:/g, 'emojify books'],
[/:bookmark:/g, 'emojify bookmark'],
[/:name_badge:/g, 'emojify name_badge'],
[/:microscope:/g, 'emojify microscope'],
[/:telescope:/g, 'emojify telescope'],
[/:newspaper:/g, 'emojify newspaper'],
[/:football:/g, 'emojify football'],
[/:basketball:/g, 'emojify basketball'],
[/:soccer:/g, 'emojify soccer'],
[/:baseball:/g, 'emojify baseball'],
[/:tennis:/g, 'emojify tennis'],
[/:8ball:/g, 'emojify eightball'],
[/:rugby_football:/g, 'emojify rugby_football'],
[/:bowling:/g, 'emojify bowling'],
[/:golf:/g, 'emojify golf'],
[/:mountain_bicyclist:/g, 'emojify mountain_bicyclist'],
[/:bicyclist:/g, 'emojify bicyclist'],
[/:horse_racing:/g, 'emojify horse_racing'],
[/:snowboarder:/g, 'emojify snowboarder'],
[/:swimmer:/g, 'emojify swimmer'],
[/:surfer:/g, 'emojify surfer'],
[/:ski:/g, 'emojify ski'],
[/:spades:/g, 'emojify spades'],
[/:hearts:/g, 'emojify hearts'],
[/:clubs:/g, 'emojify clubs'],
[/:diamonds:/g, 'emojify diamonds'],
[/:gem:/g, 'emojify gem'],
[/:ring:/g, 'emojify ring'],
[/:trophy:/g, 'emojify trophy'],
[/:musical_score:/g, 'emojify musical_score'],
[/:musical_keyboard:/g, 'emojify musical_keyboard'],
[/:violin:/g, 'emojify violin'],
[/:space_invader:/g, 'emojify space_invader'],
[/:video_game:/g, 'emojify video_game'],
[/:black_joker:/g, 'emojify black_joker'],
[/:flower_playing_cards:/g, 'emojify flower_playing_cards'],
[/:game_die:/g, 'emojify game_die'],
[/:dart:/g, 'emojify dart'],
[/:mahjong:/g, 'emojify mahjong'],
[/:clapper:/g, 'emojify clapper'],
[/:memo:/g, 'emojify memo'],
[/:pencil:/g, 'emojify pencil'],
[/:book:/g, 'emojify book'],
[/:art:/g, 'emojify art'],
[/:microphone:/g, 'emojify microphone'],
[/:headphones:/g, 'emojify headphones'],
[/:trumpet:/g, 'emojify trumpet'],
[/:saxophone:/g, 'emojify saxophone'],
[/:guitar:/g, 'emojify guitar'],
[/:shoe:/g, 'emojify shoe'],
[/:sandal:/g, 'emojify sandal'],
[/:high_heel:/g, 'emojify high_heel'],
[/:lipstick:/g, 'emojify lipstick'],
[/:boot:/g, 'emojify boot'],
[/:shirt:/g, 'emojify shirt'],
[/:tshirt:/g, 'emojify tshirt'],
[/:necktie:/g, 'emojify necktie'],
[/:womans_clothes:/g, 'emojify womans_clothes'],
[/:dress:/g, 'emojify dress'],
[/:running_shirt_with_sash:/g, 'emojify running_shirt_with_sash'],
[/:jeans:/g, 'emojify jeans'],
[/:kimono:/g, 'emojify kimono'],
[/:bikini:/g, 'emojify bikini'],
[/:ribbon:/g, 'emojify ribbon'],
[/:tophat:/g, 'emojify tophat'],
[/:crown:/g, 'emojify crown'],
[/:womans_hat:/g, 'emojify womans_hat'],
[/:mans_shoe:/g, 'emojify mans_shoe'],
[/:closed_umbrella:/g, 'emojify closed_umbrella'],
[/:briefcase:/g, 'emojify briefcase'],
[/:handbag:/g, 'emojify handbag'],
[/:pouch:/g, 'emojify pouch'],
[/:purse:/g, 'emojify purse'],
[/:eyeglasses:/g, 'emojify eyeglasses'],
[/:fishing_pole_and_fish:/g, 'emojify fishing_pole_and_fish'],
[/:coffee:/g, 'emojify coffee'],
[/:tea:/g, 'emojify tea'],
[/:sake:/g, 'emojify sake'],
[/:baby_bottle:/g, 'emojify baby_bottle'],
[/:beer:/g, 'emojify beer'],
[/:beers:/g, 'emojify beers'],
[/:cocktail:/g, 'emojify cocktail'],
[/:tropical_drink:/g, 'emojify tropical_drink'],
[/:wine_glass:/g, 'emojify wine_glass'],
[/:fork_and_knife:/g, 'emojify fork_and_knife'],
[/:pizza:/g, 'emojify pizza'],
[/:hamburger:/g, 'emojify hamburger'],
[/:fries:/g, 'emojify fries'],
[/:poultry_leg:/g, 'emojify poultry_leg'],
[/:meat_on_bone:/g, 'emojify meat_on_bone'],
[/:spaghetti:/g, 'emojify spaghetti'],
[/:curry:/g, 'emojify curry'],
[/:fried_shrimp:/g, 'emojify fried_shrimp'],
[/:bento:/g, 'emojify bento'],
[/:sushi:/g, 'emojify sushi'],
[/:fish_cake:/g, 'emojify fish_cake'],
[/:rice_ball:/g, 'emojify rice_ball'],
[/:rice_cracker:/g, 'emojify rice_cracker'],
[/:rice:/g, 'emojify rice'],
[/:ramen:/g, 'emojify ramen'],
[/:stew:/g, 'emojify stew'],
[/:oden:/g, 'emojify oden'],
[/:dango:/g, 'emojify dango'],
[/:egg:/g, 'emojify egg'],
[/:bread:/g, 'emojify bread'],
[/:doughnut:/g, 'emojify doughnut'],
[/:custard:/g, 'emojify custard'],
[/:icecream:/g, 'emojify icecream'],
[/:ice_cream:/g, 'emojify ice_cream'],
[/:shaved_ice:/g, 'emojify shaved_ice'],
[/:birthday:/g, 'emojify birthday'],
[/:cake:/g, 'emojify cake'],
[/:cookie:/g, 'emojify cookie'],
[/:chocolate_bar:/g, 'emojify chocolate_bar'],
[/:candy:/g, 'emojify candy'],
[/:lollipop:/g, 'emojify lollipop'],
[/:honey_pot:/g, 'emojify honey_pot'],
[/:apple:/g, 'emojify apple'],
[/:green_apple:/g, 'emojify green_apple'],
[/:tangerine:/g, 'emojify tangerine'],
[/:lemon:/g, 'emojify lemon'],
[/:cherries:/g, 'emojify cherries'],
[/:grapes:/g, 'emojify grapes'],
[/:watermelon:/g, 'emojify watermelon'],
[/:strawberry:/g, 'emojify strawberry'],
[/:peach:/g, 'emojify peach'],
[/:melon:/g, 'emojify melon'],
[/:banana:/g, 'emojify banana'],
[/:pear:/g, 'emojify pear'],
[/:pineapple:/g, 'emojify pineapple'],
[/:sweet_potato:/g, 'emojify sweet_potato'],
[/:eggplant:/g, 'emojify eggplant'],
[/:tomato:/g, 'emojify tomato'],
[/:corn:/g, 'emojify corn']
];
var PLACES = [
[/:109:/g, 'emojify onezeronine'],
[/:house:/g, 'emojify house'],
[/:house_with_garden:/g, 'emojify house_with_garden'],
[/:school:/g, 'emojify school'],
[/:office:/g, 'emojify office'],
[/:post_office:/g, 'emojify post_office'],
[/:hospital:/g, 'emojify hospital'],
[/:bank:/g, 'emojify bank'],
[/:convenience_store:/g, 'emojify convenience_store'],
[/:love_hotel:/g, 'emojify love_hotel'],
[/:hotel:/g, 'emojify hotel'],
[/:wedding:/g, 'emojify wedding'],
[/:church:/g, 'emojify church'],
[/:department_store:/g, 'emojify department_store'],
[/:european_post_office:/g, 'emojify european_post_office'],
[/:city_sunrise:/g, 'emojify city_sunrise'],
[/:city_sunset:/g, 'emojify city_sunset'],
[/:japanese_castle:/g, 'emojify japanese_castle'],
[/:european_castle:/g, 'emojify european_castle'],
[/:tent:/g, 'emojify tent'],
[/:factory:/g, 'emojify factory'],
[/:tokyo_tower:/g, 'emojify tokyo_tower'],
[/:japan:/g, 'emojify japan'],
[/:mount_fuji:/g, 'emojify mount_fuji'],
[/:sunrise_over_mountains:/g, 'emojify sunrise_over_mountains'],
[/:sunrise:/g, 'emojify sunrise'],
[/:stars:/g, 'emojify stars'],
[/:statue_of_liberty:/g, 'emojify statue_of_liberty'],
[/:bridge_at_night:/g, 'emojify bridge_at_night'],
[/:carousel_horse:/g, 'emojify carousel_horse'],
[/:rainbow:/g, 'emojify rainbow'],
[/:ferris_wheel:/g, 'emojify ferris_wheel'],
[/:fountain:/g, 'emojify fountain'],
[/:roller_coaster:/g, 'emojify roller_coaster'],
[/:ship:/g, 'emojify ship'],
[/:speedboat:/g, 'emojify speedboat'],
[/:boat:/g, 'emojify boat'],
[/:sailboat:/g, 'emojify sailboat'],
[/:rowboat:/g, 'emojify rowboat'],
[/:anchor:/g, 'emojify anchor'],
[/:rocket:/g, 'emojify rocket'],
[/:airplane:/g, 'emojify airplane'],
[/:helicopter:/g, 'emojify helicopter'],
[/:steam_locomotive:/g, 'emojify steam_locomotive'],
[/:tram:/g, 'emojify tram'],
[/:mountain_railway:/g, 'emojify mountain_railway'],
[/:bike:/g, 'emojify bike'],
[/:aerial_tramway:/g, 'emojify aerial_tramway'],
[/:suspension_railway:/g, 'emojify suspension_railway'],
[/:mountain_cableway:/g, 'emojify mountain_cableway'],
[/:tractor:/g, 'emojify tractor'],
[/:blue_car:/g, 'emojify blue_car'],
[/:oncoming_automobile:/g, 'emojify oncoming_automobile'],
[/:car:/g, 'emojify car'],
[/:red_car:/g, 'emojify red_car'],
[/:taxi:/g, 'emojify taxi'],
[/:oncoming_taxi:/g, 'emojify oncoming_taxi'],
[/:articulated_lorry:/g, 'emojify articulated_lorry'],
[/:bus:/g, 'emojify bus'],
[/:oncoming_bus:/g, 'emojify oncoming_bus'],
[/:rotating_light:/g, 'emojify rotating_light'],
[/:police_car:/g, 'emojify police_car'],
[/:oncoming_police_car:/g, 'emojify oncoming_police_car'],
[/:fire_engine:/g, 'emojify fire_engine'],
[/:ambulance:/g, 'emojify ambulance'],
[/:minibus:/g, 'emojify minibus'],
[/:truck:/g, 'emojify truck'],
[/:train:/g, 'emojify train'],
[/:station:/g, 'emojify station'],
[/:train2:/g, 'emojify train2'],
[/:bullettrain_front:/g, 'emojify bullettrain_front'],
[/:bullettrain_side:/g, 'emojify bullettrain_side'],
[/:light_rail:/g, 'emojify light_rail'],
[/:monorail:/g, 'emojify monorail'],
[/:railway_car:/g, 'emojify railway_car'],
[/:trolleybus:/g, 'emojify trolleybus'],
[/:ticket:/g, 'emojify ticket'],
[/:fuelpump:/g, 'emojify fuelpump'],
[/:vertical_traffic_light:/g, 'emojify vertical_traffic_light'],
[/:traffic_light:/g, 'emojify traffic_light'],
[/:warning:/g, 'emojify warning'],
[/:construction:/g, 'emojify construction'],
[/:beginner:/g, 'emojify beginner'],
[/:atm:/g, 'emojify atm'],
[/:slot_machine:/g, 'emojify slot_machine'],
[/:busstop:/g, 'emojify busstop'],
[/:barber:/g, 'emojify barber'],
[/:hotsprings:/g, 'emojify hotsprings'],
[/:checkered_flag:/g, 'emojify checkered_flag'],
[/:crossed_flags:/g, 'emojify crossed_flags'],
[/:izakaya_lantern:/g, 'emojify izakaya_lantern'],
[/:moyai:/g, 'emojify moyai'],
[/:circus_tent:/g, 'emojify circus_tent'],
[/:performing_arts:/g, 'emojify performing_arts'],
[/:round_pushpin:/g, 'emojify round_pushpin'],
[/:triangular_flag_on_post:/g, 'emojify triangular_flag_on_post'],
[/:jp:/g, 'emojify jp'],
[/:kr:/g, 'emojify kr'],
[/:cn:/g, 'emojify cn'],
[/:us:/g, 'emojify us'],
[/:fr:/g, 'emojify fr'],
[/:es:/g, 'emojify es'],
[/:it:/g, 'emojify it'],
[/:ru:/g, 'emojify ru'],
[/:gb:/g, 'emojify gb'],
[/:uk:/g, 'emojify uk'],
[/:de:/g, 'emojify de']
];
var SYMBOLS = [
[/:one:/g, 'emojify one'],
[/:two:/g, 'emojify two'],
[/:three:/g, 'emojify three'],
[/:four:/g, 'emojify four'],
[/:five:/g, 'emojify five'],
[/:six:/g, 'emojify six'],
[/:seven:/g, 'emojify seven'],
[/:eight:/g, 'emojify eight'],
[/:nine:/g, 'emojify nine'],
[/:keycap_ten:/g, 'emojify keycap_ten'],
[/:1234:/g, 'emojify onetwothreefour'],
[/:zero:/g, 'emojify zero'],
[/:hash:/g, 'emojify hash'],
[/:symbols:/g, 'emojify symbols'],
[/:arrow_backward:/g, 'emojify arrow_backward'],
[/:arrow_down:/g, 'emojify arrow_down'],
[/:arrow_forward:/g, 'emojify arrow_forward'],
[/:arrow_left:/g, 'emojify arrow_left'],
[/:capital_abcd:/g, 'emojify capital_abcd'],
[/:abcd:/g, 'emojify abcd'],
[/:abc:/g, 'emojify abc'],
[/:arrow_lower_left:/g, 'emojify arrow_lower_left'],
[/:arrow_lower_right:/g, 'emojify arrow_lower_right'],
[/:arrow_right:/g, 'emojify arrow_right'],
[/:arrow_up:/g, 'emojify arrow_up'],
[/:arrow_upper_left:/g, 'emojify arrow_upper_left'],
[/:arrow_upper_right:/g, 'emojify arrow_upper_right'],
[/:arrow_double_down:/g, 'emojify arrow_double_down'],
[/:arrow_double_up:/g, 'emojify arrow_double_up'],
[/:arrow_down_small:/g, 'emojify arrow_down_small'],
[/:arrow_heading_down:/g, 'emojify arrow_heading_down'],
[/:arrow_heading_up:/g, 'emojify arrow_heading_up'],
[/:leftwards_arrow_with_hook:/g, 'emojify leftwards_arrow_with_hook'],
[/:arrow_right_hook:/g, 'emojify arrow_right_hook'],
[/:left_right_arrow:/g, 'emojify left_right_arrow'],
[/:arrow_up_down:/g, 'emojify arrow_up_down'],
[/:arrow_up_small:/g, 'emojify arrow_up_small'],
[/:arrows_clockwise:/g, 'emojify arrows_clockwise'],
[/:arrows_counterclockwise:/g, 'emojify arrows_counterclockwise'],
[/:rewind:/g, 'emojify rewind'],
[/:fast_forward:/g, 'emojify fast_forward'],
[/:information_source:/g, 'emojify information_source'],
[/:ok:/g, 'emojify ok'],
[/:twisted_rightwards_arrows:/g, 'emojify twisted_rightwards_arrows'],
[/:repeat:/g, 'emojify repeat'],
[/:repeat_one:/g, 'emojify repeat_one'],
[/:new:/g, 'emojify new'],
[/:top:/g, 'emojify top'],
[/:up:/g, 'emojify up'],
[/:cool:/g, 'emojify cool'],
[/:free:/g, 'emojify free'],
[/:ng:/g, 'emojify ng'],
[/:cinema:/g, 'emojify cinema'],
[/:koko:/g, 'emojify koko'],
[/:signal_strength:/g, 'emojify signal_strength'],
[/:u5272:/g, 'emojify u5272'],
[/:u5408:/g, 'emojify u5408'],
[/:u55b6:/g, 'emojify u55b6'],
[/:u6307:/g, 'emojify u6307'],
[/:u6708:/g, 'emojify u6708'],
[/:u6709:/g, 'emojify u6709'],
[/:u6e80:/g, 'emojify u6e80'],
[/:u7121:/g, 'emojify u7121'],
[/:u7533:/g, 'emojify u7533'],
[/:u7a7a:/g, 'emojify u7a7a'],
[/:u7981:/g, 'emojify u7981'],
[/:sa:/g, 'emojify sa'],
[/:restroom:/g, 'emojify restroom'],
[/:mens:/g, 'emojify mens'],
[/:womens:/g, 'emojify womens'],
[/:baby_symbol:/g, 'emojify baby_symbol'],
[/:no_smoking:/g, 'emojify no_smoking'],
[/:parking:/g, 'emojify parking'],
[/:wheelchair:/g, 'emojify wheelchair'],
[/:metro:/g, 'emojify metro'],
[/:baggage_claim:/g, 'emojify baggage_claim'],
[/:accept:/g, 'emojify accept'],
[/:wc:/g, 'emojify wc'],
[/:potable_water:/g, 'emojify potable_water'],
[/:put_litter_in_its_place:/g, 'emojify put_litter_in_its_place'],
[/:secret:/g, 'emojify secret'],
[/:congratulations:/g, 'emojify congratulations'],
[/:m:/g, 'emojify m'],
[/:passport_control:/g, 'emojify passport_control'],
[/:left_luggage:/g, 'emojify left_luggage'],
[/:customs:/g, 'emojify customs'],
[/:ideograph_advantage:/g, 'emojify ideograph_advantage'],
[/:cl:/g, 'emojify cl'],
[/:sos:/g, 'emojify sos'],
[/:id:/g, 'emojify id'],
[/:no_entry_sign:/g, 'emojify no_entry_sign'],
[/:underage:/g, 'emojify underage'],
[/:no_mobile_phones:/g, 'emojify no_mobile_phones'],
[/:do_not_litter:/g, 'emojify do_not_litter'],
[/:non-potable_water:/g, 'emojify non-potable_water'],
[/:no_bicycles:/g, 'emojify no_bicycles'],
[/:no_pedestrians:/g, 'emojify no_pedestrians'],
[/:children_crossing:/g, 'emojify children_crossing'],
[/:no_entry:/g, 'emojify no_entry'],
[/:eight_spoked_asterisk:/g, 'emojify eight_spoked_asterisk'],
[/:eight_pointed_black_star:/g, 'emojify eight_pointed_black_star'],
[/:heart_decoration:/g, 'emojify heart_decoration'],
[/:vs:/g, 'emojify vs'],
[/:vibration_mode:/g, 'emojify vibration_mode'],
[/:mobile_phone_off:/g, 'emojify mobile_phone_off'],
[/:chart:/g, 'emojify chart'],
[/:currency_exchange:/g, 'emojify currency_exchange'],
[/:aries:/g, 'emojify aries'],
[/:taurus:/g, 'emojify taurus'],
[/:gemini:/g, 'emojify gemini'],
[/:cancer:/g, 'emojify cancer'],
[/:leo:/g, 'emojify leo'],
[/:virgo:/g, 'emojify virgo'],
[/:libra:/g, 'emojify libra'],
[/:scorpius:/g, 'emojify scorpius'],
[/:sagittarius:/g, 'emojify sagittarius'],
[/:capricorn:/g, 'emojify capricorn'],
[/:aquarius:/g, 'emojify aquarius'],
[/:pisces:/g, 'emojify pisces'],
[/:ophiuchus:/g, 'emojify ophiuchus'],
[/:six_pointed_star:/g, 'emojify six_pointed_star'],
[/:negative_squared_cross_mark:/g, 'emojify negative_squared_cross_mark'],
[/:a:/g, 'emojify a'],
[/:b:/g, 'emojify b'],
[/:ab:/g, 'emojify ab'],
[/:o2:/g, 'emojify o2'],
[/:diamond_shape_with_a_dot_inside:/g, 'emojify diamond_shape_with_a_dot_inside'],
[/:recycle:/g, 'emojify recycle'],
[/:end:/g, 'emojify end'],
[/:on:/g, 'emojify on'],
[/:soon:/g, 'emojify soon'],
[/:clock1:/g, 'emojify clock1'],
[/:clock130:/g, 'emojify clock130'],
[/:clock10:/g, 'emojify clock10'],
[/:clock1030:/g, 'emojify clock1030'],
[/:clock11:/g, 'emojify clock11'],
[/:clock1130:/g, 'emojify clock1130'],
[/:clock12:/g, 'emojify clock12'],
[/:clock1230:/g, 'emojify clock1230'],
[/:clock2:/g, 'emojify clock2'],
[/:clock230:/g, 'emojify clock230'],
[/:clock3:/g, 'emojify clock3'],
[/:clock330:/g, 'emojify clock330'],
[/:clock4:/g, 'emojify clock4'],
[/:clock430:/g, 'emojify clock430'],
[/:clock5:/g, 'emojify clock5'],
[/:clock530:/g, 'emojify clock530'],
[/:clock6:/g, 'emojify clock6'],
[/:clock630:/g, 'emojify clock630'],
[/:clock7:/g, 'emojify clock7'],
[/:clock730:/g, 'emojify clock730'],
[/:clock8:/g, 'emojify clock8'],
[/:clock830:/g, 'emojify clock830'],
[/:clock9:/g, 'emojify clock9'],
[/:clock930:/g, 'emojify clock930'],
[/:heavy_dollar_sign:/g, 'emojify heavy_dollar_sign'],
[/:copyright:/g, 'emojify copyright'],
[/:registered:/g, 'emojify registered'],
[/:tm:/g, 'emojify tm'],
[/:x:/g, 'emojify x'],
[/:heavy_exclamation_mark:/g, 'emojify heavy_exclamation_mark'],
[/:bangbang:/g, 'emojify bangbang'],
[/:interrobang:/g, 'emojify interrobang'],
[/:o:/g, 'emojify o'],
[/:heavy_multiplication_x:/g, 'emojify heavy_multiplication_x'],
[/:heavy_plus_sign:/g, 'emojify heavy_plus_sign'],
[/:heavy_minus_sign:/g, 'emojify heavy_minus_sign'],
[/:heavy_division_sign:/g, 'emojify heavy_division_sign'],
[/:white_flower:/g, 'emojify white_flower'],
[/:100:/g, 'emojify onehundred'],
[/:heavy_check_mark:/g, 'emojify heavy_check_mark'],
[/:ballot_box_with_check:/g, 'emojify ballot_box_with_check'],
[/:radio_button:/g, 'emojify radio_button'],
[/:link:/g, 'emojify link'],
[/:curly_loop:/g, 'emojify curly_loop'],
[/:wavy_dash:/g, 'emojify wavy_dash'],
[/:part_alternation_mark:/g, 'emojify part_alternation_mark'],
[/:trident:/g, 'emojify trident'],
[/:black_square:/g, 'emojify black_square'],
[/:white_square:/g, 'emojify white_square'],
[/:white_check_mark:/g, 'emojify white_check_mark'],
[/:black_square_button:/g, 'emojify black_square_button'],
[/:white_square_button:/g, 'emojify white_square_button'],
[/:black_circle:/g, 'emojify black_circle'],
[/:white_circle:/g, 'emojify white_circle'],
[/:red_circle:/g, 'emojify red_circle'],
[/:large_blue_circle:/g, 'emojify large_blue_circle'],
[/:large_blue_diamond:/g, 'emojify large_blue_diamond'],
[/:large_orange_diamond:/g, 'emojify large_orange_diamond'],
[/:small_blue_diamond:/g, 'emojify small_blue_diamond'],
[/:small_orange_diamond:/g, 'emojify small_orange_diamond'],
[/:small_red_triangle:/g, 'emojify small_red_triangle'],
[/:small_red_triangle_down:/g, 'emojify small_red_triangle_down'],
[/:shipit:/g, 'emojify shipit']
];
})(this);
/*!
* Sortable.js v0.6
* https://github.com/HubSpot/sortable
*
* Copyright 2013 Adam Schwartz
* Released under the MIT license
*/
(function() {
var SELECTOR, clickEvent, numberRegExp, sortable, touchDevice, trimRegExp;
SELECTOR = 'table[data-sortable]';
numberRegExp = /^-?[£$¤]?[\d,.]+%?$/;
trimRegExp = /^\s+|\s+$/g;
touchDevice = 'ontouchstart' in document.documentElement;
clickEvent = touchDevice ? 'touchstart' : 'click';
sortable = {
init: function() {
var table, tables, _i, _len, _results;
tables = document.querySelectorAll(SELECTOR);
_results = [];
for (_i = 0, _len = tables.length; _i < _len; _i++) {
table = tables[_i];
_results.push(sortable.initTable(table));
}
return _results;
},
initTable: function(table) {
var i, th, ths, _i, _len;
if (table.tHead.rows.length !== 1) {
return;
}
if (table.getAttribute('data-sortable-initialized') === 'true') {
return;
}
table.setAttribute('data-sortable-initialized', 'true');
ths = table.querySelectorAll('th');
for (i = _i = 0, _len = ths.length; _i < _len; i = ++_i) {
th = ths[i];
if (th.getAttribute('data-sortable') !== 'false') {
sortable.setupClickableTH(table, th, i);
}
}
return table;
},
setupClickableTH: function(table, th, i) {
var type;
type = sortable.getColumnType(table, i);
return th.addEventListener(clickEvent, function(e) {
var newSortedDirection, row, rowArray, rowArrayObject, sorted, sortedDirection, tBody, ths, _i, _j, _k, _len, _len1, _len2, _ref, _results;
sorted = this.getAttribute('data-sorted') === 'true';
sortedDirection = this.getAttribute('data-sorted-direction');
if (sorted) {
newSortedDirection = sortedDirection === 'ascending' ? 'descending' : 'ascending';
} else {
newSortedDirection = type.defaultSortDirection;
}
ths = this.parentNode.querySelectorAll('th');
for (_i = 0, _len = ths.length; _i < _len; _i++) {
th = ths[_i];
th.setAttribute('data-sorted', 'false');
th.removeAttribute('data-sorted-direction');
}
this.setAttribute('data-sorted', 'true');
this.setAttribute('data-sorted-direction', newSortedDirection);
tBody = table.tBodies[0];
rowArray = [];
_ref = tBody.rows;
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
row = _ref[_j];
rowArray.push([sortable.getNodeValue(row.cells[i]), row]);
}
if (sorted) {
rowArray.reverse();
} else {
rowArray.sort(type.compare);
}
_results = [];
for (_k = 0, _len2 = rowArray.length; _k < _len2; _k++) {
rowArrayObject = rowArray[_k];
_results.push(tBody.appendChild(rowArrayObject[1]));
}
return _results;
});
},
getColumnType: function(table, i) {
var row, text, _i, _len, _ref;
_ref = table.tBodies[0].rows;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
row = _ref[_i];
text = sortable.getNodeValue(row.cells[i]);
if (text !== '' && text.match(numberRegExp)) {
return sortable.types.numeric;
}
}
return sortable.types.alpha;
},
getNodeValue: function(node) {
if (!node) {
return '';
}
if (node.getAttribute('data-value') !== null) {
return node.getAttribute('data-value');
}
if (typeof node.innerText !== 'undefined') {
return node.innerText.replace(trimRegExp, '');
}
return node.textContent.replace(trimRegExp, '');
},
types: {
numeric: {
defaultSortDirection: 'descending',
compare: function(a, b) {
var aa, bb;
aa = parseFloat(a[0].replace(/[^0-9.-]/g, ''));
bb = parseFloat(b[0].replace(/[^0-9.-]/g, ''));
if (isNaN(aa)) {
aa = 0;
}
if (isNaN(bb)) {
bb = 0;
}
return bb - aa;
}
},
alpha: {
defaultSortDirection: 'ascending',
compare: function(a, b) {
var aa, bb;
aa = a[0].toLowerCase();
bb = b[0].toLowerCase();
if (aa === bb) {
return 0;
}
if (aa < bb) {
return -1;
}
return 1;
}
}
}
};
setTimeout(sortable.init, 0);
window.Sortable = sortable;
}).call(this);
/*!
* Theia Sticky Sidebar v1.2.2
* https://github.com/WeCodePixels/theia-sticky-sidebar
*
* Glues your website's sidebars, making them permanently visible while scrolling.
*
* Copyright 2013-2014 WeCodePixels and other contributors
* Released under the MIT license
*/
(function($) {
$.fn.theiaStickySidebar = function(options) {
var defaults = {
'containerSelector': '',
'additionalMarginTop': 0,
'additionalMarginBottom': 0,
'updateSidebarHeight': true,
'minWidth': 0
};
options = $.extend(defaults, options);
// Validate options
options.additionalMarginTop = parseInt(options.additionalMarginTop) || 0;
options.additionalMarginBottom = parseInt(options.additionalMarginBottom) || 0;
// Add CSS
$('head').append($('<style>.theiaStickySidebar:after {content: ""; display: table; clear: both;}</style>'));
this.each(function() {
var o = {};
o.sidebar = $(this);
// Save options
o.options = options || {};
// Get container
o.container = $(o.options.containerSelector);
if (o.container.size() == 0) {
o.container = o.sidebar.parent();
}
// Create sticky sidebar
o.sidebar.parents().css('-webkit-transform', 'none'); // Fix for WebKit bug - https://code.google.com/p/chromium/issues/detail?id=20574
o.sidebar.css({
'position': 'relative',
'overflow': 'visible',
// The "box-sizing" must be set to "content-box" because we set a fixed height to this element when the sticky sidebar has a fixed position.
'-webkit-box-sizing': 'border-box',
'-moz-box-sizing': 'border-box',
'box-sizing': 'border-box'
});
// Get the sticky sidebar element. If none has been found, then create one.
o.stickySidebar = o.sidebar.find('.theiaStickySidebar');
if (o.stickySidebar.length == 0) {
o.sidebar.find('script').remove(); // Remove <script> tags, otherwise they will be run again on the next line.
o.stickySidebar = $('<div>').addClass('theiaStickySidebar').append(o.sidebar.children());
o.sidebar.append(o.stickySidebar);
}
// Get existing top and bottom margins and paddings
o.marginTop = parseInt(o.sidebar.css('margin-top'));
o.marginBottom = parseInt(o.sidebar.css('margin-bottom'));
o.paddingTop = parseInt(o.sidebar.css('padding-top'));
o.paddingBottom = parseInt(o.sidebar.css('padding-bottom'));
// Add a temporary padding rule to check for collapsable margins.
var collapsedTopHeight = o.stickySidebar.offset().top;
var collapsedBottomHeight = o.stickySidebar.outerHeight();
o.stickySidebar.css('padding-top', 1);
o.stickySidebar.css('padding-bottom', 1);
collapsedTopHeight -= o.stickySidebar.offset().top;
collapsedBottomHeight = o.stickySidebar.outerHeight() - collapsedBottomHeight - collapsedTopHeight;
if (collapsedTopHeight == 0) {
o.stickySidebar.css('padding-top', 0);
o.stickySidebarPaddingTop = 0;
}
else {
o.stickySidebarPaddingTop = 1;
}
if (collapsedBottomHeight == 0) {
o.stickySidebar.css('padding-bottom', 0);
o.stickySidebarPaddingBottom = 0;
}
else {
o.stickySidebarPaddingBottom = 1;
}
// We use this to know whether the user is scrolling up or down.
o.previousScrollTop = null;
// Scroll top (value) when the sidebar has fixed position.
o.fixedScrollTop = 0;
// Set sidebar to default values.
resetSidebar();
o.onScroll = function(o) {
// Stop if the sidebar isn't visible.
if (!o.stickySidebar.is(":visible")) {
return;
}
// Stop if the window is too small.
if ($('body').width() < o.options.minWidth) {
resetSidebar();
return;
}
// Stop if the sidebar width is larger than the container width (e.g. the theme is responsive and the sidebar is now below the content)
if (o.sidebar.outerWidth(true) + 50 > o.container.width()) {
resetSidebar();
return;
}
var scrollTop = $(document).scrollTop();
var position = 'static';
// If the user has scrolled down enough for the sidebar to be clipped at the top, then we can consider changing its position.
if (scrollTop >= o.container.offset().top + (o.paddingTop + o.marginTop - o.options.additionalMarginTop)) {
// The top and bottom offsets, used in various calculations.
var offsetTop = o.paddingTop + o.marginTop + options.additionalMarginTop;
var offsetBottom = o.paddingBottom + o.marginBottom + options.additionalMarginBottom;
// All top and bottom positions are relative to the window, not to the parent elemnts.
var containerTop = o.container.offset().top;
var containerBottom = o.container.offset().top + getClearedHeight(o.container);
// The top and bottom offsets relative to the window screen top (zero) and bottom (window height).
var windowOffsetTop = 0 + options.additionalMarginTop;
var windowOffsetBottom;
var sidebarSmallerThanWindow = (o.stickySidebar.outerHeight() + offsetTop + offsetBottom) < $(window).height();
if (sidebarSmallerThanWindow) {
windowOffsetBottom = windowOffsetTop + o.stickySidebar.outerHeight();
}
else {
windowOffsetBottom = $(window).height() - o.marginBottom - o.paddingBottom - options.additionalMarginBottom;
}
var staticLimitTop = containerTop - scrollTop + o.paddingTop + o.marginTop;
var staticLimitBottom = containerBottom - scrollTop - o.paddingBottom - o.marginBottom;
var top = o.stickySidebar.offset().top - scrollTop;
var scrollTopDiff = o.previousScrollTop - scrollTop;
// If the sidebar position is fixed, then it won't move up or down by itself. So, we manually adjust the top coordinate.
if (o.stickySidebar.css('position') == 'fixed') {
top += scrollTopDiff;
}
if (scrollTopDiff > 0) { // If the user is scrolling up.
top = Math.min(top, windowOffsetTop);
}
else { // If the user is scrolling down.
top = Math.max(top, windowOffsetBottom - o.stickySidebar.outerHeight());
}
top = Math.max(top, staticLimitTop);
top = Math.min(top, staticLimitBottom - o.stickySidebar.outerHeight());
// If the sidebar is the same height as the container, we won't use fixed positioning.
var sidebarSameHeightAsContainer = o.container.height() == o.stickySidebar.outerHeight();
if (!sidebarSameHeightAsContainer && top == windowOffsetTop) {
position = 'fixed';
}
else if (!sidebarSameHeightAsContainer && top == windowOffsetBottom - o.stickySidebar.outerHeight()) {
position = 'fixed';
}
else if (scrollTop + top - o.sidebar.offset().top - o.paddingTop <= options.additionalMarginTop) {
position = 'static';
}
else {
position = 'absolute';
}
}
/*
* Performance notice: It's OK to set these CSS values at each resize/scroll, even if they don't change.
* It's way slower to first check if the values have changed.
*/
if (position == 'fixed') {
o.stickySidebar.css({
'position': 'fixed',
'width': o.sidebar.width(),
'top': top,
'left': o.sidebar.offset().left + parseInt(o.sidebar.css('padding-left'))
});
}
else if (position == 'absolute') {
var css = {};
if (o.stickySidebar.css('position') != 'absolute') {
css.position = 'absolute';
css.top = scrollTop + top - o.sidebar.offset().top - o.stickySidebarPaddingTop - o.stickySidebarPaddingBottom;
}
css.width = o.sidebar.width();
css.left = '';
o.stickySidebar.css(css);
}
else if (position == 'static') {
resetSidebar();
}
if (position != 'static') {
if (o.options.updateSidebarHeight == true) {
o.sidebar.css({
'min-height': o.stickySidebar.outerHeight() + o.stickySidebar.offset().top - o.sidebar.offset().top + o.paddingBottom
});
}
}
o.previousScrollTop = scrollTop;
};
// Initialize the sidebar's position.
o.onScroll(o);
// Recalculate the sidebar's position on every scroll and resize.
$(document).scroll(function(o) {
return function() {
o.onScroll(o);
};
}(o));
$(window).resize(function(o) {
return function() {
o.stickySidebar.css({'position': 'static'});
o.onScroll(o);
};
}(o));
// Reset the sidebar to its default state
function resetSidebar() {
o.fixedScrollTop = 0;
o.sidebar.css({
'min-height': '1px'
});
o.stickySidebar.css({
'position': 'static',
'width': ''
});
}
// Get the height of a div as if its floated children were cleared. Note that this function fails if the floats are more than one level deep.
function getClearedHeight(e) {
var height = e.height();
e.children().each(function() {
height = Math.max(height, $(this).height());
});
return height;
}
});
}
})(jQuery);
angular.module("ui.bootstrap", ["ui.bootstrap.tabs"]);
/**
* @ngdoc overview
* @name ui.bootstrap.tabs
*
* @description
* AngularJS version of the tabs directive.
*/
angular.module('ui.bootstrap.tabs', [])
.directive('tabs', function() {
return function() {
throw new Error("The `tabs` directive is deprecated, please migrate to `tabset`. Instructions can be found at http://github.com/angular-ui/bootstrap/tree/master/CHANGELOG.md");
};
})
.controller('TabsetController', ['$scope', '$element',
function TabsetCtrl($scope, $element) {
var ctrl = this,
tabs = ctrl.tabs = $scope.tabs = [];
ctrl.select = function(tab) {
angular.forEach(tabs, function(tab) {
tab.active = false;
});
tab.active = true;
};
ctrl.addTab = function addTab(tab) {
tabs.push(tab);
if (tabs.length == 1) {
ctrl.select(tab);
}
};
ctrl.removeTab = function removeTab(tab) {
var index = tabs.indexOf(tab);
//Select a new tab if the tab to be removed is selected
if (tab.active && tabs.length > 1) {
//If this is the last tab, select the previous tab. else, the next tab.
var newActiveIndex = index == tabs.length - 1 ? index - 1 : index + 1;
ctrl.select(tabs[newActiveIndex]);
}
tabs.splice(index, 1);
};
}])
/**
* @ngdoc directive
* @name ui.bootstrap.tabs.directive:tabset
* @restrict EA
*
* @description
* Tabset is the outer container for the tabs directive
*
* @param {boolean=} vertical Whether or not to use vertical styling for the tabs.
*
* @example
<example module="ui.bootstrap">
<file name="index.html">
<tabset>
<tab heading="Vertical Tab 1"><b>First</b> Content!</tab>
<tab heading="Vertical Tab 2"><i>Second</i> Content!</tab>
</tabset>
<hr />
<tabset vertical="true">
<tab heading="Vertical Tab 1"><b>First</b> Vertical Content!</tab>
<tab heading="Vertical Tab 2"><i>Second</i> Vertical Content!</tab>
</tabset>
</file>
</example>
*/
.directive('tabset', function() {
return {
restrict: 'EA',
transclude: true,
scope: {},
controller: 'TabsetController',
templateUrl: 'template/tabs/tabset.html',
link: function(scope, element, attrs) {
scope.vertical = angular.isDefined(attrs.vertical) ? scope.$eval(attrs.vertical) : false;
scope.type = angular.isDefined(attrs.type) ? scope.$parent.$eval(attrs.type) : 'tabs';
}
};
})
/**
* @ngdoc directive
* @name ui.bootstrap.tabs.directive:tab
* @restrict EA
*
* @param {string=} heading The visible heading, or title, of the tab. Set HTML headings with {@link ui.bootstrap.tabs.directive:tabHeading tabHeading}.
* @param {string=} select An expression to evaluate when the tab is selected.
* @param {boolean=} active A binding, telling whether or not this tab is selected.
* @param {boolean=} disabled A binding, telling whether or not this tab is disabled.
*
* @description
* Creates a tab with a heading and content. Must be placed within a {@link ui.bootstrap.tabs.directive:tabset tabset}.
*
* @example
<example module="ui.bootstrap">
<file name="index.html">
<div ng-controller="TabsDemoCtrl">
<button class="btn btn-small" ng-click="items[0].active = true">
Select item 1, using active binding
</button>
<button class="btn btn-small" ng-click="items[1].disabled = !items[1].disabled">
Enable/disable item 2, using disabled binding
</button>
<br />
<tabset>
<tab heading="Tab 1">First Tab</tab>
<tab select="alertMe()">
<tab-heading><i class="icon-bell"></i> Alert me!</tab-heading>
Second Tab, with alert callback and html heading!
</tab>
<tab ng-repeat="item in items"
heading="{{item.title}}"
disabled="item.disabled"
active="item.active">
{{item.content}}
</tab>
</tabset>
</div>
</file>
<file name="script.js">
function TabsDemoCtrl($scope) {
$scope.items = [
{ title:"Dynamic Title 1", content:"Dynamic Item 0" },
{ title:"Dynamic Title 2", content:"Dynamic Item 1", disabled: true }
];
$scope.alertMe = function() {
setTimeout(function() {
alert("You've selected the alert tab!");
});
};
};
</file>
</example>
*/
/**
* @ngdoc directive
* @name ui.bootstrap.tabs.directive:tabHeading
* @restrict EA
*
* @description
* Creates an HTML heading for a {@link ui.bootstrap.tabs.directive:tab tab}. Must be placed as a child of a tab element.
*
* @example
<example module="ui.bootstrap">
<file name="index.html">
<tabset>
<tab>
<tab-heading><b>HTML</b> in my titles?!</tab-heading>
And some content, too!
</tab>
<tab>
<tab-heading><i class="icon-heart"></i> Icon heading?!?</tab-heading>
That's right.
</tab>
</tabset>
</file>
</example>
*/
.directive('tab', ['$parse', '$http', '$templateCache', '$compile',
function($parse, $http, $templateCache, $compile) {
return {
require: '^tabset',
restrict: 'EA',
replace: true,
templateUrl: 'template/tabs/tab.html',
transclude: true,
scope: {
heading: '@',
onSelect: '&select' //This callback is called in contentHeadingTransclude
//once it inserts the tab's content into the dom
},
controller: function() {
//Empty controller so other directives can require being 'under' a tab
},
compile: function(elm, attrs, transclude) {
return function postLink(scope, elm, attrs, tabsetCtrl) {
var getActive, setActive;
scope.active = false; // default value
if (attrs.active) {
getActive = $parse(attrs.active);
setActive = getActive.assign;
scope.$parent.$watch(getActive, function updateActive(value) {
if ( !!value && scope.disabled ) {
setActive(scope.$parent, false); // Prevent active assignment
} else {
scope.active = !!value;
}
});
} else {
setActive = getActive = angular.noop;
}
scope.$watch('active', function(active) {
setActive(scope.$parent, active);
if (active) {
tabsetCtrl.select(scope);
scope.onSelect();
}
});
scope.disabled = false;
if ( attrs.disabled ) {
scope.$parent.$watch($parse(attrs.disabled), function(value) {
scope.disabled = !! value;
});
}
scope.select = function() {
if ( ! scope.disabled ) {
scope.active = true;
}
};
tabsetCtrl.addTab(scope);
scope.$on('$destroy', function() {
tabsetCtrl.removeTab(scope);
});
//If the tabset sets this tab to active, set the parent scope's active
//binding too. We do this so the watch for the parent's initial active
//value won't overwrite what is initially set by the tabset
if (scope.active) {
setActive(scope.$parent, true);
}
//Transclude the collection of sibling elements. Use forEach to find
//the heading if it exists. We don't use a directive for tab-heading
//because it is problematic. Discussion @ http://git.io/MSNPwQ
transclude(scope.$parent, function(clone) {
//Look at every element in the clone collection. If it's tab-heading,
//mark it as that. If it's not tab-heading, mark it as tab contents
var contents = [], heading;
angular.forEach(clone, function(el) {
//See if it's a tab-heading attr or element directive
//First make sure it's a normal element, one that has a tagName
if (el.tagName &&
(el.hasAttribute("tab-heading") ||
el.hasAttribute("data-tab-heading") ||
el.tagName.toLowerCase() == "tab-heading" ||
el.tagName.toLowerCase() == "data-tab-heading"
)) {
heading = el;
} else {
contents.push(el);
}
});
//Share what we found on the scope, so our tabHeadingTransclude and
//tabContentTransclude directives can find out what the heading and
//contents are.
if (heading) {
scope.headingElement = angular.element(heading);
}
scope.contentElement = angular.element(contents);
});
};
}
};
}])
.directive('tabHeadingTransclude', [function() {
return {
restrict: 'A',
require: '^tab',
link: function(scope, elm, attrs, tabCtrl) {
scope.$watch('headingElement', function updateHeadingElement(heading) {
if (heading) {
elm.html('');
elm.append(heading);
}
});
}
};
}])
.directive('tabContentTransclude', ['$parse', function($parse) {
return {
restrict: 'A',
require: '^tabset',
link: function(scope, elm, attrs, tabsetCtrl) {
scope.$watch($parse(attrs.tabContentTransclude), function(tab) {
elm.html('');
if (tab) {
elm.append(tab.contentElement);
}
});
}
};
}])
;
angular.module("ui.bootstrap", ["ui.bootstrap.tpls", "ui.bootstrap.tabs"]);
angular.module("ui.bootstrap.tpls", ["template/tabs/tab.html","template/tabs/tabset.html"]);
/**
* @ngdoc overview
* @name ui.bootstrap.tabs
*
* @description
* AngularJS version of the tabs directive.
*/
angular.module('ui.bootstrap.tabs', [])
.directive('tabs', function() {
return function() {
throw new Error("The `tabs` directive is deprecated, please migrate to `tabset`. Instructions can be found at http://github.com/angular-ui/bootstrap/tree/master/CHANGELOG.md");
};
})
.controller('TabsetController', ['$scope', '$element',
function TabsetCtrl($scope, $element) {
var ctrl = this,
tabs = ctrl.tabs = $scope.tabs = [];
ctrl.select = function(tab) {
angular.forEach(tabs, function(tab) {
tab.active = false;
});
tab.active = true;
};
ctrl.addTab = function addTab(tab) {
tabs.push(tab);
if (tabs.length == 1) {
ctrl.select(tab);
}
};
ctrl.removeTab = function removeTab(tab) {
var index = tabs.indexOf(tab);
//Select a new tab if the tab to be removed is selected
if (tab.active && tabs.length > 1) {
//If this is the last tab, select the previous tab. else, the next tab.
var newActiveIndex = index == tabs.length - 1 ? index - 1 : index + 1;
ctrl.select(tabs[newActiveIndex]);
}
tabs.splice(index, 1);
};
}])
/**
* @ngdoc directive
* @name ui.bootstrap.tabs.directive:tabset
* @restrict EA
*
* @description
* Tabset is the outer container for the tabs directive
*
* @param {boolean=} vertical Whether or not to use vertical styling for the tabs.
*
* @example
<example module="ui.bootstrap">
<file name="index.html">
<tabset>
<tab heading="Vertical Tab 1"><b>First</b> Content!</tab>
<tab heading="Vertical Tab 2"><i>Second</i> Content!</tab>
</tabset>
<hr />
<tabset vertical="true">
<tab heading="Vertical Tab 1"><b>First</b> Vertical Content!</tab>
<tab heading="Vertical Tab 2"><i>Second</i> Vertical Content!</tab>
</tabset>
</file>
</example>
*/
.directive('tabset', function() {
return {
restrict: 'EA',
transclude: true,
scope: {},
controller: 'TabsetController',
templateUrl: 'template/tabs/tabset.html',
link: function(scope, element, attrs) {
scope.vertical = angular.isDefined(attrs.vertical) ? scope.$eval(attrs.vertical) : false;
scope.type = angular.isDefined(attrs.type) ? scope.$parent.$eval(attrs.type) : 'tabs';
}
};
})
/**
* @ngdoc directive
* @name ui.bootstrap.tabs.directive:tab
* @restrict EA
*
* @param {string=} heading The visible heading, or title, of the tab. Set HTML headings with {@link ui.bootstrap.tabs.directive:tabHeading tabHeading}.
* @param {string=} select An expression to evaluate when the tab is selected.
* @param {boolean=} active A binding, telling whether or not this tab is selected.
* @param {boolean=} disabled A binding, telling whether or not this tab is disabled.
*
* @description
* Creates a tab with a heading and content. Must be placed within a {@link ui.bootstrap.tabs.directive:tabset tabset}.
*
* @example
<example module="ui.bootstrap">
<file name="index.html">
<div ng-controller="TabsDemoCtrl">
<button class="btn btn-small" ng-click="items[0].active = true">
Select item 1, using active binding
</button>
<button class="btn btn-small" ng-click="items[1].disabled = !items[1].disabled">
Enable/disable item 2, using disabled binding
</button>
<br />
<tabset>
<tab heading="Tab 1">First Tab</tab>
<tab select="alertMe()">
<tab-heading><i class="icon-bell"></i> Alert me!</tab-heading>
Second Tab, with alert callback and html heading!
</tab>
<tab ng-repeat="item in items"
heading="{{item.title}}"
disabled="item.disabled"
active="item.active">
{{item.content}}
</tab>
</tabset>
</div>
</file>
<file name="script.js">
function TabsDemoCtrl($scope) {
$scope.items = [
{ title:"Dynamic Title 1", content:"Dynamic Item 0" },
{ title:"Dynamic Title 2", content:"Dynamic Item 1", disabled: true }
];
$scope.alertMe = function() {
setTimeout(function() {
alert("You've selected the alert tab!");
});
};
};
</file>
</example>
*/
/**
* @ngdoc directive
* @name ui.bootstrap.tabs.directive:tabHeading
* @restrict EA
*
* @description
* Creates an HTML heading for a {@link ui.bootstrap.tabs.directive:tab tab}. Must be placed as a child of a tab element.
*
* @example
<example module="ui.bootstrap">
<file name="index.html">
<tabset>
<tab>
<tab-heading><b>HTML</b> in my titles?!</tab-heading>
And some content, too!
</tab>
<tab>
<tab-heading><i class="icon-heart"></i> Icon heading?!?</tab-heading>
That's right.
</tab>
</tabset>
</file>
</example>
*/
.directive('tab', ['$parse', '$http', '$templateCache', '$compile',
function($parse, $http, $templateCache, $compile) {
return {
require: '^tabset',
restrict: 'EA',
replace: true,
templateUrl: 'template/tabs/tab.html',
transclude: true,
scope: {
heading: '@',
onSelect: '&select' //This callback is called in contentHeadingTransclude
//once it inserts the tab's content into the dom
},
controller: function() {
//Empty controller so other directives can require being 'under' a tab
},
compile: function(elm, attrs, transclude) {
return function postLink(scope, elm, attrs, tabsetCtrl) {
var getActive, setActive;
scope.active = false; // default value
if (attrs.active) {
getActive = $parse(attrs.active);
setActive = getActive.assign;
scope.$parent.$watch(getActive, function updateActive(value) {
if ( !!value && scope.disabled ) {
setActive(scope.$parent, false); // Prevent active assignment
} else {
scope.active = !!value;
}
});
} else {
setActive = getActive = angular.noop;
}
scope.$watch('active', function(active) {
setActive(scope.$parent, active);
if (active) {
tabsetCtrl.select(scope);
scope.onSelect();
}
});
scope.disabled = false;
if ( attrs.disabled ) {
scope.$parent.$watch($parse(attrs.disabled), function(value) {
scope.disabled = !! value;
});
}
scope.select = function() {
if ( ! scope.disabled ) {
scope.active = true;
}
};
tabsetCtrl.addTab(scope);
scope.$on('$destroy', function() {
tabsetCtrl.removeTab(scope);
});
//If the tabset sets this tab to active, set the parent scope's active
//binding too. We do this so the watch for the parent's initial active
//value won't overwrite what is initially set by the tabset
if (scope.active) {
setActive(scope.$parent, true);
}
//Transclude the collection of sibling elements. Use forEach to find
//the heading if it exists. We don't use a directive for tab-heading
//because it is problematic. Discussion @ http://git.io/MSNPwQ
transclude(scope.$parent, function(clone) {
//Look at every element in the clone collection. If it's tab-heading,
//mark it as that. If it's not tab-heading, mark it as tab contents
var contents = [], heading;
angular.forEach(clone, function(el) {
//See if it's a tab-heading attr or element directive
//First make sure it's a normal element, one that has a tagName
if (el.tagName &&
(el.hasAttribute("tab-heading") ||
el.hasAttribute("data-tab-heading") ||
el.tagName.toLowerCase() == "tab-heading" ||
el.tagName.toLowerCase() == "data-tab-heading"
)) {
heading = el;
} else {
contents.push(el);
}
});
//Share what we found on the scope, so our tabHeadingTransclude and
//tabContentTransclude directives can find out what the heading and
//contents are.
if (heading) {
scope.headingElement = angular.element(heading);
}
scope.contentElement = angular.element(contents);
});
};
}
};
}])
.directive('tabHeadingTransclude', [function() {
return {
restrict: 'A',
require: '^tab',
link: function(scope, elm, attrs, tabCtrl) {
scope.$watch('headingElement', function updateHeadingElement(heading) {
if (heading) {
elm.html('');
elm.append(heading);
}
});
}
};
}])
.directive('tabContentTransclude', ['$parse', function($parse) {
return {
restrict: 'A',
require: '^tabset',
link: function(scope, elm, attrs, tabsetCtrl) {
scope.$watch($parse(attrs.tabContentTransclude), function(tab) {
elm.html('');
if (tab) {
elm.append(tab.contentElement);
}
});
}
};
}])
;
angular.module("template/tabs/pane.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("template/tabs/pane.html",
"<div class=\"tab-pane\" ng-class=\"{active: selected}\" ng-show=\"selected\" ng-transclude></div>\n" +
"");
}]);
angular.module("template/tabs/tab.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("template/tabs/tab.html",
"<li ng-class=\"{active: active, disabled: disabled}\">\n" +
" <a ng-click=\"select()\" tab-heading-transclude>{{heading}}</a>\n" +
"</li>\n" +
"");
}]);
angular.module("template/tabs/tabs.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("template/tabs/tabs.html",
"<div class=\"tabbable\">\n" +
" <ul class=\"nav nav-tabs\">\n" +
" <li ng-repeat=\"pane in panes\" ng-class=\"{active:pane.selected}\">\n" +
" <a ng-click=\"select(pane)\">{{pane.heading}}</a>\n" +
" </li>\n" +
" </ul>\n" +
" <div class=\"tab-content\" ng-transclude></div>\n" +
"</div>\n" +
"");
}]);
angular.module("template/tabs/tabset.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("template/tabs/tabset.html",
"\n" +
"<div class=\"tabbable\">\n" +
" <ul class=\"nav {{type && 'nav-' + type}}\" ng-class=\"{'nav-stacked': vertical}\" ng-transclude>\n" +
" </ul>\n" +
" <div class=\"tab-content\">\n" +
" <div class=\"tab-pane\" \n" +
" ng-repeat=\"tab in tabs\" \n" +
" ng-class=\"{active: tab.active}\"\n" +
" tab-content-transclude=\"tab\" tt=\"tab\">\n" +
" </div>\n" +
" </div>\n" +
"</div>\n" +
"");
}]);
/*
* zClip :: jQuery ZeroClipboard v1.1.1
* http://steamdev.com/zclip
*
* Copyright 2011, SteamDev
* Released under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*
* Date: Wed Jun 01, 2011
*/
(function(a){a.fn.zclip=function(c){if(typeof c=="object"&&!c.length){var b=a.extend({path:"ZeroClipboard.swf",copy:null,beforeCopy:null,afterCopy:null,clickAfter:true,setHandCursor:true,setCSSEffects:true},c);return this.each(function(){var e=a(this);if(e.is(":visible")&&(typeof b.copy=="string"||a.isFunction(b.copy))){ZeroClipboard.setMoviePath(b.path);var d=new ZeroClipboard.Client();if(a.isFunction(b.copy)){e.bind("zClip_copy",b.copy)}if(a.isFunction(b.beforeCopy)){e.bind("zClip_beforeCopy",b.beforeCopy)}if(a.isFunction(b.afterCopy)){e.bind("zClip_afterCopy",b.afterCopy)}d.setHandCursor(b.setHandCursor);d.setCSSEffects(b.setCSSEffects);d.addEventListener("mouseOver",function(f){e.trigger("mouseenter")});d.addEventListener("mouseOut",function(f){e.trigger("mouseleave")});d.addEventListener("mouseDown",function(f){e.trigger("mousedown");if(!a.isFunction(b.copy)){d.setText(b.copy)}else{d.setText(e.triggerHandler("zClip_copy"))}if(a.isFunction(b.beforeCopy)){e.trigger("zClip_beforeCopy")}});d.addEventListener("complete",function(f,g){if(a.isFunction(b.afterCopy)){e.trigger("zClip_afterCopy")}else{if(g.length>500){g=g.substr(0,500)+"...\n\n("+(g.length-500)+" characters not shown)"}e.removeClass("hover");alert("Copied text to clipboard:\n\n "+g)}if(b.clickAfter){e.trigger("click")}});d.glue(e[0],e.parent()[0]);a(window).bind("load resize",function(){d.reposition()})}})}else{if(typeof c=="string"){return this.each(function(){var f=a(this);c=c.toLowerCase();var e=f.data("zclipId");var d=a("#"+e+".zclip");if(c=="remove"){d.remove();f.removeClass("active hover")}else{if(c=="hide"){d.hide();f.removeClass("active hover")}else{if(c=="show"){d.show()}}}})}}}})(jQuery);var ZeroClipboard={version:"1.0.7",clients:{},moviePath:"ZeroClipboard.swf",nextId:1,$:function(a){if(typeof(a)=="string"){a=document.getElementById(a)}if(!a.addClass){a.hide=function(){this.style.display="none"};a.show=function(){this.style.display=""};a.addClass=function(b){this.removeClass(b);this.className+=" "+b};a.removeClass=function(d){var e=this.className.split(/\s+/);var b=-1;for(var c=0;c<e.length;c++){if(e[c]==d){b=c;c=e.length}}if(b>-1){e.splice(b,1);this.className=e.join(" ")}return this};a.hasClass=function(b){return !!this.className.match(new RegExp("\\s*"+b+"\\s*"))}}return a},setMoviePath:function(a){this.moviePath=a},dispatch:function(d,b,c){var a=this.clients[d];if(a){a.receiveEvent(b,c)}},register:function(b,a){this.clients[b]=a},getDOMObjectPosition:function(c,a){var b={left:0,top:0,width:c.width?c.width:c.offsetWidth,height:c.height?c.height:c.offsetHeight};if(c&&(c!=a)){b.left+=c.offsetLeft;b.top+=c.offsetTop}return b},Client:function(a){this.handlers={};this.id=ZeroClipboard.nextId++;this.movieId="ZeroClipboardMovie_"+this.id;ZeroClipboard.register(this.id,this);if(a){this.glue(a)}}};ZeroClipboard.Client.prototype={id:0,ready:false,movie:null,clipText:"",handCursorEnabled:true,cssEffects:true,handlers:null,glue:function(d,b,e){this.domElement=ZeroClipboard.$(d);var f=99;if(this.domElement.style.zIndex){f=parseInt(this.domElement.style.zIndex,10)+1}if(typeof(b)=="string"){b=ZeroClipboard.$(b)}else{if(typeof(b)=="undefined"){b=document.getElementsByTagName("body")[0]}}var c=ZeroClipboard.getDOMObjectPosition(this.domElement,b);this.div=document.createElement("div");this.div.className="zclip";this.div.id="zclip-"+this.movieId;$(this.domElement).data("zclipId","zclip-"+this.movieId);var a=this.div.style;a.position="absolute";a.left=""+c.left+"px";a.top=""+c.top+"px";a.width=""+c.width+"px";a.height=""+c.height+"px";a.zIndex=f;if(typeof(e)=="object"){for(addedStyle in e){a[addedStyle]=e[addedStyle]}}b.appendChild(this.div);this.div.innerHTML=this.getHTML(c.width,c.height)},getHTML:function(d,a){var c="";var b="id="+this.id+"&width="+d+"&height="+a;if(navigator.userAgent.match(/MSIE/)){var e=location.href.match(/^https/i)?"https://":"http://";c+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+e+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+d+'" height="'+a+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+b+'"/><param name="wmode" value="transparent"/></object>'}else{c+='<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+d+'" height="'+a+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+b+'" wmode="transparent" />'}return c},hide:function(){if(this.div){this.div.style.left="-2000px"}},show:function(){this.reposition()},destroy:function(){if(this.domElement&&this.div){this.hide();this.div.innerHTML="";var a=document.getElementsByTagName("body")[0];try{a.removeChild(this.div)}catch(b){}this.domElement=null;this.div=null}},reposition:function(c){if(c){this.domElement=ZeroClipboard.$(c);if(!this.domElement){this.hide()}}if(this.domElement&&this.div){var b=ZeroClipboard.getDOMObjectPosition(this.domElement);var a=this.div.style;a.left=""+b.left+"px";a.top=""+b.top+"px"}},setText:function(a){this.clipText=a;if(this.ready){this.movie.setText(a)}},addEventListener:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");if(!this.handlers[a]){this.handlers[a]=[]}this.handlers[a].push(b)},setHandCursor:function(a){this.handCursorEnabled=a;if(this.ready){this.movie.setHandCursor(a)}},setCSSEffects:function(a){this.cssEffects=!!a},receiveEvent:function(d,f){d=d.toString().toLowerCase().replace(/^on/,"");switch(d){case"load":this.movie=document.getElementById(this.movieId);if(!this.movie){var c=this;setTimeout(function(){c.receiveEvent("load",null)},1);return}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){var c=this;setTimeout(function(){c.receiveEvent("load",null)},100);this.ready=true;return}this.ready=true;try{this.movie.setText(this.clipText)}catch(h){}try{this.movie.setHandCursor(this.handCursorEnabled)}catch(h){}break;case"mouseover":if(this.domElement&&this.cssEffects){this.domElement.addClass("hover");if(this.recoverActive){this.domElement.addClass("active")}}break;case"mouseout":if(this.domElement&&this.cssEffects){this.recoverActive=false;if(this.domElement.hasClass("active")){this.domElement.removeClass("active");this.recoverActive=true}this.domElement.removeClass("hover")}break;case"mousedown":if(this.domElement&&this.cssEffects){this.domElement.addClass("active")}break;case"mouseup":if(this.domElement&&this.cssEffects){this.domElement.removeClass("active");this.recoverActive=false}break}if(this.handlers[d]){for(var b=0,a=this.handlers[d].length;b<a;b++){var g=this.handlers[d][b];if(typeof(g)=="function"){g(this,f)}else{if((typeof(g)=="object")&&(g.length==2)){g[0][g[1]](this,f)}else{if(typeof(g)=="string"){window[g](this,f)}}}}}}};
window.exercism = {
collections: {},
views: {},
models: {},
routers: {}
};
$(document).ready(function() {
$("a#copy-code").on('click', function (e) {
e.preventDefault();
}).each(function () {
$(this).zclip({
path: 'http://www.steamdev.com/zclip/js/ZeroClipboard.swf',
copy: $("#submission-code").text(),
afterCopy: function() {
alert("The submission code was successfully copied to your clipboard!");
}
});
});
});
$(function () {
if ($('#nitstat-chart').length !== 0) {
var stats = $('#nitstat-chart').data('stats');
var data = {
labels : stats.labels,
datasets : [
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,1)",
pointColor : "rgba(151,187,205,1)",
pointStrokeColor : "#fff",
data : stats.given
},
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
pointStrokeColor : "#fff",
data : stats.received
}
]
};
var ctx = $("#nitstat-chart").get(0).getContext("2d");
new Chart(ctx).Line(data, {
scaleOverride : true,
scaleSteps : stats.steps,
scaleStepWidth : stats.step,
scaleStartValue : 0,
bezierCurve: false });
}
});
//TODO move all variable declaration to the tops of functions.
$(function() {
$(".pending-submission, .work").each(function(index,element) {
var elem = $(element);
var language = elem.data('language');
$(".language",elem).tooltip({ title: language });
var nitCount = elem.data('nits');
$(".nits",elem).tooltip({ title: nitCount + " Nits by Others" });
var versionCount = elem.data('versions');
$(".versions",elem).tooltip({ title: "Iteration " + versionCount });
});
$(".code a[data-action='enlarge']").on("click",function() {
var codeDiv = $(this).parents(".code");
codeDiv.removeClass($(this).data("old-class"));
codeDiv.addClass($(this).data("new-class"));
$(this).hide();
$("a[data-action='shrink']",codeDiv).show();
});
$(".code a[data-action='shrink']").on("click",function() {
var codeDiv = $(this).parents(".code");
codeDiv.removeClass($(this).data("old-class"));
codeDiv.addClass($(this).data("new-class"));
$(this).hide();
$("a[data-action='enlarge']",codeDiv).show();
});
$('form').on('submit', function() {
var $this = $(this).find(':submit');
window.setTimeout(function() { $this.attr('disabled', true); }, 1);
});
$("form").submit(function() {
$(this).submit(function() {
return false;
});
});
$('textarea').each(function () {
var $this = $(this);
var question_text = "You have unsaved changes on this page";
var was_sumbitted = false;
$this.parents("form").on('submit',function(){
was_sumbitted = true;
});
window.onbeforeunload = function (e) {
var unsaved = $this.text() !== $this.val();
if(!was_sumbitted && unsaved) {
// see http://stackoverflow.com/questions/10311341/confirmation-before-closing-of-tab-browser
e = e || window.event;
if (e) {
e.returnValue = question_text;
}
return question_text;
}
};
});
// cmd + return submits nitpicks on mac ctrl + return submits on windows
// from https://github.com/dewski/cmd-enter
$(document).on('keydown', 'textarea', function(e) {
if(e.keyCode === 13 && (e.metaKey || e.ctrlKey)) {
$(this).parents('form').submit();
}
});
$('.work-slug').popover({
trigger: 'hover',
placement: 'right',
html: true,
delay: {
show: 600,
hide: 100
},
content: 'use the command <code>exercism fetch</code> to add this assignment to your exercism directory'
});
$(".mute").each(function(index, element) {
var elem = $(element);
$(".mute-btn",elem).tooltip({ placement: "bottom", title: "Mute this submission until there is further activity." });
$(".unmute-btn",elem).tooltip({ placement: "bottom", title: "Unmute this sumission." });
});
});
(function() {
var destroyTeam, dismissTeamMember, toggleTeamEdit;
angular.module('exercism', ['ui.bootstrap']);
$(function() {
$("[data-toggle=tooltip]").tooltip();
$("#feedback_guide").popover({
content: $("#encourage").html(),
html: true
});
$("#feedback_guide_alert .close").click(function(e) {
e.preventDefault();
return $.cookie('feedback_guide_alert', 'closed', {
path: '/'
});
});
$("#current_submission").theiaStickySidebar({
additionalMarginTop: 70
});
if ($.cookie('feedback_guide_alert') !== 'closed') {
$("#feedback_guide_alert").removeClass("hidden");
}
$('.member_delete').on('click', function() {
var slug, username;
username = $(this).data('username');
slug = $(this).data('team');
if (confirm("Are you sure you want to remove " + username + "?")) {
return dismissTeamMember(username, slug);
}
});
$('#destroy_team').on('click', function() {
var slug;
slug = $(this).data('team');
if (confirm("Are you sure you want to delete " + slug + "?")) {
return destroyTeam(slug);
}
});
$('#edit_team').on('click', function(event) {
event.preventDefault();
return toggleTeamEdit();
});
if (_.any($('.comments'))) {
emojify.setConfig({
emoticons_enabled: false
});
return emojify.run(document.getElementsByClassName("comments")[0]);
}
});
toggleTeamEdit = function() {
var delete_buttons, members_box;
members_box = $('#add_members');
delete_buttons = $('.member_delete');
if (members_box.hasClass('hidden')) {
delete_buttons.removeClass('hidden');
members_box.slideDown();
return members_box.removeClass('hidden');
} else {
return members_box.slideUp(function() {
delete_buttons.addClass('hidden');
return members_box.addClass('hidden');
});
}
};
destroyTeam = function(slug) {
var form, href, method_input;
href = "/teams/" + slug;
form = $('<form method="post" action="' + href + '"></form>');
method_input = '<input name="_method" value="delete" type="hidden"/>';
form.hide().append(method_input).appendTo('body');
return form.submit();
};
dismissTeamMember = function(username, slug) {
var form, href, method_input;
href = "/teams/" + slug + "/members/" + username;
form = $('<form method="post" action="' + href + '"></form>');
method_input = '<input name="_method" value="delete" type="hidden"/>';
form.hide().append(method_input).appendTo('body');
return form.submit();
};
(function(i, s, o, g, r, a, m) {
i["GoogleAnalyticsObject"] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments);
};
i[r].l = 1 * new Date();
a = s.createElement(o);
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m);
})(window, document, "script", "//www.google-analytics.com/analytics.js", "ga");
ga("create", "UA-47528450-1", "exercism.io");
ga("send", "pageview");
}).call(this);
(function() {
angular.module('exercism').controller("CommentsCtrl", function($scope, $http) {
$scope.commentThread = {};
$scope.hideCommentForm = true;
$scope.showCommentForm = function() {
return $scope.hideCommentForm = false;
};
$scope.hideCommentFormFn = function() {
return $scope.hideCommentForm = true;
};
return $scope.addComment = function(commentId) {
var commentThreadBody;
commentThreadBody = $scope.commentThread.body;
return $http.post("/comments/" + commentId + "/comment_threads", $.param({
"body": commentThreadBody
}), {
headers: {
"Content-Type": 'application/x-www-form-urlencoded'
}
}).success(function(data, status, headers) {
$scope.commentThreads.push(data);
$scope.hideCommentForm = true;
return $scope.commentThread.body = '';
}).error(function(data, status, headers) {
return alert(data.body);
});
};
});
}).call(this);
(function() {
angular.module('exercism').controller("MarkdownCtrl", function($scope, $http) {
var PATTERN;
PATTERN = /\B@[a-z0-9_-]+/gi;
$scope.data || ($scope.data = {});
$scope.$watch('data.body', function(body) {
var query, submission_key;
if (body && PATTERN.test(body)) {
query = body.match(PATTERN)[0].replace('@', '');
submission_key = $('.md-markdown-preview textarea').attr('data-submission-key');
return $http.get("/api/v1/user/find", {
params: {
query: query,
submission_key: submission_key
}
}).success(function(data, status, headers) {
return $('.comment').atwho({
at: '@',
data: data
});
});
}
});
return $scope.preview = function() {
return $http.post("/comments/preview", $.param({
"body": $scope.data.body
}), {
headers: {
"Content-Type": 'application/x-www-form-urlencoded'
}
}).success(function(data, status, headers) {
return $scope.data.preview = data;
});
};
});
}).call(this);
(function() {
angular.module('exercism').controller("PaginationCtrl", function($scope, $http) {
$scope.currentPage = 0;
$scope.pageSize = 10;
$scope.looks = [];
$http.get("/api/v1/looks").success(function(data, status, headers) {
return $scope.looks = data.looks;
});
$scope.numberOfPages = function() {
return Math.ceil($scope.looks.length / $scope.pageSize);
};
return this;
});
angular.module('exercism').filter('startFrom', function() {
return function(input, start) {
start = +start;
return input.slice(start);
};
});
}).call(this);
//# sourceMappingURL=app.js.map
|
src/containers/Uielements/Tooltip/index.js
|
EncontrAR/backoffice
|
import React, { Component } from 'react';
import { Row, Col } from 'antd';
import Tooltip from '../../../components/uielements/tooltip';
import PageHeader from '../../../components/utility/pageHeader';
import Box from '../../../components/utility/box';
import LayoutWrapper from '../../../components/utility/layoutWrapper';
import ContentHolder from '../../../components/utility/contentHolder';
import basicStyle from '../../../config/basicStyle';
import IntlMessages from '../../../components/utility/intlMessages';
const text = (
<span>
{<IntlMessages id="uiElements.tooltip.contentSpan" />}
</span>
);
export default class extends Component {
render() {
const { rowStyle, colStyle, gutter } = basicStyle;
return (
<LayoutWrapper>
<PageHeader>
{<IntlMessages id="uiElements.tooltip.tooltip" />}
</PageHeader>
<Row style={rowStyle} gutter={gutter} justify="start">
<Col md={12} sm={12} xs={24} style={colStyle}>
<Box
title={<IntlMessages id="uiElements.tooltip.basicExample" />}
subtitle={
<IntlMessages id="uiElements.tooltip.basicExampleSubTitle" />
}
>
<ContentHolder>
<Tooltip
title={
<IntlMessages id="uiElements.tooltip.tooltipContent" />
}
>
<span>
{
<IntlMessages id="uiElements.tooltip.tooltipContentSpan" />
}
</span>
</Tooltip>
</ContentHolder>
</Box>
</Col>
<Col md={12} sm={12} xs={24} style={colStyle}>
<Box
title={<IntlMessages id="uiElements.tooltip.placementTitle" />}
subtitle={
<IntlMessages id="uiElements.tooltip.placementSubTitle" />
}
>
<ContentHolder>
<div className="demoBtnsWrapper">
<Tooltip placement="topLeft" title={text}>
<a className="tooltipBtn">
{<IntlMessages id="uiElements.tooltip.TL" />}
</a>
</Tooltip>
<Tooltip placement="top" title={text}>
<a className="tooltipBtn">
{<IntlMessages id="uiElements.tooltip.top" />}
</a>
</Tooltip>
<Tooltip placement="topRight" title={text}>
<a className="tooltipBtn">
{<IntlMessages id="uiElements.tooltip.TR" />}
</a>
</Tooltip>
</div>
<div className="demoBtnsWrapper">
<Tooltip placement="leftTop" title={text}>
<a className="tooltipBtn">
{<IntlMessages id="uiElements.tooltip.LT" />}
</a>
</Tooltip>
<Tooltip placement="left" title={text}>
<a className="tooltipBtn">
{<IntlMessages id="uiElements.tooltip.left" />}
</a>
</Tooltip>
<Tooltip placement="leftBottom" title={text}>
<a className="tooltipBtn">
{<IntlMessages id="uiElements.tooltip.LB" />}
</a>
</Tooltip>
</div>
<div className="demoBtnsWrapper">
<Tooltip placement="rightTop" title={text}>
<a className="tooltipBtn">
{<IntlMessages id="uiElements.tooltip.RT" />}
</a>
</Tooltip>
<Tooltip placement="right" title={text}>
<a className="tooltipBtn">
{<IntlMessages id="uiElements.tooltip.right" />}
</a>
</Tooltip>
<Tooltip placement="rightBottom" title={text}>
<a className="tooltipBtn">
{<IntlMessages id="uiElements.tooltip.RB" />}
</a>
</Tooltip>
</div>
<div className="demoBtnsWrapper">
<Tooltip placement="bottomLeft" title={text}>
<a className="tooltipBtn">
{<IntlMessages id="uiElements.tooltip.BL" />}
</a>
</Tooltip>
<Tooltip placement="bottom" title={text}>
<a className="tooltipBtn">
{<IntlMessages id="uiElements.tooltip.bottom" />}
</a>
</Tooltip>
<Tooltip placement="bottomRight" title={text}>
<a className="tooltipBtn">
{<IntlMessages id="uiElements.tooltip.BR" />}
</a>
</Tooltip>
</div>
</ContentHolder>
</Box>
</Col>
</Row>
</LayoutWrapper>
);
}
}
|
ajax/libs/jquery.fancytree/2.22.5/jquery.fancytree-all.min.js
|
him2him2/cdnjs
|
/*! jQuery Fancytree Plugin - 2.22.5 - 2017-05-11T17:01:53Z
* https://github.com/mar10/fancytree
* Copyright (c) 2017 Martin Wendt; Licensed MIT */
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
define( [ "jquery" ], factory );
} else {
factory( jQuery );
}
}(function( $ ) {
!function(a,b,c,d){"use strict";function e(b,c){b||(c=c?": "+c:"",a.error("Fancytree assertion failed"+c))}function f(a,c){var d,e,f=b.console?b.console[a]:null;if(f)try{f.apply(b.console,c)}catch(g){for(e="",d=0;d<c.length;d++)e+=c[d];f(e)}}function g(a){return!(!a.tree||a.statusNodeType===d)}function h(b,c,d,e){var f,g,h,i=a.map(a.trim(b).split("."),function(a){return parseInt(a,10)}),j=a.map(Array.prototype.slice.call(arguments,1),function(a){return parseInt(a,10)});for(f=0;f<j.length;f++)if(g=i[f]||0,h=j[f]||0,g!==h)return g>h;return!0}function i(a,b,c,d,e){var f=function(){var c=b[a],f=d[a],g=b.ext[e],h=function(){return c.apply(b,arguments)},i=function(a){return c.apply(b,a)};return function(){var a=b._local,c=b._super,d=b._superApply;try{return b._local=g,b._super=h,b._superApply=i,f.apply(b,arguments)}finally{b._local=a,b._super=c,b._superApply=d}}}();return f}function j(b,c,d,e){for(var f in d)"function"==typeof d[f]?"function"==typeof b[f]?b[f]=i(f,b,c,d,e):"_"===f.charAt(0)?b.ext[e][f]=i(f,b,c,d,e):a.error("Could not override tree."+f+". Use prefix '_' to create tree."+e+"._"+f):"options"!==f&&(b.ext[e][f]=d[f])}function k(b,c){return b===d?a.Deferred(function(){this.resolve()}).promise():a.Deferred(function(){this.resolveWith(b,c)}).promise()}function l(b,c){return b===d?a.Deferred(function(){this.reject()}).promise():a.Deferred(function(){this.rejectWith(b,c)}).promise()}function m(a,b){return function(){a.resolveWith(b)}}function n(b){var c=a.extend({},b.data()),d=c.json;return delete c.fancytree,delete c.uiFancytree,d&&(delete c.json,c=a.extend(c,d)),c}function o(a){return(""+a).replace(y,function(a){return B[a]})}function p(a){return(""+a).replace(z,function(a){return B[a]})}function q(a){return a=a.toLowerCase(),function(b){return b.title.toLowerCase().indexOf(a)>=0}}function r(a){var b=new RegExp("^"+a,"i");return function(a){return b.test(a.title)}}function s(b,c){var d,f,g,h;for(this.parent=b,this.tree=b.tree,this.ul=null,this.li=null,this.statusNodeType=null,this._isLoading=!1,this._error=null,this.data={},d=0,f=H.length;d<f;d++)g=H[d],this[g]=c[g];c.data&&a.extend(this.data,c.data);for(g in c)I[g]||a.isFunction(c[g])||K[g]||(this.data[g]=c[g]);null==this.key?this.tree.options.defaultKey?(this.key=this.tree.options.defaultKey(this),e(this.key,"defaultKey() must return a unique key")):this.key="_"+w._nextNodeKey++:this.key=""+this.key,c.active&&(e(null===this.tree.activeNode,"only one active node allowed"),this.tree.activeNode=this),c.selected&&(this.tree.lastSelectedNode=this),h=c.children,h?h.length?this._setChildren(h):this.children=this.lazy?[]:null:this.children=null,this.tree._callHook("treeRegisterNode",this.tree,!0,this)}function t(b){this.widget=b,this.$div=b.element,this.options=b.options,this.options&&(a.isFunction(this.options.lazyload)&&!a.isFunction(this.options.lazyLoad)&&(this.options.lazyLoad=function(){return w.warn("The 'lazyload' event is deprecated since 2014-02-25. Use 'lazyLoad' (with uppercase L) instead."),b.options.lazyload.apply(this,arguments)}),a.isFunction(this.options.loaderror)&&a.error("The 'loaderror' event was renamed since 2014-07-03. Use 'loadError' (with uppercase E) instead."),this.options.fx!==d&&w.warn("The 'fx' option was replaced by 'toggleEffect' since 2014-11-30."),this.options.removeNode!==d&&a.error("The 'removeNode' event was replaced by 'modifyChild' since 2.20 (2016-09-10).")),this.ext={},this.data=n(this.$div),this._id=a.ui.fancytree._nextId++,this._ns=".fancytree-"+this._id,this.activeNode=null,this.focusNode=null,this._hasFocus=null,this._enableUpdate=!0,this.lastSelectedNode=null,this.systemFocusElement=null,this.lastQuicksearchTerm="",this.lastQuicksearchTime=0,this.statusClassPropName="span",this.ariaPropName="li",this.nodeContainerAttrName="li",this.$div.find(">ul.fancytree-container").remove();var c,e={tree:this};this.rootNode=new s(e,{title:"root",key:"root_"+this._id,children:null,expanded:!0}),this.rootNode.parent=null,c=a("<ul>",{"class":"ui-fancytree fancytree-container fancytree-plain"}).appendTo(this.$div),this.$container=c,this.rootNode.ul=c[0],null==this.options.debugLevel&&(this.options.debugLevel=w.debugLevel)}if(a.ui&&a.ui.fancytree)return void a.ui.fancytree.warn("Fancytree: ignored duplicate include");var u,v,w=null,x=new RegExp(/\.|\//),y=/[&<>"'\/]/g,z=/[<>"'\/]/g,A="$recursive_request",B={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},C={16:!0,17:!0,18:!0},D={8:"backspace",9:"tab",10:"return",13:"return",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",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:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},E={0:"",1:"left",2:"middle",3:"right"},F="active expanded focus folder hideCheckbox lazy selected unselectable".split(" "),G={},H="expanded extraClasses folder hideCheckbox icon key lazy refKey selected statusNodeType title tooltip unselectable".split(" "),I={},J={},K={active:!0,children:!0,data:!0,focus:!0};for(u=0;u<F.length;u++)G[F[u]]=!0;for(u=0;u<H.length;u++)v=H[u],I[v]=!0,v!==v.toLowerCase()&&(J[v.toLowerCase()]=v);e(a.ui,"Fancytree requires jQuery UI (http://jqueryui.com)"),s.prototype={_findDirectChild:function(a){var b,c,d=this.children;if(d)if("string"==typeof a){for(b=0,c=d.length;b<c;b++)if(d[b].key===a)return d[b]}else{if("number"==typeof a)return this.children[a];if(a.parent===this)return a}return null},_setChildren:function(a){e(a&&(!this.children||0===this.children.length),"only init supported"),this.children=[];for(var b=0,c=a.length;b<c;b++)this.children.push(new s(this,a[b]))},addChildren:function(b,c){var d,f,g,h=this.getFirstChild(),i=this.getLastChild(),j=null,k=[];for(a.isPlainObject(b)&&(b=[b]),this.children||(this.children=[]),d=0,f=b.length;d<f;d++)k.push(new s(this,b[d]));if(j=k[0],null==c?this.children=this.children.concat(k):(c=this._findDirectChild(c),g=a.inArray(c,this.children),e(g>=0,"insertBefore must be an existing child"),this.children.splice.apply(this.children,[g,0].concat(k))),h&&!c){for(d=0,f=k.length;d<f;d++)k[d].render();h!==this.getFirstChild()&&h.renderStatus(),i!==this.getLastChild()&&i.renderStatus()}else(!this.parent||this.parent.ul||this.tr)&&this.render();return 3===this.tree.options.selectMode&&this.fixSelection3FromEndNodes(),this.triggerModifyChild("add",1===k.length?k[0]:null),j},addClass:function(a){return this.toggleClass(a,!0)},addNode:function(a,b){switch(b!==d&&"over"!==b||(b="child"),b){case"after":return this.getParent().addChildren(a,this.getNextSibling());case"before":return this.getParent().addChildren(a,this);case"firstChild":var c=this.children?this.children[0]:null;return this.addChildren(a,c);case"child":case"over":return this.addChildren(a)}e(!1,"Invalid mode: "+b)},addPagingNode:function(b,c){var d,e;if(c=c||"child",b===!1){for(d=this.children.length-1;d>=0;d--)e=this.children[d],"paging"===e.statusNodeType&&this.removeChild(e);return void(this.partload=!1)}return b=a.extend({title:this.tree.options.strings.moreData,statusNodeType:"paging",icon:!1},b),this.partload=!0,this.addNode(b,c)},appendSibling:function(a){return this.addNode(a,"after")},applyPatch:function(b){if(null===b)return this.remove(),k(this);var c,d,e,f={children:!0,expanded:!0,parent:!0};for(c in b)e=b[c],f[c]||a.isFunction(e)||(I[c]?this[c]=e:this.data[c]=e);return b.hasOwnProperty("children")&&(this.removeChildren(),b.children&&this._setChildren(b.children)),this.isVisible()&&(this.renderTitle(),this.renderStatus()),d=b.hasOwnProperty("expanded")?this.setExpanded(b.expanded):k(this)},collapseSiblings:function(){return this.tree._callHook("nodeCollapseSiblings",this)},copyTo:function(a,b,c){return a.addNode(this.toDict(!0,c),b)},countChildren:function(a){var b,c,d,e=this.children;if(!e)return 0;if(d=e.length,a!==!1)for(b=0,c=d;b<c;b++)d+=e[b].countChildren();return d},debug:function(a){this.tree.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),f("log",arguments))},discard:function(){return this.warn("FancytreeNode.discard() is deprecated since 2014-02-16. Use .resetLazy() instead."),this.resetLazy()},discardMarkup:function(a){var b=a?"nodeRemoveMarkup":"nodeRemoveChildMarkup";this.tree._callHook(b,this)},findAll:function(b){b=a.isFunction(b)?b:q(b);var c=[];return this.visit(function(a){b(a)&&c.push(a)}),c},findFirst:function(b){b=a.isFunction(b)?b:q(b);var c=null;return this.visit(function(a){if(b(a))return c=a,!1}),c},_changeSelectStatusAttrs:function(a){var b=!1;switch(a){case!1:b=this.selected||this.partsel,this.selected=!1,this.partsel=!1;break;case!0:b=!this.selected||!this.partsel,this.selected=!0,this.partsel=!0;break;case d:b=this.selected||!this.partsel,this.selected=!1,this.partsel=!0;break;default:e(!1,"invalid state: "+a)}return b&&this.renderStatus(),b},fixSelection3AfterClick:function(){var a=this.isSelected();this.visit(function(b){b._changeSelectStatusAttrs(a)}),this.fixSelection3FromEndNodes()},fixSelection3FromEndNodes:function(){function a(b){var c,e,f,g,h,i,j,k=b.children;if(k&&k.length){for(i=!0,j=!1,c=0,e=k.length;c<e;c++)f=k[c],g=a(f),g!==!1&&(j=!0),g!==!0&&(i=!1);h=!!i||!!j&&d}else h=!!b.selected;return b._changeSelectStatusAttrs(h),h}e(3===this.tree.options.selectMode,"expected selectMode 3"),a(this),this.visitParents(function(a){var b,c,e,f,g=a.children,h=!0,i=!1;for(b=0,c=g.length;b<c;b++)e=g[b],(e.selected||e.partsel)&&(i=!0),e.unselectable||e.selected||(h=!1);f=!!h||!!i&&d,a._changeSelectStatusAttrs(f)})},fromDict:function(b){for(var c in b)I[c]?this[c]=b[c]:"data"===c?a.extend(this.data,b.data):a.isFunction(b[c])||K[c]||(this.data[c]=b[c]);b.children&&(this.removeChildren(),this.addChildren(b.children)),this.renderTitle()},getChildren:function(){return this.hasChildren()===d?d:this.children},getFirstChild:function(){return this.children?this.children[0]:null},getIndex:function(){return a.inArray(this,this.parent.children)},getIndexHier:function(b,c){b=b||".";var d,e=[];return a.each(this.getParentList(!1,!0),function(a,b){d=""+(b.getIndex()+1),c&&(d=("0000000"+d).substr(-c)),e.push(d)}),e.join(b)},getKeyPath:function(a){var b=[],c=this.tree.options.keyPathSeparator;return this.visitParents(function(a){a.parent&&b.unshift(a.key)},!a),c+b.join(c)},getLastChild:function(){return this.children?this.children[this.children.length-1]:null},getLevel:function(){for(var a=0,b=this.parent;b;)a++,b=b.parent;return a},getNextSibling:function(){if(this.parent){var a,b,c=this.parent.children;for(a=0,b=c.length-1;a<b;a++)if(c[a]===this)return c[a+1]}return null},getParent:function(){return this.parent},getParentList:function(a,b){for(var c=[],d=b?this:this.parent;d;)(a||d.parent)&&c.unshift(d),d=d.parent;return c},getPrevSibling:function(){if(this.parent){var a,b,c=this.parent.children;for(a=1,b=c.length;a<b;a++)if(c[a]===this)return c[a-1]}return null},getSelectedNodes:function(a){var b=[];return this.visit(function(c){if(c.selected&&(b.push(c),a===!0))return"skip"}),b},hasChildren:function(){return this.lazy?null==this.children?d:0!==this.children.length&&(1!==this.children.length||!this.children[0].isStatusNode()||d):!(!this.children||!this.children.length)},hasFocus:function(){return this.tree.hasFocus()&&this.tree.focusNode===this},info:function(a){this.tree.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),f("info",arguments))},isActive:function(){return this.tree.activeNode===this},isChildOf:function(a){return this.parent&&this.parent===a},isDescendantOf:function(a){if(!a||a.tree!==this.tree)return!1;for(var b=this.parent;b;){if(b===a)return!0;b=b.parent}return!1},isExpanded:function(){return!!this.expanded},isFirstSibling:function(){var a=this.parent;return!a||a.children[0]===this},isFolder:function(){return!!this.folder},isLastSibling:function(){var a=this.parent;return!a||a.children[a.children.length-1]===this},isLazy:function(){return!!this.lazy},isLoaded:function(){return!this.lazy||this.hasChildren()!==d},isLoading:function(){return!!this._isLoading},isRoot:function(){return this.isRootNode()},isPartload:function(){return!!this.partload},isRootNode:function(){return this.tree.rootNode===this},isSelected:function(){return!!this.selected},isStatusNode:function(){return!!this.statusNodeType},isPagingNode:function(){return"paging"===this.statusNodeType},isTopLevel:function(){return this.tree.rootNode===this.parent},isUndefined:function(){return this.hasChildren()===d},isVisible:function(){var a,b,c=this.getParentList(!1,!1);for(a=0,b=c.length;a<b;a++)if(!c[a].expanded)return!1;return!0},lazyLoad:function(a){return this.warn("FancytreeNode.lazyLoad() is deprecated since 2014-02-16. Use .load() instead."),this.load(a)},load:function(a){var b,c,d=this,f=this.isExpanded();return e(this.isLazy(),"load() requires a lazy node"),a||this.isUndefined()?(this.isLoaded()&&this.resetLazy(),c=this.tree._triggerNodeEvent("lazyLoad",this),c===!1?k(this):(e("boolean"!=typeof c,"lazyLoad event must return source in data.result"),b=this.tree._callHook("nodeLoadChildren",this,c),f?(this.expanded=!0,b.always(function(){d.render()})):b.always(function(){d.renderStatus()}),b)):k(this)},makeVisible:function(b){var c,d=this,e=[],f=new a.Deferred,g=this.getParentList(!1,!1),h=g.length,i=!(b&&b.noAnimation===!0),j=!(b&&b.scrollIntoView===!1);for(c=h-1;c>=0;c--)e.push(g[c].setExpanded(!0,b));return a.when.apply(a,e).done(function(){j?d.scrollIntoView(i).done(function(){f.resolve()}):f.resolve()}),f.promise()},moveTo:function(b,c,f){c===d||"over"===c?c="child":"firstChild"===c&&(b.children&&b.children.length?(c="before",b=b.children[0]):c="child");var g,h=this.parent,i="child"===c?b:b.parent;if(this!==b){if(this.parent?i.isDescendantOf(this)&&a.error("Cannot move a node to its own descendant"):a.error("Cannot move system root"),i!==h&&h.triggerModifyChild("remove",this),1===this.parent.children.length){if(this.parent===i)return;this.parent.children=this.parent.lazy?[]:null,this.parent.expanded=!1}else g=a.inArray(this,this.parent.children),e(g>=0,"invalid source parent"),this.parent.children.splice(g,1);if(this.parent=i,i.hasChildren())switch(c){case"child":i.children.push(this);break;case"before":g=a.inArray(b,i.children),e(g>=0,"invalid target parent"),i.children.splice(g,0,this);break;case"after":g=a.inArray(b,i.children),e(g>=0,"invalid target parent"),i.children.splice(g+1,0,this);break;default:a.error("Invalid mode "+c)}else i.children=[this];f&&b.visit(f,!0),i===h?i.triggerModifyChild("move",this):i.triggerModifyChild("add",this),this.tree!==b.tree&&(this.warn("Cross-tree moveTo is experimantal!"),this.visit(function(a){a.tree=b.tree},!0)),h.isDescendantOf(i)||h.render(),i.isDescendantOf(h)||i===h||i.render()}},navigate:function(b,c){function d(d){if(d){try{d.makeVisible({scrollIntoView:!1})}catch(e){}return a(d.span).is(":visible")?c===!1?d.setFocus():d.setActive():(d.debug("Navigate: skipping hidden node"),void d.navigate(b,c))}}var e,f,g,h=!0,i=a.ui.keyCode,j=null;switch(b){case i.BACKSPACE:this.parent&&this.parent.parent&&(g=d(this.parent));break;case i.HOME:this.tree.visit(function(b){if(a(b.span).is(":visible"))return g=d(b),!1});break;case i.END:this.tree.visit(function(b){a(b.span).is(":visible")&&(g=b)}),g&&(g=d(g));break;case i.LEFT:this.expanded?(this.setExpanded(!1),g=d(this)):this.parent&&this.parent.parent&&(g=d(this.parent));break;case i.RIGHT:this.expanded||!this.children&&!this.lazy?this.children&&this.children.length&&(g=d(this.children[0])):(this.setExpanded(),g=d(this));break;case i.UP:for(j=this.getPrevSibling();j&&!a(j.span).is(":visible");)j=j.getPrevSibling();for(;j&&j.expanded&&j.children&&j.children.length;)j=j.children[j.children.length-1];!j&&this.parent&&this.parent.parent&&(j=this.parent),g=d(j);break;case i.DOWN:if(this.expanded&&this.children&&this.children.length)j=this.children[0];else for(f=this.getParentList(!1,!0),e=f.length-1;e>=0;e--){for(j=f[e].getNextSibling();j&&!a(j.span).is(":visible");)j=j.getNextSibling();if(j)break}g=d(j);break;default:h=!1}return g||k()},remove:function(){return this.parent.removeChild(this)},removeChild:function(a){return this.tree._callHook("nodeRemoveChild",this,a)},removeChildren:function(){return this.tree._callHook("nodeRemoveChildren",this)},removeClass:function(a){return this.toggleClass(a,!1)},render:function(a,b){return this.tree._callHook("nodeRender",this,a,b)},renderTitle:function(){return this.tree._callHook("nodeRenderTitle",this)},renderStatus:function(){return this.tree._callHook("nodeRenderStatus",this)},replaceWith:function(b){var c,d=this.parent,f=a.inArray(this,d.children),g=this;return e(this.isPagingNode(),"replaceWith() currently requires a paging status node"),c=this.tree._callHook("nodeLoadChildren",this,b),c.done(function(a){var b=g.children;for(u=0;u<b.length;u++)b[u].parent=d;d.children.splice.apply(d.children,[f+1,0].concat(b)),g.children=null,g.remove(),d.render()}).fail(function(){g.setExpanded()}),c},resetLazy:function(){this.removeChildren(),this.expanded=!1,this.lazy=!0,this.children=d,this.renderStatus()},scheduleAction:function(b,c){this.tree.timer&&clearTimeout(this.tree.timer),this.tree.timer=null;var d=this;switch(b){case"cancel":break;case"expand":this.tree.timer=setTimeout(function(){d.tree.debug("setTimeout: trigger expand"),d.setExpanded(!0)},c);break;case"activate":this.tree.timer=setTimeout(function(){d.tree.debug("setTimeout: trigger activate"),d.setActive(!0)},c);break;default:a.error("Invalid mode "+b)}},scrollIntoView:function(f,h){h!==d&&g(h)&&(this.warn("scrollIntoView() with 'topNode' option is deprecated since 2014-05-08. Use 'options.topNode' instead."),h={topNode:h});var i,j,l,m,n=a.extend({effects:f===!0?{duration:200,queue:!1}:f,scrollOfs:this.tree.options.scrollOfs,scrollParent:this.tree.options.scrollParent||this.tree.$container,topNode:null},h),o=new a.Deferred,p=this,q=a(this.span).height(),r=a(n.scrollParent),s=n.scrollOfs.top||0,t=n.scrollOfs.bottom||0,u=r.height(),v=r.scrollTop(),w=r,x=r[0]===b,y=n.topNode||null,z=null;return a(this.span).is(":visible")?(x?(j=a(this.span).offset().top,i=y&&y.span?a(y.span).offset().top:0,w=a("html,body")):(e(r[0]!==c&&r[0]!==c.body,"scrollParent should be a simple element or `window`, not document or body."),m=r.offset().top,j=a(this.span).offset().top-m+v,i=y?a(y.span).offset().top-m+v:0,l=Math.max(0,r.innerHeight()-r[0].clientHeight),u-=l),j<v+s?z=j-s:j+q>v+u-t&&(z=j+q-u+t,y&&(e(y.isRootNode()||a(y.span).is(":visible"),"topNode must be visible"),i<z&&(z=i-s))),null!==z?n.effects?(n.effects.complete=function(){o.resolveWith(p)},w.stop(!0).animate({scrollTop:z},n.effects)):(w[0].scrollTop=z,o.resolveWith(this)):o.resolveWith(this),o.promise()):(this.warn("scrollIntoView(): node is invisible."),k())},setActive:function(a,b){return this.tree._callHook("nodeSetActive",this,a,b)},setExpanded:function(a,b){return this.tree._callHook("nodeSetExpanded",this,a,b)},setFocus:function(a){return this.tree._callHook("nodeSetFocus",this,a)},setSelected:function(a){return this.tree._callHook("nodeSetSelected",this,a)},setStatus:function(a,b,c){return this.tree._callHook("nodeSetStatus",this,a,b,c)},setTitle:function(a){this.title=a,this.renderTitle(),this.triggerModify("rename")},sortChildren:function(a,b){var c,d,e=this.children;if(e){if(a=a||function(a,b){var c=a.title.toLowerCase(),d=b.title.toLowerCase();return c===d?0:c>d?1:-1},e.sort(a),b)for(c=0,d=e.length;c<d;c++)e[c].children&&e[c].sortChildren(a,"$norender$");"$norender$"!==b&&this.render(),this.triggerModifyChild("sort")}},toDict:function(b,c){var d,e,f,g={},h=this;if(a.each(H,function(a,b){(h[b]||h[b]===!1)&&(g[b]=h[b])}),a.isEmptyObject(this.data)||(g.data=a.extend({},this.data),a.isEmptyObject(g.data)&&delete g.data),c&&c(g,h),b&&this.hasChildren())for(g.children=[],d=0,e=this.children.length;d<e;d++)f=this.children[d],f.isStatusNode()||g.children.push(f.toDict(!0,c));return g},toggleClass:function(b,c){var e,f,g=/\S+/g,h=b.match(g)||[],i=0,j=!1,k=this[this.tree.statusClassPropName],l=" "+(this.extraClasses||"")+" ";for(k&&a(k).toggleClass(b,c);e=h[i++];)if(f=l.indexOf(" "+e+" ")>=0,c=c===d?!f:!!c)f||(l+=e+" ",j=!0);else for(;l.indexOf(" "+e+" ")>-1;)l=l.replace(" "+e+" "," ");return this.extraClasses=a.trim(l),j},toggleExpanded:function(){return this.tree._callHook("nodeToggleExpanded",this)},toggleSelected:function(){return this.tree._callHook("nodeToggleSelected",this)},toString:function(){return"<FancytreeNode(#"+this.key+", '"+this.title+"')>"},triggerModifyChild:function(b,c,d){var e,f=this.tree.options.modifyChild;f&&(c&&c.parent!==this&&a.error("childNode "+c+" is not a child of "+this),e={node:this,tree:this.tree,operation:b,childNode:c||null},d&&a.extend(e,d),f({type:"modifyChild"},e))},triggerModify:function(a,b){this.parent.triggerModifyChild(a,this,b)},visit:function(a,b){var c,d,e=!0,f=this.children;if(b===!0&&(e=a(this),e===!1||"skip"===e))return e;if(f)for(c=0,d=f.length;c<d&&(e=f[c].visit(a,!0),e!==!1);c++);return e},visitAndLoad:function(b,c,d){var e,f,g,h=this;return b&&c===!0&&(f=b(h),f===!1||"skip"===f)?d?f:k():h.children||h.lazy?(e=new a.Deferred,g=[],h.load().done(function(){for(var c=0,d=h.children.length;c<d;c++){if(f=h.children[c].visitAndLoad(b,!0,!0),f===!1){e.reject();break}"skip"!==f&&g.push(f)}a.when.apply(this,g).then(function(){e.resolve()})}),e.promise()):k()},visitParents:function(a,b){if(b&&a(this)===!1)return!1;for(var c=this.parent;c;){if(a(c)===!1)return!1;c=c.parent}return!0},warn:function(a){Array.prototype.unshift.call(arguments,this.toString()),f("warn",arguments)}},t.prototype={_makeHookContext:function(b,c,e){var f,g;return b.node!==d?(c&&b.originalEvent!==c&&a.error("invalid args"),f=b):b.tree?(g=b.tree,f={node:b,tree:g,widget:g.widget,options:g.widget.options,originalEvent:c}):b.widget?f={node:null,tree:b,widget:b.widget,options:b.widget.options,originalEvent:c}:a.error("invalid args"),e&&a.extend(f,e),f},_callHook:function(b,c,d){var e=this._makeHookContext(c),f=this[b],g=Array.prototype.slice.call(arguments,2);return a.isFunction(f)||a.error("_callHook('"+b+"') is not a function"),g.unshift(e),f.apply(this,g)},_requireExtension:function(b,c,d,f){d=!!d;var g=this._local.name,h=this.options.extensions,i=a.inArray(b,h)<a.inArray(g,h),j=c&&null==this.ext[b],k=!j&&null!=d&&d!==i;return e(g&&g!==b,"invalid or same name"),!j&&!k||(f||(j||c?(f="'"+g+"' extension requires '"+b+"'",k&&(f+=" to be registered "+(d?"before":"after")+" itself")):f="If used together, `"+b+"` must be registered "+(d?"before":"after")+" `"+g+"`"),a.error(f),!1)},activateKey:function(a){var b=this.getNodeByKey(a);return b?b.setActive():this.activeNode&&this.activeNode.setActive(!1),b},addPagingNode:function(a,b){return this.rootNode.addPagingNode(a,b)},applyPatch:function(b){var c,d,f,g,h,i,j=b.length,k=[];for(d=0;d<j;d++)f=b[d],e(2===f.length,"patchList must be an array of length-2-arrays"),g=f[0],h=f[1],i=null===g?this.rootNode:this.getNodeByKey(g),i?(c=new a.Deferred,k.push(c),i.applyPatch(h).always(m(c,i))):this.warn("could not find node with key '"+g+"'");return a.when.apply(a,k).promise()},clear:function(a){this._callHook("treeClear",this)},count:function(){return this.rootNode.countChildren()},debug:function(a){this.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),f("log",arguments))},enableUpdate:function(a){return a=a!==!1,!!this._enableUpdate==!!a?a:(this._enableUpdate=a,a?(this.debug("enableUpdate(true): redraw "),this.render()):this.debug("enableUpdate(false)..."),!a)},findAll:function(a){return this.rootNode.findAll(a)},findFirst:function(a){return this.rootNode.findFirst(a)},findNextNode:function(b,c,d){var e=null,f=c.parent.children,g=null,h=function(a,b,c){var d,e,f=a.children,g=f.length,i=f[b];if(i&&c(i)===!1)return!1;if(i&&i.children&&i.expanded&&h(i,0,c)===!1)return!1;for(d=b+1;d<g;d++)if(h(a,d,c)===!1)return!1;return e=a.parent,e?h(e,e.children.indexOf(a)+1,c):h(a,0,c)};return b="string"==typeof b?r(b):b,c=c||this.getFirstChild(),h(c.parent,f.indexOf(c),function(d){return d!==e&&(e=e||d,a(d.span).is(":visible")?(!b(d)||(g=d,g===c))&&void 0:void d.debug("quicksearch: skipping hidden node"))}),g},generateFormElements:function(b,c,d){function e(b){j.append(a("<input>",{type:"checkbox",name:g,value:b.key,checked:!0}))}d=d||{};var f,g="string"==typeof b?b:"ft_"+this._id+"[]",h="string"==typeof c?c:"ft_"+this._id+"_active",i="fancytree_result_"+this._id,j=a("#"+i),k=3===this.options.selectMode&&d.stopOnParents!==!1;j.length?j.empty():j=a("<div>",{id:i}).hide().insertAfter(this.$container),c!==!1&&this.activeNode&&j.append(a("<input>",{type:"radio",name:h,value:this.activeNode.key,checked:!0})),d.filter?this.visit(function(a){var b=d.filter(a);return"skip"===b?b:void(b!==!1&&e(a))}):b!==!1&&(f=this.getSelectedNodes(k),a.each(f,function(a,b){e(b)}))},getActiveNode:function(){return this.activeNode},getFirstChild:function(){return this.rootNode.getFirstChild()},getFocusNode:function(){return this.focusNode},getNodeByKey:function(a,b){var d,e;return!b&&(d=c.getElementById(this.options.idPrefix+a))?d.ftnode?d.ftnode:null:(b=b||this.rootNode,e=null,b.visit(function(b){if(b.key===a)return e=b,!1},!0),e)},getRootNode:function(){return this.rootNode},getSelectedNodes:function(a){return this.rootNode.getSelectedNodes(a)},hasFocus:function(){return!!this._hasFocus},info:function(a){this.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),f("info",arguments))},loadKeyPath:function(b,c,e){function f(a,b,d){c.call(r,b,"loading"),b.load().done(function(){r.loadKeyPath.call(r,l[a],c,b).always(m(d,r))}).fail(function(e){r.warn("loadKeyPath: error loading: "+a+" (parent: "+o+")"),c.call(r,b,"error"),d.reject()})}var g,h,i,j,k,l,n,o,p,q=this.options.keyPathSeparator,r=this;for(c=c||a.noop,a.isArray(b)||(b=[b]),l={},i=0;i<b.length;i++)for(o=e||this.rootNode,j=b[i],j.charAt(0)===q&&(j=j.substr(1)),p=j.split(q);p.length;){if(k=p.shift(),n=o._findDirectChild(k),!n){this.warn("loadKeyPath: key not found: "+k+" (parent: "+o+")"),c.call(this,k,"error");break}if(0===p.length){c.call(this,n,"ok");break}if(n.lazy&&n.hasChildren()===d){c.call(this,n,"loaded"),l[k]?l[k].push(p.join(q)):l[k]=[p.join(q)];break}c.call(this,n,"loaded"),o=n}g=[];for(k in l)n=o._findDirectChild(k),null==n&&(n=r.getNodeByKey(k)),h=new a.Deferred,g.push(h),f(k,n,h);return a.when.apply(a,g).promise()},reactivate:function(a){var b,c=this.activeNode;return c?(this.activeNode=null,b=c.setActive(!0,{noFocus:!0}),a&&c.setFocus(),b):k()},reload:function(a){return this._callHook("treeClear",this),this._callHook("treeLoad",this,a)},render:function(a,b){return this.rootNode.render(a,b)},setFocus:function(a){return this._callHook("treeSetFocus",this,a)},toDict:function(a,b){var c=this.rootNode.toDict(!0,b);return a?c:c.children},toString:function(){return"<Fancytree(#"+this._id+")>"},_triggerNodeEvent:function(a,b,c,e){var f=this._makeHookContext(b,c,e),g=this.widget._trigger(a,c,f);return g!==!1&&f.result!==d?f.result:g},_triggerTreeEvent:function(a,b,c){var e=this._makeHookContext(this,b,c),f=this.widget._trigger(a,b,e);return f!==!1&&e.result!==d?e.result:f},visit:function(a){return this.rootNode.visit(a,!1)},warn:function(a){Array.prototype.unshift.call(arguments,this.toString()),f("warn",arguments)}},a.extend(t.prototype,{nodeClick:function(a){var b,c,d=a.targetType,e=a.node;if("expander"===d){if(e.isLoading())return void e.debug("Got 2nd click while loading: ignored");this._callHook("nodeToggleExpanded",a)}else if("checkbox"===d)this._callHook("nodeToggleSelected",a),a.options.focusOnSelect&&this._callHook("nodeSetFocus",a,!0);else{if(c=!1,b=!0,e.folder)switch(a.options.clickFolderMode){case 2:c=!0,b=!1;break;case 3:b=!0,c=!0}b&&(this.nodeSetFocus(a),this._callHook("nodeSetActive",a,!0)),c&&this._callHook("nodeToggleExpanded",a)}},nodeCollapseSiblings:function(a,b){var c,d,e,f=a.node;if(f.parent)for(c=f.parent.children,d=0,e=c.length;d<e;d++)c[d]!==f&&c[d].expanded&&this._callHook("nodeSetExpanded",c[d],!1,b)},nodeDblclick:function(a){"title"===a.targetType&&4===a.options.clickFolderMode&&this._callHook("nodeToggleExpanded",a),"title"===a.targetType&&a.originalEvent.preventDefault()},nodeKeydown:function(b){var c,d,e,f,g=b.originalEvent,h=b.node,i=b.tree,j=b.options,k=g.which,l=String.fromCharCode(k),m=!(g.altKey||g.ctrlKey||g.metaKey||g.shiftKey),n=a(g.target),o=!0,p=!(g.ctrlKey||!j.autoActivate);if(h||(f=this.getActiveNode()||this.getFirstChild(),f&&(f.setFocus(),h=b.node=this.focusNode,h.debug("Keydown force focus on active node"))),j.quicksearch&&m&&/\w/.test(l)&&!D[k]&&!n.is(":input:enabled"))return d=(new Date).getTime(),d-i.lastQuicksearchTime>500&&(i.lastQuicksearchTerm=""),i.lastQuicksearchTime=d,i.lastQuicksearchTerm+=l,c=i.findNextNode(i.lastQuicksearchTerm,i.getActiveNode()),c&&c.setActive(),void g.preventDefault();switch(w.eventToString(g)){case"+":case"=":i.nodeSetExpanded(b,!0);break;case"-":i.nodeSetExpanded(b,!1);break;case"space":h.isPagingNode()?i._triggerNodeEvent("clickPaging",b,g):j.checkbox?i.nodeToggleSelected(b):i.nodeSetActive(b,!0);break;case"return":i.nodeSetActive(b,!0);break;case"home":case"end":case"backspace":case"left":case"right":case"up":case"down":e=h.navigate(g.which,p,!0);break;default:o=!1}o&&g.preventDefault()},nodeLoadChildren:function(b,c){var d,f,g,h=b.tree,i=b.node,j=(new Date).getTime();return a.isFunction(c)&&(c=c.call(h,{type:"source"},b),e(!a.isFunction(c),"source callback must not return another function")),c.url&&(i._requestId&&i.warn("Recursive load request #"+j+" while #"+i._requestId+" is pending."),d=a.extend({},b.options.ajax,c),i._requestId=j,d.debugDelay?(f=d.debugDelay,a.isArray(f)&&(f=f[0]+Math.random()*(f[1]-f[0])),i.warn("nodeLoadChildren waiting debugDelay "+Math.round(f)+" ms ..."),d.debugDelay=!1,g=a.Deferred(function(b){setTimeout(function(){a.ajax(d).done(function(){b.resolveWith(this,arguments)}).fail(function(){b.rejectWith(this,arguments)})},f)})):g=a.ajax(d),c=new a.Deferred,g.done(function(d,e,f){var g,k;if("json"!==this.dataType&&"jsonp"!==this.dataType||"string"!=typeof d||a.error("Ajax request returned a string (did you get the JSON dataType wrong?)."),i._requestId&&i._requestId>j)return void c.rejectWith(this,[A]);if(b.options.postProcess){try{k=h._triggerNodeEvent("postProcess",b,b.originalEvent,{response:d,error:null,dataType:this.dataType})}catch(l){k={error:l,message:""+l,details:"postProcess failed"}}if(k.error)return g=a.isPlainObject(k.error)?k.error:{message:k.error},g=h._makeHookContext(i,null,g),void c.rejectWith(this,[g]);d=a.isArray(k)?k:d}else d&&d.hasOwnProperty("d")&&b.options.enableAspx&&(d="string"==typeof d.d?a.parseJSON(d.d):d.d);c.resolveWith(this,[d])}).fail(function(a,b,d){var e=h._makeHookContext(i,null,{error:a,args:Array.prototype.slice.call(arguments),message:d,details:a.status+": "+d});c.rejectWith(this,[e])})),a.isFunction(c.then)&&a.isFunction(c["catch"])&&(g=c,c=new a.Deferred,g.then(function(a){c.resolve(a)},function(a){c.reject(a)})),a.isFunction(c.promise)&&(h.nodeSetStatus(b,"loading"),c.done(function(a){h.nodeSetStatus(b,"ok"),i._requestId=null}).fail(function(a){var c;return a===A?void i.warn("Ignored response for obsolete load request #"+j+" (expected #"+i._requestId+")"):(a.node&&a.error&&a.message?c=a:(c=h._makeHookContext(i,null,{error:a,args:Array.prototype.slice.call(arguments),message:a?a.message||a.toString():""}),"[object Object]"===c.message&&(c.message="")),i.warn("Load children failed ("+c.message+")",c),void(h._triggerNodeEvent("loadError",c,null)!==!1&&h.nodeSetStatus(b,"error",c.message,c.details)))})),a.when(c).done(function(b){var c;a.isPlainObject(b)&&(e(i.isRootNode(),"source may only be an object for root nodes (expecting an array of child objects otherwise)"),
e(a.isArray(b.children),"if an object is passed as source, it must contain a 'children' array (all other properties are added to 'tree.data')"),c=b,b=b.children,delete c.children,a.extend(h.data,c)),e(a.isArray(b),"expected array of children"),i._setChildren(b),h._triggerNodeEvent("loadChildren",i)})},nodeLoadKeyPath:function(a,b){},nodeRemoveChild:function(b,c){var d,f=b.node,g=a.extend({},b,{node:c}),h=f.children;return 1===h.length?(e(c===h[0],"invalid single child"),this.nodeRemoveChildren(b)):(this.activeNode&&(c===this.activeNode||this.activeNode.isDescendantOf(c))&&this.activeNode.setActive(!1),this.focusNode&&(c===this.focusNode||this.focusNode.isDescendantOf(c))&&(this.focusNode=null),this.nodeRemoveMarkup(g),this.nodeRemoveChildren(g),d=a.inArray(c,h),e(d>=0,"invalid child"),f.triggerModifyChild("remove",c),c.visit(function(a){a.parent=null},!0),this._callHook("treeRegisterNode",this,!1,c),void h.splice(d,1))},nodeRemoveChildMarkup:function(b){var c=b.node;c.ul&&(c.isRootNode()?a(c.ul).empty():(a(c.ul).remove(),c.ul=null),c.visit(function(a){a.li=a.ul=null}))},nodeRemoveChildren:function(b){var c,d=b.tree,e=b.node,f=e.children;f&&(this.activeNode&&this.activeNode.isDescendantOf(e)&&this.activeNode.setActive(!1),this.focusNode&&this.focusNode.isDescendantOf(e)&&(this.focusNode=null),this.nodeRemoveChildMarkup(b),c=a.extend({},b),e.triggerModifyChild("remove",null),e.visit(function(a){a.parent=null,d._callHook("treeRegisterNode",d,!1,a)}),e.lazy?e.children=[]:e.children=null,e.isRootNode()||(e.expanded=!1),this.nodeRenderStatus(b))},nodeRemoveMarkup:function(b){var c=b.node;c.li&&(a(c.li).remove(),c.li=null),this.nodeRemoveChildMarkup(b)},nodeRender:function(b,d,f,g,h){var i,j,k,l,m,n,o,p=b.node,q=b.tree,r=b.options,s=r.aria,t=!1,u=p.parent,v=!u,w=p.children,x=null;if(q._enableUpdate!==!1&&(v||u.ul)){if(e(v||u.ul,"parent UL must exist"),v||(p.li&&(d||p.li.parentNode!==p.parent.ul)&&(p.li.parentNode===p.parent.ul?x=p.li.nextSibling:this.debug("Unlinking "+p+" (must be child of "+p.parent+")"),this.nodeRemoveMarkup(b)),p.li?this.nodeRenderStatus(b):(t=!0,p.li=c.createElement("li"),p.li.ftnode=p,p.key&&r.generateIds&&(p.li.id=r.idPrefix+p.key),p.span=c.createElement("span"),p.span.className="fancytree-node",s&&!p.tr&&a(p.li).attr("role","treeitem"),p.li.appendChild(p.span),this.nodeRenderTitle(b),r.createNode&&r.createNode.call(q,{type:"createNode"},b)),r.renderNode&&r.renderNode.call(q,{type:"renderNode"},b)),w){if(v||p.expanded||f===!0){for(p.ul||(p.ul=c.createElement("ul"),(g!==!0||h)&&p.expanded||(p.ul.style.display="none"),s&&a(p.ul).attr("role","group"),p.li?p.li.appendChild(p.ul):p.tree.$div.append(p.ul)),l=0,m=w.length;l<m;l++)o=a.extend({},b,{node:w[l]}),this.nodeRender(o,d,f,!1,!0);for(i=p.ul.firstChild;i;)k=i.ftnode,k&&k.parent!==p?(p.debug("_fixParent: remove missing "+k,i),n=i.nextSibling,i.parentNode.removeChild(i),i=n):i=i.nextSibling;for(i=p.ul.firstChild,l=0,m=w.length-1;l<m;l++)j=w[l],k=i.ftnode,j!==k?p.ul.insertBefore(j.li,k.li):i=i.nextSibling}}else p.ul&&(this.warn("remove child markup for "+p),this.nodeRemoveChildMarkup(b));v||t&&u.ul.insertBefore(p.li,x)}},nodeRenderTitle:function(b,c){var e,f,g,h,i,j=b.node,k=b.tree,l=b.options,m=l.aria,n=j.getLevel(),q=[];c!==d&&(j.title=c),j.span&&k._enableUpdate!==!1&&(g=m&&j.hasChildren()!==!1?" role='button'":"",n<l.minExpandLevel?(j.lazy||(j.expanded=!0),n>1&&q.push("<span "+g+" class='fancytree-expander fancytree-expander-fixed'></span>")):q.push("<span "+g+" class='fancytree-expander'></span>"),l.checkbox&&j.hideCheckbox!==!0&&!j.isStatusNode()&&(g=m?" role='checkbox'":"",q.push("<span "+g+" class='fancytree-checkbox'></span>")),j.data.iconClass!==d&&(j.icon?a.error("'iconClass' node option is deprecated since v2.14.0: use 'icon' only instead"):(j.warn("'iconClass' node option is deprecated since v2.14.0: use 'icon' instead"),j.icon=j.data.iconClass)),e=w.evalOption("icon",j,j,l,!0),"boolean"!=typeof e&&(e=""+e),e!==!1&&(g=m?" role='presentation'":"","string"==typeof e?x.test(e)?(e="/"===e.charAt(0)?e:(l.imagePath||"")+e,q.push("<img src='"+e+"' class='fancytree-icon' alt='' />")):q.push("<span "+g+" class='fancytree-custom-icon "+e+"'></span>"):q.push("<span "+g+" class='fancytree-icon'></span>")),f="",l.renderTitle&&(f=l.renderTitle.call(k,{type:"renderTitle"},b)||""),f||(j.tooltip?i=j.tooltip:l.tooltip&&(i=l.tooltip===!0?j.title:l.tooltip.call(k,j)),i=i?" title='"+p(i)+"'":"",h=l.titlesTabbable?" tabindex='0'":"",f="<span class='fancytree-title'"+i+h+">"+(l.escapeTitles?o(j.title):j.title)+"</span>"),q.push(f),j.span.innerHTML=q.join(""),this.nodeRenderStatus(b),l.enhanceTitle&&(b.$title=a(">span.fancytree-title",j.span),f=l.enhanceTitle.call(k,{type:"enhanceTitle"},b)||""))},nodeRenderStatus:function(b){var c,d=b.node,e=b.tree,f=b.options,g=d.hasChildren(),h=d.isLastSibling(),i=f.aria,j=f._classNames,k=[],l=d[e.statusClassPropName];l&&e._enableUpdate!==!1&&(i&&(c=a(d.tr||d.li)),k.push(j.node),e.activeNode===d&&k.push(j.active),e.focusNode===d&&k.push(j.focused),d.expanded&&k.push(j.expanded),i&&(g!==!1?c.attr("aria-expanded",Boolean(d.expanded)):c.removeAttr("aria-expanded")),d.folder&&k.push(j.folder),g!==!1&&k.push(j.hasChildren),h&&k.push(j.lastsib),d.lazy&&null==d.children&&k.push(j.lazy),d.partload&&k.push(j.partload),d.partsel&&k.push(j.partsel),d.unselectable&&k.push(j.unselectable),d._isLoading&&k.push(j.loading),d._error&&k.push(j.error),d.statusNodeType&&k.push(j.statusNodePrefix+d.statusNodeType),d.selected?(k.push(j.selected),i&&c.attr("aria-selected",!0)):i&&c.attr("aria-selected",!1),d.extraClasses&&k.push(d.extraClasses),g===!1?k.push(j.combinedExpanderPrefix+"n"+(h?"l":"")):k.push(j.combinedExpanderPrefix+(d.expanded?"e":"c")+(d.lazy&&null==d.children?"d":"")+(h?"l":"")),k.push(j.combinedIconPrefix+(d.expanded?"e":"c")+(d.folder?"f":"")),l.className=k.join(" "),d.li&&a(d.li).toggleClass(j.lastsib,h))},nodeSetActive:function(b,c,d){d=d||{};var f,g=b.node,h=b.tree,i=b.options,j=d.noEvents===!0,m=d.noFocus===!0,n=g===h.activeNode;return c=c!==!1,n===c?k(g):c&&!j&&this._triggerNodeEvent("beforeActivate",g,b.originalEvent)===!1?l(g,["rejected"]):(c?(h.activeNode&&(e(h.activeNode!==g,"node was active (inconsistency)"),f=a.extend({},b,{node:h.activeNode}),h.nodeSetActive(f,!1),e(null===h.activeNode,"deactivate was out of sync?")),i.activeVisible&&g.makeVisible({scrollIntoView:m&&null==h.focusNode}),h.activeNode=g,h.nodeRenderStatus(b),m||h.nodeSetFocus(b),j||h._triggerNodeEvent("activate",g,b.originalEvent)):(e(h.activeNode===g,"node was not active (inconsistency)"),h.activeNode=null,this.nodeRenderStatus(b),j||b.tree._triggerNodeEvent("deactivate",g,b.originalEvent)),k(g))},nodeSetExpanded:function(b,c,e){e=e||{};var f,g,h,i,j,m,n=b.node,o=b.tree,p=b.options,q=e.noAnimation===!0,r=e.noEvents===!0;if(c=c!==!1,n.expanded&&c||!n.expanded&&!c)return k(n);if(c&&!n.lazy&&!n.hasChildren())return k(n);if(!c&&n.getLevel()<p.minExpandLevel)return l(n,["locked"]);if(!r&&this._triggerNodeEvent("beforeExpand",n,b.originalEvent)===!1)return l(n,["rejected"]);if(q||n.isVisible()||(q=e.noAnimation=!0),g=new a.Deferred,c&&!n.expanded&&p.autoCollapse){j=n.getParentList(!1,!0),m=p.autoCollapse;try{for(p.autoCollapse=!1,h=0,i=j.length;h<i;h++)this._callHook("nodeCollapseSiblings",j[h],e)}finally{p.autoCollapse=m}}return g.done(function(){var a=n.getLastChild();c&&p.autoScroll&&!q&&a?a.scrollIntoView(!0,{topNode:n}).always(function(){r||b.tree._triggerNodeEvent(c?"expand":"collapse",b)}):r||b.tree._triggerNodeEvent(c?"expand":"collapse",b)}),f=function(d){var e,f,g=p._classNames,h=p.toggleEffect;if(n.expanded=c,o._callHook("nodeRender",b,!1,!1,!0),n.ul)if(e="none"!==n.ul.style.display,f=!!n.expanded,e===f)n.warn("nodeSetExpanded: UL.style.display already set");else{if(h&&!q)return a(n.li).addClass(g.animating),void a(n.ul).addClass(g.animating).toggle(h.effect,h.options,h.duration,function(){a(this).removeClass(g.animating),a(n.li).removeClass(g.animating),d()});n.ul.style.display=n.expanded||!parent?"":"none"}d()},c&&n.lazy&&n.hasChildren()===d?n.load().done(function(){g.notifyWith&&g.notifyWith(n,["loaded"]),f(function(){g.resolveWith(n)})}).fail(function(a){f(function(){g.rejectWith(n,["load failed ("+a+")"])})}):f(function(){g.resolveWith(n)}),g.promise()},nodeSetFocus:function(b,d){var e,f=b.tree,g=b.node,h=f.options,i=!!b.originalEvent&&a(b.originalEvent.target).is(":input");if(d=d!==!1,f.focusNode){if(f.focusNode===g&&d)return;e=a.extend({},b,{node:f.focusNode}),f.focusNode=null,this._triggerNodeEvent("blur",e),this._callHook("nodeRenderStatus",e)}d&&(this.hasFocus()||(g.debug("nodeSetFocus: forcing container focus"),this._callHook("treeSetFocus",b,!0,{calledByNode:!0})),g.makeVisible({scrollIntoView:!1}),f.focusNode=g,h.titlesTabbable?i||a(g.span).find(".fancytree-title").focus():0===a(c.activeElement).closest(".fancytree-container").length&&a(f.$container).focus(),h.aria&&a(f.$container).attr("aria-activedescendant",a(g.tr||g.li).uniqueId().attr("id")),this._triggerNodeEvent("focus",b),h.autoScroll&&g.scrollIntoView(),this._callHook("nodeRenderStatus",b))},nodeSetSelected:function(a,b){var c=a.node,d=a.tree,e=a.options;if(b=b!==!1,!c.unselectable){if(c.selected&&b||!c.selected&&!b)return!!c.selected;if(this._triggerNodeEvent("beforeSelect",c,a.originalEvent)===!1)return!!c.selected;b&&1===e.selectMode?d.lastSelectedNode&&d.lastSelectedNode.setSelected(!1):3===e.selectMode&&(c.selected=b,c.fixSelection3AfterClick()),c.selected=b,this.nodeRenderStatus(a),d.lastSelectedNode=b?c:null,d._triggerNodeEvent("select",a)}},nodeSetStatus:function(b,c,d,e){function f(){var a=h.children?h.children[0]:null;if(a&&a.isStatusNode()){try{h.ul&&(h.ul.removeChild(a.li),a.li=null)}catch(b){}1===h.children.length?h.children=[]:h.children.shift()}}function g(b,c){var d=h.children?h.children[0]:null;return d&&d.isStatusNode()?(a.extend(d,b),d.statusNodeType=c,i._callHook("nodeRenderTitle",d)):(h._setChildren([b]),h.children[0].statusNodeType=c,i.render()),h.children[0]}var h=b.node,i=b.tree;switch(c){case"ok":f(),h._isLoading=!1,h._error=null,h.renderStatus();break;case"loading":h.parent||g({title:i.options.strings.loading+(d?" ("+d+")":""),checkbox:!1,tooltip:e},c),h._isLoading=!0,h._error=null,h.renderStatus();break;case"error":g({title:i.options.strings.loadError+(d?" ("+d+")":""),checkbox:!1,tooltip:e},c),h._isLoading=!1,h._error={message:d,details:e},h.renderStatus();break;case"nodata":g({title:i.options.strings.noData,checkbox:!1,tooltip:e},c),h._isLoading=!1,h._error=null,h.renderStatus();break;default:a.error("invalid node status "+c)}},nodeToggleExpanded:function(a){return this.nodeSetExpanded(a,!a.node.expanded)},nodeToggleSelected:function(a){return this.nodeSetSelected(a,!a.node.selected)},treeClear:function(a){var b=a.tree;b.activeNode=null,b.focusNode=null,b.$div.find(">ul.fancytree-container").empty(),b.rootNode.children=null},treeCreate:function(a){},treeDestroy:function(a){this.$div.find(">ul.fancytree-container").remove(),this.$source&&this.$source.removeClass("ui-helper-hidden")},treeInit:function(a){var b=a.tree,c=b.options;b.$container.attr("tabindex",c.tabindex),c.rtl?b.$container.attr("DIR","RTL").addClass("fancytree-rtl"):b.$container.removeAttr("DIR").removeClass("fancytree-rtl"),c.aria&&(b.$container.attr("role","tree"),1!==c.selectMode&&b.$container.attr("aria-multiselectable",!0)),this.treeLoad(a)},treeLoad:function(b,c){var d,f,g,h,i=b.tree,j=b.widget.element,k=a.extend({},b,{node:this.rootNode});if(i.rootNode.children&&this.treeClear(b),c=c||this.options.source)"string"==typeof c&&a.error("Not implemented");else switch(f=j.data("type")||"html"){case"html":g=j.find(">ul:first"),g.addClass("ui-fancytree-source ui-helper-hidden"),c=a.ui.fancytree.parseHtml(g),this.data=a.extend(this.data,n(g));break;case"json":c=a.parseJSON(j.text()),j.contents().filter(function(){return 3===this.nodeType}).remove(),a.isPlainObject(c)&&(e(a.isArray(c.children),"if an object is passed as source, it must contain a 'children' array (all other properties are added to 'tree.data')"),d=c,c=c.children,delete d.children,a.extend(i.data,d));break;default:a.error("Invalid data-type: "+f)}return h=this.nodeLoadChildren(k,c).done(function(){i.render(),3===b.options.selectMode&&i.rootNode.fixSelection3FromEndNodes(),i.activeNode&&i.options.activeVisible&&i.activeNode.makeVisible(),i._triggerTreeEvent("init",null,{status:!0})}).fail(function(){i.render(),i._triggerTreeEvent("init",null,{status:!1})})},treeRegisterNode:function(a,b,c){},treeSetFocus:function(b,c,d){function e(a){!a.activeNode&&a.getFirstChild()&&a.getFirstChild().setFocus()}if(c=c!==!1,c!==this.hasFocus()&&(this._hasFocus=c,!c&&this.focusNode?this.focusNode.setFocus(!1):!c||d&&d.calledByNode||a(this.$container).focus(),this.$container.toggleClass("fancytree-treefocus",c),this._triggerTreeEvent(c?"focusTree":"blurTree"),c)){var f=this;setTimeout(function(){e(f)},0)}},treeSetOption:function(b,c,d){var e=b.tree,f=!0,g=!1;switch(c){case"aria":case"checkbox":case"icon":case"minExpandLevel":case"tabindex":e._callHook("treeCreate",e),g=!0;break;case"escapeTitles":case"tooltip":g=!0;break;case"rtl":d===!1?e.$container.removeAttr("DIR").removeClass("fancytree-rtl"):e.$container.attr("DIR","RTL").addClass("fancytree-rtl"),g=!0;break;case"source":f=!1,e._callHook("treeLoad",e,d),g=!0}e.debug("set option "+c+"="+d+" <"+typeof d+">"),f&&(this.widget._super?this.widget._super.call(this.widget,c,d):a.Widget.prototype._setOption.call(this.widget,c,d)),g&&e.render(!0,!1)}}),a.widget("ui.fancytree",{options:{activeVisible:!0,ajax:{type:"GET",cache:!1,dataType:"json"},aria:!1,autoActivate:!0,autoCollapse:!1,autoScroll:!1,checkbox:!1,clickFolderMode:4,debugLevel:null,disabled:!1,enableAspx:!0,escapeTitles:!1,extensions:[],toggleEffect:{effect:"blind",options:{direction:"vertical",scale:"box"},duration:200},generateIds:!1,icon:!0,idPrefix:"ft_",focusOnSelect:!1,keyboard:!0,keyPathSeparator:"/",minExpandLevel:1,quicksearch:!1,rtl:!1,scrollOfs:{top:0,bottom:0},scrollParent:null,selectMode:2,strings:{loading:"Loading...",loadError:"Load error!",moreData:"More...",noData:"No data."},tabindex:"0",titlesTabbable:!1,tooltip:!1,_classNames:{node:"fancytree-node",folder:"fancytree-folder",animating:"fancytree-animating",combinedExpanderPrefix:"fancytree-exp-",combinedIconPrefix:"fancytree-ico-",hasChildren:"fancytree-has-children",active:"fancytree-active",selected:"fancytree-selected",expanded:"fancytree-expanded",lazy:"fancytree-lazy",focused:"fancytree-focused",partload:"fancytree-partload",partsel:"fancytree-partsel",unselectable:"fancytree-unselectable",lastsib:"fancytree-lastsib",loading:"fancytree-loading",error:"fancytree-error",statusNodePrefix:"fancytree-statusnode-"},lazyLoad:null,postProcess:null},_create:function(){this.tree=new t(this),this.$source=this.source||"json"===this.element.data("type")?this.element:this.element.find(">ul:first");var b,c,f,g=this.options,h=g.extensions,i=this.tree;for(f=0;f<h.length;f++)c=h[f],b=a.ui.fancytree._extensions[c],b||a.error("Could not apply extension '"+c+"' (it is not registered, did you forget to include it?)"),this.tree.options[c]=a.extend(!0,{},b.options,this.tree.options[c]),e(this.tree.ext[c]===d,"Extension name must not exist as Fancytree.ext attribute: '"+c+"'"),this.tree.ext[c]={},j(this.tree,i,b,c),i=b;g.icons!==d&&(g.icon!==!0?a.error("'icons' tree option is deprecated since v2.14.0: use 'icon' only instead"):(this.tree.warn("'icons' tree option is deprecated since v2.14.0: use 'icon' instead"),g.icon=g.icons)),g.iconClass!==d&&(g.icon?a.error("'iconClass' tree option is deprecated since v2.14.0: use 'icon' only instead"):(this.tree.warn("'iconClass' tree option is deprecated since v2.14.0: use 'icon' instead"),g.icon=g.iconClass)),g.tabbable!==d&&(g.tabindex=g.tabbable?"0":"-1",this.tree.warn("'tabbable' tree option is deprecated since v2.17.0: use 'tabindex='"+g.tabindex+"' instead")),this.tree._callHook("treeCreate",this.tree)},_init:function(){this.tree._callHook("treeInit",this.tree),this._bind()},_setOption:function(a,b){return this.tree._callHook("treeSetOption",this.tree,a,b)},destroy:function(){this._unbind(),this.tree._callHook("treeDestroy",this.tree),a.Widget.prototype.destroy.call(this)},_unbind:function(){var b=this.tree._ns;this.element.off(b),this.tree.$container.off(b),a(c).off(b)},_bind:function(){var a=this,b=this.options,c=this.tree,d=c._ns;this._unbind(),c.$container.on("focusin"+d+" focusout"+d,function(a){var b=w.getNode(a),d="focusin"===a.type;b?c._callHook("nodeSetFocus",c._makeHookContext(b,a),d):c._callHook("treeSetFocus",c,d)}).on("selectstart"+d,"span.fancytree-title",function(a){a.preventDefault()}).on("keydown"+d,function(a){if(b.disabled||b.keyboard===!1)return!0;var d,e=c.focusNode,f=c._makeHookContext(e||c,a),g=c.phase;try{return c.phase="userEvent",d=e?c._triggerNodeEvent("keydown",e,a):c._triggerTreeEvent("keydown",a),"preventNav"===d?d=!0:d!==!1&&(d=c._callHook("nodeKeydown",f)),d}finally{c.phase=g}}).on("mousedown"+d+" dblclick"+d,function(c){if(b.disabled)return!0;var d,e=w.getEventTarget(c),f=e.node,g=a.tree,h=g.phase;if(!f)return!0;d=g._makeHookContext(f,c);try{switch(g.phase="userEvent",c.type){case"mousedown":return d.targetType=e.type,f.isPagingNode()?g._triggerNodeEvent("clickPaging",d,c)===!0:g._triggerNodeEvent("click",d,c)!==!1&&g._callHook("nodeClick",d);case"dblclick":return d.targetType=e.type,g._triggerNodeEvent("dblclick",d,c)!==!1&&g._callHook("nodeDblclick",d)}}finally{g.phase=h}})},getActiveNode:function(){return this.tree.activeNode},getNodeByKey:function(a){return this.tree.getNodeByKey(a)},getRootNode:function(){return this.tree.rootNode},getTree:function(){return this.tree}}),w=a.ui.fancytree,a.extend(a.ui.fancytree,{version:"2.22.5",buildType: "production",debugLevel: 1,_nextId:1,_nextNodeKey:1,_extensions:{},_FancytreeClass:t,_FancytreeNodeClass:s,jquerySupports:{positionMyOfs:h(a.ui.version,1,9)},assert:function(a,b){return e(a,b)},debounce:function(a,b,c,d){var e;return 3===arguments.length&&"boolean"!=typeof c&&(d=c,c=!1),function(){var f=arguments;d=d||this,c&&!e&&b.apply(d,f),clearTimeout(e),e=setTimeout(function(){c||b.apply(d,f),e=null},a)}},debug:function(b){a.ui.fancytree.debugLevel>=2&&f("log",arguments)},error:function(a){f("error",arguments)},escapeHtml:o,fixPositionOptions:function(b){if((b.offset||(""+b.my+b.at).indexOf("%")>=0)&&a.error("expected new position syntax (but '%' is not supported)"),!a.ui.fancytree.jquerySupports.positionMyOfs){var c=/(\w+)([+-]?\d+)?\s+(\w+)([+-]?\d+)?/.exec(b.my),d=/(\w+)([+-]?\d+)?\s+(\w+)([+-]?\d+)?/.exec(b.at),e=(c[2]?+c[2]:0)+(d[2]?+d[2]:0),f=(c[4]?+c[4]:0)+(d[4]?+d[4]:0);b=a.extend({},b,{my:c[1]+" "+c[3],at:d[1]+" "+d[3]}),(e||f)&&(b.offset=""+e+" "+f)}return b},getEventTargetType:function(a){return this.getEventTarget(a).type},getEventTarget:function(b){var c=b&&b.target?b.target.className:"",e={node:this.getNode(b.target),type:d};return/\bfancytree-title\b/.test(c)?e.type="title":/\bfancytree-expander\b/.test(c)?e.type=e.node.hasChildren()===!1?"prefix":"expander":/\bfancytree-checkbox\b/.test(c)||/\bfancytree-radio\b/.test(c)?e.type="checkbox":/\bfancytree-icon\b/.test(c)?e.type="icon":/\bfancytree-node\b/.test(c)?e.type="title":b&&b.target&&a(b.target).closest(".fancytree-title").length&&(e.type="title"),e},getNode:function(a){if(a instanceof s)return a;for(a instanceof jQuery?a=a[0]:a.originalEvent!==d&&(a=a.target);a;){if(a.ftnode)return a.ftnode;a=a.parentNode}return null},getTree:function(b){var c;return b instanceof t?b:(b===d&&(b=0),"number"==typeof b?b=a(".fancytree-container").eq(b):"string"==typeof b?b=a(b).eq(0):b.selector!==d?b=b.eq(0):b.originalEvent!==d&&(b=a(b.target)),b=b.closest(":ui-fancytree"),c=b.data("ui-fancytree")||b.data("fancytree"),c?c.tree:null)},evalOption:function(b,c,d,e,f){var g,h,i=c.tree,j=e[b],k=d[b];return a.isFunction(j)?(g={node:c,tree:i,widget:i.widget,options:i.widget.options},h=j.call(i,{type:b},g),null==h&&(h=k)):h=null!=k?k:j,null==h&&(h=f),h},eventToString:function(a){var b=a.which,c=a.type,d=[];return a.altKey&&d.push("alt"),a.ctrlKey&&d.push("ctrl"),a.metaKey&&d.push("meta"),a.shiftKey&&d.push("shift"),"click"===c||"dblclick"===c?d.push(E[a.button]+c):C[b]||d.push(D[b]||String.fromCharCode(b).toLowerCase()),d.join("+")},info:function(b){a.ui.fancytree.debugLevel>=1&&f("info",arguments)},keyEventToString:function(a){return this.warn("keyEventToString() is deprecated: use eventToString()"),this.eventToString(a)},overrideMethod:function(b,c,d){var e,f=b[c]||a.noop;b[c]=function(){try{return e=this._super,this._super=f,d.apply(this,arguments)}finally{this._super=e}}},parseHtml:function(b){var c,e,f,g,h,i,j,k,l=b.find(">li"),m=[];return l.each(function(){var l,o,p=a(this),q=p.find(">span:first",this),r=q.length?null:p.find(">a:first"),s={tooltip:null,data:{}};for(q.length?s.title=q.html():r&&r.length?(s.title=r.html(),s.data.href=r.attr("href"),s.data.target=r.attr("target"),s.tooltip=r.attr("title")):(s.title=p.html(),h=s.title.search(/<ul/i),h>=0&&(s.title=s.title.substring(0,h))),s.title=a.trim(s.title),g=0,i=F.length;g<i;g++)s[F[g]]=d;for(c=this.className.split(" "),f=[],g=0,i=c.length;g<i;g++)e=c[g],G[e]?s[e]=!0:f.push(e);if(s.extraClasses=f.join(" "),j=p.attr("title"),j&&(s.tooltip=j),j=p.attr("id"),j&&(s.key=j),l=n(p),l&&!a.isEmptyObject(l)){for(o in J)l.hasOwnProperty(o)&&(l[J[o]]=l[o],delete l[o]);for(g=0,i=H.length;g<i;g++)j=H[g],k=l[j],null!=k&&(delete l[j],s[j]=k);a.extend(s.data,l)}b=p.find(">ul:first"),b.length?s.children=a.ui.fancytree.parseHtml(b):s.children=s.lazy?d:null,m.push(s)}),m},registerExtension:function(b){e(null!=b.name,"extensions must have a `name` property."),e(null!=b.version,"extensions must have a `version` property."),a.ui.fancytree._extensions[b.name]=b},unescapeHtml:function(a){var b=c.createElement("div");return b.innerHTML=a,0===b.childNodes.length?"":b.childNodes[0].nodeValue},warn:function(a){f("warn",arguments)}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.childcounter.min.js' */
!function(a,b){"use strict";a.ui.fancytree._FancytreeClass.prototype.countSelected=function(a){var b=this;b.options;return b.getSelectedNodes(a).length},a.ui.fancytree._FancytreeNodeClass.prototype.updateCounters=function(){var b=this,c=a("span.fancytree-childcounter",b.span),d=b.tree.options.childcounter,e=b.countChildren(d.deep);b.data.childCounter=e,!e&&d.hideZeros||b.isExpanded()&&d.hideExpanded?c.remove():(c.length||(c=a("<span class='fancytree-childcounter'/>").appendTo(a("span.fancytree-icon",b.span))),c.text(e)),!d.deep||b.isTopLevel()||b.isRoot()||b.parent.updateCounters()},a.ui.fancytree.prototype.widgetMethod1=function(a){this.tree;return a},a.ui.fancytree.registerExtension({name:"childcounter",version:"2.22.5",options:{deep:!0,hideZeros:!0,hideExpanded:!1},foo:42,_appendCounter:function(a){},treeInit:function(a){a.options,a.options.childcounter;this._superApply(arguments),this.$container.addClass("fancytree-ext-childcounter")},treeDestroy:function(a){this._superApply(arguments)},nodeRenderTitle:function(b,c){var d=b.node,e=b.options.childcounter,f=null==d.data.childCounter?d.countChildren(e.deep):+d.data.childCounter;this._super(b,c),!f&&e.hideZeros||d.isExpanded()&&e.hideExpanded||a("span.fancytree-icon",d.span).append(a("<span class='fancytree-childcounter'/>").text(f))},nodeSetExpanded:function(a,b,c){var d=a.tree;a.node;return this._superApply(arguments).always(function(){d.nodeRenderTitle(a)})}})}(jQuery);
/*! Extension 'jquery.fancytree.clones.min.js' */
!function(a,b,c,d){"use strict";function e(b,c){b||(c=c?": "+c:"",a.error("Assertion failed"+c))}function f(a,b){var c;for(c=a.length-1;c>=0;c--)if(a[c]===b)return a.splice(c,1),!0;return!1}function g(a,b,c){for(var d,e,f=3&a.length,g=a.length-f,h=c,i=3432918353,j=461845907,k=0;k<g;)e=255&a.charCodeAt(k)|(255&a.charCodeAt(++k))<<8|(255&a.charCodeAt(++k))<<16|(255&a.charCodeAt(++k))<<24,++k,e=(65535&e)*i+(((e>>>16)*i&65535)<<16)&4294967295,e=e<<15|e>>>17,e=(65535&e)*j+(((e>>>16)*j&65535)<<16)&4294967295,h^=e,h=h<<13|h>>>19,d=5*(65535&h)+((5*(h>>>16)&65535)<<16)&4294967295,h=(65535&d)+27492+(((d>>>16)+58964&65535)<<16);switch(e=0,f){case 3:e^=(255&a.charCodeAt(k+2))<<16;case 2:e^=(255&a.charCodeAt(k+1))<<8;case 1:e^=255&a.charCodeAt(k),e=(65535&e)*i+(((e>>>16)*i&65535)<<16)&4294967295,e=e<<15|e>>>17,e=(65535&e)*j+(((e>>>16)*j&65535)<<16)&4294967295,h^=e}return h^=a.length,h^=h>>>16,h=2246822507*(65535&h)+((2246822507*(h>>>16)&65535)<<16)&4294967295,h^=h>>>13,h=3266489909*(65535&h)+((3266489909*(h>>>16)&65535)<<16)&4294967295,h^=h>>>16,b?("0000000"+(h>>>0).toString(16)).substr(-8):h>>>0}function h(b){var c,d=a.map(b.getParentList(!1,!0),function(a){return a.refKey||a.key});return d=d.join("/"),c="id_"+g(d,!0)}a.ui.fancytree._FancytreeNodeClass.prototype.getCloneList=function(b){var c,d=this.tree,e=d.refMap[this.refKey]||null,f=d.keyMap;return e&&(c=this.key,b?e=a.map(e,function(a){return f[a]}):(e=a.map(e,function(a){return a===c?null:f[a]}),e.length<1&&(e=null))),e},a.ui.fancytree._FancytreeNodeClass.prototype.isClone=function(){var a=this.refKey||null,b=a&&this.tree.refMap[a]||null;return!!(b&&b.length>1)},a.ui.fancytree._FancytreeNodeClass.prototype.reRegister=function(b,c){b=null==b?null:""+b,c=null==c?null:""+c;var d=this.tree,e=this.key,f=this.refKey,g=d.keyMap,h=d.refMap,i=h[f]||null,j=!1;return null!=b&&b!==this.key&&(g[b]&&a.error("[ext-clones] reRegister("+b+"): already exists: "+this),delete g[e],g[b]=this,i&&(h[f]=a.map(i,function(a){return a===e?b:a})),this.key=b,j=!0),null!=c&&c!==this.refKey&&(i&&(1===i.length?delete h[f]:h[f]=a.map(i,function(a){return a===e?null:a})),h[c]?h[c].append(b):h[c]=[this.key],this.refKey=c,j=!0),j},a.ui.fancytree._FancytreeNodeClass.prototype.setRefKey=function(a){return this.reRegister(null,a)},a.ui.fancytree._FancytreeClass.prototype.getNodesByRef=function(b,c){var d=this.keyMap,e=this.refMap[b]||null;return e&&(e=c?a.map(e,function(a){var b=d[a];return b.isDescendantOf(c)?b:null}):a.map(e,function(a){return d[a]}),e.length<1&&(e=null)),e},a.ui.fancytree._FancytreeClass.prototype.changeRefKey=function(a,b){var c,d,e=this.keyMap,f=this.refMap[a]||null;if(f){for(c=0;c<f.length;c++)d=e[f[c]],d.refKey=b;delete this.refMap[a],this.refMap[b]=f}},a.ui.fancytree.registerExtension({name:"clones",version:"2.22.5",options:{highlightActiveClones:!0,highlightClones:!1},treeCreate:function(a){this._superApply(arguments),a.tree.refMap={},a.tree.keyMap={}},treeInit:function(a){this.$container.addClass("fancytree-ext-clones"),e(null==a.options.defaultKey),a.options.defaultKey=function(a){return h(a)},this._superApply(arguments)},treeClear:function(a){return a.tree.refMap={},a.tree.keyMap={},this._superApply(arguments)},treeRegisterNode:function(b,c,d){var g,h,i=b.tree,j=i.keyMap,k=i.refMap,l=d.key,m=d&&null!=d.refKey?""+d.refKey:null;return d.isStatusNode()?this._super(b,c,d):(c?(null!=j[d.key]&&a.error("clones.treeRegisterNode: node.key already exists: "+d),j[l]=d,m&&(g=k[m],g?(g.push(l),2===g.length&&b.options.clones.highlightClones&&j[g[0]].renderStatus()):k[m]=[l])):(null==j[l]&&a.error("clones.treeRegisterNode: node.key not registered: "+d.key),delete j[l],m&&(g=k[m],g&&(h=g.length,h<=1?(e(1===h),e(g[0]===l),delete k[m]):(f(g,l),2===h&&b.options.clones.highlightClones&&j[g[0]].renderStatus())))),this._super(b,c,d))},nodeRenderStatus:function(b){var c,d,e=b.node;return d=this._super(b),b.options.clones.highlightClones&&(c=a(e[b.tree.statusClassPropName]),c.length&&e.isClone()&&c.addClass("fancytree-clone")),d},nodeSetActive:function(b,c,d){var e,f=b.tree.statusClassPropName,g=b.node;return e=this._superApply(arguments),b.options.clones.highlightActiveClones&&g.isClone()&&a.each(g.getCloneList(!0),function(b,d){a(d[f]).toggleClass("fancytree-active-clone",c!==!1)}),e}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.dnd.min.js' */
!function(a,b,c,d){"use strict";function e(a){return 0===a?"":a>0?"+"+a:""+a}function f(){h||(a.ui.plugin.add("draggable","connectToFancytree",{start:function(b,c){var d=a(this).data("ui-draggable")||a(this).data("draggable"),e=c.helper.data("ftSourceNode")||null;if(e)return d.offset.click.top=-2,d.offset.click.left=16,e.tree.ext.dnd._onDragEvent("start",e,null,b,c,d)},drag:function(b,c){var d,e,f,g=a(this).data("ui-draggable")||a(this).data("draggable"),h=c.helper.data("ftSourceNode")||null,i=c.helper.data("ftTargetNode")||null,j=a.ui.fancytree.getNode(b.target),k=h&&h.tree.options.dnd;return b.target&&!j&&(e=a(b.target).closest("div.fancytree-drag-helper,#fancytree-drop-marker").length>0)?(f=h||i||a.ui.fancytree,void f.debug("Drag event over helper: ignored.")):(c.helper.data("ftTargetNode",j),k&&k.updateHelper&&(d=h.tree._makeHookContext(h,b,{otherNode:j,ui:c,draggable:g,dropMarker:a("#fancytree-drop-marker")}),k.updateHelper.call(h.tree,h,d)),i&&i!==j&&i.tree.ext.dnd._onDragEvent("leave",i,h,b,c,g),void(j&&j.tree.options.dnd.dragDrop&&(j===i?j.tree.ext.dnd._onDragEvent("over",j,h,b,c,g):(j.tree.ext.dnd._onDragEvent("enter",j,h,b,c,g),j.tree.ext.dnd._onDragEvent("over",j,h,b,c,g)))))},stop:function(b,c){var d,e=a(this).data("ui-draggable")||a(this).data("draggable"),f=c.helper.data("ftSourceNode")||null,g=c.helper.data("ftTargetNode")||null,h="mouseup"===b.type&&1===b.which;h||(d=f||g||a.ui.fancytree,d.debug("Drag was cancelled")),g&&(h&&g.tree.ext.dnd._onDragEvent("drop",g,f,b,c,e),g.tree.ext.dnd._onDragEvent("leave",g,f,b,c,e)),f&&f.tree.ext.dnd._onDragEvent("stop",f,null,b,c,e)}}),h=!0)}function g(b){var c=b.options.dnd||null,d=b.options.glyph||null;c&&f(),c&&c.dragStart&&b.widget.element.draggable(a.extend({addClasses:!1,appendTo:b.$container,containment:!1,delay:0,distance:4,revert:!1,scroll:!0,scrollSpeed:7,scrollSensitivity:10,connectToFancytree:!0,helper:function(b){var c,e,f,g=a.ui.fancytree.getNode(b.target);return g?(f=g.tree.options.dnd,e=a(g.span),c=a("<div class='fancytree-drag-helper'><span class='fancytree-drag-helper-img' /></div>").css({zIndex:3,position:"relative"}).append(e.find("span.fancytree-title").clone()),c.data("ftSourceNode",g),d&&c.find(".fancytree-drag-helper-img").addClass(d.map.dragHelper),f.initHelper&&f.initHelper.call(g.tree,g,{node:g,tree:g.tree,originalEvent:b,ui:{helper:c}}),c):"<div>ERROR?: helper requested but sourceNode not found</div>"},start:function(a,b){var c=b.helper.data("ftSourceNode");return!!c}},b.options.dnd.draggable)),c&&c.dragDrop&&b.widget.element.droppable(a.extend({addClasses:!1,tolerance:"intersect",greedy:!1},b.options.dnd.droppable))}var h=!1,i="fancytree-drop-accept",j="fancytree-drop-after",k="fancytree-drop-before",l="fancytree-drop-over",m="fancytree-drop-reject",n="fancytree-drop-target";a.ui.fancytree.registerExtension({name:"dnd",version:"2.22.5",options:{autoExpandMS:1e3,draggable:null,droppable:null,focusOnClick:!1,preventVoidMoves:!0,preventRecursiveMoves:!0,smartRevert:!0,dropMarkerOffsetX:-24,dropMarkerInsertOffsetX:-16,dragStart:null,dragStop:null,initHelper:null,updateHelper:null,dragEnter:null,dragOver:null,dragExpand:null,dragDrop:null,dragLeave:null},treeInit:function(b){var c=b.tree;this._superApply(arguments),c.options.dnd.dragStart&&c.$container.on("mousedown",function(c){if(b.options.dnd.focusOnClick){var d=a.ui.fancytree.getNode(c);d&&d.debug("Re-enable focus that was prevented by jQuery UI draggable."),setTimeout(function(){a(c.target).closest(":tabbable").focus()},10)}}),g(c)},_setDndStatus:function(b,c,d,f,g){var h,o="center",p=this._local,q=this.options.dnd,r=this.options.glyph,s=b?a(b.span):null,t=a(c.span),u=t.find("span.fancytree-title");if(p.$dropMarker||(p.$dropMarker=a("<div id='fancytree-drop-marker'></div>").hide().css({"z-index":1e3}).prependTo(a(this.$div).parent()),r&&p.$dropMarker.addClass(r.map.dropMarker)),"after"===f||"before"===f||"over"===f){switch(h=q.dropMarkerOffsetX||0,f){case"before":o="top",h+=q.dropMarkerInsertOffsetX||0;break;case"after":o="bottom",h+=q.dropMarkerInsertOffsetX||0}p.$dropMarker.toggleClass(j,"after"===f).toggleClass(l,"over"===f).toggleClass(k,"before"===f).show().position(a.ui.fancytree.fixPositionOptions({my:"left"+e(h)+" center",at:"left "+o,of:u}))}else p.$dropMarker.hide();s&&s.toggleClass(i,g===!0).toggleClass(m,g===!1),t.toggleClass(n,"after"===f||"before"===f||"over"===f).toggleClass(j,"after"===f).toggleClass(k,"before"===f).toggleClass(i,g===!0).toggleClass(m,g===!1),d.toggleClass(i,g===!0).toggleClass(m,g===!1)},_onDragEvent:function(b,e,f,g,h,i){var j,k,l,m,n,o,p,q,r,s=this.options,t=s.dnd,u=this._makeHookContext(e,g,{otherNode:f,ui:h,draggable:i}),v=null,w=this,x=a(e.span);switch(t.smartRevert&&(i.options.revert="invalid"),b){case"start":e.isStatusNode()?v=!1:t.dragStart&&(v=t.dragStart(e,u)),v===!1?(this.debug("tree.dragStart() cancelled"),h.helper.trigger("mouseup").hide()):(t.smartRevert&&(m=e[u.tree.nodeContainerAttrName].getBoundingClientRect(),l=a(i.options.appendTo)[0].getBoundingClientRect(),i.originalPosition.left=Math.max(0,m.left-l.left),i.originalPosition.top=Math.max(0,m.top-l.top)),x.addClass("fancytree-drag-source"),a(c).on("keydown.fancytree-dnd,mousedown.fancytree-dnd",function(b){"keydown"===b.type&&b.which===a.ui.keyCode.ESCAPE?w.ext.dnd._cancelDrag():"mousedown"===b.type&&w.ext.dnd._cancelDrag()}));break;case"enter":r=(!t.preventRecursiveMoves||!e.isDescendantOf(f))&&(t.dragEnter?t.dragEnter(e,u):null),v=!!r&&(a.isArray(r)?{over:a.inArray("over",r)>=0,before:a.inArray("before",r)>=0,after:a.inArray("after",r)>=0}:{over:r===!0||"over"===r,before:r===!0||"before"===r,after:r===!0||"after"===r}),h.helper.data("enterResponse",v);break;case"over":p=h.helper.data("enterResponse"),q=null,p===!1||("string"==typeof p?q=p:(k=x.offset(),n={x:g.pageX-k.left,y:g.pageY-k.top},o={x:n.x/x.width(),y:n.y/x.height()},p.after&&o.y>.75?q="after":!p.over&&p.after&&o.y>.5?q="after":p.before&&o.y<=.25?q="before":!p.over&&p.before&&o.y<=.5?q="before":p.over&&(q="over"),t.preventVoidMoves&&(e===f?(this.debug(" drop over source node prevented"),q=null):"before"===q&&f&&e===f.getNextSibling()?(this.debug(" drop after source node prevented"),q=null):"after"===q&&f&&e===f.getPrevSibling()?(this.debug(" drop before source node prevented"),q=null):"over"===q&&f&&f.parent===e&&f.isLastSibling()&&(this.debug(" drop last child over own parent prevented"),q=null)),h.helper.data("hitMode",q))),"before"===q||"after"===q||!t.autoExpandMS||e.hasChildren()===!1||e.expanded||t.dragExpand&&t.dragExpand(e,u)===!1||e.scheduleAction("expand",t.autoExpandMS),q&&t.dragOver&&(u.hitMode=q,v=t.dragOver(e,u)),j=v!==!1&&null!==q,t.smartRevert&&(i.options.revert=!j),this._local._setDndStatus(f,e,h.helper,q,j);break;case"drop":q=h.helper.data("hitMode"),q&&t.dragDrop&&(u.hitMode=q,t.dragDrop(e,u));break;case"leave":e.scheduleAction("cancel"),h.helper.data("enterResponse",null),h.helper.data("hitMode",null),this._local._setDndStatus(f,e,h.helper,"out",d),t.dragLeave&&t.dragLeave(e,u);break;case"stop":x.removeClass("fancytree-drag-source"),a(c).off(".fancytree-dnd"),t.dragStop&&t.dragStop(e,u);break;default:a.error("Unsupported drag event: "+b)}return v},_cancelDrag:function(){var b=a.ui.ddmanager.current;b&&b.cancel()}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.dnd5.min.js' */
!function(a,b,c,d){"use strict";function e(a){return 0===a?"":a>0?"+"+a:""+a}function f(b){var c;return!!b&&(c=a.isPlainObject(b)?{over:!!b.over,before:!!b.before,after:!!b.after}:a.isArray(b)?{over:a.inArray("over",b)>=0,before:a.inArray("before",b)>=0,after:a.inArray("after",b)>=0}:{over:b===!0||"over"===b,before:b===!0||"before"===b,after:b===!0||"after"===b},0!==Object.keys(c).length&&c)}function g(d,e){var f,g,h,i=d.options.dnd5,j=d.$scrollParent[0],k=i.scrollSensitivity,l=i.scrollSpeed,m=0;return j!==c&&"HTML"!==j.tagName?(f=d.$scrollParent.offset(),g=j.scrollTop,f.top+j.offsetHeight-e.pageY<k?(h=j.scrollHeight-d.$scrollParent.innerHeight()-g,h>0&&(j.scrollTop=m=g+l)):g>0&&e.pageY-f.top<k&&(j.scrollTop=m=g-l)):(g=a(c).scrollTop(),g>0&&e.pageY-g<k?(m=g-l,a(c).scrollTop(m)):a(b).height()-(e.pageY-g)<k&&(m=g+l,a(c).scrollTop(m))),m&&d.debug("autoScroll: "+m+"px"),m}function h(b,c){if(c.options.dnd5.scroll&&g(c.tree,b),!c.node)return c.tree.warn("Ignore dragover for non-node"),u;var d,f,h,i=null,j=c.tree,q=j.options,s=q.dnd5,v=c.node,w=c.otherNode,x="center",y=a(v.span),z=y.find("span.fancytree-title");if(t===!1)return j.warn("Ignore dragover, since dragenter returned false"),!1;if("string"==typeof t?a.error("assert failed: dragenter returned string"):(f=y.offset(),h=(b.pageY-f.top)/y.height(),t.after&&h>.75?i="after":!t.over&&t.after&&h>.5?i="after":t.before&&h<=.25?i="before":!t.over&&t.before&&h<=.5?i="before":t.over&&(i="over"),s.preventVoidMoves&&(v===w?(v.debug("drop over source node prevented"),i=null):"before"===i&&w&&v===w.getNextSibling()?(v.debug("drop after source node prevented"),i=null):"after"===i&&w&&v===w.getPrevSibling()?(v.debug("drop before source node prevented"),i=null):"over"===i&&w&&w.parent===v&&w.isLastSibling()&&(v.debug("drop last child over own parent prevented"),i=null))),c.hitMode=i,i&&s.dragOver&&(s.dragOver(v,c),i=c.hitMode),u=i,"after"===i||"before"===i||"over"===i){switch(d=s.dropMarkerOffsetX||0,i){case"before":x="top",d+=s.dropMarkerInsertOffsetX||0;break;case"after":x="bottom",d+=s.dropMarkerInsertOffsetX||0}r.toggleClass(l,"after"===i).toggleClass(n,"over"===i).toggleClass(m,"before"===i).show().position(a.ui.fancytree.fixPositionOptions({my:"left"+e(d)+" center",at:"left "+x,of:z}))}else r.hide();return a(v.span).toggleClass(p,"after"===i||"before"===i||"over"===i).toggleClass(l,"after"===i).toggleClass(m,"before"===i).toggleClass(k,"over"===i).toggleClass(o,i===!1),i}var i="fancytree-drag-source",j="fancytree-drag-remove",k="fancytree-drop-accept",l="fancytree-drop-after",m="fancytree-drop-before",n="fancytree-drop-over",o="fancytree-drop-reject",p="fancytree-drop-target",q="application/x-fancytree-node",r=null,s=null,t=null,u=null;a.ui.fancytree.registerExtension({name:"dnd5",version:"2.22.5",options:{autoExpandMS:1500,setTextTypeJson:!1,preventForeignNodes:!1,preventNonNodes:!1,preventRecursiveMoves:!0,preventVoidMoves:!0,scroll:!0,scrollSensitivity:20,scrollSpeed:5,dropMarkerOffsetX:-24,dropMarkerInsertOffsetX:-16,dragStart:null,dragDrag:a.noop,dragEnd:a.noop,dragEnter:null,dragOver:a.noop,dragExpand:a.noop,dragDrop:a.noop,dragLeave:a.noop},treeInit:function(b){var c=b.tree,e=b.options,g=e.dnd5,l=a.ui.fancytree.getNode;a.inArray("dnd",e.extensions)>=0&&a.error("Extensions 'dnd' and 'dnd5' are mutually exclusive."),g.dragStop&&a.error("dragStop is not used by ext-dnd5. Use dragEnd instead."),g.dragStart&&a.ui.fancytree.overrideMethod(b.options,"createNode",function(a,b){this._super.apply(this,arguments),b.node.span.draggable=!0}),this._superApply(arguments),this.$container.addClass("fancytree-ext-dnd5"),this.$scrollParent=this.$container.children(":first").scrollParent(),r=a("#fancytree-drop-marker"),r.length||(r=a("<div id='fancytree-drop-marker'></div>").hide().css({"z-index":1e3,"pointer-events":"none"}).prependTo("body")),g.dragStart&&c.$container.on("dragstart drag dragend",function(b){var e,f=l(b),h=b.dataTransfer||b.originalEvent.dataTransfer,k="move"===h.dropEffect,m=f?a(f.span):null,n={node:f,tree:c,options:c.options,originalEvent:b,dataTransfer:h,isCancelled:d};switch(b.type){case"dragstart":a(f.span).addClass(i),s=f,e=JSON.stringify(f.toDict());try{h.setData(q,e),h.setData("text/html",a(f.span).html()),h.setData("text/plain",f.title)}catch(o){c.warn("Could not set data (IE only accepts 'text') - "+o)}return g.setTextTypeJson?h.setData("text",e):h.setData("text",f.title),h.effectAllowed="all",h.setDragImage&&h.setDragImage(a(f.span).find(".fancytree-title")[0],-10,-10),g.dragStart(f,n)!==!1;case"drag":m.toggleClass(j,k),g.dragDrag(f,n);break;case"dragend":a(f.span).removeClass(i+" "+j),s=null,t=null,n.isCancelled="none"===h.dropEffect,r.hide(),g.dragEnd(f,n)}}),g.dragEnter&&c.$container.on("dragenter dragover dragleave drop",function(b){var e,i,j,m,p=null,v=l(b),w=b.dataTransfer||b.originalEvent.dataTransfer,x={node:v,tree:c,options:c.options,hitMode:t,originalEvent:b,dataTransfer:w,otherNode:s||null,otherNodeData:null,dropEffect:d,isCancelled:d};switch(b.type){case"dragenter":if(!v){c.debug("Ignore non-node "+b.type+": "+b.target.tagName+"."+b.target.className),t=!1;break}if(a(v.span).addClass(n).removeClass(k+" "+o),g.preventNonNodes&&!i){v.debug("Reject dropping a non-node"),t=!1;break}if(g.preventForeignNodes&&(!s||s.tree!==v.tree)){v.debug("Reject dropping a foreign node"),t=!1;break}setTimeout(function(){!g.autoExpandMS||v.hasChildren()===!1||v.expanded||g.dragExpand&&g.dragExpand(v,x)===!1||v.scheduleAction("expand",g.autoExpandMS)},0),r.show(),g.preventRecursiveMoves&&v.isDescendantOf(x.otherNode)?m=!1:(j=g.dragEnter(v,x),m=f(j)),t=m,p=m&&(m.over||m.before||m.after);break;case"dragover":u=h(b,x),p=!!u;break;case"dragleave":if(!v){c.debug("Ignore non-node "+b.type+": "+b.target.tagName+"."+b.target.className);break}if(!a(v.span).hasClass(n)){v.debug("Ignore dragleave (multi)");break}a(v.span).removeClass(n+" "+k+" "+o),v.scheduleAction("cancel"),g.dragLeave(v,x),r.hide();break;case"drop":if(a.inArray(q,w.types)>=0&&(i=w.getData(q),c.info(b.type+": getData('application/x-fancytree-node'): '"+i+"'")),i||(i=w.getData("text"),c.info(b.type+": getData('text'): '"+i+"'")),i)try{e=JSON.parse(i),e.title!==d&&(x.otherNodeData=e)}catch(y){}c.debug(b.type+": nodeData: '"+i+"', otherNodeData: ",x.otherNodeData),a(v.span).removeClass(n+" "+k+" "+o),r.hide(),x.hitMode=u,x.dropEffect=w.dropEffect,x.isCancelled="none"===x.dropEffect,g.dragDrop(v,x),b.preventDefault()}if(p)return b.preventDefault(),!1})}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.edit.min.js' */
!function(a,b,c,d){"use strict";var e=/Mac/.test(navigator.platform),f=a.ui.fancytree.escapeHtml,g=a.ui.fancytree.unescapeHtml;a.ui.fancytree._FancytreeNodeClass.prototype.editStart=function(){var b,d=this,e=this.tree,f=e.ext.edit,h=e.options.edit,i=a(".fancytree-title",d.span),j={node:d,tree:e,options:e.options,isNew:a(d[e.statusClassPropName]).hasClass("fancytree-edit-new"),orgTitle:d.title,input:null,dirty:!1};return h.beforeEdit.call(d,{type:"beforeEdit"},j)!==!1&&(a.ui.fancytree.assert(!f.currentNode,"recursive edit"),f.currentNode=this,f.eventData=j,e.widget._unbind(),a(c).on("mousedown.fancytree-edit",function(b){a(b.target).hasClass("fancytree-edit-input")||d.editEnd(!0,b)}),b=a("<input />",{"class":"fancytree-edit-input",type:"text",value:e.options.escapeTitles?j.orgTitle:g(j.orgTitle)}),f.eventData.input=b,null!=h.adjustWidthOfs&&b.width(i.width()+h.adjustWidthOfs),null!=h.inputCss&&b.css(h.inputCss),i.html(b),b.focus().change(function(a){b.addClass("fancytree-edit-dirty")}).keydown(function(b){switch(b.which){case a.ui.keyCode.ESCAPE:d.editEnd(!1,b);break;case a.ui.keyCode.ENTER:return d.editEnd(!0,b),!1}b.stopPropagation()}).blur(function(a){return d.editEnd(!0,a)}),void h.edit.call(d,{type:"edit"},j))},a.ui.fancytree._FancytreeNodeClass.prototype.editEnd=function(b,d){var e,g=this,h=this.tree,i=h.ext.edit,j=i.eventData,k=h.options.edit,l=a(".fancytree-title",g.span),m=l.find("input.fancytree-edit-input");return k.trim&&m.val(a.trim(m.val())),e=m.val(),j.dirty=e!==g.title,j.originalEvent=d,b===!1?j.save=!1:j.isNew?j.save=""!==e:j.save=j.dirty&&""!==e,k.beforeClose.call(g,{type:"beforeClose"},j)!==!1&&((!j.save||k.save.call(g,{type:"save"},j)!==!1)&&(m.removeClass("fancytree-edit-dirty").off(),a(c).off(".fancytree-edit"),j.save?(g.setTitle(h.options.escapeTitles?e:f(e)),g.setFocus()):j.isNew?(g.remove(),g=j.node=null,i.relatedNode.setFocus()):(g.renderTitle(),g.setFocus()),i.eventData=null,i.currentNode=null,i.relatedNode=null,h.widget._bind(),a(h.$container).focus(),j.input=null,k.close.call(g,{type:"close"},j),!0))},a.ui.fancytree._FancytreeNodeClass.prototype.editCreateNode=function(b,c){var d,e=this.tree,f=this;return b=b||"child",null==c?c={title:""}:"string"==typeof c?c={title:c}:a.ui.fancytree.assert(a.isPlainObject(c)),"child"!==b||this.isExpanded()||this.hasChildren()===!1?(d=this.addNode(c,b),d.match=!0,a(d[e.statusClassPropName]).removeClass("fancytree-hide").addClass("fancytree-match"),void d.makeVisible().done(function(){a(d[e.statusClassPropName]).addClass("fancytree-edit-new"),f.tree.ext.edit.relatedNode=f,d.editStart()})):void this.setExpanded().done(function(){f.editCreateNode(b,c)})},a.ui.fancytree._FancytreeClass.prototype.isEditing=function(){return this.ext.edit?this.ext.edit.currentNode:null},a.ui.fancytree._FancytreeNodeClass.prototype.isEditing=function(){return!!this.tree.ext.edit&&this.tree.ext.edit.currentNode===this},a.ui.fancytree.registerExtension({name:"edit",version:"2.22.5",options:{adjustWidthOfs:4,allowEmpty:!1,inputCss:{minWidth:"3em"},triggerStart:["f2","shift+click","mac+enter"],trim:!0,beforeClose:a.noop,beforeEdit:a.noop,close:a.noop,edit:a.noop,save:a.noop},currentNode:null,treeInit:function(a){this._superApply(arguments),this.$container.addClass("fancytree-ext-edit")},nodeClick:function(b){return a.inArray("shift+click",b.options.edit.triggerStart)>=0&&b.originalEvent.shiftKey?(b.node.editStart(),!1):this._superApply(arguments)},nodeDblclick:function(b){return a.inArray("dblclick",b.options.edit.triggerStart)>=0?(b.node.editStart(),!1):this._superApply(arguments)},nodeKeydown:function(b){switch(b.originalEvent.which){case 113:if(a.inArray("f2",b.options.edit.triggerStart)>=0)return b.node.editStart(),!1;break;case a.ui.keyCode.ENTER:if(a.inArray("mac+enter",b.options.edit.triggerStart)>=0&&e)return b.node.editStart(),!1}return this._superApply(arguments)}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.filter.min.js' */
!function(a,b,c,d){"use strict";function e(a){return(a+"").replace(/([.?*+\^\$\[\]\\(){}|-])/g,"\\$1")}function f(b){return b.indexOf(">")>=0?a("<div/>").html(b).text():b}var g="__not_found__",h=a.ui.fancytree.escapeHtml;a.ui.fancytree._FancytreeClass.prototype._applyFilterImpl=function(b,c,d){var i,j,k,l,m=0,n=this.options,o=n.escapeTitles,p=n.autoCollapse,q=a.extend({},n.filter,d),r="hide"===q.mode,s=!!q.leavesOnly&&!c;return"string"==typeof b&&(i=q.fuzzy?b.split("").reduce(function(a,b){return a+"[^"+b+"]*"+b}):e(b),k=new RegExp(".*"+i+".*","i"),l=new RegExp(e(b),"gi"),b=function(a){var b,c=o?a.title:f(a.title),d=!!k.test(c);return d&&q.highlight&&(b=o?h(a.title):c,a.titleWithHighlight=b.replace(l,function(a){return"<mark>"+a+"</mark>"})),d}),this.enableFilter=!0,this.lastFilterArgs=arguments,this.$div.addClass("fancytree-ext-filter"),r?this.$div.addClass("fancytree-ext-filter-hide"):this.$div.addClass("fancytree-ext-filter-dimm"),this.$div.toggleClass("fancytree-ext-filter-hide-expanders",!!q.hideExpanders),this.visit(function(a){delete a.match,delete a.titleWithHighlight,a.subMatchCount=0}),j=this.getRootNode()._findDirectChild(g),j&&j.remove(),n.autoCollapse=!1,this.visit(function(a){if(!s||null==a.children){var d=b(a),e=!1;if("skip"===d)return a.visit(function(a){a.match=!1},!0),"skip";d||!c&&"branch"!==d||!a.parent.match||(d=!0,e=!0),d&&(m++,a.match=!0,a.visitParents(function(a){a.subMatchCount+=1,!q.autoExpand||e||a.expanded||(a.setExpanded(!0,{noAnimation:!0,noEvents:!0,scrollIntoView:!1}),a._filterAutoExpanded=!0)}))}}),n.autoCollapse=p,0===m&&q.nodata&&r&&(j=q.nodata,a.isFunction(j)&&(j=j()),j===!0?j={}:"string"==typeof j&&(j={title:j}),j=a.extend({statusNodeType:"nodata",key:g,title:this.options.strings.noData},j),this.getRootNode().addNode(j).match=!0),this.render(),m},a.ui.fancytree._FancytreeClass.prototype.filterNodes=function(a,b){return"boolean"==typeof b&&(b={leavesOnly:b},this.warn("Fancytree.filterNodes() leavesOnly option is deprecated since 2.9.0 / 2015-04-19. Use opts.leavesOnly instead.")),this._applyFilterImpl(a,!1,b)},a.ui.fancytree._FancytreeClass.prototype.applyFilter=function(a){return this.warn("Fancytree.applyFilter() is deprecated since 2.1.0 / 2014-05-29. Use .filterNodes() instead."),this.filterNodes.apply(this,arguments)},a.ui.fancytree._FancytreeClass.prototype.filterBranches=function(a,b){return this._applyFilterImpl(a,!0,b)},a.ui.fancytree._FancytreeClass.prototype.clearFilter=function(){var b,c=this.getRootNode()._findDirectChild(g),d=this.options.escapeTitles,e=this.options.enhanceTitle;c&&c.remove(),this.visit(function(c){c.match&&c.span&&(b=a(c.span).find(">span.fancytree-title"),d?b.text(c.title):b.html(c.title),e&&e({type:"enhanceTitle"},{node:c,$title:b})),delete c.match,delete c.subMatchCount,delete c.titleWithHighlight,c.$subMatchBadge&&(c.$subMatchBadge.remove(),delete c.$subMatchBadge),c._filterAutoExpanded&&c.expanded&&c.setExpanded(!1,{noAnimation:!0,noEvents:!0,scrollIntoView:!1}),delete c._filterAutoExpanded}),this.enableFilter=!1,this.lastFilterArgs=null,this.$div.removeClass("fancytree-ext-filter fancytree-ext-filter-dimm fancytree-ext-filter-hide"),this.render()},a.ui.fancytree._FancytreeClass.prototype.isFilterActive=function(){return!!this.enableFilter},a.ui.fancytree._FancytreeNodeClass.prototype.isMatched=function(){return!(this.tree.enableFilter&&!this.match)},a.ui.fancytree.registerExtension({name:"filter",version:"2.22.5",options:{autoApply:!0,autoExpand:!1,counter:!0,fuzzy:!1,hideExpandedCounter:!0,hideExpanders:!1,highlight:!0,leavesOnly:!1,nodata:!0,mode:"dimm"},nodeLoadChildren:function(a,b){return this._superApply(arguments).done(function(){a.tree.enableFilter&&a.tree.lastFilterArgs&&a.options.filter.autoApply&&a.tree._applyFilterImpl.apply(a.tree,a.tree.lastFilterArgs)})},nodeSetExpanded:function(a,b,c){return delete a.node._filterAutoExpanded,!b&&a.options.filter.hideExpandedCounter&&a.node.$subMatchBadge&&a.node.$subMatchBadge.show(),this._superApply(arguments)},nodeRenderStatus:function(b){var c,d=b.node,e=b.tree,f=b.options.filter,g=a(d.span).find("span.fancytree-title"),h=a(d[e.statusClassPropName]),i=b.options.enhanceTitle,j=b.options.escapeTitles;return c=this._super(b),h.length&&e.enableFilter?(h.toggleClass("fancytree-match",!!d.match).toggleClass("fancytree-submatch",!!d.subMatchCount).toggleClass("fancytree-hide",!(d.match||d.subMatchCount)),!f.counter||!d.subMatchCount||d.isExpanded()&&f.hideExpandedCounter?d.$subMatchBadge&&d.$subMatchBadge.hide():(d.$subMatchBadge||(d.$subMatchBadge=a("<span class='fancytree-childcounter'/>"),a("span.fancytree-icon, span.fancytree-custom-icon",d.span).append(d.$subMatchBadge)),d.$subMatchBadge.show().text(d.subMatchCount)),!d.span||d.isEditing&&d.isEditing.call(d)||(d.titleWithHighlight?g.html(d.titleWithHighlight):j?g.text(d.title):g.html(d.title),i&&i({type:"enhanceTitle"},{node:d,$title:g})),c):c}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.glyph.min.js' */
!function(a,b,c,d){"use strict";function e(a,b){return a.map[b]}a.ui.fancytree.registerExtension({name:"glyph",version:"2.22.5",options:{map:{checkbox:"icon-check-empty",checkboxSelected:"icon-check",checkboxUnknown:"icon-check icon-muted",error:"icon-exclamation-sign",expanderClosed:"icon-caret-right",expanderLazy:"icon-angle-right",expanderOpen:"icon-caret-down",nodata:"icon-meh",noExpander:"",dragHelper:"icon-caret-right",dropMarker:"icon-caret-right",doc:"icon-file-alt",docOpen:"icon-file-alt",loading:"icon-refresh icon-spin",folder:"icon-folder-close-alt",folderOpen:"icon-folder-open-alt"}},treeInit:function(a){var b=a.tree;this._superApply(arguments),b.$container.addClass("fancytree-ext-glyph")},nodeRenderStatus:function(b){var c,d,f,g=b.node,h=a(g.span),i=b.options.glyph,j=i.map;return d=this._super(b),g.isRoot()?d:(f=h.children("span.fancytree-expander").get(0),f&&(c=g.expanded&&g.hasChildren()?"expanderOpen":g.isUndefined()?"expanderLazy":g.hasChildren()?"expanderClosed":"noExpander",f.className="fancytree-expander "+j[c]),f=g.tr?a("td",g.tr).find("span.fancytree-checkbox").get(0):h.children("span.fancytree-checkbox").get(0),f&&(c=g.selected?"checkboxSelected":g.partsel?"checkboxUnknown":"checkbox",f.className="fancytree-checkbox "+j[c]),f=h.children("span.fancytree-icon").get(0),f&&(c=g.statusNodeType?e(i,g.statusNodeType):g.folder?g.expanded&&g.hasChildren()?e(i,"folderOpen"):e(i,"folder"):g.expanded?e(i,"docOpen"):e(i,"doc"),f.className="fancytree-icon "+c),d)},nodeSetStatus:function(b,c,d,f){var g,h,i=b.options.glyph,j=b.node;return g=this._superApply(arguments),"error"!==c&&"loading"!==c&&"nodata"!==c||(j.parent?(h=a("span.fancytree-expander",j.span).get(0),h&&(h.className="fancytree-expander "+e(i,c))):(h=a(".fancytree-statusnode-"+c,j[this.nodeContainerAttrName]).find("span.fancytree-icon").get(0),h&&(h.className="fancytree-icon "+e(i,c)))),g}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.gridnav.min.js' */
!function(a,b,c,d){"use strict";function e(b,c){var d,e=c.get(0),f=0;return b.children().each(function(){return this!==e&&(d=a(this).prop("colspan"),void(f+=d?d:1))}),f}function f(b,c){var d,e=null,f=0;return b.children().each(function(){return f>=c?(e=a(this),!1):(d=a(this).prop("colspan"),void(f+=d?d:1))}),e}function g(a,b){var c,d,g=a.closest("td"),i=null;switch(b){case h.LEFT:i=g.prev();break;case h.RIGHT:i=g.next();break;case h.UP:case h.DOWN:for(c=g.parent(),d=e(c,g);;){if(c=b===h.UP?c.prev():c.next(),!c.length)break;if(!c.is(":hidden")&&(i=f(c,d),i&&i.find(":input,a").length))break}}return i}var h=a.ui.keyCode,i={text:[h.UP,h.DOWN],checkbox:[h.UP,h.DOWN,h.LEFT,h.RIGHT],link:[h.UP,h.DOWN,h.LEFT,h.RIGHT],radiobutton:[h.UP,h.DOWN,h.LEFT,h.RIGHT],"select-one":[h.LEFT,h.RIGHT],"select-multiple":[h.LEFT,h.RIGHT]};a.ui.fancytree.registerExtension({name:"gridnav",version:"2.22.5",options:{autofocusInput:!1,handleCursorKeys:!0},treeInit:function(b){this._requireExtension("table",!0,!0),this._superApply(arguments),this.$container.addClass("fancytree-ext-gridnav"),this.$container.on("focusin",function(c){var d,e=a.ui.fancytree.getNode(c.target);e&&!e.isActive()&&(d=b.tree._makeHookContext(e,c),b.tree._callHook("nodeSetActive",d,!0))})},nodeSetActive:function(b,c,d){var e,f=b.options.gridnav,g=b.node,h=b.originalEvent||{},i=a(h.target).is(":input");c=c!==!1,this._superApply(arguments),c&&(b.options.titlesTabbable?(i||(a(g.span).find("span.fancytree-title").focus(),g.setFocus()),b.tree.$container.attr("tabindex","-1")):f.autofocusInput&&!i&&(e=a(g.tr||g.span),e.find(":input:enabled:first").focus()))},nodeKeydown:function(b){var c,d,e,f=b.options.gridnav,h=b.originalEvent,j=a(h.target);return j.is(":input:enabled")?c=j.prop("type"):j.is("a")&&(c="link"),c&&f.handleCursorKeys?(d=i[c],!(d&&a.inArray(h.which,d)>=0&&(e=g(j,h.which),e&&e.length))||(e.find(":input:enabled,a").focus(),!1)):this._superApply(arguments)}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.persist.min.js' */
!function(a,b,c,d){"use strict";function e(b,c,d,f,g){var h,i,j,l,m=!1,n=b.options.persist.expandOpts,o=[],p=[];for(d=d||[],g=g||a.Deferred(),h=0,j=d.length;h<j;h++)i=d[h],l=b.getNodeByKey(i),l?f&&l.isUndefined()?(m=!0,b.debug("_loadLazyNodes: "+l+" is lazy: loading..."),"expand"===f?o.push(l.setExpanded(!0,n)):o.push(l.load())):(b.debug("_loadLazyNodes: "+l+" already loaded."),l.setExpanded(!0,n)):(p.push(i),b.debug("_loadLazyNodes: "+l+" was not yet found."));return a.when.apply(a,o).always(function(){if(m&&p.length>0)e(b,c,p,f,g);else{if(p.length)for(b.warn("_loadLazyNodes: could not load those keys: ",p),h=0,j=p.length;h<j;h++)i=d[h],c._appendKey(k,d[h],!1);g.resolve()}}),g}var f,g,h,i=a.ui.fancytree.assert,j="active",k="expanded",l="focus",m="selected";"function"==typeof Cookies?(h=Cookies.set,f=Cookies.get,g=Cookies.remove):(h=f=a.cookie,g=a.removeCookie),a.ui.fancytree._FancytreeClass.prototype.clearCookies=function(a){var b=this.ext.persist,c=b.cookiePrefix;a=a||"active expanded focus selected",a.indexOf(j)>=0&&b._data(c+j,null),a.indexOf(k)>=0&&b._data(c+k,null),a.indexOf(l)>=0&&b._data(c+l,null),a.indexOf(m)>=0&&b._data(c+m,null)},a.ui.fancytree._FancytreeClass.prototype.getPersistData=function(){var a=this.ext.persist,b=a.cookiePrefix,c=a.cookieDelimiter,d={};return d[j]=a._data(b+j),d[k]=(a._data(b+k)||"").split(c),d[m]=(a._data(b+m)||"").split(c),d[l]=a._data(b+l),d},a.ui.fancytree.registerExtension({name:"persist",version:"2.22.5",options:{cookieDelimiter:"~",cookiePrefix:d,cookie:{raw:!1,expires:"",path:"",domain:"",secure:!1},expandLazy:!1,expandOpts:d,fireActivate:!0,overrideSource:!0,store:"auto",types:"active expanded focus selected"},_data:function(a,b){var c=this._local.localStorage;return b===d?c?c.getItem(a):f(a):void(null===b?c?c.removeItem(a):g(a):c?c.setItem(a,b):h(a,b,this.options.persist.cookie))},_appendKey:function(b,c,d){c=""+c;var e=this._local,f=this.options.persist,g=f.cookieDelimiter,h=e.cookiePrefix+b,i=e._data(h),j=i?i.split(g):[],k=a.inArray(c,j);k>=0&&j.splice(k,1),d&&j.push(c),e._data(h,j.join(g))},treeInit:function(c){var g=c.tree,h=c.options,n=this._local,o=this.options.persist;return i("auto"!==o.store&&"cookie"!==o.store||f,"Missing required plugin for 'persist' extension: js.cookie.js or jquery.cookie.js"),n.cookiePrefix=o.cookiePrefix||"fancytree-"+g._id+"-",n.storeActive=o.types.indexOf(j)>=0,n.storeExpanded=o.types.indexOf(k)>=0,n.storeSelected=o.types.indexOf(m)>=0,n.storeFocus=o.types.indexOf(l)>=0,"cookie"!==o.store&&b.localStorage?n.localStorage="local"===o.store?b.localStorage:b.sessionStorage:n.localStorage=null,g.$div.bind("fancytreeinit",function(b){if(g._triggerTreeEvent("beforeRestore",null,{})!==!1){var c,f,i,p,q,r=n._data(n.cookiePrefix+l),s=o.fireActivate===!1;c=n._data(n.cookiePrefix+k),p=c&&c.split(o.cookieDelimiter),f=n.storeExpanded?e(g,n,p,!!o.expandLazy&&"expand",null):(new a.Deferred).resolve(),f.done(function(){if(n.storeSelected){if(c=n._data(n.cookiePrefix+m))for(p=c.split(o.cookieDelimiter),i=0;i<p.length;i++)q=g.getNodeByKey(p[i]),q?(q.selected===d||o.overrideSource&&q.selected===!1)&&(q.selected=!0,q.renderStatus()):n._appendKey(m,p[i],!1);3===g.options.selectMode&&g.visit(function(a){if(a.selected)return a.fixSelection3AfterClick(),"skip"})}n.storeActive&&(c=n._data(n.cookiePrefix+j),!c||!h.persist.overrideSource&&g.activeNode||(q=g.getNodeByKey(c),q&&(q.debug("persist: set active",c),q.setActive(!0,{noFocus:!0,noEvents:s})))),n.storeFocus&&r&&(q=g.getNodeByKey(r),q&&(g.options.titlesTabbable?a(q.span).find(".fancytree-title").focus():a(g.$container).focus())),g._triggerTreeEvent("restore",null,{})})}}),this._superApply(arguments)},nodeSetActive:function(a,b,c){var d,e=this._local;return b=b!==!1,d=this._superApply(arguments),e.storeActive&&e._data(e.cookiePrefix+j,this.activeNode?this.activeNode.key:null),d},nodeSetExpanded:function(a,b,c){var d,e=a.node,f=this._local;return b=b!==!1,d=this._superApply(arguments),f.storeExpanded&&f._appendKey(k,e.key,b),d},nodeSetFocus:function(a,b){var c,d=this._local;return b=b!==!1,c=this._superApply(arguments),d.storeFocus&&d._data(d.cookiePrefix+l,this.focusNode?this.focusNode.key:null),c},nodeSetSelected:function(b,c){var d,e,f=b.tree,g=b.node,h=this._local;return c=c!==!1,d=this._superApply(arguments),h.storeSelected&&(3===f.options.selectMode?(e=a.map(f.getSelectedNodes(!0),function(a){return a.key}),e=e.join(b.options.persist.cookieDelimiter),h._data(h.cookiePrefix+m,e)):h._appendKey(m,g.key,g.selected)),d}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.table.min.js' */
!function(a,b,c,d){"use strict";function e(b,c){c=c||"",b||a.error("Assertion failed "+c)}function f(a,b){a.insertBefore(b,a.firstChild)}function g(a,b){a.parentNode.insertBefore(b,a.nextSibling)}function h(a,b){a.visit(function(a){var c=a.tr;if(c&&(c.style.display=a.hide||!b?"none":""),!a.expanded)return"skip"})}function i(b){var c,d,f,g=b.parent,h=g?g.children:null;if(h&&h.length>1&&h[0]!==b)for(c=a.inArray(b,h),f=h[c-1],e(f.tr);f.children&&f.children.length&&(d=f.children[f.children.length-1],d.tr);)f=d;else f=g;return f}a.ui.fancytree.registerExtension({name:"table",version:"2.22.5",options:{checkboxColumnIdx:null,indentation:16,nodeColumnIdx:0},treeInit:function(b){var d,f,g,h,i,j=b.tree,k=b.options,l=k.table,m=j.widget.element;if(null!=l.customStatus&&(null!=k.renderStatusColumns?a.error("The 'customStatus' option is deprecated since v2.15.0. Use 'renderStatusColumns' only instead."):(j.warn("The 'customStatus' option is deprecated since v2.15.0. Use 'renderStatusColumns' instead."),k.renderStatusColumns=l.customStatus)),k.renderStatusColumns&&k.renderStatusColumns===!0&&(k.renderStatusColumns=k.renderColumns),m.addClass("fancytree-container fancytree-ext-table"),j.tbody=m.find(">tbody")[0],i=a(j.tbody),f=a("thead >tr:last >th",m).length,h=i.children("tr:first"),h.length)g=h.children("td").length,f&&g!==f&&(j.warn("Column count mismatch between thead ("+f+") and tbody ("+g+"): using tbody."),f=g),h=h.clone();else for(e(f>=1,"Need either <thead> or <tbody> with <td> elements to determine column count."),h=a("<tr />"),d=0;d<f;d++)h.append("<td />");h.find(">td").eq(l.nodeColumnIdx).html("<span class='fancytree-node' />"),k.aria&&(h.attr("role","row"),h.find("td").attr("role","gridcell")),j.rowFragment=c.createDocumentFragment(),j.rowFragment.appendChild(h.get(0)),i.empty(),j.statusClassPropName="tr",j.ariaPropName="tr",this.nodeContainerAttrName="tr",j.$container=m,this._superApply(arguments),a(j.rootNode.ul).remove(),j.rootNode.ul=null,this.$container.attr("tabindex",k.tabindex),k.aria&&j.$container.attr("role","treegrid").attr("aria-readonly",!0)},nodeRemoveChildMarkup:function(b){var c=b.node;c.visit(function(b){b.tr&&(a(b.tr).remove(),b.tr=null)})},nodeRemoveMarkup:function(b){var c=b.node;c.tr&&(a(c.tr).remove(),c.tr=null),this.nodeRemoveChildMarkup(b)},nodeRender:function(b,c,d,j,k){var l,m,n,o,p,q,r,s,t=b.tree,u=b.node,v=b.options,w=!u.parent;if(t._enableUpdate!==!1){if(k||(b.hasCollapsedParents=u.parent&&!u.parent.expanded),!w)if(u.tr&&c&&this.nodeRemoveMarkup(b),u.tr)c?this.nodeRenderTitle(b):this.nodeRenderStatus(b);else{if(b.hasCollapsedParents&&!d)return;p=t.rowFragment.firstChild.cloneNode(!0),q=i(u),e(q),j===!0&&k?p.style.display="none":d&&b.hasCollapsedParents&&(p.style.display="none"),q.tr?g(q.tr,p):(e(!q.parent,"prev. row must have a tr, or be system root"),f(t.tbody,p)),u.tr=p,u.key&&v.generateIds&&(u.tr.id=v.idPrefix+u.key),u.tr.ftnode=u,u.span=a("span.fancytree-node",u.tr).get(0),this.nodeRenderTitle(b),v.createNode&&v.createNode.call(t,{type:"createNode"},b)}if(v.renderNode&&v.renderNode.call(t,{type:"renderNode"},b),l=u.children,l&&(w||d||u.expanded))for(n=0,o=l.length;n<o;n++)s=a.extend({},b,{node:l[n]}),s.hasCollapsedParents=s.hasCollapsedParents||!u.expanded,this.nodeRender(s,c,d,j,!0);l&&!k&&(r=u.tr||null,m=t.tbody.firstChild,u.visit(function(a){if(a.tr){if(a.parent.expanded||"none"===a.tr.style.display||(a.tr.style.display="none",h(a,!1)),a.tr.previousSibling!==r){u.debug("_fixOrder: mismatch at node: "+a);var b=r?r.nextSibling:m;t.tbody.insertBefore(a.tr,b)}r=a.tr}}))}},nodeRenderTitle:function(b,c){var d,e,f=b.node,g=b.options,h=f.isStatusNode();return e=this._super(b,c),f.isRootNode()?e:(g.checkbox&&!h&&null!=g.table.checkboxColumnIdx&&(d=a("span.fancytree-checkbox",f.span),a(f.tr).find("td").eq(+g.table.checkboxColumnIdx).html(d)),this.nodeRenderStatus(b),h?g.renderStatusColumns&&g.renderStatusColumns.call(b.tree,{type:"renderStatusColumns"},b):g.renderColumns&&g.renderColumns.call(b.tree,{type:"renderColumns"},b),e)},nodeRenderStatus:function(b){var c,d=b.node,e=b.options;this._super(b),a(d.tr).removeClass("fancytree-node"),c=(d.getLevel()-1)*e.table.indentation,a(d.span).css({paddingLeft:c+"px"})},nodeSetExpanded:function(b,c,d){function e(a){h(b.node,c),a?c&&b.options.autoScroll&&!d.noAnimation&&b.node.hasChildren()?b.node.getLastChild().scrollIntoView(!0,{topNode:b.node}).always(function(){d.noEvents||b.tree._triggerNodeEvent(c?"expand":"collapse",b),f.resolveWith(b.node)}):(d.noEvents||b.tree._triggerNodeEvent(c?"expand":"collapse",b),f.resolveWith(b.node)):(d.noEvents||b.tree._triggerNodeEvent(c?"expand":"collapse",b),f.rejectWith(b.node))}if(c=c!==!1,b.node.expanded&&c||!b.node.expanded&&!c)return this._superApply(arguments);var f=new a.Deferred,g=a.extend({},d,{noEvents:!0,noAnimation:!0});return d=d||{},this._super(b,c,g).done(function(){e(!0)}).fail(function(){e(!1)}),f.promise()},nodeSetStatus:function(b,c,d,e){if("ok"===c){var f=b.node,g=f.children?f.children[0]:null;g&&g.isStatusNode()&&a(g.tr).remove()}return this._superApply(arguments)},treeClear:function(a){return this.nodeRemoveChildMarkup(this._makeHookContext(this.rootNode)),this._superApply(arguments)},treeDestroy:function(a){return this.$container.find("tbody").empty(),this.$source&&this.$source.removeClass("ui-helper-hidden"),this._superApply(arguments)}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.themeroller.min.js' */
!function(a,b,c,d){"use strict";a.ui.fancytree.registerExtension({name:"themeroller",version:"2.22.5",options:{activeClass:"ui-state-active",addClass:"ui-corner-all",focusClass:"ui-state-focus",hoverClass:"ui-state-hover",selectedClass:"ui-state-highlight"},treeInit:function(b){var c=b.widget.element,d=b.options.themeroller;this._superApply(arguments),"TABLE"===c[0].nodeName?(c.addClass("ui-widget ui-corner-all"),c.find(">thead tr").addClass("ui-widget-header"),c.find(">tbody").addClass("ui-widget-conent")):c.addClass("ui-widget ui-widget-content ui-corner-all"),c.delegate(".fancytree-node","mouseenter mouseleave",function(b){var c=a.ui.fancytree.getNode(b.target),e="mouseenter"===b.type;a(c.tr?c.tr:c.span).toggleClass(d.hoverClass+" "+d.addClass,e)})},treeDestroy:function(a){this._superApply(arguments),a.widget.element.removeClass("ui-widget ui-widget-content ui-corner-all")},nodeRenderStatus:function(b){var c={},d=b.node,e=a(d.tr?d.tr:d.span),f=b.options.themeroller;this._super(b),c[f.activeClass]=!1,c[f.focusClass]=!1,c[f.selectedClass]=!1,d.isActive()&&(c[f.activeClass]=!0),d.hasFocus()&&(c[f.focusClass]=!0),d.isSelected()&&!d.isActive()&&(c[f.selectedClass]=!0),e.toggleClass(f.activeClass,c[f.activeClass]),e.toggleClass(f.focusClass,c[f.focusClass]),e.toggleClass(f.selectedClass,c[f.selectedClass]),e.addClass(f.addClass)}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.wide.min.js' */
!function(a,b,c,d){"use strict";function e(b,c){b="fancytree-style-"+b;var d=a("#"+b);if(!c)return d.remove(),null;d.length||(d=a("<style />").attr("id",b).addClass("fancytree-style").prop("type","text/css").appendTo("head"));try{d.html(c)}catch(e){d[0].styleSheet.cssText=c}return d}function f(a,b,c,d,e,f){var g,h="#"+a+" span.fancytree-level-",i=[];for(g=0;g<b;g++)i.push(h+(g+1)+" span.fancytree-title { padding-left: "+(g*c+d)+f+"; }");return i.push("#"+a+" div.ui-effects-wrapper ul li span.fancytree-title, #"+a+" ul.fancytree-animating span.fancytree-title { padding-left: "+e+f+"; position: static; width: auto; }"),i.join("\n")}var g=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;a.ui.fancytree.registerExtension({name:"wide",version:"2.22.5",options:{iconWidth:null,iconSpacing:null,labelSpacing:null,levelOfs:null},treeCreate:function(b){this._superApply(arguments),this.$container.addClass("fancytree-ext-wide");var c,d,h,i,j,k,l=b.options.wide,m=a("<li id='fancytreeTemp'><span class='fancytree-node'><span class='fancytree-icon' /><span class='fancytree-title' /></span><ul />").appendTo(b.tree.$container),n=m.find(".fancytree-icon"),o=m.find("ul"),p=l.iconSpacing||n.css("margin-left"),q=l.iconWidth||n.css("width"),r=l.labelSpacing||"3px",s=l.levelOfs||o.css("padding-left");m.remove(),h=p.match(g)[2],p=parseFloat(p,10),i=r.match(g)[2],r=parseFloat(r,10),j=q.match(g)[2],q=parseFloat(q,10),k=s.match(g)[2],h===j&&k===j&&i===j||a.error("iconWidth, iconSpacing, and levelOfs must have the same css measure unit"),this._local.measureUnit=j,this._local.levelOfs=parseFloat(s),this._local.lineOfs=(1+(b.options.checkbox?1:0)+(b.options.icon===!1?0:1))*(q+p)+p,this._local.labelOfs=r,this._local.maxDepth=10,c=this.$container.uniqueId().attr("id"),d=f(c,this._local.maxDepth,this._local.levelOfs,this._local.lineOfs,this._local.labelOfs,this._local.measureUnit),e(c,d)},treeDestroy:function(a){return e(this.$container.attr("id"),null),this._superApply(arguments)},nodeRenderStatus:function(b){var c,d,g,h=b.node,i=h.getLevel();return g=this._super(b),i>this._local.maxDepth&&(c=this.$container.attr("id"),this._local.maxDepth*=2,h.debug("Define global ext-wide css up to level "+this._local.maxDepth),d=f(c,this._local.maxDepth,this._local.levelOfs,this._local.lineOfs,this._local.labelSpacing,this._local.measureUnit),e(c,d)),a(h.span).addClass("fancytree-level-"+i),g}})}(jQuery,window,document);
}));
|
packages/mineral-ui-icons/src/Icon3DRotation.js
|
mineral-ui/mineral-ui
|
/* @flow */
import React from 'react';
import Icon from 'mineral-ui/Icon';
import type { IconProps } from 'mineral-ui/Icon/types';
/* eslint-disable prettier/prettier */
export default function Icon3DRotation(props: IconProps) {
const iconProps = {
rtl: false,
...props
};
return (
<Icon {...iconProps}>
<g>
<path d="M7.52 21.48A10.487 10.487 0 0 1 1.55 13H.05C.56 19.16 5.71 24 12 24l.66-.03-3.81-3.81-1.33 1.32zm.89-6.52c-.19 0-.37-.03-.52-.08a1.07 1.07 0 0 1-.4-.24c-.11-.1-.2-.22-.26-.37-.06-.14-.09-.3-.09-.47h-1.3c0 .36.07.68.21.95.14.27.33.5.56.69.24.18.51.32.82.41.3.1.62.15.96.15.37 0 .72-.05 1.03-.15.32-.1.6-.25.83-.44s.42-.43.55-.72c.13-.29.2-.61.2-.97 0-.19-.02-.38-.07-.56a1.67 1.67 0 0 0-.23-.51c-.1-.16-.24-.3-.4-.43-.17-.13-.37-.23-.61-.31a2.098 2.098 0 0 0 .89-.75c.1-.15.17-.3.22-.46.05-.16.07-.32.07-.48 0-.36-.06-.68-.18-.96a1.78 1.78 0 0 0-.51-.69c-.2-.19-.47-.33-.77-.43C9.1 8.05 8.76 8 8.39 8c-.36 0-.69.05-1 .16-.3.11-.57.26-.79.45-.21.19-.38.41-.51.67-.12.26-.18.54-.18.85h1.3c0-.17.03-.32.09-.45s.14-.25.25-.34c.11-.09.23-.17.38-.22.15-.05.3-.08.48-.08.4 0 .7.1.89.31.19.2.29.49.29.86 0 .18-.03.34-.08.49a.87.87 0 0 1-.25.37c-.11.1-.25.18-.41.24-.16.06-.36.09-.58.09H7.5v1.03h.77c.22 0 .42.02.6.07s.33.13.45.23c.12.11.22.24.29.4.07.16.1.35.1.57 0 .41-.12.72-.35.93-.23.23-.55.33-.95.33zm8.55-5.92c-.32-.33-.7-.59-1.14-.77-.43-.18-.92-.27-1.46-.27H12v8h2.3c.55 0 1.06-.09 1.51-.27.45-.18.84-.43 1.16-.76.32-.33.57-.73.74-1.19.17-.47.26-.99.26-1.57v-.4c0-.58-.09-1.1-.26-1.57-.18-.47-.43-.87-.75-1.2zm-.39 3.16c0 .42-.05.79-.14 1.13-.1.33-.24.62-.43.85-.19.23-.43.41-.71.53-.29.12-.62.18-.99.18h-.91V9.12h.97c.72 0 1.27.23 1.64.69.38.46.57 1.12.57 1.99v.4zM12 0l-.66.03 3.81 3.81 1.33-1.33c3.27 1.55 5.61 4.72 5.96 8.48h1.5C23.44 4.84 18.29 0 12 0z"/>
</g>
</Icon>
);
}
Icon3DRotation.displayName = 'Icon3DRotation';
Icon3DRotation.category = 'action';
|
src/components/DatePicker/DatePicker-test.js
|
carbon-design-system/carbon-components-react
|
/**
* Copyright IBM Corp. 2016, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import DatePicker from '../DatePicker';
import DatePickerSkeleton from '../DatePicker/DatePicker.Skeleton';
import { mount, shallow } from 'enzyme';
import DatePickerInput from '../DatePickerInput/DatePickerInput';
describe('DatePicker', () => {
describe('Renders as expected', () => {
const wrapper = mount(
<DatePicker onChange={() => {}} className="extra-class">
<div className="test-child" />
<div className="test-child" />
</DatePicker>
);
const datepicker = wrapper.childAt(0);
it('has the expected classes', () => {
expect(datepicker.children().hasClass('bx--date-picker')).toBe(true);
});
it('should add extra classes that are passed via className', () => {
expect(datepicker.children().hasClass('extra-class')).toBe(true);
});
it('should add the date picker type as expected', () => {
expect(wrapper.props().datePickerType).toEqual(undefined);
wrapper.setProps({ datePickerType: 'simple' });
expect(wrapper.props().datePickerType).toEqual('simple');
});
it('should specify short date picker as expected', () => {
expect(wrapper.props().short).toEqual(false);
wrapper.setProps({ short: true });
expect(wrapper.props().short).toEqual(true);
});
it('should specify light date picker as expected', () => {
expect(wrapper.props().light).toEqual(false);
wrapper.setProps({ light: true });
expect(wrapper.props().light).toEqual(true);
});
it('should add the date format as expected', () => {
expect(wrapper.props().dateFormat).toEqual('m/d/Y');
wrapper.setProps({ dateFormat: 'd/m/Y' });
expect(wrapper.props().dateFormat).toEqual('d/m/Y');
});
it('has the value as expected', () => {
expect(wrapper.props().value).toEqual(undefined);
wrapper.setProps({ value: '11/08/2017' });
expect(wrapper.props().value).toEqual('11/08/2017');
});
it('should render the children as expected', () => {
expect(wrapper.props().children.length).toEqual(2);
});
});
describe('Simple date picker', () => {
const wrapper = mount(
<DatePicker datePickerType="simple" className="extra-class">
<div className="test-child" />
</DatePicker>
);
const datepicker = wrapper.childAt(0);
it('has the simple date picker class', () => {
expect(datepicker.children().hasClass('bx--date-picker--simple')).toBe(
true
);
});
it('has the value as expected', () => {
expect(wrapper.props().value).toEqual(undefined);
wrapper.setProps({ value: '11/08/2017' });
expect(wrapper.props().value).toEqual('11/08/2017');
});
it('should not initalize a calendar', () => {
expect(wrapper.cal).toEqual(undefined);
});
});
describe('Single date picker', () => {
const wrapper = mount(
<DatePicker
onChange={() => {}}
datePickerType="single"
className="extra-class">
<div className="test-child">
<input type="text" className="bx--date-picker__input" />
</div>
</DatePicker>
);
const datepicker = wrapper.childAt(0);
const input = wrapper.find('.bx--date-picker__input');
const icon = wrapper.find('svg');
it('has the single date picker class', () => {
expect(datepicker.children().hasClass('bx--date-picker--single')).toBe(
true
);
});
it('should initalize a calendar', () => {
expect(wrapper.instance().cal).toBeDefined();
});
it('should update the classnames', () => {
expect(
wrapper
.instance()
.cal.calendarContainer.classList.contains('bx--date-picker__calendar')
).toBe(true);
});
it('has the value as expected', () => {
expect(wrapper.props().value).toEqual(undefined);
wrapper.setProps({ value: '11/08/2017' });
expect(wrapper.props().value).toEqual('11/08/2017');
});
it('should not render an icon', () => {
expect(icon.length).toEqual(0);
});
});
describe('Single date picker with initial value', () => {
const wrapper = mount(
<DatePicker
datePickerType="single"
dateFormat="m/d/Y"
value={'02/26/2017'}
onChange={() => {}}>
<DatePickerInput
key="label"
labelText="Controlled Date"
id="date-picker-input-id"
/>
</DatePicker>
);
it('has the value as expected', () => {
// MOUNT
expect(wrapper.props().value).toEqual('02/26/2017');
// UPDATE
wrapper.setProps({ value: '02/17/2017' });
expect(wrapper.props().value).toEqual('02/17/2017');
});
});
describe('Range date picker', () => {
const wrapper = mount(
<DatePicker
onChange={() => {}}
datePickerType="range"
className="extra-class">
<div className="test-child">
<input
type="text"
className="bx--date-picker__input"
id="input-from"
/>
</div>
<div className="test-child">
<input type="text" className="bx--date-picker__input" id="input-to" />
</div>
</DatePicker>
);
const datepicker = wrapper.childAt(0);
it('has the range date picker class', () => {
expect(datepicker.children().hasClass('bx--date-picker--range')).toBe(
true
);
});
it('should initalize a calendar', () => {
expect(wrapper.instance().cal).toBeDefined();
});
it('should update the classnames', () => {
expect(
wrapper
.instance()
.cal.calendarContainer.classList.contains('bx--date-picker__calendar')
).toBe(true);
});
it('has the value as expected', () => {
expect(wrapper.props().value).toEqual(undefined);
wrapper.setProps({ value: '11/08/2017' });
expect(wrapper.props().value).toEqual('11/08/2017');
});
});
describe('Date picker with locale', () => {
const wrapper = mount(
<DatePicker
onChange={() => {}}
datePickerType="range"
className="extra-class"
locale="es">
<div className="test-child">
<input
type="text"
className="bx--date-picker__input"
id="input-from"
/>
</div>
<div className="test-child">
<input type="text" className="bx--date-picker__input" id="input-to" />
</div>
</DatePicker>
);
const wrapperNoLocale = mount(
<DatePicker
onChange={() => {}}
datePickerType="range"
className="extra-class">
<div className="test-child">
<input
type="text"
className="bx--date-picker__input"
id="input-from"
/>
</div>
<div className="test-child">
<input type="text" className="bx--date-picker__input" id="input-to" />
</div>
</DatePicker>
);
it('has the range date picker locale', () => {
const datepicker = wrapper.find('DatePicker');
expect(datepicker.props().locale).toBe('es');
});
it('has the range date picker without locale defined', () => {
const datepicker = wrapperNoLocale.find('DatePicker');
expect(datepicker.props().locale).toBe('en');
});
});
describe('Date picker can be used with enzyme shallow', () => {
beforeEach(done => {
const spy = {};
spy.console = jest.spyOn(console, 'error').mockImplementation(e => {
done.fail(e);
});
done();
});
it('date picker should not throw exception when mounted or unmounted', () => {
const wrapper = shallow(
<DatePicker
onChange={() => {}}
datePickerType="range"
className="extra-class"
locale="es">
<div className="test-child">
<input
type="text"
className="bx--date-picker__input"
id="input-from"
/>
</div>
<div className="test-child">
<input
type="text"
className="bx--date-picker__input"
id="input-to"
/>
</div>
</DatePicker>
);
expect(wrapper.find('DatePicker')).toBeDefined();
wrapper.unmount();
});
});
describe('Date picker with minDate and maxDate', () => {
console.error = jest.fn(); // eslint-disable-line no-console
const wrapper = mount(
<DatePicker
onChange={() => {}}
datePickerType="range"
className="extra-class"
minDate="01/01/2018"
maxDate="01/30/2018">
<div className="test-child">
<input
type="text"
className="bx--date-picker__input"
id="input-from"
/>
</div>
<div className="test-child">
<input type="text" className="bx--date-picker__input" id="input-to" />
</div>
</DatePicker>
);
it('has the range date picker with min and max dates', () => {
const datepicker = wrapper.find('DatePicker');
expect(datepicker.props().minDate).toBe('01/01/2018');
expect(datepicker.props().maxDate).toBe('01/30/2018');
});
it('should not have "console.error" being created', () => {
expect(console.error).not.toBeCalled(); // eslint-disable-line no-console
});
});
});
describe('DatePickerSkeleton', () => {
describe('Renders as expected', () => {
const wrapper = shallow(<DatePickerSkeleton range />);
it('Has the expected classes', () => {
expect(wrapper.children().hasClass('bx--skeleton')).toEqual(true);
expect(wrapper.children().hasClass('bx--date-picker')).toEqual(true);
expect(wrapper.children().hasClass('bx--date-picker--range')).toEqual(
true
);
});
});
});
|
ajax/libs/material-ui/4.11.3/es/FormLabel/FormLabel.js
|
cdnjs/cdnjs
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
import _extends from "@babel/runtime/helpers/esm/extends";
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import formControlState from '../FormControl/formControlState';
import useFormControl from '../FormControl/useFormControl';
import capitalize from '../utils/capitalize';
import withStyles from '../styles/withStyles';
export const styles = theme => ({
/* Styles applied to the root element. */
root: _extends({
color: theme.palette.text.secondary
}, theme.typography.body1, {
lineHeight: 1,
padding: 0,
'&$focused': {
color: theme.palette.primary.main
},
'&$disabled': {
color: theme.palette.text.disabled
},
'&$error': {
color: theme.palette.error.main
}
}),
/* Styles applied to the root element if the color is secondary. */
colorSecondary: {
'&$focused': {
color: theme.palette.secondary.main
}
},
/* Pseudo-class applied to the root element if `focused={true}`. */
focused: {},
/* Pseudo-class applied to the root element if `disabled={true}`. */
disabled: {},
/* Pseudo-class applied to the root element if `error={true}`. */
error: {},
/* Pseudo-class applied to the root element if `filled={true}`. */
filled: {},
/* Pseudo-class applied to the root element if `required={true}`. */
required: {},
/* Styles applied to the asterisk element. */
asterisk: {
'&$error': {
color: theme.palette.error.main
}
}
});
const FormLabel = /*#__PURE__*/React.forwardRef(function FormLabel(props, ref) {
const {
children,
classes,
className,
component: Component = 'label'
} = props,
other = _objectWithoutPropertiesLoose(props, ["children", "classes", "className", "color", "component", "disabled", "error", "filled", "focused", "required"]);
const muiFormControl = useFormControl();
const fcs = formControlState({
props,
muiFormControl,
states: ['color', 'required', 'focused', 'disabled', 'error', 'filled']
});
return /*#__PURE__*/React.createElement(Component, _extends({
className: clsx(classes.root, classes[`color${capitalize(fcs.color || 'primary')}`], className, fcs.disabled && classes.disabled, fcs.error && classes.error, fcs.filled && classes.filled, fcs.focused && classes.focused, fcs.required && classes.required),
ref: ref
}, other), children, fcs.required && /*#__PURE__*/React.createElement("span", {
"aria-hidden": true,
className: clsx(classes.asterisk, fcs.error && classes.error)
}, "\u2009", '*'));
});
process.env.NODE_ENV !== "production" ? FormLabel.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the d.ts file and run "yarn proptypes" |
// ----------------------------------------------------------------------
/**
* The content of the component.
*/
children: PropTypes.node,
/**
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: PropTypes.object,
/**
* @ignore
*/
className: PropTypes.string,
/**
* The color of the component. It supports those theme colors that make sense for this component.
*/
color: PropTypes.oneOf(['primary', 'secondary']),
/**
* The component used for the root node.
* Either a string to use a HTML element or a component.
*/
component: PropTypes
/* @typescript-to-proptypes-ignore */
.elementType,
/**
* If `true`, the label should be displayed in a disabled state.
*/
disabled: PropTypes.bool,
/**
* If `true`, the label should be displayed in an error state.
*/
error: PropTypes.bool,
/**
* If `true`, the label should use filled classes key.
*/
filled: PropTypes.bool,
/**
* If `true`, the input of this label is focused (used by `FormGroup` components).
*/
focused: PropTypes.bool,
/**
* If `true`, the label will indicate that the input is required.
*/
required: PropTypes.bool
} : void 0;
export default withStyles(styles, {
name: 'MuiFormLabel'
})(FormLabel);
|
src/TabPane.js
|
xsistens/react-bootstrap
|
import React from 'react';
import deprecationWarning from './utils/deprecationWarning';
import Tab from './Tab';
const TabPane = React.createClass({
componentWillMount() {
deprecationWarning(
'TabPane', 'Tab',
'https://github.com/react-bootstrap/react-bootstrap/pull/1091'
);
},
render() {
return (
<Tab {...this.props} />
);
}
});
export default TabPane;
|
src/components/settlement/SettlementCardNoForm.js
|
HuZai/react_settlement
|
/**
* Created by zhengHu on 16-10-8.
* 图片list处理
*/
import React from 'react';
import SettlementInput from 'components/settlement/SettlementInput';
class SettlementZiTiForm extends React.Component {
constructor(props) {
super(props);
this.state = Object.assign({},this.props.data,{type:"card"});
this.haddleInput = this.haddleInput.bind(this);
}
haddleInput(names,event){
let jsons={};
jsons[names]=event.target.value;
this.setState(jsons);
}
componentDidMount(){
}
btnClass(){
let classArray=['secoo_btn','secoo_btn_default'];
if(this.state.cardNo && this.state.cardNo.length>=18){
}else{
classArray.push('disabled');
}
return classArray.join(' ');
}
render() {
let datas=this.state;
return (
<div className='input-pops-item ziti-input selected'>
<div className='title-line'>
<span className='left-area secoo_icon_guanbi' onClick={()=>this.props.close('card')}></span>输入身份证号
</div>
<SettlementInput data={{placeholder:'请输入收货人身份证号',refName:'cardNo',value:datas.cardNo,focus:true,maxlength:18}} ref='name' haddleInput={this.haddleInput}/>
<a href='javascript:;' className={this.btnClass()} onClick={()=>this.props.saveAddressClick(datas)} ref="btnZiTi" >确定</a>
</div>
);
}
}
SettlementZiTiForm.defaultProps = {
};
export default SettlementZiTiForm;
|
bower_components/sinon/test/rhino/env.rhino.1.2.js
|
evitics/localsite
|
/*
* Envjs core-env.1.2.13
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*/
var Envjs = function(){
var i,
name,
override = function(){
for(i=0;i<arguments.length;i++){
for ( name in arguments[i] ) {
var g = arguments[i].__lookupGetter__(name),
s = arguments[i].__lookupSetter__(name);
if ( g || s ) {
if ( g ) { Envjs.__defineGetter__(name, g); }
if ( s ) { Envjs.__defineSetter__(name, s); }
} else {
Envjs[name] = arguments[i][name];
}
}
}
};
if(arguments.length === 1 && typeof(arguments[0]) == 'string'){
window.location = arguments[0];
}else if (arguments.length === 1 && typeof(arguments[0]) == "object"){
override(arguments[0]);
}else if(arguments.length === 2 && typeof(arguments[0]) == 'string'){
override(arguments[1]);
window.location = arguments[0];
}
return;
},
__this__ = this;
//eg "Mozilla"
Envjs.appCodeName = "Envjs";
//eg "Gecko/20070309 Firefox/2.0.0.3"
Envjs.appName = "Resig/20070309 PilotFish/1.2.13";
Envjs.version = "1.6";//?
Envjs.revision = '';
/*
* Envjs core-env.1.2.13
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*/
//CLOSURE_START
(function(){
/**
* @author john resig
*/
// Helper method for extending one object with another.
function __extend__(a,b) {
for ( var i in b ) {
var g = b.__lookupGetter__(i), s = b.__lookupSetter__(i);
if ( g || s ) {
if ( g ) { a.__defineGetter__(i, g); }
if ( s ) { a.__defineSetter__(i, s); }
} else {
a[i] = b[i];
}
} return a;
}
/**
* Writes message to system out
* @param {String} message
*/
Envjs.log = function(message){};
/**
* Constants providing enumerated levels for logging in modules
*/
Envjs.DEBUG = 1;
Envjs.INFO = 2;
Envjs.WARN = 3;
Envjs.ERROR = 3;
Envjs.NONE = 3;
/**
* Writes error info out to console
* @param {Error} e
*/
Envjs.lineSource = function(e){};
/**
* TODO: used in ./event/eventtarget.js
* @param {Object} event
*/
Envjs.defaultEventBehaviors = {};
/**
* describes which script src values will trigger Envjs to load
* the script like a browser would
*/
Envjs.scriptTypes = {
"text/javascript" :false,
"text/envjs" :true
};
/**
* will be called when loading a script throws an error
* @param {Object} script
* @param {Object} e
*/
Envjs.onScriptLoadError = function(script, e){
console.log('error loading script %s %s', script, e);
};
/**
* load and execute script tag text content
* @param {Object} script
*/
Envjs.loadInlineScript = function(script){
var tmpFile;
tmpFile = Envjs.writeToTempFile(script.text, 'js') ;
load(tmpFile);
};
/**
* Should evaluate script in some context
* @param {Object} context
* @param {Object} source
* @param {Object} name
*/
Envjs.eval = function(context, source, name){};
/**
* Executes a script tag
* @param {Object} script
* @param {Object} parser
*/
Envjs.loadLocalScript = function(script){
//console.log("loading script %s", script);
var types,
src,
i,
base,
filename,
xhr;
if(script.type){
types = script.type.split(";");
for(i=0;i<types.length;i++){
if(Envjs.scriptTypes[types[i]]){
//ok this script type is allowed
break;
}
if(i+1 == types.length){
//console.log('wont load script type %s', script.type);
return false;
}
}
}
try{
//console.log('handling inline scripts');
if(!script.src.length){
Envjs.loadInlineScript(script);
return true;
}
}catch(e){
//Envjs.error("Error loading script.", e);
Envjs.onScriptLoadError(script, e);
return false;
}
//console.log("loading allowed external script %s", script.src);
//lets you register a function to execute
//before the script is loaded
if(Envjs.beforeScriptLoad){
for(src in Envjs.beforeScriptLoad){
if(script.src.match(src)){
Envjs.beforeScriptLoad[src](script);
}
}
}
base = "" + script.ownerDocument.location;
//filename = Envjs.uri(script.src.match(/([^\?#]*)/)[1], base );
//console.log('loading script from base %s', base);
filename = Envjs.uri(script.src, base);
try {
xhr = new XMLHttpRequest();
xhr.open("GET", filename, false/*syncronous*/);
//console.log("loading external script %s", filename);
xhr.onreadystatechange = function(){
//console.log("readyState %s", xhr.readyState);
if(xhr.readyState === 4){
Envjs.eval(
script.ownerDocument.ownerWindow,
xhr.responseText,
filename
);
}
};
xhr.send(null, false);
} catch(e) {
console.log("could not load script %s \n %s", filename, e );
Envjs.onScriptLoadError(script, e);
return false;
}
//lets you register a function to execute
//after the script is loaded
if(Envjs.afterScriptLoad){
for(src in Envjs.afterScriptLoad){
if(script.src.match(src)){
Envjs.afterScriptLoad[src](script);
}
}
}
return true;
};
/**
* An 'image' was requested by the document.
*
* - During inital parse of a <link>
* - Via an innerHTML parse of a <link>
* - A modificiation of the 'src' attribute of an Image/HTMLImageElement
*
* NOTE: this is optional API. If this doesn't exist then the default
* 'loaded' event occurs.
*
* @param node {Object} the <img> node
* @param node the src value
* @return 'true' to indicate the 'load' succeed, false otherwise
*/
Envjs.loadImage = function(node, src) {
return true;
};
/**
* A 'link' was requested by the document. Typically this occurs when:
* - During inital parse of a <link>
* - Via an innerHTML parse of a <link>
* - A modificiation of the 'href' attribute on a <link> node in the tree
*
* @param node {Object} is the link node in question
* @param href {String} is the href.
*
* Return 'true' to indicate that the 'load' was successful, or false
* otherwise. The appropriate event is then triggered.
*
* NOTE: this is optional API. If this doesn't exist then the default
* 'loaded' event occurs
*/
Envjs.loadLink = function(node, href) {
return true;
};
(function(){
/*
* cookie handling
* Private internal helper class used to save/retreive cookies
*/
/**
* Specifies the location of the cookie file
*/
Envjs.cookieFile = function(){
return 'file://'+Envjs.homedir+'/.cookies';
};
/**
* saves cookies to a local file
* @param {Object} htmldoc
*/
Envjs.saveCookies = function(){
var cookiejson = JSON.stringify(Envjs.cookies.peristent,null,'\t');
//console.log('persisting cookies %s', cookiejson);
Envjs.writeToFile(cookiejson, Envjs.cookieFile());
};
/**
* loads cookies from a local file
* @param {Object} htmldoc
*/
Envjs.loadCookies = function(){
var cookiejson,
js;
try{
cookiejson = Envjs.readFromFile(Envjs.cookieFile())
js = JSON.parse(cookiejson, null, '\t');
}catch(e){
//console.log('failed to load cookies %s', e);
js = {};
}
return js;
};
Envjs.cookies = {
persistent:{
//domain - key on domain name {
//path - key on path {
//name - key on name {
//value : cookie value
//other cookie properties
//}
//}
//}
//expire - provides a timestamp for expiring the cookie
//cookie - the cookie!
},
temporary:{//transient is a reserved word :(
//like above
}
};
var __cookies__;
//HTMLDocument cookie
Envjs.setCookie = function(url, cookie){
var i,
index,
name,
value,
properties = {},
attr,
attrs;
url = Envjs.urlsplit(url);
if(cookie)
attrs = cookie.split(";");
else
return;
//for now the strategy is to simply create a json object
//and post it to a file in the .cookies.js file. I hate parsing
//dates so I decided not to implement support for 'expires'
//(which is deprecated) and instead focus on the easier 'max-age'
//(which succeeds 'expires')
cookie = {};//keyword properties of the cookie
cookie['domain'] = url.hostname;
cookie['path'] = url.path||'/';
for(i=0;i<attrs.length;i++){
index = attrs[i].indexOf("=");
if(index > -1){
name = __trim__(attrs[i].slice(0,index));
value = __trim__(attrs[i].slice(index+1));
if(name=='max-age'){
//we'll have to when to check these
//and garbage collect expired cookies
cookie[name] = parseInt(value, 10);
} else if( name == 'domain' ){
if(__domainValid__(url, value)){
cookie['domain'] = value;
}
} else if( name == 'path' ){
//not sure of any special logic for path
cookie['path'] = value;
} else {
//its not a cookie keyword so store it in our array of properties
//and we'll serialize individually in a moment
properties[name] = value;
}
}else{
if( attrs[i] == 'secure' ){
cookie[attrs[i]] = true;
}
}
}
if(!('max-age' in cookie)){
//it's a transient cookie so it only lasts as long as
//the window.location remains the same (ie in-memory cookie)
__mergeCookie__(Envjs.cookies.temporary, cookie, properties);
}else{
//the cookie is persistent
__mergeCookie__(Envjs.cookies.persistent, cookie, properties);
Envjs.saveCookies();
}
};
function __domainValid__(url, value){
var i,
domainParts = url.hostname.split('.').reverse(),
newDomainParts = value.split('.').reverse();
if(newDomainParts.length > 1){
for(i=0;i<newDomainParts.length;i++){
if(!(newDomainParts[i] == domainParts[i])){
return false;
}
}
return true;
}
return false;
};
Envjs.getCookies = function(url){
//The cookies that are returned must belong to the same domain
//and be at or below the current window.location.path. Also
//we must check to see if the cookie was set to 'secure' in which
//case we must check our current location.protocol to make sure it's
//https:
var persisted;
url = Envjs.urlsplit(url);
if(!__cookies__){
try{
__cookies__ = true;
try{
persisted = Envjs.loadCookies();
}catch(e){
//fail gracefully
//console.log('%s', e);
}
if(persisted){
__extend__(Envjs.cookies.persistent, persisted);
}
//console.log('set cookies for doc %s', doc.baseURI);
}catch(e){
console.log('cookies not loaded %s', e)
};
}
var temporary = __cookieString__(Envjs.cookies.temporary, url),
persistent = __cookieString__(Envjs.cookies.persistent, url);
//console.log('temporary cookies: %s', temporary);
//console.log('persistent cookies: %s', persistent);
return temporary + persistent;
};
function __cookieString__(cookies, url) {
var cookieString = "",
domain,
path,
name,
i=0;
for (domain in cookies) {
// check if the cookie is in the current domain (if domain is set)
// console.log('cookie domain %s', domain);
if (domain == "" || domain == url.hostname) {
for (path in cookies[domain]) {
// console.log('cookie domain path %s', path);
// make sure path is at or below the window location path
if (path == "/" || url.path.indexOf(path) > -1) {
for (name in cookies[domain][path]) {
// console.log('cookie domain path name %s', name);
cookieString +=
((i++ > 0)?'; ':'') +
name + "=" +
cookies[domain][path][name].value;
}
}
}
}
}
return cookieString;
};
function __mergeCookie__(target, cookie, properties){
var name, now;
if(!target[cookie.domain]){
target[cookie.domain] = {};
}
if(!target[cookie.domain][cookie.path]){
target[cookie.domain][cookie.path] = {};
}
for(name in properties){
now = new Date().getTime();
target[cookie.domain][cookie.path][name] = {
"value":properties[name],
"secure":cookie.secure,
"max-age":cookie['max-age'],
"date-created":now,
"expiration":(cookie['max-age']===0) ?
0 :
now + cookie['max-age']
};
//console.log('cookie is %o',target[cookie.domain][cookie.path][name]);
}
};
})();//end cookies
/*
http://www.JSON.org/json2.js
2008-07-15
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.
*/
try{ JSON; }catch(e){
JSON = function () {
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
Date.prototype.toJSON = function (key) {
return this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z';
};
String.prototype.toJSON = function (key) {
return String(this);
};
Number.prototype.toJSON =
Boolean.prototype.toJSON = function (key) {
return this.valueOf();
};
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
escapeable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
gap,
indent,
meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
rep;
function quote(string) {
escapeable.lastIndex = 0;
return escapeable.test(string) ?
'"' + string.replace(escapeable, function (a) {
var c = meta[a];
if (typeof c === 'string') {
return c;
}
return '\\u' + ('0000' +
(+(a.charCodeAt(0))).toString(16)).slice(-4);
}) + '"' :
'"' + string + '"';
}
function str(key, holder) {
var i, // The loop counter.
k, // The member key.
v, // The member value.
length,
mind = gap,
partial,
value = holder[key];
if (value && typeof value === 'object' &&
typeof value.toJSON === 'function') {
value = value.toJSON(key);
}
if (typeof rep === 'function') {
value = rep.call(holder, key, value);
}
switch (typeof value) {
case 'string':
return quote(value);
case 'number':
return isFinite(value) ? String(value) : 'null';
case 'boolean':
case 'null':
return String(value);
case 'object':
if (!value) {
return 'null';
}
gap += indent;
partial = [];
if (typeof value.length === 'number' &&
!(value.propertyIsEnumerable('length'))) {
length = value.length;
for (i = 0; i < length; i += 1) {
partial[i] = str(i, value) || 'null';
}
v = partial.length === 0 ? '[]' :
gap ? '[\n' + gap +
partial.join(',\n' + gap) + '\n' +
mind + ']' :
'[' + partial.join(',') + ']';
gap = mind;
return v;
}
if (rep && typeof rep === 'object') {
length = rep.length;
for (i = 0; i < length; i += 1) {
k = rep[i];
if (typeof k === 'string') {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
} else {
for (k in value) {
if (Object.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
}
v = partial.length === 0 ? '{}' :
gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
mind + '}' : '{' + partial.join(',') + '}';
gap = mind;
return v;
}
}
return {
stringify: function (value, replacer, space) {
var i;
gap = '';
indent = '';
if (typeof space === 'number') {
for (i = 0; i < space; i += 1) {
indent += ' ';
}
} else if (typeof space === 'string') {
indent = space;
}
rep = replacer;
if (replacer && typeof replacer !== 'function' &&
(typeof replacer !== 'object' ||
typeof replacer.length !== 'number')) {
throw new Error('JSON.stringify');
}
return str('', {'': value});
},
parse: function (text, reviver) {
var j;
function walk(holder, key) {
var k, v, value = holder[key];
if (value && typeof value === 'object') {
for (k in value) {
if (Object.hasOwnProperty.call(value, k)) {
v = walk(value, k);
if (v !== undefined) {
value[k] = v;
} else {
delete value[k];
}
}
}
}
return reviver.call(holder, key, value);
}
cx.lastIndex = 0;
if (cx.test(text)) {
text = text.replace(cx, function (a) {
return '\\u' + ('0000' +
(+(a.charCodeAt(0))).toString(16)).slice(-4);
});
}
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, ''))) {
j = eval('(' + text + ')');
return typeof reviver === 'function' ?
walk({'': j}, '') : j;
}
throw new SyntaxError('JSON.parse');
}
};
}();
}
/**
* synchronizes thread modifications
* @param {Function} fn
*/
Envjs.sync = function(fn){};
/**
* sleep thread for specified duration
* @param {Object} millseconds
*/
Envjs.sleep = function(millseconds){};
/**
* Interval to wait on event loop when nothing is happening
*/
Envjs.WAIT_INTERVAL = 20;//milliseconds
/*
* Copyright (c) 2010 Nick Galbreath
* http://code.google.com/p/stringencoders/source/browse/#svn/trunk/javascript
*
* 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.
*/
/*
* url processing in the spirit of python's urlparse module
* see `pydoc urlparse` or
* http://docs.python.org/library/urlparse.html
*
* urlsplit: break apart a URL into components
* urlunsplit: reconsistute a URL from componets
* urljoin: join an absolute and another URL
* urldefrag: remove the fragment from a URL
*
* Take a look at the tests in urlparse-test.html
*
* On URL Normalization:
*
* urlsplit only does minor normalization the components Only scheme
* and hostname are lowercased urljoin does a bit more, normalizing
* paths with "." and "..".
* urlnormalize adds additional normalization
*
* * removes default port numbers
* http://abc.com:80/ -> http://abc.com/, etc
* * normalizes path
* http://abc.com -> http://abc.com/
* and other "." and ".." cleanups
* * if file, remove query and fragment
*
* It does not do:
* * normalizes escaped hex values
* http://abc.com/%7efoo -> http://abc.com/%7Efoo
* * normalize '+' <--> '%20'
*
* Differences with Python
*
* The javascript urlsplit returns a normal object with the following
* properties: scheme, netloc, hostname, port, path, query, fragment.
* All properties are read-write.
*
* In python, the resulting object is not a dict, but a specialized,
* read-only, and has alternative tuple interface (e.g. obj[0] ==
* obj.scheme). It's not clear why such a simple function requires
* a unique datastructure.
*
* urlunsplit in javascript takes an duck-typed object,
* { scheme: 'http', netloc: 'abc.com', ...}
* while in * python it takes a list-like object.
* ['http', 'abc.com'... ]
*
* For all functions, the javascript version use
* hostname+port if netloc is missing. In python
* hostname+port were always ignored.
*
* Similar functionality in different languages:
*
* http://php.net/manual/en/function.parse-url.php
* returns assocative array but cannot handle relative URL
*
* TODO: test allowfragments more
* TODO: test netloc missing, but hostname present
*/
var urlparse = {};
// Unlike to be useful standalone
//
// NORMALIZE PATH with "../" and "./"
// http://en.wikipedia.org/wiki/URL_normalization
// http://tools.ietf.org/html/rfc3986#section-5.2.3
//
urlparse.normalizepath = function(path)
{
if (!path || path === '/') {
return '/';
}
var parts = path.split('/');
var newparts = [];
// make sure path always starts with '/'
if (parts[0]) {
newparts.push('');
}
for (var i = 0; i < parts.length; ++i) {
if (parts[i] === '..') {
if (newparts.length > 1) {
newparts.pop();
} else {
newparts.push(parts[i]);
}
} else if (parts[i] != '.') {
newparts.push(parts[i]);
}
}
path = newparts.join('/');
if (!path) {
path = '/';
}
return path;
};
//
// Does many of the normalizations that the stock
// python urlsplit/urlunsplit/urljoin neglects
//
// Doesn't do hex-escape normalization on path or query
// %7e -> %7E
// Nor, '+' <--> %20 translation
//
urlparse.urlnormalize = function(url)
{
var parts = urlparse.urlsplit(url);
switch (parts.scheme) {
case 'file':
// files can't have query strings
// and we don't bother with fragments
parts.query = '';
parts.fragment = '';
break;
case 'http':
case 'https':
// remove default port
if ((parts.scheme === 'http' && parts.port == 80) ||
(parts.scheme === 'https' && parts.port == 443)) {
parts.port = null;
// hostname is already lower case
parts.netloc = parts.hostname;
}
break;
default:
// if we don't have specific normalizations for this
// scheme, return the original url unmolested
return url;
}
// for [file|http|https]. Not sure about other schemes
parts.path = urlparse.normalizepath(parts.path);
return urlparse.urlunsplit(parts);
};
urlparse.urldefrag = function(url)
{
var idx = url.indexOf('#');
if (idx == -1) {
return [ url, '' ];
} else {
return [ url.substr(0,idx), url.substr(idx+1) ];
}
};
urlparse.urlsplit = function(url, default_scheme, allow_fragments)
{
var leftover;
if (typeof allow_fragments === 'undefined') {
allow_fragments = true;
}
// scheme (optional), host, port
var fullurl = /^([A-Za-z]+)?(:?\/\/)([0-9.\-A-Za-z]*)(?::(\d+))?(.*)$/;
// path, query, fragment
var parse_leftovers = /([^?#]*)?(?:\?([^#]*))?(?:#(.*))?$/;
var o = {};
var parts = url.match(fullurl);
if (parts) {
o.scheme = parts[1] || default_scheme || '';
o.hostname = parts[3].toLowerCase() || '';
o.port = parseInt(parts[4],10) || '';
// Probably should grab the netloc from regexp
// and then parse again for hostname/port
o.netloc = parts[3];
if (parts[4]) {
o.netloc += ':' + parts[4];
}
leftover = parts[5];
} else {
o.scheme = default_scheme || '';
o.netloc = '';
o.hostname = '';
leftover = url;
}
o.scheme = o.scheme.toLowerCase();
parts = leftover.match(parse_leftovers);
o.path = parts[1] || '';
o.query = parts[2] || '';
if (allow_fragments) {
o.fragment = parts[3] || '';
} else {
o.fragment = '';
}
return o;
};
urlparse.urlunsplit = function(o) {
var s = '';
if (o.scheme) {
s += o.scheme + '://';
}
if (o.netloc) {
if (s == '') {
s += '//';
}
s += o.netloc;
} else if (o.hostname) {
// extension. Python only uses netloc
if (s == '') {
s += '//';
}
s += o.hostname;
if (o.port) {
s += ':' + o.port;
}
}
if (o.path) {
s += o.path;
}
if (o.query) {
s += '?' + o.query;
}
if (o.fragment) {
s += '#' + o.fragment;
}
return s;
};
urlparse.urljoin = function(base, url, allow_fragments)
{
if (typeof allow_fragments === 'undefined') {
allow_fragments = true;
}
var url_parts = urlparse.urlsplit(url);
// if url parts has a scheme (i.e. absolute)
// then nothing to do
if (url_parts.scheme) {
if (! allow_fragments) {
return url;
} else {
return urlparse.urldefrag(url)[0];
}
}
var base_parts = urlparse.urlsplit(base);
// copy base, only if not present
if (!base_parts.scheme) {
base_parts.scheme = url_parts.scheme;
}
// copy netloc, only if not present
if (!base_parts.netloc || !base_parts.hostname) {
base_parts.netloc = url_parts.netloc;
base_parts.hostname = url_parts.hostname;
base_parts.port = url_parts.port;
}
// paths
if (url_parts.path.length > 0) {
if (url_parts.path.charAt(0) == '/') {
base_parts.path = url_parts.path;
} else {
// relative path.. get rid of "current filename" and
// replace. Same as var parts =
// base_parts.path.split('/'); parts[parts.length-1] =
// url_parts.path; base_parts.path = parts.join('/');
var idx = base_parts.path.lastIndexOf('/');
if (idx == -1) {
base_parts.path = url_parts.path;
} else {
base_parts.path = base_parts.path.substr(0,idx) + '/' +
url_parts.path;
}
}
}
// clean up path
base_parts.path = urlparse.normalizepath(base_parts.path);
// copy query string
base_parts.query = url_parts.query;
// copy fragments
if (allow_fragments) {
base_parts.fragment = url_parts.fragment;
} else {
base_parts.fragment = '';
}
return urlparse.urlunsplit(base_parts);
};
/**
* getcwd - named after posix call of same name (see 'man 2 getcwd')
*
*/
Envjs.getcwd = function() {
return '.';
};
/**
* resolves location relative to doc location
*
* @param {Object} path Relative or absolute URL
* @param {Object} base (semi-optional) The base url used in resolving "path" above
*/
Envjs.uri = function(path, base) {
//console.log('constructing uri from path %s and base %s', path, base);
// Semi-common trick is to make an iframe with src='javascript:false'
// (or some equivalent). By returning '', the load is skipped
if (path.indexOf('javascript') === 0) {
return '';
}
// if path is absolute, then just normalize and return
if (path.match('^[a-zA-Z]+://')) {
return urlparse.urlnormalize(path);
}
// interesting special case, a few very large websites use
// '//foo/bar/' to mean 'http://foo/bar'
if (path.match('^//')) {
path = 'http:' + path;
}
// if base not passed in, try to get it from document
// Ideally I would like the caller to pass in document.baseURI to
// make this more self-sufficient and testable
if (!base && document) {
base = document.baseURI;
}
// about:blank doesn't count
if (base === 'about:blank'){
base = '';
}
// if base is still empty, then we are in QA mode loading local
// files. Get current working directory
if (!base) {
base = 'file://' + Envjs.getcwd() + '/';
}
// handles all cases if path is abosulte or relative to base
// 3rd arg is "false" --> remove fragments
var newurl = urlparse.urlnormalize(urlparse.urljoin(base, path, false));
return newurl;
};
/**
* Used in the XMLHttpRquest implementation to run a
* request in a seperate thread
* @param {Object} fn
*/
Envjs.runAsync = function(fn){};
/**
* Used to write to a local file
* @param {Object} text
* @param {Object} url
*/
Envjs.writeToFile = function(text, url){};
/**
* Used to write to a local file
* @param {Object} text
* @param {Object} suffix
*/
Envjs.writeToTempFile = function(text, suffix){};
/**
* Used to read the contents of a local file
* @param {Object} url
*/
Envjs.readFromFile = function(url){};
/**
* Used to delete a local file
* @param {Object} url
*/
Envjs.deleteFile = function(url){};
/**
* establishes connection and calls responsehandler
* @param {Object} xhr
* @param {Object} responseHandler
* @param {Object} data
*/
Envjs.connection = function(xhr, responseHandler, data){};
__extend__(Envjs, urlparse);
/**
* Makes an object window-like by proxying object accessors
* @param {Object} scope
* @param {Object} parent
*/
Envjs.proxy = function(scope, parent, aliasList){};
Envjs.javaEnabled = false;
Envjs.homedir = '';
Envjs.tmpdir = '';
Envjs.os_name = '';
Envjs.os_arch = '';
Envjs.os_version = '';
Envjs.lang = '';
Envjs.platform = '';
/**
*
* @param {Object} frameElement
* @param {Object} url
*/
Envjs.loadFrame = function(frame, url){
try {
if(frame.contentWindow){
//mark for garbage collection
frame.contentWindow = null;
}
//create a new scope for the window proxy
//platforms will need to override this function
//to make sure the scope is global-like
frame.contentWindow = (function(){return this;})();
new Window(frame.contentWindow, window);
//I dont think frames load asynchronously in firefox
//and I think the tests have verified this but for
//some reason I'm less than confident... Are there cases?
frame.contentDocument = frame.contentWindow.document;
frame.contentDocument.async = false;
if(url){
//console.log('envjs.loadFrame async %s', frame.contentDocument.async);
frame.contentWindow.location = url;
}
} catch(e) {
console.log("failed to load frame content: from %s %s", url, e);
}
};
// The following are in rhino/window.js
// TODO: Envjs.unloadFrame
// TODO: Envjs.proxy
/**
* @author john resig & the envjs team
* @uri http://www.envjs.com/
* @copyright 2008-2010
* @license MIT
*/
//CLOSURE_END
}());
/*
* Envjs rhino-env.1.2.13
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*/
var __context__ = Packages.org.mozilla.javascript.Context.getCurrentContext();
Envjs.platform = "Rhino";
Envjs.revision = "1.7.0.rc2";
/*
* Envjs rhino-env.1.2.13
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*/
//CLOSURE_START
(function(){
/**
* @author john resig
*/
// Helper method for extending one object with another.
function __extend__(a,b) {
for ( var i in b ) {
var g = b.__lookupGetter__(i), s = b.__lookupSetter__(i);
if ( g || s ) {
if ( g ) { a.__defineGetter__(i, g); }
if ( s ) { a.__defineSetter__(i, s); }
} else {
a[i] = b[i];
}
} return a;
}
/**
* Writes message to system out.
*
* Some sites redefine 'print' as in 'window.print', so instead of
* printing to stdout, you are popping open a new window, which might
* call print, etc, etc,etc This can cause infinite loops and can
* exhausing all memory.
*
* By defining this upfront now, Envjs.log will always call the native 'print'
* function
*
* @param {Object} message
*/
Envjs.log = print;
Envjs.lineSource = function(e){
return e&&e.rhinoException?e.rhinoException.lineSource():"(line ?)";
};
/**
* load and execute script tag text content
* @param {Object} script
*/
Envjs.loadInlineScript = function(script){
if(script.ownerDocument.ownerWindow){
Envjs.eval(
script.ownerDocument.ownerWindow,
script.text,
'eval('+script.text.substring(0,16)+'...):'+new Date().getTime()
);
}else{
Envjs.eval(
__this__,
script.text,
'eval('+script.text.substring(0,16)+'...):'+new Date().getTime()
);
}
//console.log('evaluated at scope %s \n%s',
// script.ownerDocument.ownerWindow.guid, script.text);
};
Envjs.eval = function(context, source, name){
__context__.evaluateString(
context,
source,
name,
0,
null
);
};
//Temporary patch for parser module
Packages.org.mozilla.javascript.Context.
getCurrentContext().setOptimizationLevel(-1);
/**
* Rhino provides a very succinct 'sync'
* @param {Function} fn
*/
try{
Envjs.sync = sync;
Envjs.spawn = spawn;
} catch(e){
//sync unavailable on AppEngine
Envjs.sync = function(fn){
//console.log('Threadless platform, sync is safe');
return fn;
};
Envjs.spawn = function(fn){
//console.log('Threadless platform, spawn shares main thread.');
return fn();
};
}
/**
* sleep thread for specified duration
* @param {Object} millseconds
*/
Envjs.sleep = function(millseconds){
try{
java.lang.Thread.currentThread().sleep(millseconds);
}catch(e){
console.log('Threadless platform, cannot sleep.');
}
};
/**
* provides callback hook for when the system exits
*/
Envjs.onExit = function(callback){
var rhino = Packages.org.mozilla.javascript,
contextFactory = __context__.getFactory(),
listener = new rhino.ContextFactory.Listener({
contextReleased: function(context){
if(context === __context__)
console.log('context released', context);
contextFactory.removeListener(this);
if(callback)
callback();
}
});
contextFactory.addListener(listener);
};
/**
* Get 'Current Working Directory'
*/
Envjs.getcwd = function() {
return java.lang.System.getProperty('user.dir');
}
/**
*
* @param {Object} fn
* @param {Object} onInterupt
*/
Envjs.runAsync = function(fn, onInterupt){
////Envjs.debug("running async");
var running = true,
run;
try{
run = Envjs.sync(function(){
fn();
Envjs.wait();
});
Envjs.spawn(run);
}catch(e){
console.log("error while running async operation", e);
try{if(onInterrupt)onInterrupt(e)}catch(ee){};
}
};
/**
* Used to write to a local file
* @param {Object} text
* @param {Object} url
*/
Envjs.writeToFile = function(text, url){
//Envjs.debug("writing text to url : " + url);
var out = new java.io.FileWriter(
new java.io.File(
new java.net.URI(url.toString())));
out.write( text, 0, text.length );
out.flush();
out.close();
};
/**
* Used to write to a local file
* @param {Object} text
* @param {Object} suffix
*/
Envjs.writeToTempFile = function(text, suffix){
//Envjs.debug("writing text to temp url : " + suffix);
// Create temp file.
var temp = java.io.File.createTempFile("envjs-tmp", suffix);
// Delete temp file when program exits.
temp.deleteOnExit();
// Write to temp file
var out = new java.io.FileWriter(temp);
out.write(text, 0, text.length);
out.close();
return temp.getAbsolutePath().toString()+'';
};
/**
* Used to read the contents of a local file
* @param {Object} url
*/
Envjs.readFromFile = function( url ){
var fileReader = new java.io.FileReader(
new java.io.File(
new java.net.URI( url )));
var stringwriter = new java.io.StringWriter(),
buffer = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 1024),
length;
while ((length = fileReader.read(buffer, 0, 1024)) != -1) {
stringwriter.write(buffer, 0, length);
}
stringwriter.close();
return stringwriter.toString()+"";
};
/**
* Used to delete a local file
* @param {Object} url
*/
Envjs.deleteFile = function(url){
var file = new java.io.File( new java.net.URI( url ) );
file["delete"]();
};
/**
* establishes connection and calls responsehandler
* @param {Object} xhr
* @param {Object} responseHandler
* @param {Object} data
*/
Envjs.connection = function(xhr, responseHandler, data){
var url = java.net.URL(xhr.url),
connection,
header,
outstream,
buffer,
length,
binary = false,
name, value,
contentEncoding,
instream,
responseXML,
i;
if ( /^file\:/.test(url) ) {
try{
if ( "PUT" == xhr.method || "POST" == xhr.method ) {
data = data || "" ;
Envjs.writeToFile(data, url);
xhr.readyState = 4;
//could be improved, I just cant recall the correct http codes
xhr.status = 200;
xhr.statusText = "";
} else if ( xhr.method == "DELETE" ) {
Envjs.deleteFile(url);
xhr.readyState = 4;
//could be improved, I just cant recall the correct http codes
xhr.status = 200;
xhr.statusText = "";
} else {
connection = url.openConnection();
connection.connect();
//try to add some canned headers that make sense
try{
if(xhr.url.match(/html$/)){
xhr.responseHeaders["Content-Type"] = 'text/html';
}else if(xhr.url.match(/.xml$/)){
xhr.responseHeaders["Content-Type"] = 'text/xml';
}else if(xhr.url.match(/.js$/)){
xhr.responseHeaders["Content-Type"] = 'text/javascript';
}else if(xhr.url.match(/.json$/)){
xhr.responseHeaders["Content-Type"] = 'application/json';
}else{
xhr.responseHeaders["Content-Type"] = 'text/plain';
}
//xhr.responseHeaders['Last-Modified'] = connection.getLastModified();
//xhr.responseHeaders['Content-Length'] = headerValue+'';
//xhr.responseHeaders['Date'] = new Date()+'';*/
}catch(e){
console.log('failed to load response headers',e);
}
}
}catch(e){
console.log('failed to open file %s %s', url, e);
connection = null;
xhr.readyState = 4;
xhr.statusText = "Local File Protocol Error";
xhr.responseText = "<html><head/><body><p>"+ e+ "</p></body></html>";
}
} else {
connection = url.openConnection();
connection.setRequestMethod( xhr.method );
// Add headers to Java connection
for (header in xhr.headers){
connection.addRequestProperty(header+'', xhr.headers[header]+'');
}
//write data to output stream if required
if(data){
if(data instanceof Document){
if ( xhr.method == "PUT" || xhr.method == "POST" ) {
connection.setDoOutput(true);
outstream = connection.getOutputStream(),
xml = (new XMLSerializer()).serializeToString(data);
buffer = new java.lang.String(xml).getBytes('UTF-8');
outstream.write(buffer, 0, buffer.length);
outstream.close();
}
}else if(data.length&&data.length>0){
if ( xhr.method == "PUT" || xhr.method == "POST" ) {
connection.setDoOutput(true);
outstream = connection.getOutputStream();
buffer = new java.lang.String(data).getBytes('UTF-8');
outstream.write(buffer, 0, buffer.length);
outstream.close();
}
}
connection.connect();
}else{
connection.connect();
}
}
if(connection){
try{
length = connection.getHeaderFields().size();
// Stick the response headers into responseHeaders
for (i = 0; i < length; i++) {
name = connection.getHeaderFieldKey(i);
value = connection.getHeaderField(i);
if (name)
xhr.responseHeaders[name+''] = value+'';
}
}catch(e){
console.log('failed to load response headers \n%s',e);
}
xhr.readyState = 4;
xhr.status = parseInt(connection.responseCode,10) || undefined;
xhr.statusText = connection.responseMessage || "";
contentEncoding = connection.getContentEncoding() || "utf-8";
instream = null;
responseXML = null;
try{
//console.log('contentEncoding %s', contentEncoding);
if( contentEncoding.equalsIgnoreCase("gzip") ||
contentEncoding.equalsIgnoreCase("decompress")){
//zipped content
binary = true;
outstream = new java.io.ByteArrayOutputStream();
buffer = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024);
instream = new java.util.zip.GZIPInputStream(connection.getInputStream())
}else{
//this is a text file
outstream = new java.io.StringWriter();
buffer = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 1024);
instream = new java.io.InputStreamReader(connection.getInputStream());
}
}catch(e){
if (connection.getResponseCode() == 404){
console.log('failed to open connection stream \n %s %s',
e.toString(), e);
}else{
console.log('failed to open connection stream \n %s %s',
e.toString(), e);
}
instream = connection.getErrorStream();
}
while ((length = instream.read(buffer, 0, 1024)) != -1) {
outstream.write(buffer, 0, length);
}
outstream.close();
instream.close();
if(binary){
xhr.responseText = new String(outstream.toByteArray(), 'UTF-8') + '';
}else{
xhr.responseText = outstream.toString() + '';
}
}
if(responseHandler){
//Envjs.debug('calling ajax response handler');
responseHandler();
}
};
//Since we're running in rhino I guess we can safely assume
//java is 'enabled'. I'm sure this requires more thought
//than I've given it here
Envjs.javaEnabled = true;
Envjs.homedir = java.lang.System.getProperty("user.home");
Envjs.tmpdir = java.lang.System.getProperty("java.io.tmpdir");
Envjs.os_name = java.lang.System.getProperty("os.name");
Envjs.os_arch = java.lang.System.getProperty("os.arch");
Envjs.os_version = java.lang.System.getProperty("os.version");
Envjs.lang = java.lang.System.getProperty("user.lang");
/**
*
* @param {Object} frameElement
* @param {Object} url
*/
Envjs.loadFrame = function(frame, url){
try {
if(frame.contentWindow){
//mark for garbage collection
frame.contentWindow = null;
}
//create a new scope for the window proxy
frame.contentWindow = Envjs.proxy();
new Window(frame.contentWindow, window);
//I dont think frames load asynchronously in firefox
//and I think the tests have verified this but for
//some reason I'm less than confident... Are there cases?
frame.contentDocument = frame.contentWindow.document;
frame.contentDocument.async = false;
if(url){
//console.log('envjs.loadFrame async %s', frame.contentDocument.async);
frame.contentWindow.location = url;
}
} catch(e) {
console.log("failed to load frame content: from %s %s", url, e);
}
};
/**
* unloadFrame
* @param {Object} frame
*/
Envjs.unloadFrame = function(frame){
var all, length, i;
try{
//TODO: probably self-referencing structures within a document tree
//preventing it from being entirely garbage collected once orphaned.
//Should have code to walk tree and break all links between contained
//objects.
frame.contentDocument = null;
if(frame.contentWindow){
frame.contentWindow.close();
}
gc();
}catch(e){
console.log(e);
}
};
/**
* Makes an object window-like by proxying object accessors
* @param {Object} scope
* @param {Object} parent
*/
Envjs.proxy = function(scope, parent) {
try{
if(scope+'' == '[object global]'){
return scope
}else{
return __context__.initStandardObjects();
}
}catch(e){
console.log('failed to init standard objects %s %s \n%s', scope, parent, e);
}
};
/**
* @author john resig & the envjs team
* @uri http://www.envjs.com/
* @copyright 2008-2010
* @license MIT
*/
//CLOSURE_END
}());
/**
* @author envjs team
*/
var Console,
console;
/*
* Envjs console.1.2.13
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*/
//CLOSURE_START
(function(){
/**
* @author envjs team
* borrowed 99%-ish with love from firebug-lite
*
* http://wiki.commonjs.org/wiki/Console
*/
Console = function(module){
var $level,
$logger,
$null = function(){};
if(Envjs[module] && Envjs[module].loglevel){
$level = Envjs.module.loglevel;
$logger = {
log: function(level){
logFormatted(arguments, (module)+" ");
},
debug: $level>1 ? $null: function() {
logFormatted(arguments, (module)+" debug");
},
info: $level>2 ? $null:function(){
logFormatted(arguments, (module)+" info");
},
warn: $level>3 ? $null:function(){
logFormatted(arguments, (module)+" warning");
},
error: $level>4 ? $null:function(){
logFormatted(arguments, (module)+" error");
}
};
} else {
$logger = {
log: function(level){
logFormatted(arguments, "");
},
debug: $null,
info: $null,
warn: $null,
error: $null
};
}
return $logger;
};
console = new Console("console",1);
function logFormatted(objects, className)
{
var html = [];
var format = objects[0];
var objIndex = 0;
if (typeof(format) != "string")
{
format = "";
objIndex = -1;
}
var parts = parseFormat(format);
for (var i = 0; i < parts.length; ++i)
{
var part = parts[i];
if (part && typeof(part) == "object")
{
var object = objects[++objIndex];
part.appender(object, html);
}
else {
appendText(part, html);
}
}
for (var i = objIndex+1; i < objects.length; ++i)
{
appendText(" ", html);
var object = objects[i];
if (typeof(object) == "string") {
appendText(object, html);
} else {
appendObject(object, html);
}
}
Envjs.log(html.join(' '));
}
function parseFormat(format)
{
var parts = [];
var reg = /((^%|[^\\]%)(\d+)?(\.)([a-zA-Z]))|((^%|[^\\]%)([a-zA-Z]))/;
var appenderMap = {s: appendText, d: appendInteger, i: appendInteger, f: appendFloat};
for (var m = reg.exec(format); m; m = reg.exec(format))
{
var type = m[8] ? m[8] : m[5];
var appender = type in appenderMap ? appenderMap[type] : appendObject;
var precision = m[3] ? parseInt(m[3]) : (m[4] == "." ? -1 : 0);
parts.push(format.substr(0, m[0][0] == "%" ? m.index : m.index+1));
parts.push({appender: appender, precision: precision});
format = format.substr(m.index+m[0].length);
}
parts.push(format);
return parts;
}
function escapeHTML(value)
{
return value;
}
function objectToString(object)
{
try
{
return object+"";
}
catch (exc)
{
return null;
}
}
// ********************************************************************************************
function appendText(object, html)
{
html.push(escapeHTML(objectToString(object)));
}
function appendNull(object, html)
{
html.push(escapeHTML(objectToString(object)));
}
function appendString(object, html)
{
html.push(escapeHTML(objectToString(object)));
}
function appendInteger(object, html)
{
html.push(escapeHTML(objectToString(object)));
}
function appendFloat(object, html)
{
html.push(escapeHTML(objectToString(object)));
}
function appendFunction(object, html)
{
var reName = /function ?(.*?)\(/;
var m = reName.exec(objectToString(object));
var name = m ? m[1] : "function";
html.push(escapeHTML(name));
}
function appendObject(object, html)
{
try
{
if (object == undefined) {
appendNull("undefined", html);
} else if (object == null) {
appendNull("null", html);
} else if (typeof object == "string") {
appendString(object, html);
} else if (typeof object == "number") {
appendInteger(object, html);
} else if (typeof object == "function") {
appendFunction(object, html);
} else if (object.nodeType == 1) {
appendSelector(object, html);
} else if (typeof object == "object") {
appendObjectFormatted(object, html);
} else {
appendText(object, html);
}
}
catch (exc)
{
}
}
function appendObjectFormatted(object, html)
{
var text = objectToString(object);
var reObject = /\[object (.*?)\]/;
var m = reObject.exec(text);
html.push( m ? m[1] : text);
}
function appendSelector(object, html)
{
html.push(escapeHTML(object.nodeName.toLowerCase()));
if (object.id) {
html.push(escapeHTML(object.id));
}
if (object.className) {
html.push(escapeHTML(object.className));
}
}
function appendNode(node, html)
{
if (node.nodeType == 1)
{
html.push( node.nodeName.toLowerCase());
for (var i = 0; i < node.attributes.length; ++i)
{
var attr = node.attributes[i];
if (!attr.specified) {
continue;
}
html.push( attr.nodeName.toLowerCase(),escapeHTML(attr.nodeValue));
}
if (node.firstChild)
{
for (var child = node.firstChild; child; child = child.nextSibling) {
appendNode(child, html);
}
html.push( node.nodeName.toLowerCase());
}
}
else if (node.nodeType === 3)
{
html.push(escapeHTML(node.nodeValue));
}
};
/**
* @author john resig & the envjs team
* @uri http://www.envjs.com/
* @copyright 2008-2010
* @license MIT
*/
//CLOSURE_END
}());
/*
* Envjs dom.1.2.13
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*
* Parts of the implementation were originally written by:\
* and Jon van Noort (jon@webarcana.com.au) \
* and David Joham (djoham@yahoo.com)",\
* and Scott Severtson
*
* This file simply provides the global definitions we need to \
* be able to correctly implement to core browser DOM interfaces."
*/
var Attr,
CDATASection,
CharacterData,
Comment,
Document,
DocumentFragment,
DocumentType,
DOMException,
DOMImplementation,
Element,
Entity,
EntityReference,
NamedNodeMap,
Namespace,
Node,
NodeList,
Notation,
ProcessingInstruction,
Text,
Range,
XMLSerializer,
DOMParser;
/*
* Envjs dom.1.2.13
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*/
//CLOSURE_START
(function(){
/**
* @author john resig
*/
// Helper method for extending one object with another.
function __extend__(a,b) {
for ( var i in b ) {
var g = b.__lookupGetter__(i), s = b.__lookupSetter__(i);
if ( g || s ) {
if ( g ) { a.__defineGetter__(i, g); }
if ( s ) { a.__defineSetter__(i, s); }
} else {
a[i] = b[i];
}
} return a;
}
/**
* @author john resig
*/
//from jQuery
function __setArray__( target, array ) {
// Resetting the length to 0, then using the native Array push
// is a super-fast way to populate an object with array-like properties
target.length = 0;
Array.prototype.push.apply( target, array );
}
/**
* @class NodeList -
* provides the abstraction of an ordered collection of nodes
*
* @param ownerDocument : Document - the ownerDocument
* @param parentNode : Node - the node that the NodeList is attached to (or null)
*/
NodeList = function(ownerDocument, parentNode) {
this.length = 0;
this.parentNode = parentNode;
this.ownerDocument = ownerDocument;
this._readonly = false;
__setArray__(this, []);
};
__extend__(NodeList.prototype, {
item : function(index) {
var ret = null;
if ((index >= 0) && (index < this.length)) {
// bounds check
ret = this[index];
}
// if the index is out of bounds, default value null is returned
return ret;
},
get xml() {
var ret = "",
i;
// create string containing the concatenation of the string values of each child
for (i=0; i < this.length; i++) {
if(this[i]){
if(this[i].nodeType == Node.TEXT_NODE && i>0 &&
this[i-1].nodeType == Node.TEXT_NODE){
//add a single space between adjacent text nodes
ret += " "+this[i].xml;
}else{
ret += this[i].xml;
}
}
}
return ret;
},
toArray: function () {
var children = [],
i;
for ( i=0; i < this.length; i++) {
children.push (this[i]);
}
return children;
},
toString: function(){
return "[object NodeList]";
}
});
/**
* @method __findItemIndex__
* find the item index of the node
* @author Jon van Noort (jon@webarcana.com.au)
* @param node : Node
* @return : int
*/
var __findItemIndex__ = function (nodelist, node) {
var ret = -1, i;
for (i=0; i<nodelist.length; i++) {
// compare id to each node's _id
if (nodelist[i] === node) {
// found it!
ret = i;
break;
}
}
// if node is not found, default value -1 is returned
return ret;
};
/**
* @method __insertBefore__
* insert the specified Node into the NodeList before the specified index
* Used by Node.insertBefore(). Note: Node.insertBefore() is responsible
* for Node Pointer surgery __insertBefore__ simply modifies the internal
* data structure (Array).
* @param newChild : Node - the Node to be inserted
* @param refChildIndex : int - the array index to insert the Node before
*/
var __insertBefore__ = function(nodelist, newChild, refChildIndex) {
if ((refChildIndex >= 0) && (refChildIndex <= nodelist.length)) {
// bounds check
if (newChild.nodeType == Node.DOCUMENT_FRAGMENT_NODE) {
// node is a DocumentFragment
// append the children of DocumentFragment
Array.prototype.splice.apply(nodelist,
[refChildIndex, 0].concat(newChild.childNodes.toArray()));
}
else {
// append the newChild
Array.prototype.splice.apply(nodelist,[refChildIndex, 0, newChild]);
}
}
};
/**
* @method __replaceChild__
* replace the specified Node in the NodeList at the specified index
* Used by Node.replaceChild(). Note: Node.replaceChild() is responsible
* for Node Pointer surgery __replaceChild__ simply modifies the internal
* data structure (Array).
*
* @param newChild : Node - the Node to be inserted
* @param refChildIndex : int - the array index to hold the Node
*/
var __replaceChild__ = function(nodelist, newChild, refChildIndex) {
var ret = null;
// bounds check
if ((refChildIndex >= 0) && (refChildIndex < nodelist.length)) {
// preserve old child for return
ret = nodelist[refChildIndex];
if (newChild.nodeType == Node.DOCUMENT_FRAGMENT_NODE) {
// node is a DocumentFragment
// get array containing children prior to refChild
Array.prototype.splice.apply(nodelist,
[refChildIndex, 1].concat(newChild.childNodes.toArray()));
}
else {
// simply replace node in array (links between Nodes are
// made at higher level)
nodelist[refChildIndex] = newChild;
}
}
// return replaced node
return ret;
};
/**
* @method __removeChild__
* remove the specified Node in the NodeList at the specified index
* Used by Node.removeChild(). Note: Node.removeChild() is responsible
* for Node Pointer surgery __removeChild__ simply modifies the internal
* data structure (Array).
* @param refChildIndex : int - the array index holding the Node to be removed
*/
var __removeChild__ = function(nodelist, refChildIndex) {
var ret = null;
if (refChildIndex > -1) {
// found it!
// return removed node
ret = nodelist[refChildIndex];
// rebuild array without removed child
Array.prototype.splice.apply(nodelist,[refChildIndex, 1]);
}
// return removed node
return ret;
};
/**
* @method __appendChild__
* append the specified Node to the NodeList. Used by Node.appendChild().
* Note: Node.appendChild() is responsible for Node Pointer surgery
* __appendChild__ simply modifies the internal data structure (Array).
* @param newChild : Node - the Node to be inserted
*/
var __appendChild__ = function(nodelist, newChild) {
if (newChild.nodeType == Node.DOCUMENT_FRAGMENT_NODE) {
// node is a DocumentFragment
// append the children of DocumentFragment
Array.prototype.push.apply(nodelist, newChild.childNodes.toArray() );
} else {
// simply add node to array (links between Nodes are made at higher level)
Array.prototype.push.apply(nodelist, [newChild]);
}
};
/**
* @method __cloneNodes__ -
* Returns a NodeList containing clones of the Nodes in this NodeList
* @param deep : boolean -
* If true, recursively clone the subtree under each of the nodes;
* if false, clone only the nodes themselves (and their attributes,
* if it is an Element).
* @param parentNode : Node - the new parent of the cloned NodeList
* @return : NodeList - NodeList containing clones of the Nodes in this NodeList
*/
var __cloneNodes__ = function(nodelist, deep, parentNode) {
var cloneNodeList = new NodeList(nodelist.ownerDocument, parentNode);
// create list containing clones of each child
for (var i=0; i < nodelist.length; i++) {
__appendChild__(cloneNodeList, nodelist[i].cloneNode(deep));
}
return cloneNodeList;
};
var __ownerDocument__ = function(node){
return (node.nodeType == Node.DOCUMENT_NODE)?node:node.ownerDocument;
};
/**
* @class Node -
* The Node interface is the primary datatype for the entire
* Document Object Model. It represents a single node in the
* document tree.
* @param ownerDocument : Document - The Document object associated with this node.
*/
Node = function(ownerDocument) {
this.baseURI = 'about:blank';
this.namespaceURI = null;
this.nodeName = "";
this.nodeValue = null;
// A NodeList that contains all children of this node. If there are no
// children, this is a NodeList containing no nodes. The content of the
// returned NodeList is "live" in the sense that, for instance, changes to
// the children of the node object that it was created from are immediately
// reflected in the nodes returned by the NodeList accessors; it is not a
// static snapshot of the content of the node. This is true for every
// NodeList, including the ones returned by the getElementsByTagName method.
this.childNodes = new NodeList(ownerDocument, this);
// The first child of this node. If there is no such node, this is null
this.firstChild = null;
// The last child of this node. If there is no such node, this is null.
this.lastChild = null;
// The node immediately preceding this node. If there is no such node,
// this is null.
this.previousSibling = null;
// The node immediately following this node. If there is no such node,
// this is null.
this.nextSibling = null;
this.attributes = null;
// The namespaces in scope for this node
this._namespaces = new NamespaceNodeMap(ownerDocument, this);
this._readonly = false;
//IMPORTANT: These must come last so rhino will not iterate parent
// properties before child properties. (qunit.equiv issue)
// The parent of this node. All nodes, except Document, DocumentFragment,
// and Attr may have a parent. However, if a node has just been created
// and not yet added to the tree, or if it has been removed from the tree,
// this is null
this.parentNode = null;
// The Document object associated with this node
this.ownerDocument = ownerDocument;
};
// nodeType constants
Node.ELEMENT_NODE = 1;
Node.ATTRIBUTE_NODE = 2;
Node.TEXT_NODE = 3;
Node.CDATA_SECTION_NODE = 4;
Node.ENTITY_REFERENCE_NODE = 5;
Node.ENTITY_NODE = 6;
Node.PROCESSING_INSTRUCTION_NODE = 7;
Node.COMMENT_NODE = 8;
Node.DOCUMENT_NODE = 9;
Node.DOCUMENT_TYPE_NODE = 10;
Node.DOCUMENT_FRAGMENT_NODE = 11;
Node.NOTATION_NODE = 12;
Node.NAMESPACE_NODE = 13;
Node.DOCUMENT_POSITION_EQUAL = 0x00;
Node.DOCUMENT_POSITION_DISCONNECTED = 0x01;
Node.DOCUMENT_POSITION_PRECEDING = 0x02;
Node.DOCUMENT_POSITION_FOLLOWING = 0x04;
Node.DOCUMENT_POSITION_CONTAINS = 0x08;
Node.DOCUMENT_POSITION_CONTAINED_BY = 0x10;
Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
__extend__(Node.prototype, {
get localName(){
return this.prefix?
this.nodeName.substring(this.prefix.length+1, this.nodeName.length):
this.nodeName;
},
get prefix(){
return this.nodeName.split(':').length>1?
this.nodeName.split(':')[0]:
null;
},
set prefix(value){
if(value === null){
this.nodeName = this.localName;
}else{
this.nodeName = value+':'+this.localName;
}
},
hasAttributes : function() {
if (this.attributes.length == 0) {
return false;
}else{
return true;
}
},
get textContent(){
return __recursivelyGatherText__(this);
},
set textContent(newText){
while(this.firstChild != null){
this.removeChild( this.firstChild );
}
var text = this.ownerDocument.createTextNode(newText);
this.appendChild(text);
},
insertBefore : function(newChild, refChild) {
var prevNode;
if(newChild==null){
return newChild;
}
if(refChild==null){
this.appendChild(newChild);
return this.newChild;
}
// test for exceptions
if (__ownerDocument__(this).implementation.errorChecking) {
// throw Exception if Node is readonly
if (this._readonly) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
// throw Exception if newChild was not created by this Document
if (__ownerDocument__(this) != __ownerDocument__(newChild)) {
throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR));
}
// throw Exception if the node is an ancestor
if (__isAncestor__(this, newChild)) {
throw(new DOMException(DOMException.HIERARCHY_REQUEST_ERR));
}
}
// if refChild is specified, insert before it
if (refChild) {
// find index of refChild
var itemIndex = __findItemIndex__(this.childNodes, refChild);
// throw Exception if there is no child node with this id
if (__ownerDocument__(this).implementation.errorChecking && (itemIndex < 0)) {
throw(new DOMException(DOMException.NOT_FOUND_ERR));
}
// if the newChild is already in the tree,
var newChildParent = newChild.parentNode;
if (newChildParent) {
// remove it
newChildParent.removeChild(newChild);
}
// insert newChild into childNodes
__insertBefore__(this.childNodes, newChild, itemIndex);
// do node pointer surgery
prevNode = refChild.previousSibling;
// handle DocumentFragment
if (newChild.nodeType == Node.DOCUMENT_FRAGMENT_NODE) {
if (newChild.childNodes.length > 0) {
// set the parentNode of DocumentFragment's children
for (var ind = 0; ind < newChild.childNodes.length; ind++) {
newChild.childNodes[ind].parentNode = this;
}
// link refChild to last child of DocumentFragment
refChild.previousSibling = newChild.childNodes[newChild.childNodes.length-1];
}
}else {
// set the parentNode of the newChild
newChild.parentNode = this;
// link refChild to newChild
refChild.previousSibling = newChild;
}
}else {
// otherwise, append to end
prevNode = this.lastChild;
this.appendChild(newChild);
}
if (newChild.nodeType == Node.DOCUMENT_FRAGMENT_NODE) {
// do node pointer surgery for DocumentFragment
if (newChild.childNodes.length > 0) {
if (prevNode) {
prevNode.nextSibling = newChild.childNodes[0];
}else {
// this is the first child in the list
this.firstChild = newChild.childNodes[0];
}
newChild.childNodes[0].previousSibling = prevNode;
newChild.childNodes[newChild.childNodes.length-1].nextSibling = refChild;
}
}else {
// do node pointer surgery for newChild
if (prevNode) {
prevNode.nextSibling = newChild;
}else {
// this is the first child in the list
this.firstChild = newChild;
}
newChild.previousSibling = prevNode;
newChild.nextSibling = refChild;
}
return newChild;
},
replaceChild : function(newChild, oldChild) {
var ret = null;
if(newChild==null || oldChild==null){
return oldChild;
}
// test for exceptions
if (__ownerDocument__(this).implementation.errorChecking) {
// throw Exception if Node is readonly
if (this._readonly) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
// throw Exception if newChild was not created by this Document
if (__ownerDocument__(this) != __ownerDocument__(newChild)) {
throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR));
}
// throw Exception if the node is an ancestor
if (__isAncestor__(this, newChild)) {
throw(new DOMException(DOMException.HIERARCHY_REQUEST_ERR));
}
}
// get index of oldChild
var index = __findItemIndex__(this.childNodes, oldChild);
// throw Exception if there is no child node with this id
if (__ownerDocument__(this).implementation.errorChecking && (index < 0)) {
throw(new DOMException(DOMException.NOT_FOUND_ERR));
}
// if the newChild is already in the tree,
var newChildParent = newChild.parentNode;
if (newChildParent) {
// remove it
newChildParent.removeChild(newChild);
}
// add newChild to childNodes
ret = __replaceChild__(this.childNodes,newChild, index);
if (newChild.nodeType == Node.DOCUMENT_FRAGMENT_NODE) {
// do node pointer surgery for Document Fragment
if (newChild.childNodes.length > 0) {
for (var ind = 0; ind < newChild.childNodes.length; ind++) {
newChild.childNodes[ind].parentNode = this;
}
if (oldChild.previousSibling) {
oldChild.previousSibling.nextSibling = newChild.childNodes[0];
} else {
this.firstChild = newChild.childNodes[0];
}
if (oldChild.nextSibling) {
oldChild.nextSibling.previousSibling = newChild;
} else {
this.lastChild = newChild.childNodes[newChild.childNodes.length-1];
}
newChild.childNodes[0].previousSibling = oldChild.previousSibling;
newChild.childNodes[newChild.childNodes.length-1].nextSibling = oldChild.nextSibling;
}
} else {
// do node pointer surgery for newChild
newChild.parentNode = this;
if (oldChild.previousSibling) {
oldChild.previousSibling.nextSibling = newChild;
}else{
this.firstChild = newChild;
}
if (oldChild.nextSibling) {
oldChild.nextSibling.previousSibling = newChild;
}else{
this.lastChild = newChild;
}
newChild.previousSibling = oldChild.previousSibling;
newChild.nextSibling = oldChild.nextSibling;
}
return ret;
},
removeChild : function(oldChild) {
if(!oldChild){
return null;
}
// throw Exception if NamedNodeMap is readonly
if (__ownerDocument__(this).implementation.errorChecking &&
(this._readonly || oldChild._readonly)) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
// get index of oldChild
var itemIndex = __findItemIndex__(this.childNodes, oldChild);
// throw Exception if there is no child node with this id
if (__ownerDocument__(this).implementation.errorChecking && (itemIndex < 0)) {
throw(new DOMException(DOMException.NOT_FOUND_ERR));
}
// remove oldChild from childNodes
__removeChild__(this.childNodes, itemIndex);
// do node pointer surgery
oldChild.parentNode = null;
if (oldChild.previousSibling) {
oldChild.previousSibling.nextSibling = oldChild.nextSibling;
}else {
this.firstChild = oldChild.nextSibling;
}
if (oldChild.nextSibling) {
oldChild.nextSibling.previousSibling = oldChild.previousSibling;
}else {
this.lastChild = oldChild.previousSibling;
}
oldChild.previousSibling = null;
oldChild.nextSibling = null;
return oldChild;
},
appendChild : function(newChild) {
if(!newChild){
return null;
}
// test for exceptions
if (__ownerDocument__(this).implementation.errorChecking) {
// throw Exception if Node is readonly
if (this._readonly) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
// throw Exception if arg was not created by this Document
if (__ownerDocument__(this) != __ownerDocument__(this)) {
throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR));
}
// throw Exception if the node is an ancestor
if (__isAncestor__(this, newChild)) {
throw(new DOMException(DOMException.HIERARCHY_REQUEST_ERR));
}
}
// if the newChild is already in the tree,
var newChildParent = newChild.parentNode;
if (newChildParent) {
// remove it
//console.debug('removing node %s', newChild);
newChildParent.removeChild(newChild);
}
// add newChild to childNodes
__appendChild__(this.childNodes, newChild);
if (newChild.nodeType == Node.DOCUMENT_FRAGMENT_NODE) {
// do node pointer surgery for DocumentFragment
if (newChild.childNodes.length > 0) {
for (var ind = 0; ind < newChild.childNodes.length; ind++) {
newChild.childNodes[ind].parentNode = this;
}
if (this.lastChild) {
this.lastChild.nextSibling = newChild.childNodes[0];
newChild.childNodes[0].previousSibling = this.lastChild;
this.lastChild = newChild.childNodes[newChild.childNodes.length-1];
} else {
this.lastChild = newChild.childNodes[newChild.childNodes.length-1];
this.firstChild = newChild.childNodes[0];
}
}
} else {
// do node pointer surgery for newChild
newChild.parentNode = this;
if (this.lastChild) {
this.lastChild.nextSibling = newChild;
newChild.previousSibling = this.lastChild;
this.lastChild = newChild;
} else {
this.lastChild = newChild;
this.firstChild = newChild;
}
}
return newChild;
},
hasChildNodes : function() {
return (this.childNodes.length > 0);
},
cloneNode: function(deep) {
// use importNode to clone this Node
//do not throw any exceptions
try {
return __ownerDocument__(this).importNode(this, deep);
} catch (e) {
//there shouldn't be any exceptions, but if there are, return null
// may want to warn: $debug("could not clone node: "+e.code);
return null;
}
},
normalize : function() {
var i;
var inode;
var nodesToRemove = new NodeList();
if (this.nodeType == Node.ELEMENT_NODE || this.nodeType == Node.DOCUMENT_NODE) {
var adjacentTextNode = null;
// loop through all childNodes
for(i = 0; i < this.childNodes.length; i++) {
inode = this.childNodes.item(i);
if (inode.nodeType == Node.TEXT_NODE) {
// this node is a text node
if (inode.length < 1) {
// this text node is empty
// add this node to the list of nodes to be remove
__appendChild__(nodesToRemove, inode);
}else {
if (adjacentTextNode) {
// previous node was also text
adjacentTextNode.appendData(inode.data);
// merge the data in adjacent text nodes
// add this node to the list of nodes to be removed
__appendChild__(nodesToRemove, inode);
} else {
// remember this node for next cycle
adjacentTextNode = inode;
}
}
} else {
// (soon to be) previous node is not a text node
adjacentTextNode = null;
// normalize non Text childNodes
inode.normalize();
}
}
// remove redundant Text Nodes
for(i = 0; i < nodesToRemove.length; i++) {
inode = nodesToRemove.item(i);
inode.parentNode.removeChild(inode);
}
}
},
isSupported : function(feature, version) {
// use Implementation.hasFeature to determine if this feature is supported
return __ownerDocument__(this).implementation.hasFeature(feature, version);
},
getElementsByTagName : function(tagname) {
// delegate to _getElementsByTagNameRecursive
// recurse childNodes
var nodelist = new NodeList(__ownerDocument__(this));
for (var i = 0; i < this.childNodes.length; i++) {
__getElementsByTagNameRecursive__(this.childNodes.item(i),
tagname,
nodelist);
}
return nodelist;
},
getElementsByTagNameNS : function(namespaceURI, localName) {
// delegate to _getElementsByTagNameNSRecursive
return __getElementsByTagNameNSRecursive__(this, namespaceURI, localName,
new NodeList(__ownerDocument__(this)));
},
importNode : function(importedNode, deep) {
var i;
var importNode;
//there is no need to perform namespace checks since everything has already gone through them
//in order to have gotten into the DOM in the first place. The following line
//turns namespace checking off in ._isValidNamespace
__ownerDocument__(this).importing = true;
if (importedNode.nodeType == Node.ELEMENT_NODE) {
if (!__ownerDocument__(this).implementation.namespaceAware) {
// create a local Element (with the name of the importedNode)
importNode = __ownerDocument__(this).createElement(importedNode.tagName);
// create attributes matching those of the importedNode
for(i = 0; i < importedNode.attributes.length; i++) {
importNode.setAttribute(importedNode.attributes.item(i).name, importedNode.attributes.item(i).value);
}
} else {
// create a local Element (with the name & namespaceURI of the importedNode)
importNode = __ownerDocument__(this).createElementNS(importedNode.namespaceURI, importedNode.nodeName);
// create attributes matching those of the importedNode
for(i = 0; i < importedNode.attributes.length; i++) {
importNode.setAttributeNS(importedNode.attributes.item(i).namespaceURI,
importedNode.attributes.item(i).name, importedNode.attributes.item(i).value);
}
// create namespace definitions matching those of the importedNode
for(i = 0; i < importedNode._namespaces.length; i++) {
importNode._namespaces[i] = __ownerDocument__(this).createNamespace(importedNode._namespaces.item(i).localName);
importNode._namespaces[i].value = importedNode._namespaces.item(i).value;
}
}
} else if (importedNode.nodeType == Node.ATTRIBUTE_NODE) {
if (!__ownerDocument__(this).implementation.namespaceAware) {
// create a local Attribute (with the name of the importedAttribute)
importNode = __ownerDocument__(this).createAttribute(importedNode.name);
} else {
// create a local Attribute (with the name & namespaceURI of the importedAttribute)
importNode = __ownerDocument__(this).createAttributeNS(importedNode.namespaceURI, importedNode.nodeName);
// create namespace definitions matching those of the importedAttribute
for(i = 0; i < importedNode._namespaces.length; i++) {
importNode._namespaces[i] = __ownerDocument__(this).createNamespace(importedNode._namespaces.item(i).localName);
importNode._namespaces[i].value = importedNode._namespaces.item(i).value;
}
}
// set the value of the local Attribute to match that of the importedAttribute
importNode.value = importedNode.value;
} else if (importedNode.nodeType == Node.DOCUMENT_FRAGMENT_NODE) {
// create a local DocumentFragment
importNode = __ownerDocument__(this).createDocumentFragment();
} else if (importedNode.nodeType == Node.NAMESPACE_NODE) {
// create a local NamespaceNode (with the same name & value as the importedNode)
importNode = __ownerDocument__(this).createNamespace(importedNode.nodeName);
importNode.value = importedNode.value;
} else if (importedNode.nodeType == Node.TEXT_NODE) {
// create a local TextNode (with the same data as the importedNode)
importNode = __ownerDocument__(this).createTextNode(importedNode.data);
} else if (importedNode.nodeType == Node.CDATA_SECTION_NODE) {
// create a local CDATANode (with the same data as the importedNode)
importNode = __ownerDocument__(this).createCDATASection(importedNode.data);
} else if (importedNode.nodeType == Node.PROCESSING_INSTRUCTION_NODE) {
// create a local ProcessingInstruction (with the same target & data as the importedNode)
importNode = __ownerDocument__(this).createProcessingInstruction(importedNode.target, importedNode.data);
} else if (importedNode.nodeType == Node.COMMENT_NODE) {
// create a local Comment (with the same data as the importedNode)
importNode = __ownerDocument__(this).createComment(importedNode.data);
} else { // throw Exception if nodeType is not supported
throw(new DOMException(DOMException.NOT_SUPPORTED_ERR));
}
if (deep) {
// recurse childNodes
for(i = 0; i < importedNode.childNodes.length; i++) {
importNode.appendChild(__ownerDocument__(this).importNode(importedNode.childNodes.item(i), true));
}
}
//reset importing
__ownerDocument__(this).importing = false;
return importNode;
},
contains : function(node){
while(node && node != this ){
node = node.parentNode;
}
return !!node;
},
compareDocumentPosition : function(b){
//console.log("comparing document position %s %s", this, b);
var i,
length,
a = this,
parent,
aparents,
bparents;
//handle a couple simpler case first
if(a === b) {
return Node.DOCUMENT_POSITION_EQUAL;
}
if(a.ownerDocument !== b.ownerDocument) {
return Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|
Node.DOCUMENT_POSITION_FOLLOWING|
Node.DOCUMENT_POSITION_DISCONNECTED;
}
if(a.parentNode === b.parentNode){
length = a.parentNode.childNodes.length;
for(i=0;i<length;i++){
if(a.parentNode.childNodes[i] === a){
return Node.DOCUMENT_POSITION_FOLLOWING;
}else if(a.parentNode.childNodes[i] === b){
return Node.DOCUMENT_POSITION_PRECEDING;
}
}
}
if(a.contains(b)) {
return Node.DOCUMENT_POSITION_CONTAINED_BY|
Node.DOCUMENT_POSITION_FOLLOWING;
}
if(b.contains(a)) {
return Node.DOCUMENT_POSITION_CONTAINS|
Node.DOCUMENT_POSITION_PRECEDING;
}
aparents = [];
parent = a.parentNode;
while(parent){
aparents[aparents.length] = parent;
parent = parent.parentNode;
}
bparents = [];
parent = b.parentNode;
while(parent){
i = aparents.indexOf(parent);
if(i < 0){
bparents[bparents.length] = parent;
parent = parent.parentNode;
}else{
//i cant be 0 since we already checked for equal parentNode
if(bparents.length > aparents.length){
return Node.DOCUMENT_POSITION_FOLLOWING;
}else if(bparents.length < aparents.length){
return Node.DOCUMENT_POSITION_PRECEDING;
}else{
//common ancestor diverge point
if (i === 0) {
return Node.DOCUMENT_POSITION_FOLLOWING;
} else {
parent = aparents[i-1];
}
return parent.compareDocumentPosition(bparents.pop());
}
}
}
return Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|
Node.DOCUMENT_POSITION_DISCONNECTED;
},
toString : function() {
return '[object Node]';
}
});
/**
* @method __getElementsByTagNameRecursive__ - implements getElementsByTagName()
* @param elem : Element - The element which are checking and then recursing into
* @param tagname : string - The name of the tag to match on. The special value "*" matches all tags
* @param nodeList : NodeList - The accumulating list of matching nodes
*
* @return : NodeList
*/
var __getElementsByTagNameRecursive__ = function (elem, tagname, nodeList) {
if (elem.nodeType == Node.ELEMENT_NODE || elem.nodeType == Node.DOCUMENT_NODE) {
if(elem.nodeType !== Node.DOCUMENT_NODE &&
((elem.nodeName.toUpperCase() == tagname.toUpperCase()) ||
(tagname == "*")) ){
// add matching node to nodeList
__appendChild__(nodeList, elem);
}
// recurse childNodes
for(var i = 0; i < elem.childNodes.length; i++) {
nodeList = __getElementsByTagNameRecursive__(elem.childNodes.item(i), tagname, nodeList);
}
}
return nodeList;
};
/**
* @method __getElementsByTagNameNSRecursive__
* implements getElementsByTagName()
*
* @param elem : Element - The element which are checking and then recursing into
* @param namespaceURI : string - the namespace URI of the required node
* @param localName : string - the local name of the required node
* @param nodeList : NodeList - The accumulating list of matching nodes
*
* @return : NodeList
*/
var __getElementsByTagNameNSRecursive__ = function(elem, namespaceURI, localName, nodeList) {
if (elem.nodeType == Node.ELEMENT_NODE || elem.nodeType == Node.DOCUMENT_NODE) {
if (((elem.namespaceURI == namespaceURI) || (namespaceURI == "*")) &&
((elem.localName == localName) || (localName == "*"))) {
// add matching node to nodeList
__appendChild__(nodeList, elem);
}
// recurse childNodes
for(var i = 0; i < elem.childNodes.length; i++) {
nodeList = __getElementsByTagNameNSRecursive__(
elem.childNodes.item(i), namespaceURI, localName, nodeList);
}
}
return nodeList;
};
/**
* @method __isAncestor__ - returns true if node is ancestor of target
* @param target : Node - The node we are using as context
* @param node : Node - The candidate ancestor node
* @return : boolean
*/
var __isAncestor__ = function(target, node) {
// if this node matches, return true,
// otherwise recurse up (if there is a parentNode)
return ((target == node) || ((target.parentNode) && (__isAncestor__(target.parentNode, node))));
};
var __recursivelyGatherText__ = function(aNode) {
var accumulateText = "",
idx,
node;
for (idx=0;idx < aNode.childNodes.length;idx++){
node = aNode.childNodes.item(idx);
if(node.nodeType == Node.TEXT_NODE)
accumulateText += node.data;
else
accumulateText += __recursivelyGatherText__(node);
}
return accumulateText;
};
/**
* function __escapeXML__
* @param str : string - The string to be escaped
* @return : string - The escaped string
*/
var escAmpRegEx = /&(?!(amp;|lt;|gt;|quot|apos;))/g;
var escLtRegEx = /</g;
var escGtRegEx = />/g;
var quotRegEx = /"/g;
var aposRegEx = /'/g;
function __escapeXML__(str) {
str = str.replace(escAmpRegEx, "&").
replace(escLtRegEx, "<").
replace(escGtRegEx, ">").
replace(quotRegEx, """).
replace(aposRegEx, "'");
return str;
};
/*
function __escapeHTML5__(str) {
str = str.replace(escAmpRegEx, "&").
replace(escLtRegEx, "<").
replace(escGtRegEx, ">");
return str;
};
function __escapeHTML5Atribute__(str) {
str = str.replace(escAmpRegEx, "&").
replace(escLtRegEx, "<").
replace(escGtRegEx, ">").
replace(quotRegEx, """).
replace(aposRegEx, "'");
return str;
};
*/
/**
* function __unescapeXML__
* @param str : string - The string to be unescaped
* @return : string - The unescaped string
*/
var unescAmpRegEx = /&/g;
var unescLtRegEx = /</g;
var unescGtRegEx = />/g;
var unquotRegEx = /"/g;
var unaposRegEx = /'/g;
function __unescapeXML__(str) {
str = str.replace(unescAmpRegEx, "&").
replace(unescLtRegEx, "<").
replace(unescGtRegEx, ">").
replace(unquotRegEx, "\"").
replace(unaposRegEx, "'");
return str;
};
/**
* @class NamedNodeMap -
* used to represent collections of nodes that can be accessed by name
* typically a set of Element attributes
*
* @extends NodeList -
* note W3C spec says that this is not the case, but we need an item()
* method identical to NodeList's, so why not?
* @param ownerDocument : Document - the ownerDocument
* @param parentNode : Node - the node that the NamedNodeMap is attached to (or null)
*/
NamedNodeMap = function(ownerDocument, parentNode) {
NodeList.apply(this, arguments);
__setArray__(this, []);
};
NamedNodeMap.prototype = new NodeList();
__extend__(NamedNodeMap.prototype, {
add: function(name){
this[this.length] = name;
},
getNamedItem : function(name) {
var ret = null;
//console.log('NamedNodeMap getNamedItem %s', name);
// test that Named Node exists
var itemIndex = __findNamedItemIndex__(this, name);
if (itemIndex > -1) {
// found it!
ret = this[itemIndex];
}
// if node is not found, default value null is returned
return ret;
},
setNamedItem : function(arg) {
//console.log('setNamedItem %s', arg);
// test for exceptions
if (__ownerDocument__(this).implementation.errorChecking) {
// throw Exception if arg was not created by this Document
if (this.ownerDocument != arg.ownerDocument) {
throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR));
}
// throw Exception if DOMNamedNodeMap is readonly
if (this._readonly || (this.parentNode && this.parentNode._readonly)) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
// throw Exception if arg is already an attribute of another Element object
if (arg.ownerElement && (arg.ownerElement != this.parentNode)) {
throw(new DOMException(DOMException.INUSE_ATTRIBUTE_ERR));
}
}
//console.log('setNamedItem __findNamedItemIndex__ ');
// get item index
var itemIndex = __findNamedItemIndex__(this, arg.name);
var ret = null;
//console.log('setNamedItem __findNamedItemIndex__ %s', itemIndex);
if (itemIndex > -1) { // found it!
ret = this[itemIndex]; // use existing Attribute
// throw Exception if DOMAttr is readonly
if (__ownerDocument__(this).implementation.errorChecking && ret._readonly) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
} else {
this[itemIndex] = arg; // over-write existing NamedNode
this[arg.name.toLowerCase()] = arg;
}
} else {
// add new NamedNode
//console.log('setNamedItem add new named node map (by index)');
Array.prototype.push.apply(this, [arg]);
//console.log('setNamedItem add new named node map (by name) %s %s', arg, arg.name);
this[arg.name] = arg;
//console.log('finsished setNamedItem add new named node map (by name) %s', arg.name);
}
//console.log('setNamedItem parentNode');
arg.ownerElement = this.parentNode; // update ownerElement
// return old node or new node
//console.log('setNamedItem exit');
return ret;
},
removeNamedItem : function(name) {
var ret = null;
// test for exceptions
// throw Exception if NamedNodeMap is readonly
if (__ownerDocument__(this).implementation.errorChecking &&
(this._readonly || (this.parentNode && this.parentNode._readonly))) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
// get item index
var itemIndex = __findNamedItemIndex__(this, name);
// throw Exception if there is no node named name in this map
if (__ownerDocument__(this).implementation.errorChecking && (itemIndex < 0)) {
throw(new DOMException(DOMException.NOT_FOUND_ERR));
}
// get Node
var oldNode = this[itemIndex];
//this[oldNode.name] = undefined;
// throw Exception if Node is readonly
if (__ownerDocument__(this).implementation.errorChecking && oldNode._readonly) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
// return removed node
return __removeChild__(this, itemIndex);
},
getNamedItemNS : function(namespaceURI, localName) {
var ret = null;
// test that Named Node exists
var itemIndex = __findNamedItemNSIndex__(this, namespaceURI, localName);
if (itemIndex > -1) {
// found it! return NamedNode
ret = this[itemIndex];
}
// if node is not found, default value null is returned
return ret;
},
setNamedItemNS : function(arg) {
//console.log('setNamedItemNS %s', arg);
// test for exceptions
if (__ownerDocument__(this).implementation.errorChecking) {
// throw Exception if NamedNodeMap is readonly
if (this._readonly || (this.parentNode && this.parentNode._readonly)) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
// throw Exception if arg was not created by this Document
if (__ownerDocument__(this) != __ownerDocument__(arg)) {
throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR));
}
// throw Exception if arg is already an attribute of another Element object
if (arg.ownerElement && (arg.ownerElement != this.parentNode)) {
throw(new DOMException(DOMException.INUSE_ATTRIBUTE_ERR));
}
}
// get item index
var itemIndex = __findNamedItemNSIndex__(this, arg.namespaceURI, arg.localName);
var ret = null;
if (itemIndex > -1) {
// found it!
// use existing Attribute
ret = this[itemIndex];
// throw Exception if Attr is readonly
if (__ownerDocument__(this).implementation.errorChecking && ret._readonly) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
} else {
// over-write existing NamedNode
this[itemIndex] = arg;
}
}else {
// add new NamedNode
Array.prototype.push.apply(this, [arg]);
}
arg.ownerElement = this.parentNode;
// return old node or null
return ret;
//console.log('finished setNamedItemNS %s', arg);
},
removeNamedItemNS : function(namespaceURI, localName) {
var ret = null;
// test for exceptions
// throw Exception if NamedNodeMap is readonly
if (__ownerDocument__(this).implementation.errorChecking && (this._readonly || (this.parentNode && this.parentNode._readonly))) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
// get item index
var itemIndex = __findNamedItemNSIndex__(this, namespaceURI, localName);
// throw Exception if there is no matching node in this map
if (__ownerDocument__(this).implementation.errorChecking && (itemIndex < 0)) {
throw(new DOMException(DOMException.NOT_FOUND_ERR));
}
// get Node
var oldNode = this[itemIndex];
// throw Exception if Node is readonly
if (__ownerDocument__(this).implementation.errorChecking && oldNode._readonly) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
return __removeChild__(this, itemIndex); // return removed node
},
get xml() {
var ret = "";
// create string containing concatenation of all (but last) Attribute string values (separated by spaces)
for (var i=0; i < this.length -1; i++) {
ret += this[i].xml +" ";
}
// add last Attribute to string (without trailing space)
if (this.length > 0) {
ret += this[this.length -1].xml;
}
return ret;
},
toString : function(){
return "[object NamedNodeMap]";
}
});
/**
* @method __findNamedItemIndex__
* find the item index of the node with the specified name
*
* @param name : string - the name of the required node
* @param isnsmap : if its a NamespaceNodeMap
* @return : int
*/
var __findNamedItemIndex__ = function(namednodemap, name, isnsmap) {
var ret = -1;
// loop through all nodes
for (var i=0; i<namednodemap.length; i++) {
// compare name to each node's nodeName
if(namednodemap[i].localName && name && isnsmap){
if (namednodemap[i].localName.toLowerCase() == name.toLowerCase()) {
// found it!
ret = i;
break;
}
}else{
if(namednodemap[i].name && name){
if (namednodemap[i].name.toLowerCase() == name.toLowerCase()) {
// found it!
ret = i;
break;
}
}
}
}
// if node is not found, default value -1 is returned
return ret;
};
/**
* @method __findNamedItemNSIndex__
* find the item index of the node with the specified
* namespaceURI and localName
*
* @param namespaceURI : string - the namespace URI of the required node
* @param localName : string - the local name of the required node
* @return : int
*/
var __findNamedItemNSIndex__ = function(namednodemap, namespaceURI, localName) {
var ret = -1;
// test that localName is not null
if (localName) {
// loop through all nodes
for (var i=0; i<namednodemap.length; i++) {
if(namednodemap[i].namespaceURI && namednodemap[i].localName){
// compare name to each node's namespaceURI and localName
if ((namednodemap[i].namespaceURI.toLowerCase() == namespaceURI.toLowerCase()) &&
(namednodemap[i].localName.toLowerCase() == localName.toLowerCase())) {
// found it!
ret = i;
break;
}
}
}
}
// if node is not found, default value -1 is returned
return ret;
};
/**
* @method __hasAttribute__
* Returns true if specified node exists
*
* @param name : string - the name of the required node
* @return : boolean
*/
var __hasAttribute__ = function(namednodemap, name) {
var ret = false;
// test that Named Node exists
var itemIndex = __findNamedItemIndex__(namednodemap, name);
if (itemIndex > -1) {
// found it!
ret = true;
}
// if node is not found, default value false is returned
return ret;
}
/**
* @method __hasAttributeNS__
* Returns true if specified node exists
*
* @param namespaceURI : string - the namespace URI of the required node
* @param localName : string - the local name of the required node
* @return : boolean
*/
var __hasAttributeNS__ = function(namednodemap, namespaceURI, localName) {
var ret = false;
// test that Named Node exists
var itemIndex = __findNamedItemNSIndex__(namednodemap, namespaceURI, localName);
if (itemIndex > -1) {
// found it!
ret = true;
}
// if node is not found, default value false is returned
return ret;
}
/**
* @method __cloneNamedNodes__
* Returns a NamedNodeMap containing clones of the Nodes in this NamedNodeMap
*
* @param parentNode : Node - the new parent of the cloned NodeList
* @param isnsmap : bool - is this a NamespaceNodeMap
* @return NamedNodeMap containing clones of the Nodes in this NamedNodeMap
*/
var __cloneNamedNodes__ = function(namednodemap, parentNode, isnsmap) {
var cloneNamedNodeMap = isnsmap?
new NamespaceNodeMap(namednodemap.ownerDocument, parentNode):
new NamedNodeMap(namednodemap.ownerDocument, parentNode);
// create list containing clones of all children
for (var i=0; i < namednodemap.length; i++) {
__appendChild__(cloneNamedNodeMap, namednodemap[i].cloneNode(false));
}
return cloneNamedNodeMap;
};
/**
* @class NamespaceNodeMap -
* used to represent collections of namespace nodes that can be
* accessed by name typically a set of Element attributes
*
* @extends NamedNodeMap
*
* @param ownerDocument : Document - the ownerDocument
* @param parentNode : Node - the node that the NamespaceNodeMap is attached to (or null)
*/
var NamespaceNodeMap = function(ownerDocument, parentNode) {
this.NamedNodeMap = NamedNodeMap;
this.NamedNodeMap(ownerDocument, parentNode);
__setArray__(this, []);
};
NamespaceNodeMap.prototype = new NamedNodeMap();
__extend__(NamespaceNodeMap.prototype, {
get xml() {
var ret = "",
ns,
ind;
// identify namespaces declared local to this Element (ie, not inherited)
for (ind = 0; ind < this.length; ind++) {
// if namespace declaration does not exist in the containing node's, parentNode's namespaces
ns = null;
try {
var ns = this.parentNode.parentNode._namespaces.
getNamedItem(this[ind].localName);
}catch (e) {
//breaking to prevent default namespace being inserted into return value
break;
}
if (!(ns && (""+ ns.nodeValue == ""+ this[ind].nodeValue))) {
// display the namespace declaration
ret += this[ind].xml +" ";
}
}
return ret;
}
});
/**
* @class Namespace -
* The Namespace interface represents an namespace in an Element object
*
* @param ownerDocument : The Document object associated with this node.
*/
Namespace = function(ownerDocument) {
Node.apply(this, arguments);
// the name of this attribute
this.name = "";
// If this attribute was explicitly given a value in the original document,
// this is true; otherwise, it is false.
// Note that the implementation is in charge of this attribute, not the user.
// If the user changes the value of the attribute (even if it ends up having
// the same value as the default value) then the specified flag is
// automatically flipped to true
this.specified = false;
};
Namespace.prototype = new Node();
__extend__(Namespace.prototype, {
get value(){
// the value of the attribute is returned as a string
return this.nodeValue;
},
set value(value){
this.nodeValue = value+'';
},
get nodeType(){
return Node.NAMESPACE_NODE;
},
get xml(){
var ret = "";
// serialize Namespace Declaration
if (this.nodeName != "") {
ret += this.nodeName +"=\""+ __escapeXML__(this.nodeValue) +"\"";
}
else { // handle default namespace
ret += "xmlns=\""+ __escapeXML__(this.nodeValue) +"\"";
}
return ret;
},
toString: function(){
return '[object Namespace]';
}
});
/**
* @class CharacterData - parent abstract class for Text and Comment
* @extends Node
* @param ownerDocument : The Document object associated with this node.
*/
CharacterData = function(ownerDocument) {
Node.apply(this, arguments);
};
CharacterData.prototype = new Node();
__extend__(CharacterData.prototype,{
get data(){
return this.nodeValue;
},
set data(data){
this.nodeValue = data;
},
get textContent(){
return this.nodeValue;
},
set textContent(newText){
this.nodeValue = newText;
},
get length(){return this.nodeValue.length;},
appendData: function(arg){
// throw Exception if CharacterData is readonly
if (__ownerDocument__(this).implementation.errorChecking && this._readonly) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
// append data
this.data = "" + this.data + arg;
},
deleteData: function(offset, count){
// throw Exception if CharacterData is readonly
if (__ownerDocument__(this).implementation.errorChecking && this._readonly) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
if (this.data) {
// throw Exception if offset is negative or greater than the data length,
if (__ownerDocument__(this).implementation.errorChecking &&
((offset < 0) || (offset > this.data.length) || (count < 0))) {
throw(new DOMException(DOMException.INDEX_SIZE_ERR));
}
// delete data
if(!count || (offset + count) > this.data.length) {
this.data = this.data.substring(0, offset);
}else {
this.data = this.data.substring(0, offset).
concat(this.data.substring(offset + count));
}
}
},
insertData: function(offset, arg){
// throw Exception if CharacterData is readonly
if(__ownerDocument__(this).implementation.errorChecking && this._readonly){
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
if(this.data){
// throw Exception if offset is negative or greater than the data length,
if (__ownerDocument__(this).implementation.errorChecking &&
((offset < 0) || (offset > this.data.length))) {
throw(new DOMException(DOMException.INDEX_SIZE_ERR));
}
// insert data
this.data = this.data.substring(0, offset).concat(arg, this.data.substring(offset));
}else {
// throw Exception if offset is negative or greater than the data length,
if (__ownerDocument__(this).implementation.errorChecking && (offset !== 0)) {
throw(new DOMException(DOMException.INDEX_SIZE_ERR));
}
// set data
this.data = arg;
}
},
replaceData: function(offset, count, arg){
// throw Exception if CharacterData is readonly
if (__ownerDocument__(this).implementation.errorChecking && this._readonly) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
if (this.data) {
// throw Exception if offset is negative or greater than the data length,
if (__ownerDocument__(this).implementation.errorChecking &&
((offset < 0) || (offset > this.data.length) || (count < 0))) {
throw(new DOMException(DOMException.INDEX_SIZE_ERR));
}
// replace data
this.data = this.data.substring(0, offset).
concat(arg, this.data.substring(offset + count));
}else {
// set data
this.data = arg;
}
},
substringData: function(offset, count){
var ret = null;
if (this.data) {
// throw Exception if offset is negative or greater than the data length,
// or the count is negative
if (__ownerDocument__(this).implementation.errorChecking &&
((offset < 0) || (offset > this.data.length) || (count < 0))) {
throw(new DOMException(DOMException.INDEX_SIZE_ERR));
}
// if count is not specified
if (!count) {
ret = this.data.substring(offset); // default to 'end of string'
}else{
ret = this.data.substring(offset, offset + count);
}
}
return ret;
},
toString : function(){
return "[object CharacterData]";
}
});
/**
* @class Text
* The Text interface represents the textual content (termed
* character data in XML) of an Element or Attr.
* If there is no markup inside an element's content, the text is
* contained in a single object implementing the Text interface that
* is the only child of the element. If there is markup, it is
* parsed into a list of elements and Text nodes that form the
* list of children of the element.
* @extends CharacterData
* @param ownerDocument The Document object associated with this node.
*/
Text = function(ownerDocument) {
CharacterData.apply(this, arguments);
this.nodeName = "#text";
};
Text.prototype = new CharacterData();
__extend__(Text.prototype,{
get localName(){
return null;
},
// Breaks this Text node into two Text nodes at the specified offset,
// keeping both in the tree as siblings. This node then only contains
// all the content up to the offset point. And a new Text node, which
// is inserted as the next sibling of this node, contains all the
// content at and after the offset point.
splitText : function(offset) {
var data,
inode;
// test for exceptions
if (__ownerDocument__(this).implementation.errorChecking) {
// throw Exception if Node is readonly
if (this._readonly) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
// throw Exception if offset is negative or greater than the data length,
if ((offset < 0) || (offset > this.data.length)) {
throw(new DOMException(DOMException.INDEX_SIZE_ERR));
}
}
if (this.parentNode) {
// get remaining string (after offset)
data = this.substringData(offset);
// create new TextNode with remaining string
inode = __ownerDocument__(this).createTextNode(data);
// attach new TextNode
if (this.nextSibling) {
this.parentNode.insertBefore(inode, this.nextSibling);
} else {
this.parentNode.appendChild(inode);
}
// remove remaining string from original TextNode
this.deleteData(offset);
}
return inode;
},
get nodeType(){
return Node.TEXT_NODE;
},
get xml(){
return __escapeXML__(""+ this.nodeValue);
},
toString: function(){
return "[object Text]";
}
});
/**
* @class CDATASection
* CDATA sections are used to escape blocks of text containing
* characters that would otherwise be regarded as markup.
* The only delimiter that is recognized in a CDATA section is
* the "\]\]\>" string that ends the CDATA section
* @extends Text
* @param ownerDocument : The Document object associated with this node.
*/
CDATASection = function(ownerDocument) {
Text.apply(this, arguments);
this.nodeName = '#cdata-section';
};
CDATASection.prototype = new Text();
__extend__(CDATASection.prototype,{
get nodeType(){
return Node.CDATA_SECTION_NODE;
},
get xml(){
return "<![CDATA[" + this.nodeValue + "]]>";
},
toString : function(){
return "[object CDATASection]";
}
});
/**
* @class Comment
* This represents the content of a comment, i.e., all the
* characters between the starting '<!--' and ending '-->'
* @extends CharacterData
* @param ownerDocument : The Document object associated with this node.
*/
Comment = function(ownerDocument) {
CharacterData.apply(this, arguments);
this.nodeName = "#comment";
};
Comment.prototype = new CharacterData();
__extend__(Comment.prototype, {
get localName(){
return null;
},
get nodeType(){
return Node.COMMENT_NODE;
},
get xml(){
return "<!--" + this.nodeValue + "-->";
},
toString : function(){
return "[object Comment]";
}
});
/**
* @author envjs team
* @param {Document} onwnerDocument
*/
DocumentType = function(ownerDocument) {
Node.apply(this, arguments);
this.systemId = null;
this.publicId = null;
};
DocumentType.prototype = new Node();
__extend__({
get name(){
return this.nodeName;
},
get entities(){
return null;
},
get internalSubsets(){
return null;
},
get notations(){
return null;
},
toString : function(){
return "[object DocumentType]";
}
});
/**
* @class Attr
* The Attr interface represents an attribute in an Element object
* @extends Node
* @param ownerDocument : The Document object associated with this node.
*/
Attr = function(ownerDocument) {
Node.apply(this, arguments);
// set when Attr is added to NamedNodeMap
this.ownerElement = null;
//TODO: our implementation of Attr is incorrect because we don't
// treat the value of the attribute as a child text node.
};
Attr.prototype = new Node();
__extend__(Attr.prototype, {
// the name of this attribute
get name(){
return this.nodeName;
},
// the value of the attribute is returned as a string
get value(){
return this.nodeValue||'';
},
set value(value){
// throw Exception if Attribute is readonly
if (__ownerDocument__(this).implementation.errorChecking && this._readonly) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
// delegate to node
this.nodeValue = value;
},
get textContent(){
return this.nodeValue;
},
set textContent(newText){
this.nodeValue = newText;
},
get specified(){
return (this !== null && this !== undefined);
},
get nodeType(){
return Node.ATTRIBUTE_NODE;
},
get xml() {
if (this.nodeValue) {
return __escapeXML__(this.nodeValue+"");
} else {
return '';
}
},
toString : function() {
return '[object Attr]';
}
});
/**
* @class Element -
* By far the vast majority of objects (apart from text)
* that authors encounter when traversing a document are
* Element nodes.
* @extends Node
* @param ownerDocument : The Document object associated with this node.
*/
Element = function(ownerDocument) {
Node.apply(this, arguments);
this.attributes = new NamedNodeMap(this.ownerDocument, this);
};
Element.prototype = new Node();
__extend__(Element.prototype, {
// The name of the element.
get tagName(){
return this.nodeName;
},
getAttribute: function(name) {
var ret = null;
// if attribute exists, use it
var attr = this.attributes.getNamedItem(name);
if (attr) {
ret = attr.value;
}
// if Attribute exists, return its value, otherwise, return null
return ret;
},
setAttribute : function (name, value) {
// if attribute exists, use it
var attr = this.attributes.getNamedItem(name);
//console.log('attr %s', attr);
//I had to add this check because as the script initializes
//the id may be set in the constructor, and the html element
//overrides the id property with a getter/setter.
if(__ownerDocument__(this)){
if (attr===null||attr===undefined) {
// otherwise create it
attr = __ownerDocument__(this).createAttribute(name);
//console.log('attr %s', attr);
}
// test for exceptions
if (__ownerDocument__(this).implementation.errorChecking) {
// throw Exception if Attribute is readonly
if (attr._readonly) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
// throw Exception if the value string contains an illegal character
if (!__isValidString__(value+'')) {
throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));
}
}
// assign values to properties (and aliases)
attr.value = value + '';
// add/replace Attribute in NamedNodeMap
this.attributes.setNamedItem(attr);
//console.log('element setNamedItem %s', attr);
}else{
console.warn('Element has no owner document '+this.tagName+
'\n\t cant set attribute ' + name + ' = '+value );
}
},
removeAttribute : function removeAttribute(name) {
// delegate to NamedNodeMap.removeNamedItem
return this.attributes.removeNamedItem(name);
},
getAttributeNode : function getAttributeNode(name) {
// delegate to NamedNodeMap.getNamedItem
return this.attributes.getNamedItem(name);
},
setAttributeNode: function(newAttr) {
// if this Attribute is an ID
if (__isIdDeclaration__(newAttr.name)) {
this.id = newAttr.value; // cache ID for getElementById()
}
// delegate to NamedNodeMap.setNamedItem
return this.attributes.setNamedItem(newAttr);
},
removeAttributeNode: function(oldAttr) {
// throw Exception if Attribute is readonly
if (__ownerDocument__(this).implementation.errorChecking && oldAttr._readonly) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
// get item index
var itemIndex = this.attributes._findItemIndex(oldAttr._id);
// throw Exception if node does not exist in this map
if (__ownerDocument__(this).implementation.errorChecking && (itemIndex < 0)) {
throw(new DOMException(DOMException.NOT_FOUND_ERR));
}
return this.attributes._removeChild(itemIndex);
},
getAttributeNS : function(namespaceURI, localName) {
var ret = "";
// delegate to NAmedNodeMap.getNamedItemNS
var attr = this.attributes.getNamedItemNS(namespaceURI, localName);
if (attr) {
ret = attr.value;
}
return ret; // if Attribute exists, return its value, otherwise return ""
},
setAttributeNS : function(namespaceURI, qualifiedName, value) {
// call NamedNodeMap.getNamedItem
//console.log('setAttributeNS %s %s %s', namespaceURI, qualifiedName, value);
var attr = this.attributes.getNamedItem(namespaceURI, qualifiedName);
if (!attr) { // if Attribute exists, use it
// otherwise create it
attr = __ownerDocument__(this).createAttributeNS(namespaceURI, qualifiedName);
}
value = '' + value;
// test for exceptions
if (__ownerDocument__(this).implementation.errorChecking) {
// throw Exception if Attribute is readonly
if (attr._readonly) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
// throw Exception if the Namespace is invalid
if (!__isValidNamespace__(this.ownerDocument, namespaceURI, qualifiedName, true)) {
throw(new DOMException(DOMException.NAMESPACE_ERR));
}
// throw Exception if the value string contains an illegal character
if (!__isValidString__(value)) {
throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));
}
}
// if this Attribute is an ID
//if (__isIdDeclaration__(name)) {
// this.id = value;
//}
// assign values to properties (and aliases)
attr.value = value;
attr.nodeValue = value;
// delegate to NamedNodeMap.setNamedItem
this.attributes.setNamedItemNS(attr);
},
removeAttributeNS : function(namespaceURI, localName) {
// delegate to NamedNodeMap.removeNamedItemNS
return this.attributes.removeNamedItemNS(namespaceURI, localName);
},
getAttributeNodeNS : function(namespaceURI, localName) {
// delegate to NamedNodeMap.getNamedItemNS
return this.attributes.getNamedItemNS(namespaceURI, localName);
},
setAttributeNodeNS : function(newAttr) {
// if this Attribute is an ID
if ((newAttr.prefix == "") && __isIdDeclaration__(newAttr.name)) {
this.id = newAttr.value+''; // cache ID for getElementById()
}
// delegate to NamedNodeMap.setNamedItemNS
return this.attributes.setNamedItemNS(newAttr);
},
hasAttribute : function(name) {
// delegate to NamedNodeMap._hasAttribute
return __hasAttribute__(this.attributes,name);
},
hasAttributeNS : function(namespaceURI, localName) {
// delegate to NamedNodeMap._hasAttributeNS
return __hasAttributeNS__(this.attributes, namespaceURI, localName);
},
get nodeType(){
return Node.ELEMENT_NODE;
},
get xml() {
var ret = "",
ns = "",
attrs,
attrstring,
i;
// serialize namespace declarations
if (this.namespaceURI ){
if((this === this.ownerDocument.documentElement) ||
(!this.parentNode)||
(this.parentNode && (this.parentNode.namespaceURI !== this.namespaceURI))) {
ns = ' xmlns' + (this.prefix?(':'+this.prefix):'') +
'="' + this.namespaceURI + '"';
}
}
// serialize Attribute declarations
attrs = this.attributes;
attrstring = "";
for(i=0;i< attrs.length;i++){
if(attrs[i].name.match('xmlns:')) {
attrstring += " "+attrs[i].name+'="'+attrs[i].xml+'"';
}
}
for(i=0;i< attrs.length;i++){
if(!attrs[i].name.match('xmlns:')) {
attrstring += " "+attrs[i].name+'="'+attrs[i].xml+'"';
}
}
if(this.hasChildNodes()){
// serialize this Element
ret += "<" + this.tagName + ns + attrstring +">";
ret += this.childNodes.xml;
ret += "</" + this.tagName + ">";
}else{
ret += "<" + this.tagName + ns + attrstring +"/>";
}
return ret;
},
toString : function(){
return '[object Element]';
}
});
/**
* @class DOMException - raised when an operation is impossible to perform
* @author Jon van Noort (jon@webarcana.com.au)
* @param code : int - the exception code (one of the DOMException constants)
*/
DOMException = function(code) {
this.code = code;
};
// DOMException constants
// Introduced in DOM Level 1:
DOMException.INDEX_SIZE_ERR = 1;
DOMException.DOMSTRING_SIZE_ERR = 2;
DOMException.HIERARCHY_REQUEST_ERR = 3;
DOMException.WRONG_DOCUMENT_ERR = 4;
DOMException.INVALID_CHARACTER_ERR = 5;
DOMException.NO_DATA_ALLOWED_ERR = 6;
DOMException.NO_MODIFICATION_ALLOWED_ERR = 7;
DOMException.NOT_FOUND_ERR = 8;
DOMException.NOT_SUPPORTED_ERR = 9;
DOMException.INUSE_ATTRIBUTE_ERR = 10;
// Introduced in DOM Level 2:
DOMException.INVALID_STATE_ERR = 11;
DOMException.SYNTAX_ERR = 12;
DOMException.INVALID_MODIFICATION_ERR = 13;
DOMException.NAMESPACE_ERR = 14;
DOMException.INVALID_ACCESS_ERR = 15;
/**
* @class DocumentFragment -
* DocumentFragment is a "lightweight" or "minimal" Document object.
* @extends Node
* @param ownerDocument : The Document object associated with this node.
*/
DocumentFragment = function(ownerDocument) {
Node.apply(this, arguments);
this.nodeName = "#document-fragment";
};
DocumentFragment.prototype = new Node();
__extend__(DocumentFragment.prototype,{
get nodeType(){
return Node.DOCUMENT_FRAGMENT_NODE;
},
get xml(){
var xml = "",
count = this.childNodes.length;
// create string concatenating the serialized ChildNodes
for (var i = 0; i < count; i++) {
xml += this.childNodes.item(i).xml;
}
return xml;
},
toString : function(){
return "[object DocumentFragment]";
},
get localName(){
return null;
}
});
/**
* @class ProcessingInstruction -
* The ProcessingInstruction interface represents a
* "processing instruction", used in XML as a way to
* keep processor-specific information in the text of
* the document
* @extends Node
* @author Jon van Noort (jon@webarcana.com.au)
* @param ownerDocument : The Document object associated with this node.
*/
ProcessingInstruction = function(ownerDocument) {
Node.apply(this, arguments);
};
ProcessingInstruction.prototype = new Node();
__extend__(ProcessingInstruction.prototype, {
get data(){
return this.nodeValue;
},
set data(data){
// throw Exception if Node is readonly
if (__ownerDocument__(this).errorChecking && this._readonly) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
this.nodeValue = data;
},
get textContent(){
return this.data;
},
get localName(){
return null;
},
get target(){
// The target of this processing instruction.
// XML defines this as being the first token following the markup that begins the processing instruction.
// The content of this processing instruction.
return this.nodeName;
},
set target(value){
// The target of this processing instruction.
// XML defines this as being the first token following the markup that begins the processing instruction.
// The content of this processing instruction.
this.nodeName = value;
},
get nodeType(){
return Node.PROCESSING_INSTRUCTION_NODE;
},
get xml(){
return "<?" + this.nodeName +" "+ this.nodeValue + "?>";
},
toString : function(){
return "[object ProcessingInstruction]";
}
});
/**
* @author envjs team
*/
Entity = function() {
throw new Error("Entity Not Implemented" );
};
Entity.constants = {
// content taken from W3C "HTML 4.01 Specification"
// "W3C Recommendation 24 December 1999"
nbsp: "\u00A0",
iexcl: "\u00A1",
cent: "\u00A2",
pound: "\u00A3",
curren: "\u00A4",
yen: "\u00A5",
brvbar: "\u00A6",
sect: "\u00A7",
uml: "\u00A8",
copy: "\u00A9",
ordf: "\u00AA",
laquo: "\u00AB",
not: "\u00AC",
shy: "\u00AD",
reg: "\u00AE",
macr: "\u00AF",
deg: "\u00B0",
plusmn: "\u00B1",
sup2: "\u00B2",
sup3: "\u00B3",
acute: "\u00B4",
micro: "\u00B5",
para: "\u00B6",
middot: "\u00B7",
cedil: "\u00B8",
sup1: "\u00B9",
ordm: "\u00BA",
raquo: "\u00BB",
frac14: "\u00BC",
frac12: "\u00BD",
frac34: "\u00BE",
iquest: "\u00BF",
Agrave: "\u00C0",
Aacute: "\u00C1",
Acirc: "\u00C2",
Atilde: "\u00C3",
Auml: "\u00C4",
Aring: "\u00C5",
AElig: "\u00C6",
Ccedil: "\u00C7",
Egrave: "\u00C8",
Eacute: "\u00C9",
Ecirc: "\u00CA",
Euml: "\u00CB",
Igrave: "\u00CC",
Iacute: "\u00CD",
Icirc: "\u00CE",
Iuml: "\u00CF",
ETH: "\u00D0",
Ntilde: "\u00D1",
Ograve: "\u00D2",
Oacute: "\u00D3",
Ocirc: "\u00D4",
Otilde: "\u00D5",
Ouml: "\u00D6",
times: "\u00D7",
Oslash: "\u00D8",
Ugrave: "\u00D9",
Uacute: "\u00DA",
Ucirc: "\u00DB",
Uuml: "\u00DC",
Yacute: "\u00DD",
THORN: "\u00DE",
szlig: "\u00DF",
agrave: "\u00E0",
aacute: "\u00E1",
acirc: "\u00E2",
atilde: "\u00E3",
auml: "\u00E4",
aring: "\u00E5",
aelig: "\u00E6",
ccedil: "\u00E7",
egrave: "\u00E8",
eacute: "\u00E9",
ecirc: "\u00EA",
euml: "\u00EB",
igrave: "\u00EC",
iacute: "\u00ED",
icirc: "\u00EE",
iuml: "\u00EF",
eth: "\u00F0",
ntilde: "\u00F1",
ograve: "\u00F2",
oacute: "\u00F3",
ocirc: "\u00F4",
otilde: "\u00F5",
ouml: "\u00F6",
divide: "\u00F7",
oslash: "\u00F8",
ugrave: "\u00F9",
uacute: "\u00FA",
ucirc: "\u00FB",
uuml: "\u00FC",
yacute: "\u00FD",
thorn: "\u00FE",
yuml: "\u00FF",
fnof: "\u0192",
Alpha: "\u0391",
Beta: "\u0392",
Gamma: "\u0393",
Delta: "\u0394",
Epsilon: "\u0395",
Zeta: "\u0396",
Eta: "\u0397",
Theta: "\u0398",
Iota: "\u0399",
Kappa: "\u039A",
Lambda: "\u039B",
Mu: "\u039C",
Nu: "\u039D",
Xi: "\u039E",
Omicron: "\u039F",
Pi: "\u03A0",
Rho: "\u03A1",
Sigma: "\u03A3",
Tau: "\u03A4",
Upsilon: "\u03A5",
Phi: "\u03A6",
Chi: "\u03A7",
Psi: "\u03A8",
Omega: "\u03A9",
alpha: "\u03B1",
beta: "\u03B2",
gamma: "\u03B3",
delta: "\u03B4",
epsilon: "\u03B5",
zeta: "\u03B6",
eta: "\u03B7",
theta: "\u03B8",
iota: "\u03B9",
kappa: "\u03BA",
lambda: "\u03BB",
mu: "\u03BC",
nu: "\u03BD",
xi: "\u03BE",
omicron: "\u03BF",
pi: "\u03C0",
rho: "\u03C1",
sigmaf: "\u03C2",
sigma: "\u03C3",
tau: "\u03C4",
upsilon: "\u03C5",
phi: "\u03C6",
chi: "\u03C7",
psi: "\u03C8",
omega: "\u03C9",
thetasym: "\u03D1",
upsih: "\u03D2",
piv: "\u03D6",
bull: "\u2022",
hellip: "\u2026",
prime: "\u2032",
Prime: "\u2033",
oline: "\u203E",
frasl: "\u2044",
weierp: "\u2118",
image: "\u2111",
real: "\u211C",
trade: "\u2122",
alefsym: "\u2135",
larr: "\u2190",
uarr: "\u2191",
rarr: "\u2192",
darr: "\u2193",
harr: "\u2194",
crarr: "\u21B5",
lArr: "\u21D0",
uArr: "\u21D1",
rArr: "\u21D2",
dArr: "\u21D3",
hArr: "\u21D4",
forall: "\u2200",
part: "\u2202",
exist: "\u2203",
empty: "\u2205",
nabla: "\u2207",
isin: "\u2208",
notin: "\u2209",
ni: "\u220B",
prod: "\u220F",
sum: "\u2211",
minus: "\u2212",
lowast: "\u2217",
radic: "\u221A",
prop: "\u221D",
infin: "\u221E",
ang: "\u2220",
and: "\u2227",
or: "\u2228",
cap: "\u2229",
cup: "\u222A",
intXX: "\u222B",
there4: "\u2234",
sim: "\u223C",
cong: "\u2245",
asymp: "\u2248",
ne: "\u2260",
equiv: "\u2261",
le: "\u2264",
ge: "\u2265",
sub: "\u2282",
sup: "\u2283",
nsub: "\u2284",
sube: "\u2286",
supe: "\u2287",
oplus: "\u2295",
otimes: "\u2297",
perp: "\u22A5",
sdot: "\u22C5",
lceil: "\u2308",
rceil: "\u2309",
lfloor: "\u230A",
rfloor: "\u230B",
lang: "\u2329",
rang: "\u232A",
loz: "\u25CA",
spades: "\u2660",
clubs: "\u2663",
hearts: "\u2665",
diams: "\u2666",
quot: "\u0022",
amp: "\u0026",
lt: "\u003C",
gt: "\u003E",
OElig: "\u0152",
oelig: "\u0153",
Scaron: "\u0160",
scaron: "\u0161",
Yuml: "\u0178",
circ: "\u02C6",
tilde: "\u02DC",
ensp: "\u2002",
emsp: "\u2003",
thinsp: "\u2009",
zwnj: "\u200C",
zwj: "\u200D",
lrm: "\u200E",
rlm: "\u200F",
ndash: "\u2013",
mdash: "\u2014",
lsquo: "\u2018",
rsquo: "\u2019",
sbquo: "\u201A",
ldquo: "\u201C",
rdquo: "\u201D",
bdquo: "\u201E",
dagger: "\u2020",
Dagger: "\u2021",
permil: "\u2030",
lsaquo: "\u2039",
rsaquo: "\u203A",
euro: "\u20AC",
// non-standard entities
apos: "'"
};
/**
* @author envjs team
*/
EntityReference = function() {
throw new Error("EntityReference Not Implemented" );
};
/**
* @class DOMImplementation -
* provides a number of methods for performing operations
* that are independent of any particular instance of the
* document object model.
*
* @author Jon van Noort (jon@webarcana.com.au)
*/
DOMImplementation = function() {
this.preserveWhiteSpace = false; // by default, ignore whitespace
this.namespaceAware = true; // by default, handle namespaces
this.errorChecking = true; // by default, test for exceptions
};
__extend__(DOMImplementation.prototype,{
// @param feature : string - The package name of the feature to test.
// the legal only values are "XML" and "CORE" (case-insensitive).
// @param version : string - This is the version number of the package
// name to test. In Level 1, this is the string "1.0".*
// @return : boolean
hasFeature : function(feature, version) {
var ret = false;
if (feature.toLowerCase() == "xml") {
ret = (!version || (version == "1.0") || (version == "2.0"));
}
else if (feature.toLowerCase() == "core") {
ret = (!version || (version == "2.0"));
}
else if (feature == "http://www.w3.org/TR/SVG11/feature#BasicStructure") {
ret = (version == "1.1");
}
return ret;
},
createDocumentType : function(qname, publicId, systemId){
var doctype = new DocumentType();
doctype.nodeName = qname?qname.toUpperCase():null;
doctype.publicId = publicId?publicId:null;
doctype.systemId = systemId?systemId:null;
return doctype;
},
createDocument : function(nsuri, qname, doctype){
var doc = null, documentElement;
doc = new Document(this, null);
if(doctype){
doc.doctype = doctype;
}
if(nsuri && qname){
documentElement = doc.createElementNS(nsuri, qname);
}else if(qname){
documentElement = doc.createElement(qname);
}
if(documentElement){
doc.appendChild(documentElement);
}
return doc;
},
createHTMLDocument : function(title){
var doc = new HTMLDocument($implementation, null, "");
var html = doc.createElement("html"); doc.appendChild(html);
var head = doc.createElement("head"); html.appendChild(head);
var body = doc.createElement("body"); html.appendChild(body);
var t = doc.createElement("title"); head.appendChild(t);
if( title) {
t.appendChild(doc.createTextNode(title));
}
return doc;
},
translateErrCode : function(code) {
//convert DOMException Code to human readable error message;
var msg = "";
switch (code) {
case DOMException.INDEX_SIZE_ERR : // 1
msg = "INDEX_SIZE_ERR: Index out of bounds";
break;
case DOMException.DOMSTRING_SIZE_ERR : // 2
msg = "DOMSTRING_SIZE_ERR: The resulting string is too long to fit in a DOMString";
break;
case DOMException.HIERARCHY_REQUEST_ERR : // 3
msg = "HIERARCHY_REQUEST_ERR: The Node can not be inserted at this location";
break;
case DOMException.WRONG_DOCUMENT_ERR : // 4
msg = "WRONG_DOCUMENT_ERR: The source and the destination Documents are not the same";
break;
case DOMException.INVALID_CHARACTER_ERR : // 5
msg = "INVALID_CHARACTER_ERR: The string contains an invalid character";
break;
case DOMException.NO_DATA_ALLOWED_ERR : // 6
msg = "NO_DATA_ALLOWED_ERR: This Node / NodeList does not support data";
break;
case DOMException.NO_MODIFICATION_ALLOWED_ERR : // 7
msg = "NO_MODIFICATION_ALLOWED_ERR: This object cannot be modified";
break;
case DOMException.NOT_FOUND_ERR : // 8
msg = "NOT_FOUND_ERR: The item cannot be found";
break;
case DOMException.NOT_SUPPORTED_ERR : // 9
msg = "NOT_SUPPORTED_ERR: This implementation does not support function";
break;
case DOMException.INUSE_ATTRIBUTE_ERR : // 10
msg = "INUSE_ATTRIBUTE_ERR: The Attribute has already been assigned to another Element";
break;
// Introduced in DOM Level 2:
case DOMException.INVALID_STATE_ERR : // 11
msg = "INVALID_STATE_ERR: The object is no longer usable";
break;
case DOMException.SYNTAX_ERR : // 12
msg = "SYNTAX_ERR: Syntax error";
break;
case DOMException.INVALID_MODIFICATION_ERR : // 13
msg = "INVALID_MODIFICATION_ERR: Cannot change the type of the object";
break;
case DOMException.NAMESPACE_ERR : // 14
msg = "NAMESPACE_ERR: The namespace declaration is incorrect";
break;
case DOMException.INVALID_ACCESS_ERR : // 15
msg = "INVALID_ACCESS_ERR: The object does not support this function";
break;
default :
msg = "UNKNOWN: Unknown Exception Code ("+ code +")";
}
return msg;
},
toString : function(){
return "[object DOMImplementation]";
}
});
/**
* @method DOMImplementation._isNamespaceDeclaration - Return true, if attributeName is a namespace declaration
* @author Jon van Noort (jon@webarcana.com.au)
* @param attributeName : string - the attribute name
* @return : boolean
*/
function __isNamespaceDeclaration__(attributeName) {
// test if attributeName is 'xmlns'
return (attributeName.indexOf('xmlns') > -1);
}
/**
* @method DOMImplementation._isIdDeclaration - Return true, if attributeName is an id declaration
* @author Jon van Noort (jon@webarcana.com.au)
* @param attributeName : string - the attribute name
* @return : boolean
*/
function __isIdDeclaration__(attributeName) {
// test if attributeName is 'id' (case insensitive)
return attributeName?(attributeName.toLowerCase() == 'id'):false;
}
/**
* @method DOMImplementation._isValidName - Return true,
* if name contains no invalid characters
* @author Jon van Noort (jon@webarcana.com.au)
* @param name : string - the candidate name
* @return : boolean
*/
function __isValidName__(name) {
// test if name contains only valid characters
return name.match(re_validName);
}
var re_validName = /^[a-zA-Z_:][a-zA-Z0-9\.\-_:]*$/;
/**
* @method DOMImplementation._isValidString - Return true, if string does not contain any illegal chars
* All of the characters 0 through 31 and character 127 are nonprinting control characters.
* With the exception of characters 09, 10, and 13, (Ox09, Ox0A, and Ox0D)
* Note: different from _isValidName in that ValidStrings may contain spaces
* @author Jon van Noort (jon@webarcana.com.au)
* @param name : string - the candidate string
* @return : boolean
*/
function __isValidString__(name) {
// test that string does not contains invalid characters
return (name.search(re_invalidStringChars) < 0);
}
var re_invalidStringChars = /\x01|\x02|\x03|\x04|\x05|\x06|\x07|\x08|\x0B|\x0C|\x0E|\x0F|\x10|\x11|\x12|\x13|\x14|\x15|\x16|\x17|\x18|\x19|\x1A|\x1B|\x1C|\x1D|\x1E|\x1F|\x7F/;
/**
* @method DOMImplementation._parseNSName - parse the namespace name.
* if there is no colon, the
* @author Jon van Noort (jon@webarcana.com.au)
* @param qualifiedName : string - The qualified name
* @return : NSName - [
.prefix : string - The prefix part of the qname
.namespaceName : string - The namespaceURI part of the qname
]
*/
function __parseNSName__(qualifiedName) {
var resultNSName = {};
// unless the qname has a namespaceName, the prefix is the entire String
resultNSName.prefix = qualifiedName;
resultNSName.namespaceName = "";
// split on ':'
var delimPos = qualifiedName.indexOf(':');
if (delimPos > -1) {
// get prefix
resultNSName.prefix = qualifiedName.substring(0, delimPos);
// get namespaceName
resultNSName.namespaceName = qualifiedName.substring(delimPos +1, qualifiedName.length);
}
return resultNSName;
}
/**
* @method DOMImplementation._parseQName - parse the qualified name
* @author Jon van Noort (jon@webarcana.com.au)
* @param qualifiedName : string - The qualified name
* @return : QName
*/
function __parseQName__(qualifiedName) {
var resultQName = {};
// unless the qname has a prefix, the local name is the entire String
resultQName.localName = qualifiedName;
resultQName.prefix = "";
// split on ':'
var delimPos = qualifiedName.indexOf(':');
if (delimPos > -1) {
// get prefix
resultQName.prefix = qualifiedName.substring(0, delimPos);
// get localName
resultQName.localName = qualifiedName.substring(delimPos +1, qualifiedName.length);
}
return resultQName;
}
/**
* @author envjs team
*/
Notation = function() {
throw new Error("Notation Not Implemented" );
};/**
* @author thatcher
*/
Range = function(){
};
__extend__(Range.prototype, {
get startContainer(){
},
get endContainer(){
},
get startOffset(){
},
get endOffset(){
},
get collapsed(){
},
get commonAncestorContainer(){
},
setStart: function(refNode, offset){//throws RangeException
},
setEnd: function(refNode, offset){//throws RangeException
},
setStartBefore: function(refNode){//throws RangeException
},
setStartAfter: function(refNode){//throws RangeException
},
setEndBefore: function(refNode){//throws RangeException
},
setEndAfter: function(refNode){//throws RangeException
},
collapse: function(toStart){//throws RangeException
},
selectNode: function(refNode){//throws RangeException
},
selectNodeContents: function(refNode){//throws RangeException
},
compareBoundaryPoints: function(how, sourceRange){
},
deleteContents: function(){
},
extractContents: function(){
},
cloneContents: function(){
},
insertNode: function(newNode){
},
surroundContents: function(newParent){
},
cloneRange: function(){
},
toString: function(){
return '[object Range]';
},
detach: function(){
}
});
// CompareHow
Range.START_TO_START = 0;
Range.START_TO_END = 1;
Range.END_TO_END = 2;
Range.END_TO_START = 3;
/*
* Forward declarations
*/
var __isValidNamespace__;
/**
* @class Document - The Document interface represents the entire HTML
* or XML document. Conceptually, it is the root of the document tree,
* and provides the primary access to the document's data.
*
* @extends Node
* @param implementation : DOMImplementation - the creator Implementation
*/
Document = function(implementation, docParentWindow) {
Node.apply(this, arguments);
//TODO: Temporary!!! Cnage back to true!!!
this.async = true;
// The Document Type Declaration (see DocumentType) associated with this document
this.doctype = null;
// The DOMImplementation object that handles this document.
this.implementation = implementation;
this.nodeName = "#document";
// initially false, set to true by parser
this.parsing = false;
this.baseURI = 'about:blank';
this.ownerDocument = null;
this.importing = false;
};
Document.prototype = new Node();
__extend__(Document.prototype,{
get localName(){
return null;
},
get textContent(){
return null;
},
get all(){
return this.getElementsByTagName("*");
},
get documentElement(){
var i, length = this.childNodes?this.childNodes.length:0;
for(i=0;i<length;i++){
if(this.childNodes[i].nodeType === Node.ELEMENT_NODE){
return this.childNodes[i];
}
}
return null;
},
get documentURI(){
return this.baseURI;
},
createExpression: function(xpath, nsuriMap){
return new XPathExpression(xpath, nsuriMap);
},
createDocumentFragment: function() {
var node = new DocumentFragment(this);
return node;
},
createTextNode: function(data) {
var node = new Text(this);
node.data = data;
return node;
},
createComment: function(data) {
var node = new Comment(this);
node.data = data;
return node;
},
createCDATASection : function(data) {
var node = new CDATASection(this);
node.data = data;
return node;
},
createProcessingInstruction: function(target, data) {
// throw Exception if the target string contains an illegal character
if (__ownerDocument__(this).implementation.errorChecking &&
(!__isValidName__(target))) {
throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));
}
var node = new ProcessingInstruction(this);
node.target = target;
node.data = data;
return node;
},
createElement: function(tagName) {
// throw Exception if the tagName string contains an illegal character
if (__ownerDocument__(this).implementation.errorChecking &&
(!__isValidName__(tagName))) {
throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));
}
var node = new Element(this);
node.nodeName = tagName;
return node;
},
createElementNS : function(namespaceURI, qualifiedName) {
//we use this as a parser flag to ignore the xhtml
//namespace assumed by the parser
//console.log('creating element %s %s', namespaceURI, qualifiedName);
if(this.baseURI === 'http://envjs.com/xml' &&
namespaceURI === 'http://www.w3.org/1999/xhtml'){
return this.createElement(qualifiedName);
}
//console.log('createElementNS %s %s', namespaceURI, qualifiedName);
if (__ownerDocument__(this).implementation.errorChecking) {
// throw Exception if the Namespace is invalid
if (!__isValidNamespace__(this, namespaceURI, qualifiedName)) {
throw(new DOMException(DOMException.NAMESPACE_ERR));
}
// throw Exception if the qualifiedName string contains an illegal character
if (!__isValidName__(qualifiedName)) {
throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));
}
}
var node = new Element(this);
var qname = __parseQName__(qualifiedName);
node.namespaceURI = namespaceURI;
node.prefix = qname.prefix;
node.nodeName = qualifiedName;
//console.log('created element %s %s', namespaceURI, qualifiedName);
return node;
},
createAttribute : function(name) {
//console.log('createAttribute %s ', name);
// throw Exception if the name string contains an illegal character
if (__ownerDocument__(this).implementation.errorChecking &&
(!__isValidName__(name))) {
throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));
}
var node = new Attr(this);
node.nodeName = name;
return node;
},
createAttributeNS : function(namespaceURI, qualifiedName) {
//we use this as a parser flag to ignore the xhtml
//namespace assumed by the parser
if(this.baseURI === 'http://envjs.com/xml' &&
namespaceURI === 'http://www.w3.org/1999/xhtml'){
return this.createAttribute(qualifiedName);
}
//console.log('createAttributeNS %s %s', namespaceURI, qualifiedName);
// test for exceptions
if (this.implementation.errorChecking) {
// throw Exception if the Namespace is invalid
if (!__isValidNamespace__(this, namespaceURI, qualifiedName, true)) {
throw(new DOMException(DOMException.NAMESPACE_ERR));
}
// throw Exception if the qualifiedName string contains an illegal character
if (!__isValidName__(qualifiedName)) {
throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));
}
}
var node = new Attr(this);
var qname = __parseQName__(qualifiedName);
node.namespaceURI = namespaceURI === '' ? null : namespaceURI;
node.prefix = qname.prefix;
node.nodeName = qualifiedName;
node.nodeValue = "";
//console.log('attribute %s %s %s', node.namespaceURI, node.prefix, node.nodeName);
return node;
},
createNamespace : function(qualifiedName) {
//console.log('createNamespace %s', qualifiedName);
// create Namespace specifying 'this' as ownerDocument
var node = new Namespace(this);
var qname = __parseQName__(qualifiedName);
// assign values to properties (and aliases)
node.prefix = qname.prefix;
node.localName = qname.localName;
node.name = qualifiedName;
node.nodeValue = "";
return node;
},
createRange: function(){
return new Range();
},
evaluate: function(xpathText, contextNode, nsuriMapper, resultType, result){
//return new XPathExpression().evaluate();
throw Error('Document.evaluate not supported yet!');
},
getElementById : function(elementId) {
var retNode = null,
node;
// loop through all Elements
var all = this.getElementsByTagName('*');
for (var i=0; i < all.length; i++) {
node = all[i];
// if id matches
if (node.id == elementId) {
//found the node
retNode = node;
break;
}
}
return retNode;
},
normalizeDocument: function(){
this.normalize();
},
get nodeType(){
return Node.DOCUMENT_NODE;
},
get xml(){
return this.documentElement.xml;
},
toString: function(){
return "[object XMLDocument]";
},
get defaultView(){
return { getComputedStyle: function(elem){
return window.getComputedStyle(elem);
}};
},
});
/*
* Helper function
*
*/
__isValidNamespace__ = function(doc, namespaceURI, qualifiedName, isAttribute) {
if (doc.importing === true) {
//we're doing an importNode operation (or a cloneNode) - in both cases, there
//is no need to perform any namespace checking since the nodes have to have been valid
//to have gotten into the DOM in the first place
return true;
}
var valid = true;
// parse QName
var qName = __parseQName__(qualifiedName);
//only check for namespaces if we're finished parsing
if (this.parsing === false) {
// if the qualifiedName is malformed
if (qName.localName.indexOf(":") > -1 ){
valid = false;
}
if ((valid) && (!isAttribute)) {
// if the namespaceURI is not null
if (!namespaceURI) {
valid = false;
}
}
// if the qualifiedName has a prefix
if ((valid) && (qName.prefix === "")) {
valid = false;
}
}
// if the qualifiedName has a prefix that is "xml" and the namespaceURI is
// different from "http://www.w3.org/XML/1998/namespace" [Namespaces].
if ((valid) && (qName.prefix === "xml") && (namespaceURI !== "http://www.w3.org/XML/1998/namespace")) {
valid = false;
}
return valid;
};
/**
*
* This file only handles XML parser.
* It is extended by parser/domparser.js (and parser/htmlparser.js)
*
* This depends on e4x, which some engines may not have.
*
* @author thatcher
*/
DOMParser = function(principle, documentURI, baseURI) {
// TODO: why/what should these 3 args do?
};
__extend__(DOMParser.prototype,{
parseFromString: function(xmlstring, mimetype){
var doc = new Document(new DOMImplementation()),
e4;
// The following are e4x directives.
// Full spec is here:
// http://www.ecma-international.org/publications/standards/Ecma-357.htm
//
// that is pretty gross, so checkout this summary
// http://rephrase.net/days/07/06/e4x
//
// also see the Mozilla Developer Center:
// https://developer.mozilla.org/en/E4X
//
XML.ignoreComments = false;
XML.ignoreProcessingInstructions = false;
XML.ignoreWhitespace = false;
// for some reason e4x can't handle initial xml declarations
// https://bugzilla.mozilla.org/show_bug.cgi?id=336551
// The official workaround is the big regexp below
// but simpler one seems to be ok
// xmlstring = xmlstring.replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, "");
//
xmlstring = xmlstring.replace(/<\?xml.*\?>/);
e4 = new XMLList(xmlstring);
__toDomNode__(e4, doc, doc);
//console.log('xml \n %s', doc.documentElement.xml);
return doc;
}
});
var __toDomNode__ = function(e4, parent, doc){
var xnode,
domnode,
children,
target,
value,
length,
element,
kind,
item;
//console.log('converting e4x node list \n %s', e4)
// not using the for each(item in e4) since some engines can't
// handle the syntax (i.e. says syntax error)
//
// for each(xnode in e4) {
for (item in e4) {
// NO do not do this if (e4.hasOwnProperty(item)) {
// breaks spidermonkey
xnode = e4[item];
kind = xnode.nodeKind();
//console.log('treating node kind %s', kind);
switch(kind){
case 'element':
// add node
//console.log('creating element %s %s', xnode.localName(), xnode.namespace());
if(xnode.namespace() && (xnode.namespace()+'') !== ''){
//console.log('createElementNS %s %s',xnode.namespace()+'', xnode.localName() );
domnode = doc.createElementNS(xnode.namespace()+'', xnode.localName());
}else{
domnode = doc.createElement(xnode.name()+'');
}
parent.appendChild(domnode);
// add attributes
__toDomNode__(xnode.attributes(), domnode, doc);
// add children
children = xnode.children();
length = children.length();
//console.log('recursing? %s', length ? 'yes' : 'no');
if (length > 0) {
__toDomNode__(children, domnode, doc);
}
break;
case 'attribute':
// console.log('setting attribute %s %s %s',
// xnode.localName(), xnode.namespace(), xnode.valueOf());
//
// cross-platform alert. The original code used
// xnode.text() to get the attribute value
// This worked in Rhino, but did not in Spidermonkey
// valueOf seemed to work in both
//
if(xnode.namespace() && xnode.namespace().prefix){
//console.log("%s", xnode.namespace().prefix);
parent.setAttributeNS(xnode.namespace()+'',
xnode.namespace().prefix+':'+xnode.localName(),
xnode.valueOf());
}else if((xnode.name()+'').match('http://www.w3.org/2000/xmlns/::')){
if(xnode.localName()!=='xmlns'){
parent.setAttributeNS('http://www.w3.org/2000/xmlns/',
'xmlns:'+xnode.localName(),
xnode.valueOf());
}
}else{
parent.setAttribute(xnode.localName()+'', xnode.valueOf());
}
break;
case 'text':
//console.log('creating text node : %s', xnode);
domnode = doc.createTextNode(xnode+'');
parent.appendChild(domnode);
break;
case 'comment':
//console.log('creating comment node : %s', xnode);
value = xnode+'';
domnode = doc.createComment(value.substring(4,value.length-3));
parent.appendChild(domnode);
break;
case 'processing-instruction':
//console.log('creating processing-instruction node : %s', xnode);
value = xnode+'';
target = value.split(' ')[0].substring(2);
value = value.split(' ').splice(1).join(' ').replace('?>','');
//console.log('creating processing-instruction data : %s', value);
domnode = doc.createProcessingInstruction(target, value);
parent.appendChild(domnode);
break;
default:
console.log('e4x DOM ERROR');
throw new Error("Assertion failed in xml parser");
}
}
};
/**
* @author envjs team
* @class XMLSerializer
*/
XMLSerializer = function() {};
__extend__(XMLSerializer.prototype, {
serializeToString: function(node){
return node.xml;
},
toString : function(){
return "[object XMLSerializer]";
}
});
/**
* @author john resig & the envjs team
* @uri http://www.envjs.com/
* @copyright 2008-2010
* @license MIT
*/
//CLOSURE_END
}());
/*
* Envjs event.1.2.13
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*
* This file simply provides the global definitions we need to
* be able to correctly implement to core browser DOM Event interfaces.
*/
var Event,
MouseEvent,
UIEvent,
KeyboardEvent,
MutationEvent,
DocumentEvent,
EventTarget,
EventException,
//nonstandard but very useful for implementing mutation events
//among other things like general profiling
Aspect;
/*
* Envjs event.1.2.13
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*/
//CLOSURE_START
(function(){
/**
* @author john resig
*/
// Helper method for extending one object with another.
function __extend__(a,b) {
for ( var i in b ) {
var g = b.__lookupGetter__(i), s = b.__lookupSetter__(i);
if ( g || s ) {
if ( g ) { a.__defineGetter__(i, g); }
if ( s ) { a.__defineSetter__(i, s); }
} else {
a[i] = b[i];
}
} return a;
}
/**
* @author john resig
*/
//from jQuery
function __setArray__( target, array ) {
// Resetting the length to 0, then using the native Array push
// is a super-fast way to populate an object with array-like properties
target.length = 0;
Array.prototype.push.apply( target, array );
}
/**
* Borrowed with love from:
*
* jQuery AOP - jQuery plugin to add features of aspect-oriented programming (AOP) to jQuery.
* http://jquery-aop.googlecode.com/
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Version: 1.1
*/
(function() {
var _after = 1;
var _before = 2;
var _around = 3;
var _intro = 4;
var _regexEnabled = true;
/**
* Private weaving function.
*/
var weaveOne = function(source, method, advice) {
var old = source[method];
var aspect;
if (advice.type == _after)
aspect = function() {
var returnValue = old.apply(this, arguments);
return advice.value.apply(this, [returnValue, method]);
};
else if (advice.type == _before)
aspect = function() {
advice.value.apply(this, [arguments, method]);
return old.apply(this, arguments);
};
else if (advice.type == _intro)
aspect = function() {
return advice.value.apply(this, arguments);
};
else if (advice.type == _around) {
aspect = function() {
var invocation = { object: this, args: arguments };
return advice.value.apply(invocation.object, [{ arguments: invocation.args, method: method, proceed :
function() {
return old.apply(invocation.object, invocation.args);
}
}] );
};
}
aspect.unweave = function() {
source[method] = old;
pointcut = source = aspect = old = null;
};
source[method] = aspect;
return aspect;
};
/**
* Private weaver and pointcut parser.
*/
var weave = function(pointcut, advice)
{
var source = (typeof(pointcut.target.prototype) != 'undefined') ? pointcut.target.prototype : pointcut.target;
var advices = [];
// If it's not an introduction and no method was found, try with regex...
if (advice.type != _intro && typeof(source[pointcut.method]) == 'undefined')
{
for (var method in source)
{
if (source[method] != null && source[method] instanceof Function && method.match(pointcut.method))
{
advices[advices.length] = weaveOne(source, method, advice);
}
}
if (advices.length == 0)
throw 'No method: ' + pointcut.method;
}
else
{
// Return as an array of one element
advices[0] = weaveOne(source, pointcut.method, advice);
}
return _regexEnabled ? advices : advices[0];
};
Aspect =
{
/**
* Creates an advice after the defined point-cut. The advice will be executed after the point-cut method
* has completed execution successfully, and will receive one parameter with the result of the execution.
* This function returns an array of weaved aspects (Function).
*
* @example jQuery.aop.after( {target: window, method: 'MyGlobalMethod'}, function(result) { alert('Returned: ' + result); } );
* @result Array<Function>
*
* @example jQuery.aop.after( {target: String, method: 'indexOf'}, function(index) { alert('Result found at: ' + index + ' on:' + this); } );
* @result Array<Function>
*
* @name after
* @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
* @option Object target Target object to be weaved.
* @option String method Name of the function to be weaved. Regex are supported, but not on built-in objects.
* @param Function advice Function containing the code that will get called after the execution of the point-cut. It receives one parameter
* with the result of the point-cut's execution.
*
* @type Array<Function>
* @cat Plugins/General
*/
after : function(pointcut, advice)
{
return weave( pointcut, { type: _after, value: advice } );
},
/**
* Creates an advice before the defined point-cut. The advice will be executed before the point-cut method
* but cannot modify the behavior of the method, or prevent its execution.
* This function returns an array of weaved aspects (Function).
*
* @example jQuery.aop.before( {target: window, method: 'MyGlobalMethod'}, function() { alert('About to execute MyGlobalMethod'); } );
* @result Array<Function>
*
* @example jQuery.aop.before( {target: String, method: 'indexOf'}, function(index) { alert('About to execute String.indexOf on: ' + this); } );
* @result Array<Function>
*
* @name before
* @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
* @option Object target Target object to be weaved.
* @option String method Name of the function to be weaved. Regex are supported, but not on built-in objects.
* @param Function advice Function containing the code that will get called before the execution of the point-cut.
*
* @type Array<Function>
* @cat Plugins/General
*/
before : function(pointcut, advice)
{
return weave( pointcut, { type: _before, value: advice } );
},
/**
* Creates an advice 'around' the defined point-cut. This type of advice can control the point-cut method execution by calling
* the functions '.proceed()' on the 'invocation' object, and also, can modify the arguments collection before sending them to the function call.
* This function returns an array of weaved aspects (Function).
*
* @example jQuery.aop.around( {target: window, method: 'MyGlobalMethod'}, function(invocation) {
* alert('# of Arguments: ' + invocation.arguments.length);
* return invocation.proceed();
* } );
* @result Array<Function>
*
* @example jQuery.aop.around( {target: String, method: 'indexOf'}, function(invocation) {
* alert('Searching: ' + invocation.arguments[0] + ' on: ' + this);
* return invocation.proceed();
* } );
* @result Array<Function>
*
* @example jQuery.aop.around( {target: window, method: /Get(\d+)/}, function(invocation) {
* alert('Executing ' + invocation.method);
* return invocation.proceed();
* } );
* @desc Matches all global methods starting with 'Get' and followed by a number.
* @result Array<Function>
*
*
* @name around
* @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
* @option Object target Target object to be weaved.
* @option String method Name of the function to be weaved. Regex are supported, but not on built-in objects.
* @param Function advice Function containing the code that will get called around the execution of the point-cut. This advice will be called with one
* argument containing one function '.proceed()', the collection of arguments '.arguments', and the matched method name '.method'.
*
* @type Array<Function>
* @cat Plugins/General
*/
around : function(pointcut, advice)
{
return weave( pointcut, { type: _around, value: advice } );
},
/**
* Creates an introduction on the defined point-cut. This type of advice replaces any existing methods with the same
* name. To restore them, just unweave it.
* This function returns an array with only one weaved aspect (Function).
*
* @example jQuery.aop.introduction( {target: window, method: 'MyGlobalMethod'}, function(result) { alert('Returned: ' + result); } );
* @result Array<Function>
*
* @example jQuery.aop.introduction( {target: String, method: 'log'}, function() { alert('Console: ' + this); } );
* @result Array<Function>
*
* @name introduction
* @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
* @option Object target Target object to be weaved.
* @option String method Name of the function to be weaved.
* @param Function advice Function containing the code that will be executed on the point-cut.
*
* @type Array<Function>
* @cat Plugins/General
*/
introduction : function(pointcut, advice)
{
return weave( pointcut, { type: _intro, value: advice } );
},
/**
* Configures global options.
*
* @name setup
* @param Map settings Configuration options.
* @option Boolean regexMatch Enables/disables regex matching of method names.
*
* @example jQuery.aop.setup( { regexMatch: false } );
* @desc Disable regex matching.
*
* @type Void
* @cat Plugins/General
*/
setup: function(settings)
{
_regexEnabled = settings.regexMatch;
}
};
})();
/**
* @name EventTarget
* @w3c:domlevel 2
* @uri -//TODO: paste dom event level 2 w3c spc uri here
*/
EventTarget = function(){};
EventTarget.prototype.addEventListener = function(type, fn, phase){
__addEventListener__(this, type, fn, phase);
};
EventTarget.prototype.removeEventListener = function(type, fn){
__removeEventListener__(this, type, fn);
};
EventTarget.prototype.dispatchEvent = function(event, bubbles){
__dispatchEvent__(this, event, bubbles);
};
__extend__(Node.prototype, EventTarget.prototype);
var $events = [{}];
function __addEventListener__(target, type, fn, phase){
phase = !!phase?"CAPTURING":"BUBBLING";
if ( !target.uuid ) {
//console.log('event uuid %s %s', target, target.uuid);
target.uuid = $events.length+'';
}
if ( !$events[target.uuid] ) {
//console.log('creating listener for target: %s %s', target, target.uuid);
$events[target.uuid] = {};
}
if ( !$events[target.uuid][type] ){
//console.log('creating listener for type: %s %s %s', target, target.uuid, type);
$events[target.uuid][type] = {
CAPTURING:[],
BUBBLING:[]
};
}
if ( $events[target.uuid][type][phase].indexOf( fn ) < 0 ){
//console.log('adding event listener %s %s %s %s %s %s', target, target.uuid, type, phase,
// $events[target.uuid][type][phase].length, $events[target.uuid][type][phase].indexOf( fn ));
//console.log('creating listener for function: %s %s %s', target, target.uuid, phase);
$events[target.uuid][type][phase].push( fn );
//console.log('adding event listener %s %s %s %s %s %s', target, target.uuid, type, phase,
// $events[target.uuid][type][phase].length, $events[target.uuid][type][phase].indexOf( fn ));
}
//console.log('registered event listeners %s', $events.length);
}
function __removeEventListener__(target, type, fn, phase){
phase = !!phase?"CAPTURING":"BUBBLING";
if ( !target.uuid ) {
return;
}
if ( !$events[target.uuid] ) {
return;
}
if(type == '*'){
//used to clean all event listeners for a given node
//console.log('cleaning all event listeners for node %s %s',target, target.uuid);
delete $events[target.uuid];
return;
}else if ( !$events[target.uuid][type] ){
return;
}
$events[target.uuid][type][phase] =
$events[target.uuid][type][phase].filter(function(f){
//console.log('removing event listener %s %s %s %s', target, type, phase, fn);
return f != fn;
});
}
var __eventuuid__ = 0;
function __dispatchEvent__(target, event, bubbles){
if (!event.uuid) {
event.uuid = __eventuuid__++;
}
//the window scope defines the $event object, for IE(^^^) compatibility;
//$event = event;
//console.log('dispatching event %s', event.uuid);
if (bubbles === undefined || bubbles === null) {
bubbles = true;
}
if (!event.target) {
event.target = target;
}
//console.log('dispatching? %s %s %s', target, event.type, bubbles);
if ( event.type && (target.nodeType || target === window )) {
//console.log('dispatching event %s %s %s', target, event.type, bubbles);
__captureEvent__(target, event);
event.eventPhase = Event.AT_TARGET;
if ( target.uuid && $events[target.uuid] && $events[target.uuid][event.type] ) {
event.currentTarget = target;
//console.log('dispatching %s %s %s %s', target, event.type,
// $events[target.uuid][event.type]['CAPTURING'].length);
$events[target.uuid][event.type].CAPTURING.forEach(function(fn){
//console.log('AT_TARGET (CAPTURING) event %s', fn);
var returnValue = fn( event );
//console.log('AT_TARGET (CAPTURING) return value %s', returnValue);
if(returnValue === false){
event.stopPropagation();
}
});
//console.log('dispatching %s %s %s %s', target, event.type,
// $events[target.uuid][event.type]['BUBBLING'].length);
$events[target.uuid][event.type].BUBBLING.forEach(function(fn){
//console.log('AT_TARGET (BUBBLING) event %s', fn);
var returnValue = fn( event );
//console.log('AT_TARGET (BUBBLING) return value %s', returnValue);
if(returnValue === false){
event.stopPropagation();
}
});
}
if (target["on" + event.type]) {
target["on" + event.type](event);
}
if (bubbles && !event.cancelled){
__bubbleEvent__(target, event);
}
if(!event._preventDefault){
//At this point I'm guessing that just HTMLEvents are concerned
//with default behavior being executed in a browser but I could be
//wrong as usual. The goal is much more to filter at this point
//what events have no need to be handled
//console.log('triggering default behavior for %s', event.type);
if(event.type in Envjs.defaultEventBehaviors){
Envjs.defaultEventBehaviors[event.type](event);
}
}
//console.log('deleting event %s', event.uuid);
event.target = null;
event = null;
}else{
throw new EventException(EventException.UNSPECIFIED_EVENT_TYPE_ERR);
}
}
function __captureEvent__(target, event){
var ancestorStack = [],
parent = target.parentNode;
event.eventPhase = Event.CAPTURING_PHASE;
while(parent){
if(parent.uuid && $events[parent.uuid] && $events[parent.uuid][event.type]){
ancestorStack.push(parent);
}
parent = parent.parentNode;
}
while(ancestorStack.length && !event.cancelled){
event.currentTarget = ancestorStack.pop();
if($events[event.currentTarget.uuid] && $events[event.currentTarget.uuid][event.type]){
$events[event.currentTarget.uuid][event.type].CAPTURING.forEach(function(fn){
var returnValue = fn( event );
if(returnValue === false){
event.stopPropagation();
}
});
}
}
}
function __bubbleEvent__(target, event){
var parent = target.parentNode;
event.eventPhase = Event.BUBBLING_PHASE;
while(parent){
if(parent.uuid && $events[parent.uuid] && $events[parent.uuid][event.type] ){
event.currentTarget = parent;
$events[event.currentTarget.uuid][event.type].BUBBLING.forEach(function(fn){
var returnValue = fn( event );
if(returnValue === false){
event.stopPropagation();
}
});
}
parent = parent.parentNode;
}
}
/**
* @class Event
*/
Event = function(options){
// event state is kept read-only by forcing
// a new object for each event. This may not
// be appropriate in the long run and we'll
// have to decide if we simply dont adhere to
// the read-only restriction of the specification
this._bubbles = true;
this._cancelable = true;
this._cancelled = false;
this._currentTarget = null;
this._target = null;
this._eventPhase = Event.AT_TARGET;
this._timeStamp = new Date().getTime();
this._preventDefault = false;
this._stopPropogation = false;
};
__extend__(Event.prototype,{
get bubbles(){return this._bubbles;},
get cancelable(){return this._cancelable;},
get currentTarget(){return this._currentTarget;},
set currentTarget(currentTarget){ this._currentTarget = currentTarget; },
get eventPhase(){return this._eventPhase;},
set eventPhase(eventPhase){this._eventPhase = eventPhase;},
get target(){return this._target;},
set target(target){ this._target = target;},
get timeStamp(){return this._timeStamp;},
get type(){return this._type;},
initEvent: function(type, bubbles, cancelable){
this._type=type?type:'';
this._bubbles=!!bubbles;
this._cancelable=!!cancelable;
},
preventDefault: function(){
this._preventDefault = true;
},
stopPropagation: function(){
if(this._cancelable){
this._cancelled = true;
this._bubbles = false;
}
},
get cancelled(){
return this._cancelled;
},
toString: function(){
return '[object Event]';
}
});
__extend__(Event,{
CAPTURING_PHASE : 1,
AT_TARGET : 2,
BUBBLING_PHASE : 3
});
/**
* @name UIEvent
* @param {Object} options
*/
UIEvent = function(options) {
this._view = null;
this._detail = 0;
};
UIEvent.prototype = new Event();
__extend__(UIEvent.prototype,{
get view(){
return this._view;
},
get detail(){
return this._detail;
},
initUIEvent: function(type, bubbles, cancelable, windowObject, detail){
this.initEvent(type, bubbles, cancelable);
this._detail = 0;
this._view = windowObject;
}
});
var $onblur,
$onfocus,
$onresize;
/**
* @name MouseEvent
* @w3c:domlevel 2
* @uri http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html
*/
MouseEvent = function(options) {
this._screenX= 0;
this._screenY= 0;
this._clientX= 0;
this._clientY= 0;
this._ctrlKey= false;
this._metaKey= false;
this._altKey= false;
this._button= null;
this._relatedTarget= null;
};
MouseEvent.prototype = new UIEvent();
__extend__(MouseEvent.prototype,{
get screenX(){
return this._screenX;
},
get screenY(){
return this._screenY;
},
get clientX(){
return this._clientX;
},
get clientY(){
return this._clientY;
},
get ctrlKey(){
return this._ctrlKey;
},
get altKey(){
return this._altKey;
},
get shiftKey(){
return this._shiftKey;
},
get metaKey(){
return this._metaKey;
},
get button(){
return this._button;
},
get relatedTarget(){
return this._relatedTarget;
},
initMouseEvent: function(type, bubbles, cancelable, windowObject, detail,
screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey,
metaKey, button, relatedTarget){
this.initUIEvent(type, bubbles, cancelable, windowObject, detail);
this._screenX = screenX;
this._screenY = screenY;
this._clientX = clientX;
this._clientY = clientY;
this._ctrlKey = ctrlKey;
this._altKey = altKey;
this._shiftKey = shiftKey;
this._metaKey = metaKey;
this._button = button;
this._relatedTarget = relatedTarget;
}
});
/**
* Interface KeyboardEvent (introduced in DOM Level 3)
*/
KeyboardEvent = function(options) {
this._keyIdentifier = 0;
this._keyLocation = 0;
this._ctrlKey = false;
this._metaKey = false;
this._altKey = false;
this._metaKey = false;
};
KeyboardEvent.prototype = new UIEvent();
__extend__(KeyboardEvent.prototype,{
get ctrlKey(){
return this._ctrlKey;
},
get altKey(){
return this._altKey;
},
get shiftKey(){
return this._shiftKey;
},
get metaKey(){
return this._metaKey;
},
get button(){
return this._button;
},
get relatedTarget(){
return this._relatedTarget;
},
getModifiersState: function(keyIdentifier){
},
initMouseEvent: function(type, bubbles, cancelable, windowObject,
keyIdentifier, keyLocation, modifiersList, repeat){
this.initUIEvent(type, bubbles, cancelable, windowObject, 0);
this._keyIdentifier = keyIdentifier;
this._keyLocation = keyLocation;
this._modifiersList = modifiersList;
this._repeat = repeat;
}
});
KeyboardEvent.DOM_KEY_LOCATION_STANDARD = 0;
KeyboardEvent.DOM_KEY_LOCATION_LEFT = 1;
KeyboardEvent.DOM_KEY_LOCATION_RIGHT = 2;
KeyboardEvent.DOM_KEY_LOCATION_NUMPAD = 3;
KeyboardEvent.DOM_KEY_LOCATION_MOBILE = 4;
KeyboardEvent.DOM_KEY_LOCATION_JOYSTICK = 5;
//We dont fire mutation events until someone has registered for them
var __supportedMutations__ = /DOMSubtreeModified|DOMNodeInserted|DOMNodeRemoved|DOMAttrModified|DOMCharacterDataModified/;
var __fireMutationEvents__ = Aspect.before({
target: EventTarget,
method: 'addEventListener'
}, function(target, type){
if(type && type.match(__supportedMutations__)){
//unweaving removes the __addEventListener__ aspect
__fireMutationEvents__.unweave();
// These two methods are enough to cover all dom 2 manipulations
Aspect.around({
target: Node,
method:"removeChild"
}, function(invocation){
var event,
node = invocation.arguments[0];
event = node.ownerDocument.createEvent('MutationEvents');
event.initEvent('DOMNodeRemoved', true, false, node.parentNode, null, null, null, null);
node.dispatchEvent(event, false);
return invocation.proceed();
});
Aspect.around({
target: Node,
method:"appendChild"
}, function(invocation) {
var event,
node = invocation.proceed();
event = node.ownerDocument.createEvent('MutationEvents');
event.initEvent('DOMNodeInserted', true, false, node.parentNode, null, null, null, null);
node.dispatchEvent(event, false);
return node;
});
}
});
/**
* @name MutationEvent
* @param {Object} options
*/
MutationEvent = function(options) {
this._cancelable = false;
this._timeStamp = 0;
};
MutationEvent.prototype = new Event();
__extend__(MutationEvent.prototype,{
get relatedNode(){
return this._relatedNode;
},
get prevValue(){
return this._prevValue;
},
get newValue(){
return this._newValue;
},
get attrName(){
return this._attrName;
},
get attrChange(){
return this._attrChange;
},
initMutationEvent: function( type, bubbles, cancelable,
relatedNode, prevValue, newValue, attrName, attrChange ){
this._relatedNode = relatedNode;
this._prevValue = prevValue;
this._newValue = newValue;
this._attrName = attrName;
this._attrChange = attrChange;
switch(type){
case "DOMSubtreeModified":
this.initEvent(type, true, false);
break;
case "DOMNodeInserted":
this.initEvent(type, true, false);
break;
case "DOMNodeRemoved":
this.initEvent(type, true, false);
break;
case "DOMNodeRemovedFromDocument":
this.initEvent(type, false, false);
break;
case "DOMNodeInsertedIntoDocument":
this.initEvent(type, false, false);
break;
case "DOMAttrModified":
this.initEvent(type, true, false);
break;
case "DOMCharacterDataModified":
this.initEvent(type, true, false);
break;
default:
this.initEvent(type, bubbles, cancelable);
}
}
});
// constants
MutationEvent.ADDITION = 0;
MutationEvent.MODIFICATION = 1;
MutationEvent.REMOVAL = 2;
/**
* @name EventException
*/
EventException = function(code) {
this.code = code;
};
EventException.UNSPECIFIED_EVENT_TYPE_ERR = 0;
/**
*
* DOM Level 2: http://www.w3.org/TR/DOM-Level-2-Events/events.html
* DOM Level 3: http://www.w3.org/TR/DOM-Level-3-Events/
*
* interface DocumentEvent {
* Event createEvent (in DOMString eventType)
* raises (DOMException);
* };
*
* Firefox (3.6) exposes DocumentEvent
* Safari (4) does NOT.
*/
/**
* TODO: Not sure we need a full prototype. We not just an regular object?
*/
DocumentEvent = function(){};
DocumentEvent.prototype.__EventMap__ = {
// Safari4: singular and plural forms accepted
// Firefox3.6: singular and plural forms accepted
'Event' : Event,
'Events' : Event,
'UIEvent' : UIEvent,
'UIEvents' : UIEvent,
'MouseEvent' : MouseEvent,
'MouseEvents' : MouseEvent,
'MutationEvent' : MutationEvent,
'MutationEvents' : MutationEvent,
// Safari4: accepts HTMLEvents, but not HTMLEvent
// Firefox3.6: accepts HTMLEvents, but not HTMLEvent
'HTMLEvent' : Event,
'HTMLEvents' : Event,
// Safari4: both not accepted
// Firefox3.6, only KeyEvents is accepted
'KeyEvent' : KeyboardEvent,
'KeyEvents' : KeyboardEvent,
// Safari4: both accepted
// Firefox3.6: none accepted
'KeyboardEvent' : KeyboardEvent,
'KeyboardEvents' : KeyboardEvent
};
DocumentEvent.prototype.createEvent = function(eventType) {
var Clazz = this.__EventMap__[eventType];
if (Clazz) {
return new Clazz();
}
throw(new DOMException(DOMException.NOT_SUPPORTED_ERR));
};
__extend__(Document.prototype, DocumentEvent.prototype);
/**
* @author john resig & the envjs team
* @uri http://www.envjs.com/
* @copyright 2008-2010
* @license MIT
*/
//CLOSURE_END
}());
/*
* Envjs timer.1.2.13
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*
* Parts of the implementation were originally written by:\
* Steven Parkes
*
* requires Envjs.wait, Envjs.sleep, Envjs.WAIT_INTERVAL
*/
var setTimeout,
clearTimeout,
setInterval,
clearInterval;
/*
* Envjs timer.1.2.13
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*/
//CLOSURE_START
(function(){
/*
* timer.js
* implementation provided by Steven Parkes
*/
//private
var $timers = [],
EVENT_LOOP_RUNNING = false;
$timers.lock = function(fn){
Envjs.sync(fn)();
};
//private internal class
var Timer = function(fn, interval){
this.fn = fn;
this.interval = interval;
this.at = Date.now() + interval;
// allows for calling wait() from callbacks
this.running = false;
};
Timer.prototype.start = function(){};
Timer.prototype.stop = function(){};
//static
Timer.normalize = function(time) {
time = time*1;
if ( isNaN(time) || time < 0 ) {
time = 0;
}
if ( EVENT_LOOP_RUNNING && time < Timer.MIN_TIME ) {
time = Timer.MIN_TIME;
}
return time;
};
// html5 says this should be at least 4, but the parser is using
// a setTimeout for the SAX stuff which messes up the world
Timer.MIN_TIME = /* 4 */ 0;
/**
* @function setTimeout
* @param {Object} fn
* @param {Object} time
*/
setTimeout = function(fn, time){
var num;
time = Timer.normalize(time);
$timers.lock(function(){
num = $timers.length+1;
var tfn;
if (typeof fn == 'string') {
tfn = function() {
try {
// eval in global scope
eval(fn, null);
} catch (e) {
console.log('timer error %s %s', fn, e);
} finally {
clearInterval(num);
}
};
} else {
tfn = function() {
try {
fn();
} catch (e) {
console.log('timer error %s %s', fn, e);
} finally {
clearInterval(num);
}
};
}
//console.log("Creating timer number %s", num);
$timers[num] = new Timer(tfn, time);
$timers[num].start();
});
return num;
};
/**
* @function setInterval
* @param {Object} fn
* @param {Object} time
*/
setInterval = function(fn, time){
//console.log('setting interval %s %s', time, fn.toString().substring(0,64));
time = Timer.normalize(time);
if ( time < 10 ) {
time = 10;
}
if (typeof fn == 'string') {
var fnstr = fn;
fn = function() {
eval(fnstr);
};
}
var num;
$timers.lock(function(){
num = $timers.length+1;
//Envjs.debug("Creating timer number "+num);
$timers[num] = new Timer(fn, time);
$timers[num].start();
});
return num;
};
/**
* clearInterval
* @param {Object} num
*/
clearInterval = clearTimeout = function(num){
//console.log("clearing interval "+num);
$timers.lock(function(){
if ( $timers[num] ) {
$timers[num].stop();
delete $timers[num];
}
});
};
// wait === null/undefined: execute any timers as they fire,
// waiting until there are none left
// wait(n) (n > 0): execute any timers as they fire until there
// are none left waiting at least n ms but no more, even if there
// are future events/current threads
// wait(0): execute any immediately runnable timers and return
// wait(-n): keep sleeping until the next event is more than n ms
// in the future
//
// TODO: make a priority queue ...
Envjs.wait = function(wait) {
//console.log('wait %s', wait);
var delta_wait,
start = Date.now(),
was_running = EVENT_LOOP_RUNNING;
if (wait < 0) {
delta_wait = -wait;
wait = 0;
}
EVENT_LOOP_RUNNING = true;
if (wait !== 0 && wait !== null && wait !== undefined){
wait += Date.now();
}
var earliest,
timer,
sleep,
index,
goal,
now,
nextfn;
for (;;) {
//console.log('timer loop');
earliest = sleep = goal = now = nextfn = null;
$timers.lock(function(){
for(index in $timers){
if( isNaN(index*0) ) {
continue;
}
timer = $timers[index];
// determine timer with smallest run-at time that is
// not already running
if( !timer.running && ( !earliest || timer.at < earliest.at) ) {
earliest = timer;
}
}
});
//next sleep time
sleep = earliest && earliest.at - Date.now();
if ( earliest && sleep <= 0 ) {
nextfn = earliest.fn;
try {
//console.log('running stack %s', nextfn.toString().substring(0,64));
earliest.running = true;
nextfn();
} catch (e) {
console.log('timer error %s %s', nextfn, e);
} finally {
earliest.running = false;
}
goal = earliest.at + earliest.interval;
now = Date.now();
if ( goal < now ) {
earliest.at = now;
} else {
earliest.at = goal;
}
continue;
}
// bunch of subtle cases here ...
if ( !earliest ) {
// no events in the queue (but maybe XHR will bring in events, so ...
if ( !wait || wait < Date.now() ) {
// Loop ends if there are no events and a wait hasn't been
// requested or has expired
break;
}
// no events, but a wait requested: fall through to sleep
} else {
// there are events in the queue, but they aren't firable now
/*if ( delta_wait && sleep <= delta_wait ) {
//TODO: why waste a check on a tight
// loop if it just falls through?
// if they will happen within the next delta, fall through to sleep
} else */if ( wait === 0 || ( wait > 0 && wait < Date.now () ) ) {
// loop ends even if there are events but the user
// specifcally asked not to wait too long
break;
}
// there are events and the user wants to wait: fall through to sleep
}
// Related to ajax threads ... hopefully can go away ..
var interval = Envjs.WAIT_INTERVAL || 100;
if ( !sleep || sleep > interval ) {
sleep = interval;
}
//console.log('sleeping %s', sleep);
Envjs.sleep(sleep);
}
EVENT_LOOP_RUNNING = was_running;
};
/**
* @author john resig & the envjs team
* @uri http://www.envjs.com/
* @copyright 2008-2010
* @license MIT
*/
//CLOSURE_END
}());
/*
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*
* This file simply provides the global definitions we need to
* be able to correctly implement to core browser DOM HTML interfaces.
*/
var HTMLDocument,
HTMLElement,
HTMLCollection,
HTMLAnchorElement,
HTMLAreaElement,
HTMLBaseElement,
HTMLQuoteElement,
HTMLBodyElement,
HTMLBRElement,
HTMLButtonElement,
HTMLCanvasElement,
HTMLTableColElement,
HTMLModElement,
HTMLDivElement,
HTMLDListElement,
HTMLFieldSetElement,
HTMLFormElement,
HTMLFrameElement,
HTMLFrameSetElement,
HTMLHeadElement,
HTMLHeadingElement,
HTMLHRElement,
HTMLHtmlElement,
HTMLIFrameElement,
HTMLImageElement,
HTMLInputElement,
HTMLLabelElement,
HTMLLegendElement,
HTMLLIElement,
HTMLLinkElement,
HTMLMapElement,
HTMLMetaElement,
HTMLObjectElement,
HTMLOListElement,
HTMLOptGroupElement,
HTMLOptionElement,
HTMLParagraphElement,
HTMLParamElement,
HTMLPreElement,
HTMLScriptElement,
HTMLSelectElement,
HTMLSpanElement,
HTMLStyleElement,
HTMLTableElement,
HTMLTableSectionElement,
HTMLTableCellElement,
HTMLTableDataCellElement,
HTMLTableHeaderCellElement,
HTMLTableRowElement,
HTMLTextAreaElement,
HTMLTitleElement,
HTMLUListElement,
HTMLUnknownElement,
Image,
Option,
__loadImage__,
__loadLink__;
/*
* Envjs html.1.2.13
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*/
//CLOSURE_START
(function(){
/**
* @author ariel flesler
* http://flesler.blogspot.com/2008/11/fast-trim-function-for-javascript.html
* @param {Object} str
*/
function __trim__( str ){
return (str || "").replace( /^\s+|\s+$/g, "" );
}
/**
* @author john resig
*/
// Helper method for extending one object with another.
function __extend__(a,b) {
for ( var i in b ) {
var g = b.__lookupGetter__(i), s = b.__lookupSetter__(i);
if ( g || s ) {
if ( g ) { a.__defineGetter__(i, g); }
if ( s ) { a.__defineSetter__(i, s); }
} else {
a[i] = b[i];
}
} return a;
}
/**
* @author john resig
*/
//from jQuery
function __setArray__( target, array ) {
// Resetting the length to 0, then using the native Array push
// is a super-fast way to populate an object with array-like properties
target.length = 0;
Array.prototype.push.apply( target, array );
}
/**
* @class HTMLDocument
* The Document interface represents the entire HTML or XML document.
* Conceptually, it is the root of the document tree, and provides
* the primary access to the document's data.
*
* @extends Document
*/
HTMLDocument = function(implementation, ownerWindow, referrer) {
Document.apply(this, arguments);
this.referrer = referrer || '';
this.baseURI = "about:blank";
this.ownerWindow = ownerWindow;
};
HTMLDocument.prototype = new Document();
__extend__(HTMLDocument.prototype, {
createElement: function(tagName){
var node;
tagName = tagName.toUpperCase();
// create Element specifying 'this' as ownerDocument
// This is an html document so we need to use explicit interfaces per the
//TODO: would be much faster as a big switch
switch(tagName){
case "A":
node = new HTMLAnchorElement(this);break;
case "AREA":
node = new HTMLAreaElement(this);break;
case "BASE":
node = new HTMLBaseElement(this);break;
case "BLOCKQUOTE":
node = new HTMLQuoteElement(this);break;
case "CANVAS":
node = new HTMLCanvasElement(this);break;
case "Q":
node = new HTMLQuoteElement(this);break;
case "BODY":
node = new HTMLBodyElement(this);break;
case "BR":
node = new HTMLBRElement(this);break;
case "BUTTON":
node = new HTMLButtonElement(this);break;
case "CAPTION":
node = new HTMLElement(this);break;
case "COL":
node = new HTMLTableColElement(this);break;
case "COLGROUP":
node = new HTMLTableColElement(this);break;
case "DEL":
node = new HTMLModElement(this);break;
case "INS":
node = new HTMLModElement(this);break;
case "DIV":
node = new HTMLDivElement(this);break;
case "DL":
node = new HTMLDListElement(this);break;
case "DT":
node = new HTMLElement(this); break;
case "FIELDSET":
node = new HTMLFieldSetElement(this);break;
case "FORM":
node = new HTMLFormElement(this);break;
case "FRAME":
node = new HTMLFrameElement(this);break;
case "H1":
node = new HTMLHeadingElement(this);break;
case "H2":
node = new HTMLHeadingElement(this);break;
case "H3":
node = new HTMLHeadingElement(this);break;
case "H4":
node = new HTMLHeadingElement(this);break;
case "H5":
node = new HTMLHeadingElement(this);break;
case "H6":
node = new HTMLHeadingElement(this);break;
case "HEAD":
node = new HTMLHeadElement(this);break;
case "HR":
node = new HTMLHRElement(this);break;
case "HTML":
node = new HTMLHtmlElement(this);break;
case "IFRAME":
node = new HTMLIFrameElement(this);break;
case "IMG":
node = new HTMLImageElement(this);break;
case "INPUT":
node = new HTMLInputElement(this);break;
case "LABEL":
node = new HTMLLabelElement(this);break;
case "LEGEND":
node = new HTMLLegendElement(this);break;
case "LI":
node = new HTMLLIElement(this);break;
case "LINK":
node = new HTMLLinkElement(this);break;
case "MAP":
node = new HTMLMapElement(this);break;
case "META":
node = new HTMLMetaElement(this);break;
case "NOSCRIPT":
node = new HTMLElement(this);break;
case "OBJECT":
node = new HTMLObjectElement(this);break;
case "OPTGROUP":
node = new HTMLOptGroupElement(this);break;
case "OL":
node = new HTMLOListElement(this); break;
case "OPTION":
node = new HTMLOptionElement(this);break;
case "P":
node = new HTMLParagraphElement(this);break;
case "PARAM":
node = new HTMLParamElement(this);break;
case "PRE":
node = new HTMLPreElement(this);break;
case "SCRIPT":
node = new HTMLScriptElement(this);break;
case "SELECT":
node = new HTMLSelectElement(this);break;
case "SMALL":
node = new HTMLElement(this);break;
case "SPAN":
node = new HTMLSpanElement(this);break;
case "STRONG":
node = new HTMLElement(this);break;
case "STYLE":
node = new HTMLStyleElement(this);break;
case "TABLE":
node = new HTMLTableElement(this);break;
case "TBODY":
node = new HTMLTableSectionElement(this);break;
case "TFOOT":
node = new HTMLTableSectionElement(this);break;
case "THEAD":
node = new HTMLTableSectionElement(this);break;
case "TD":
node = new HTMLTableDataCellElement(this);break;
case "TH":
node = new HTMLTableHeaderCellElement(this);break;
case "TEXTAREA":
node = new HTMLTextAreaElement(this);break;
case "TITLE":
node = new HTMLTitleElement(this);break;
case "TR":
node = new HTMLTableRowElement(this);break;
case "UL":
node = new HTMLUListElement(this);break;
default:
node = new HTMLUnknownElement(this);
}
// assign values to properties (and aliases)
node.nodeName = tagName;
return node;
},
createElementNS : function (uri, local) {
//print('createElementNS :'+uri+" "+local);
if(!uri){
return this.createElement(local);
}else if ("http://www.w3.org/1999/xhtml" == uri) {
return this.createElement(local);
} else if ("http://www.w3.org/1998/Math/MathML" == uri) {
return this.createElement(local);
} else {
return Document.prototype.createElementNS.apply(this,[uri, local]);
}
},
get anchors(){
return new HTMLCollection(this.getElementsByTagName('a'));
},
get applets(){
return new HTMLCollection(this.getElementsByTagName('applet'));
},
get documentElement(){
var html = Document.prototype.__lookupGetter__('documentElement').apply(this,[]);
if( html === null){
html = this.createElement('html');
this.appendChild(html);
html.appendChild(this.createElement('head'));
html.appendChild(this.createElement('body'));
}
return html;
},
//document.head is non-standard
get head(){
//console.log('get head');
if (!this.documentElement) {
this.appendChild(this.createElement('html'));
}
var element = this.documentElement,
length = element.childNodes.length,
i;
//check for the presence of the head element in this html doc
for(i=0;i<length;i++){
if(element.childNodes[i].nodeType === Node.ELEMENT_NODE){
if(element.childNodes[i].tagName.toLowerCase() === 'head'){
return element.childNodes[i];
}
}
}
//no head? ugh bad news html.. I guess we'll force the issue?
var head = element.appendChild(this.createElement('head'));
return head;
},
get title(){
//console.log('get title');
if (!this.documentElement) {
this.appendChild(this.createElement('html'));
}
var title,
head = this.head,
length = head.childNodes.length,
i;
//check for the presence of the title element in this head element
for(i=0;i<length;i++){
if(head.childNodes[i].nodeType === Node.ELEMENT_NODE){
if(head.childNodes[i].tagName.toLowerCase() === 'title'){
return head.childNodes[i].textContent;
}
}
}
//no title? ugh bad news html.. I guess we'll force the issue?
title = head.appendChild(this.createElement('title'));
return title.appendChild(this.createTextNode('Untitled Document')).nodeValue;
},
set title(titleStr){
//console.log('set title %s', titleStr);
if (!this.documentElement) {
this.appendChild(this.createElement('html'));
}
var title = this.title;
title.textContent = titleStr;
},
get body(){
//console.log('get body');
if (!this.documentElement) {
this.appendChild(this.createElement('html'));
}
var body,
element = this.documentElement,
length = element.childNodes.length,
i;
//check for the presence of the head element in this html doc
for(i=0;i<length;i++){
if(element.childNodes[i].nodeType === Node.ELEMENT_NODE){
if(element.childNodes[i].tagName.toLowerCase() === 'body'){
return element.childNodes[i];
}
}
}
//no head? ugh bad news html.. I guess we'll force the issue?
return element.appendChild(this.createElement('body'));
},
set body(){console.log('set body');/**in firefox this is a benevolent do nothing*/},
get cookie(){
return Envjs.getCookies(this.location+'');
},
set cookie(cookie){
return Envjs.setCookie(this.location+'', cookie);
},
/**
* document.location
*
* should be identical to window.location
*
* HTML5:
* http://dev.w3.org/html5/spec/Overview.html#the-location-interface
*
* Mozilla MDC:
* https://developer.mozilla.org/en/DOM/document.location
*
*/
get location() {
if (this.ownerWindow) {
return this.ownerWindow.location;
} else {
return this.baseURI;
}
},
set location(url) {
this.baseURI = url;
if (this.ownerWindow) {
this.ownerWindow.location = url;
}
},
/**
* document.URL (read-only)
*
* HTML DOM Level 2:
* http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-46183437
*
* HTML5:
* http://dev.w3.org/html5/spec/Overview.html#dom-document-url
*
* Mozilla MDC:
* https://developer.mozilla.org/en/DOM/document.URL
*/
get URL() {
return this.location;
},
set URL(url) {
this.location = url;
},
/**
* document.domain
*
* HTML5 Spec:
* http://dev.w3.org/html5/spec/Overview.html#dom-document-domain
*
* Mozilla MDC:
* https://developer.mozilla.org/en/DOM/document.domain
*
*/
get domain(){
var HOSTNAME = new RegExp('\/\/([^\:\/]+)'),
matches = HOSTNAME.exec(this.baseURI);
return matches&&matches.length>1?matches[1]:"";
},
set domain(value){
var i,
domainParts = this.domain.split('.').reverse(),
newDomainParts = value.split('.').reverse();
if(newDomainParts.length > 1){
for(i=0;i<newDomainParts.length;i++){
if(!(newDomainParts[i] === domainParts[i])){
return;
}
}
this.baseURI = this.baseURI.replace(domainParts.join('.'), value);
}
},
get forms(){
return new HTMLCollection(this.getElementsByTagName('form'));
},
get images(){
return new HTMLCollection(this.getElementsByTagName('img'));
},
get lastModified(){
/* TODO */
return this._lastModified;
},
get links(){
return new HTMLCollection(this.getElementsByTagName('a'));
},
getElementsByName : function(name){
//returns a real Array + the NodeList
var retNodes = __extend__([],new NodeList(this, this.documentElement)),
node;
// loop through all Elements
var all = this.getElementsByTagName('*');
for (var i=0; i < all.length; i++) {
node = all[i];
if (node.nodeType === Node.ELEMENT_NODE &&
node.getAttribute('name') == name) {
retNodes.push(node);
}
}
return retNodes;
},
toString: function(){
return "[object HTMLDocument]";
},
get innerHTML(){
return this.documentElement.outerHTML;
}
});
Aspect.around({
target: Node,
method:"appendChild"
}, function(invocation) {
var event,
okay,
node = invocation.proceed(),
doc = node.ownerDocument;
//console.log('element appended: %s %s %s', node+'', node.nodeName, node.namespaceURI);
if((node.nodeType !== Node.ELEMENT_NODE)){
//for now we are only handling element insertions. probably
//we will need to handle text node changes to script tags and
//changes to src attributes
return node;
}
//console.log('appended html element %s %s %s',
// node.namespaceURI, node.nodeName, node);
switch(doc.parsing){
case true:
//handled by parser if included
//console.log('html document in parse mode');
break;
case false:
switch(node.namespaceURI){
case null:
//fall through
case "":
//fall through
case "http://www.w3.org/1999/xhtml":
switch(node.tagName.toLowerCase()){
case 'style':
document.styleSheets.push(CSSStyleSheet(node));
break;
case 'script':
if((this.nodeName.toLowerCase() === 'head')){
try{
okay = Envjs.loadLocalScript(node, null);
//console.log('loaded script? %s %s', node.uuid, okay);
// only fire event if we actually had something to load
if (node.src && node.src.length > 0){
event = doc.createEvent('HTMLEvents');
event.initEvent( okay ? "load" : "error", false, false );
node.dispatchEvent( event, false );
}
}catch(e){
console.log('error loading html element %s %e', node, e.toString());
}
}
break;
case 'frame':
case 'iframe':
node.contentWindow = { };
node.contentDocument = new HTMLDocument(new DOMImplementation(), node.contentWindow);
node.contentWindow.document = node.contentDocument;
try{
Window;
}catch(e){
node.contentDocument.addEventListener('DOMContentLoaded', function(){
event = node.contentDocument.createEvent('HTMLEvents');
event.initEvent("load", false, false);
node.dispatchEvent( event, false );
});
}
try{
if (node.src && node.src.length > 0){
//console.log("getting content document for (i)frame from %s", node.src);
Envjs.loadFrame(node, Envjs.uri(node.src));
event = node.contentDocument.createEvent('HTMLEvents');
event.initEvent("load", false, false);
node.dispatchEvent( event, false );
}else{
//I dont like this being here:
//TODO: better mix-in strategy so the try/catch isnt required
try{
if(Window){
Envjs.loadFrame(node);
//console.log('src/html/document.js: triggering frame load');
event = node.contentDocument.createEvent('HTMLEvents');
event.initEvent("load", false, false);
node.dispatchEvent( event, false );
}
}catch(e){}
}
}catch(e){
console.log('error loading html element %s %e', node, e.toString());
}
break;
case 'link':
if (node.href && node.href.length > 0) {
__loadLink__(node, node.href);
}
break;
/*
case 'img':
if (node.src && node.src.length > 0){
// don't actually load anything, so we're "done" immediately:
event = doc.createEvent('HTMLEvents');
event.initEvent("load", false, false);
node.dispatchEvent( event, false );
}
break;
*/
case 'option':
node._updateoptions();
break;
default:
if(node.getAttribute('onload')){
console.log('calling attribute onload %s | %s', node.onload, node.tagName);
node.onload();
}
break;
}//switch on name
default:
break;
}//switch on ns
break;
default:
// console.log('element appended: %s %s', node+'', node.namespaceURI);
}//switch on doc.parsing
return node;
});
Aspect.around({
target: Node,
method:"removeChild"
}, function(invocation) {
var event,
okay,
node = invocation.proceed(),
doc = node.ownerDocument;
if((node.nodeType !== Node.ELEMENT_NODE)){
//for now we are only handling element insertions. probably we will need
//to handle text node changes to script tags and changes to src
//attributes
if(node.nodeType !== Node.DOCUMENT_NODE && node.uuid){
//console.log('removing event listeners, %s', node, node.uuid);
node.removeEventListener('*', null, null);
}
return node;
}
//console.log('appended html element %s %s %s', node.namespaceURI, node.nodeName, node);
switch(doc.parsing){
case true:
//handled by parser if included
break;
case false:
switch(node.namespaceURI){
case null:
//fall through
case "":
//fall through
case "http://www.w3.org/1999/xhtml":
//this is interesting dillema since our event engine is
//storing the registered events in an array accessed
//by the uuid property of the node. unforunately this
//means listeners hang out way after(forever ;)) the node
//has been removed and gone out of scope.
//console.log('removing event listeners, %s', node, node.uuid);
node.removeEventListener('*', null, null);
switch(node.tagName.toLowerCase()){
case 'frame':
case 'iframe':
try{
//console.log('removing iframe document');
try{
Envjs.unloadFrame(node);
}catch(e){
console.log('error freeing resources from frame %s', e);
}
node.contentWindow = null;
node.contentDocument = null;
}catch(e){
console.log('error unloading html element %s %e', node, e.toString());
}
break;
default:
break;
}//switch on name
default:
break;
}//switch on ns
break;
default:
console.log('element appended: %s %s', node+'', node.namespaceURI);
}//switch on doc.parsing
return node;
});
/**
* Named Element Support
*
*
*/
/*
*
* @returns 'name' if the node has a appropriate name
* null if node does not have a name
*/
var __isNamedElement__ = function(node) {
if (node.nodeType !== Node.ELEMENT_NODE) {
return null;
}
var tagName = node.tagName.toLowerCase();
var nodename = null;
switch (tagName) {
case 'embed':
case 'form':
case 'iframe':
nodename = node.getAttribute('name');
break;
case 'applet':
nodename = node.id;
break;
case 'object':
// TODO: object needs to be 'fallback free'
nodename = node.id;
break;
case 'img':
nodename = node.id;
if (!nodename || ! node.getAttribute('name')) {
nodename = null;
}
break;
}
return (nodename) ? nodename : null;
};
var __addNamedMap__ = function(target, node) {
var nodename = __isNamedElement__(node);
if (nodename) {
target.__defineGetter__(nodename, function() {
return node;
});
}
};
var __removeNamedMap__ = function(target, node) {
if (!node) {
return;
}
var nodename = __isNamedElement__(node);
if (nodename) {
delete target[nodename];
}
};
/**
* @name HTMLEvents
* @w3c:domlevel 2
* @uri http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html
*/
var __eval__ = function(script, node){
if (!script == ""){
// don't assemble environment if no script...
try{
eval(script);
}catch(e){
console.log('error evaluating %s', e);
}
}
};
var HTMLEvents= function(){};
HTMLEvents.prototype = {
onload: function(event){
__eval__(this.getAttribute('onload')||'', this);
},
onunload: function(event){
__eval__(this.getAttribute('onunload')||'', this);
},
onabort: function(event){
__eval__(this.getAttribute('onabort')||'', this);
},
onerror: function(event){
__eval__(this.getAttribute('onerror')||'', this);
},
onselect: function(event){
__eval__(this.getAttribute('onselect')||'', this);
},
onchange: function(event){
__eval__(this.getAttribute('onchange')||'', this);
},
onsubmit: function(event){
if (__eval__(this.getAttribute('onsubmit')||'', this)) {
this.submit();
}
},
onreset: function(event){
__eval__(this.getAttribute('onreset')||'', this);
},
onfocus: function(event){
__eval__(this.getAttribute('onfocus')||'', this);
},
onblur: function(event){
__eval__(this.getAttribute('onblur')||'', this);
},
onresize: function(event){
__eval__(this.getAttribute('onresize')||'', this);
},
onscroll: function(event){
__eval__(this.getAttribute('onscroll')||'', this);
}
};
//HTMLDocument, HTMLFramesetElement, HTMLObjectElement
var __load__ = function(element){
var event = new Event('HTMLEvents');
event.initEvent("load", false, false);
element.dispatchEvent(event);
return event;
};
//HTMLFramesetElement, HTMLBodyElement
var __unload__ = function(element){
var event = new Event('HTMLEvents');
event.initEvent("unload", false, false);
element.dispatchEvent(event);
return event;
};
//HTMLObjectElement
var __abort__ = function(element){
var event = new Event('HTMLEvents');
event.initEvent("abort", true, false);
element.dispatchEvent(event);
return event;
};
//HTMLFramesetElement, HTMLObjectElement, HTMLBodyElement
var __error__ = function(element){
var event = new Event('HTMLEvents');
event.initEvent("error", true, false);
element.dispatchEvent(event);
return event;
};
//HTMLInputElement, HTMLTextAreaElement
var __select__ = function(element){
var event = new Event('HTMLEvents');
event.initEvent("select", true, false);
element.dispatchEvent(event);
return event;
};
//HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement
var __change__ = function(element){
var event = new Event('HTMLEvents');
event.initEvent("change", true, false);
element.dispatchEvent(event);
return event;
};
//HtmlFormElement
var __submit__ = function(element){
var event = new Event('HTMLEvents');
event.initEvent("submit", true, true);
element.dispatchEvent(event);
return event;
};
//HtmlFormElement
var __reset__ = function(element){
var event = new Event('HTMLEvents');
event.initEvent("reset", false, false);
element.dispatchEvent(event);
return event;
};
//LABEL, INPUT, SELECT, TEXTAREA, and BUTTON
var __focus__ = function(element){
var event = new Event('HTMLEvents');
event.initEvent("focus", false, false);
element.dispatchEvent(event);
return event;
};
//LABEL, INPUT, SELECT, TEXTAREA, and BUTTON
var __blur__ = function(element){
var event = new Event('HTMLEvents');
event.initEvent("blur", false, false);
element.dispatchEvent(event);
return event;
};
//Window
var __resize__ = function(element){
var event = new Event('HTMLEvents');
event.initEvent("resize", true, false);
element.dispatchEvent(event);
return event;
};
//Window
var __scroll__ = function(element){
var event = new Event('HTMLEvents');
event.initEvent("scroll", true, false);
element.dispatchEvent(event);
return event;
};
/**
* @name KeyboardEvents
* @w3c:domlevel 2
* @uri http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html
*/
var KeyboardEvents= function(){};
KeyboardEvents.prototype = {
onkeydown: function(event){
__eval__(this.getAttribute('onkeydown')||'', this);
},
onkeypress: function(event){
__eval__(this.getAttribute('onkeypress')||'', this);
},
onkeyup: function(event){
__eval__(this.getAttribute('onkeyup')||'', this);
}
};
var __registerKeyboardEventAttrs__ = function(elm){
if(elm.hasAttribute('onkeydown')){
elm.addEventListener('keydown', elm.onkeydown, false);
}
if(elm.hasAttribute('onkeypress')){
elm.addEventListener('keypress', elm.onkeypress, false);
}
if(elm.hasAttribute('onkeyup')){
elm.addEventListener('keyup', elm.onkeyup, false);
}
return elm;
};
//HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement
var __keydown__ = function(element){
var event = new Event('KeyboardEvents');
event.initEvent("keydown", false, false);
element.dispatchEvent(event);
};
//HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement
var __keypress__ = function(element){
var event = new Event('KeyboardEvents');
event.initEvent("keypress", false, false);
element.dispatchEvent(event);
};
//HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement
var __keyup__ = function(element){
var event = new Event('KeyboardEvents');
event.initEvent("keyup", false, false);
element.dispatchEvent(event);
};
/**
* @name MaouseEvents
* @w3c:domlevel 2
* @uri http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html
*/
var MouseEvents= function(){};
MouseEvents.prototype = {
onclick: function(event){
__eval__(this.getAttribute('onclick')||'', this);
},
ondblclick: function(event){
__eval__(this.getAttribute('ondblclick')||'', this);
},
onmousedown: function(event){
__eval__(this.getAttribute('onmousedown')||'', this);
},
onmousemove: function(event){
__eval__(this.getAttribute('onmousemove')||'', this);
},
onmouseout: function(event){
__eval__(this.getAttribute('onmouseout')||'', this);
},
onmouseover: function(event){
__eval__(this.getAttribute('onmouseover')||'', this);
},
onmouseup: function(event){
__eval__(this.getAttribute('onmouseup')||'', this);
}
};
var __registerMouseEventAttrs__ = function(elm){
if(elm.hasAttribute('onclick')){
elm.addEventListener('click', elm.onclick, false);
}
if(elm.hasAttribute('ondblclick')){
elm.addEventListener('dblclick', elm.ondblclick, false);
}
if(elm.hasAttribute('onmousedown')){
elm.addEventListener('mousedown', elm.onmousedown, false);
}
if(elm.hasAttribute('onmousemove')){
elm.addEventListener('mousemove', elm.onmousemove, false);
}
if(elm.hasAttribute('onmouseout')){
elm.addEventListener('mouseout', elm.onmouseout, false);
}
if(elm.hasAttribute('onmouseover')){
elm.addEventListener('mouseover', elm.onmouseover, false);
}
if(elm.hasAttribute('onmouseup')){
elm.addEventListener('mouseup', elm.onmouseup, false);
}
return elm;
};
var __click__ = function(element){
var event = new Event('MouseEvents');
event.initEvent("click", true, true, null, 0,
0, 0, 0, 0, false, false, false,
false, null, null);
element.dispatchEvent(event);
};
var __mousedown__ = function(element){
var event = new Event('MouseEvents');
event.initEvent("mousedown", true, true, null, 0,
0, 0, 0, 0, false, false, false,
false, null, null);
element.dispatchEvent(event);
};
var __mouseup__ = function(element){
var event = new Event('MouseEvents');
event.initEvent("mouseup", true, true, null, 0,
0, 0, 0, 0, false, false, false,
false, null, null);
element.dispatchEvent(event);
};
var __mouseover__ = function(element){
var event = new Event('MouseEvents');
event.initEvent("mouseover", true, true, null, 0,
0, 0, 0, 0, false, false, false,
false, null, null);
element.dispatchEvent(event);
};
var __mousemove__ = function(element){
var event = new Event('MouseEvents');
event.initEvent("mousemove", true, true, null, 0,
0, 0, 0, 0, false, false, false,
false, null, null);
element.dispatchEvent(event);
};
var __mouseout__ = function(element){
var event = new Event('MouseEvents');
event.initEvent("mouseout", true, true, null, 0,
0, 0, 0, 0, false, false, false,
false, null, null);
element.dispatchEvent(event);
};
/**
* HTMLElement - DOM Level 2
*/
/* Hack for http://www.prototypejs.org/
*
* Prototype 1.6 (the library) creates a new global Element, which causes
* envjs to use the wrong Element.
*
* http://envjs.lighthouseapp.com/projects/21590/tickets/108-prototypejs-wont-load-due-it-clobbering-element
*
* Options:
* (1) Rename the dom/element to something else
* rejected: been done before. people want Element.
* (2) merge dom+html and not export Element to global namespace
* (meaning we would use a local var Element in a closure, so prototype
* can do what ever it wants)
* rejected: want dom and html separate
* (3) use global namespace (put everything under Envjs = {})
* rejected: massive change
* (4) use commonjs modules (similar to (3) in spirit)
* rejected: massive change
*
* or
*
* (5) take a reference to Element during initial loading ("compile
* time"), and use the reference instead of "Element". That's
* what the next line does. We use __DOMElement__ if we need to
* reference the parent class. Only this file explcity uses
* Element so this should work, and is the most minimal change I
* could think of with no external API changes.
*
*/
var __DOMElement__ = Element;
HTMLElement = function(ownerDocument) {
__DOMElement__.apply(this, arguments);
};
HTMLElement.prototype = new Element();
__extend__(HTMLElement.prototype, HTMLEvents.prototype);
__extend__(HTMLElement.prototype, {
get className() {
return this.getAttribute("class")||'';
},
set className(value) {
return this.setAttribute("class",__trim__(value));
},
get dir() {
return this.getAttribute("dir")||"ltr";
},
set dir(val) {
return this.setAttribute("dir",val);
},
get id(){
return this.getAttribute('id');
},
set id(id){
this.setAttribute('id', id);
},
get innerHTML(){
var ret = "",
i;
// create string containing the concatenation of the string
// values of each child
for (i=0; i < this.childNodes.length; i++) {
if(this.childNodes[i]){
if(this.childNodes[i].nodeType === Node.ELEMENT_NODE){
ret += this.childNodes[i].xhtml;
} else if (this.childNodes[i].nodeType === Node.TEXT_NODE && i>0 &&
this.childNodes[i-1].nodeType === Node.TEXT_NODE){
//add a single space between adjacent text nodes
ret += " "+this.childNodes[i].xml;
}else{
ret += this.childNodes[i].xml;
}
}
}
return ret;
},
get lang() {
return this.getAttribute("lang");
},
set lang(val) {
return this.setAttribute("lang",val);
},
get offsetHeight(){
return Number((this.style.height || '').replace("px",""));
},
get offsetWidth(){
return Number((this.style.width || '').replace("px",""));
},
offsetLeft: 0,
offsetRight: 0,
get offsetParent(){
/* TODO */
return;
},
set offsetParent(element){
/* TODO */
return;
},
scrollHeight: 0,
scrollWidth: 0,
scrollLeft: 0,
scrollRight: 0,
get style(){
return this.getAttribute('style')||'';
},
get title() {
return this.getAttribute("title");
},
set title(value) {
return this.setAttribute("title", value);
},
get tabIndex(){
var tabindex = this.getAttribute('tabindex');
if(tabindex!==null){
return Number(tabindex);
} else {
return 0;
}
},
set tabIndex(value){
if (value === undefined || value === null) {
value = 0;
}
this.setAttribute('tabindex',Number(value));
},
get outerHTML(){
//Not in the specs but I'll leave it here for now.
return this.xhtml;
},
scrollIntoView: function(){
/*TODO*/
return;
},
toString: function(){
return '[object HTMLElement]';
},
get xhtml() {
// HTMLDocument.xhtml is non-standard
// This is exactly like Document.xml except the tagName has to be
// lower cased. I dont like to duplicate this but its really not
// a simple work around between xml and html serialization via
// XMLSerializer (which uppercases html tags) and innerHTML (which
// lowercases tags)
var ret = "",
ns = "",
name = (this.tagName+"").toLowerCase(),
attrs,
attrstring = "",
i;
// serialize namespace declarations
if (this.namespaceURI){
if((this === this.ownerDocument.documentElement) ||
(!this.parentNode) ||
(this.parentNode &&
(this.parentNode.namespaceURI !== this.namespaceURI))) {
ns = ' xmlns' + (this.prefix ? (':' + this.prefix) : '') +
'="' + this.namespaceURI + '"';
}
}
// serialize Attribute declarations
attrs = this.attributes;
for(i=0;i< attrs.length;i++){
attrstring += " "+attrs[i].name+'="'+attrs[i].xml+'"';
}
if(this.hasChildNodes()){
// serialize this Element
ret += "<" + name + ns + attrstring +">";
for(i=0;i< this.childNodes.length;i++){
ret += this.childNodes[i].xhtml ?
this.childNodes[i].xhtml :
this.childNodes[i].xml;
}
ret += "</" + name + ">";
}else{
switch(name){
case 'script':
ret += "<" + name + ns + attrstring +"></"+name+">";
break;
default:
ret += "<" + name + ns + attrstring +"/>";
}
}
return ret;
},
/**
* setAttribute use a dispatch table that other tags can set to
* "listen" to various values being set. The dispatch table
* and registration functions are at the end of the file.
*
*/
setAttribute: function(name, value) {
var result = __DOMElement__.prototype.setAttribute.apply(this, arguments);
__addNamedMap__(this.ownerDocument, this);
var tagname = this.tagName;
var callback = HTMLElement.getAttributeCallback('set', tagname, name);
if (callback) {
callback(this, value);
}
},
setAttributeNS: function(namespaceURI, name, value) {
var result = __DOMElement__.prototype.setAttributeNS.apply(this, arguments);
__addNamedMap__(this.ownerDocument, this);
var tagname = this.tagName;
var callback = HTMLElement.getAttributeCallback('set', tagname, name);
if (callback) {
callback(this, value);
}
return result;
},
setAttributeNode: function(newnode) {
var result = __DOMElement__.prototype.setAttributeNode.apply(this, arguments);
__addNamedMap__(this.ownerDocument, this);
var tagname = this.tagName;
var callback = HTMLElement.getAttributeCallback('set', tagname, newnode.name);
if (callback) {
callback(this, node.value);
}
return result;
},
setAttributeNodeNS: function(newnode) {
var result = __DOMElement__.prototype.setAttributeNodeNS.apply(this, arguments);
__addNamedMap__(this.ownerDocument, this);
var tagname = this.tagName;
var callback = HTMLElement.getAttributeCallback('set', tagname, newnode.name);
if (callback) {
callback(this, node.value);
}
return result;
},
removeAttribute: function(name) {
__removeNamedMap__(this.ownerDocument, this);
return __DOMElement__.prototype.removeAttribute.apply(this, arguments);
},
removeAttributeNS: function(namespace, localname) {
__removeNamedMap__(this.ownerDocument, this);
return __DOMElement__.prototype.removeAttributeNS.apply(this, arguments);
},
removeAttributeNode: function(name) {
__removeNamedMap__(this.ownerDocument, this);
return __DOMElement__.prototype.removeAttribute.apply(this, arguments);
},
removeChild: function(oldChild) {
__removeNamedMap__(this.ownerDocument, oldChild);
return __DOMElement__.prototype.removeChild.apply(this, arguments);
},
importNode: function(othernode, deep) {
var newnode = __DOMElement__.prototype.importNode.apply(this, arguments);
__addNamedMap__(this.ownerDocument, newnode);
return newnode;
},
// not actually sure if this is needed or not
replaceNode: function(newchild, oldchild) {
var newnode = __DOMElement__.prototype.replaceNode.apply(this, arguments);
__removeNamedMap__(this.ownerDocument, oldchild);
__addNamedMap__(this.ownerDocument, newnode);
return newnode;
}
});
HTMLElement.attributeCallbacks = {};
HTMLElement.registerSetAttribute = function(tag, attrib, callbackfn) {
HTMLElement.attributeCallbacks[tag + ':set:' + attrib] = callbackfn;
};
HTMLElement.registerRemoveAttribute = function(tag, attrib, callbackfn) {
HTMLElement.attributeCallbacks[tag + ':remove:' + attrib] = callbackfn;
};
/**
* This is really only useful internally
*
*/
HTMLElement.getAttributeCallback = function(type, tag, attrib) {
return HTMLElement.attributeCallbacks[tag + ':' + type + ':' + attrib] || null;
};
/*
* HTMLCollection
*
* HTML5 -- 2.7.2.1 HTMLCollection
* http://dev.w3.org/html5/spec/Overview.html#htmlcollection
* http://dev.w3.org/html5/spec/Overview.html#collections
*/
HTMLCollection = function(nodelist, type) {
__setArray__(this, []);
var n;
for (var i=0; i<nodelist.length; i++) {
this[i] = nodelist[i];
n = nodelist[i].name;
if (n) {
this[n] = nodelist[i];
}
n = nodelist[i].id;
if (n) {
this[n] = nodelist[i];
}
}
this.length = nodelist.length;
};
HTMLCollection.prototype = {
item: function (idx) {
return ((idx >= 0) && (idx < this.length)) ? this[idx] : null;
},
namedItem: function (name) {
return this[name] || null;
},
toString: function() {
return '[object HTMLCollection]';
}
};
/*
* a set of convenience classes to centralize implementation of
* properties and methods across multiple in-form elements
*
* the hierarchy of related HTML elements and their members is as follows:
*
* Condensed Version
*
* HTMLInputCommon
* * legent (no value attr)
* * fieldset (no value attr)
* * label (no value attr)
* * option (custom value)
* HTMLTypeValueInputs (extends InputCommon)
* * select (custom value)
* * button (just sets value)
* HTMLInputAreaCommon (extends TypeValueIput)
* * input (custom)
* * textarea (just sets value)
*
* -----------------------
* HTMLInputCommon: common to all elements
* .form
*
* <legend>
* [common plus:]
* .align
*
* <fieldset>
* [identical to "legend" plus:]
* .margin
*
*
* ****
*
* <label>
* [common plus:]
* .dataFormatAs
* .htmlFor
* [plus data properties]
*
* <option>
* [common plus:]
* .defaultSelected
* .index
* .label
* .selected
* .text
* .value // unique implementation, not duplicated
* .form // unique implementation, not duplicated
* ****
*
* HTMLTypeValueInputs: common to remaining elements
* [common plus:]
* .name
* .type
* .value
* [plus data properties]
*
*
* <select>
* .length
* .multiple
* .options[]
* .selectedIndex
* .add()
* .remove()
* .item() // unimplemented
* .namedItem() // unimplemented
* [plus ".onchange"]
* [plus focus events]
* [plus data properties]
* [plus ".size"]
*
* <button>
* .dataFormatAs // duplicated from above, oh well....
* [plus ".status", ".createTextRange()"]
*
* ****
*
* HTMLInputAreaCommon: common to remaining elements
* .defaultValue
* .readOnly
* .handleEvent() // unimplemented
* .select()
* .onselect
* [plus ".size"]
* [plus ".status", ".createTextRange()"]
* [plus focus events]
* [plus ".onchange"]
*
* <textarea>
* .cols
* .rows
* .wrap // unimplemented
* .onscroll // unimplemented
*
* <input>
* .alt
* .accept // unimplemented
* .checked
* .complete // unimplemented
* .defaultChecked
* .dynsrc // unimplemented
* .height
* .hspace // unimplemented
* .indeterminate // unimplemented
* .loop // unimplemented
* .lowsrc // unimplemented
* .maxLength
* .src
* .start // unimplemented
* .useMap
* .vspace // unimplemented
* .width
* .onclick
* [plus ".size"]
* [plus ".status", ".createTextRange()"]
* [data properties] // unimplemented
* .dataFld
* .dataSrc
* [status stuff] // unimplemented
* .status
* .createTextRange()
* [focus events]
* .onblur
* .onfocus
*/
var inputElements_dataProperties = {};
var inputElements_status = {};
var inputElements_onchange = {
onchange: function(event){
__eval__(this.getAttribute('onchange')||'', this);
}
};
var inputElements_size = {
get size(){
return Number(this.getAttribute('size'));
},
set size(value){
this.setAttribute('size',value);
}
};
var inputElements_focusEvents = {
blur: function(){
__blur__(this);
if (this._oldValue != this.value){
var event = document.createEvent("HTMLEvents");
event.initEvent("change", true, true);
this.dispatchEvent( event );
}
},
focus: function(){
__focus__(this);
this._oldValue = this.value;
}
};
/*
* HTMLInputCommon - convenience class, not DOM
*/
var HTMLInputCommon = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLInputCommon.prototype = new HTMLElement();
__extend__(HTMLInputCommon.prototype, {
get form() {
// parent can be null if element is outside of a form
// or not yet added to the document
var parent = this.parentNode;
while (parent && parent.nodeName.toLowerCase() !== 'form') {
parent = parent.parentNode;
}
return parent;
},
get accessKey(){
return this.getAttribute('accesskey');
},
set accessKey(value){
this.setAttribute('accesskey',value);
},
get access(){
return this.getAttribute('access');
},
set access(value){
this.setAttribute('access', value);
},
get disabled(){
return (this.getAttribute('disabled') === 'disabled');
},
set disabled(value){
this.setAttribute('disabled', (value ? 'disabled' :''));
}
});
/*
* HTMLTypeValueInputs - convenience class, not DOM
*/
var HTMLTypeValueInputs = function(ownerDocument) {
HTMLInputCommon.apply(this, arguments);
this._oldValue = "";
};
HTMLTypeValueInputs.prototype = new HTMLInputCommon();
__extend__(HTMLTypeValueInputs.prototype, inputElements_size);
__extend__(HTMLTypeValueInputs.prototype, inputElements_status);
__extend__(HTMLTypeValueInputs.prototype, inputElements_dataProperties);
__extend__(HTMLTypeValueInputs.prototype, {
get name(){
return this.getAttribute('name')||'';
},
set name(value){
this.setAttribute('name',value);
},
});
/*
* HTMLInputAreaCommon - convenience class, not DOM
*/
var HTMLInputAreaCommon = function(ownerDocument) {
HTMLTypeValueInputs.apply(this, arguments);
};
HTMLInputAreaCommon.prototype = new HTMLTypeValueInputs();
__extend__(HTMLInputAreaCommon.prototype, inputElements_focusEvents);
__extend__(HTMLInputAreaCommon.prototype, inputElements_onchange);
__extend__(HTMLInputAreaCommon.prototype, {
get readOnly(){
return (this.getAttribute('readonly')=='readonly');
},
set readOnly(value){
this.setAttribute('readonly', (value ? 'readonly' :''));
},
select:function(){
__select__(this);
}
});
var __updateFormForNamedElement__ = function(node, value) {
if (node.form) {
// to check for ID or NAME attribute too
// not, then nothing to do
node.form._updateElements();
}
};
/**
* HTMLAnchorElement - DOM Level 2
*
* HTML5: 4.6.1 The a element
* http://dev.w3.org/html5/spec/Overview.html#the-a-element
*/
HTMLAnchorElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLAnchorElement.prototype = new HTMLElement();
__extend__(HTMLAnchorElement.prototype, {
get accessKey() {
return this.getAttribute("accesskey")||'';
},
set accessKey(val) {
return this.setAttribute("accesskey",val);
},
get charset() {
return this.getAttribute("charset")||'';
},
set charset(val) {
return this.setAttribute("charset",val);
},
get coords() {
return this.getAttribute("coords")||'';
},
set coords(val) {
return this.setAttribute("coords",val);
},
get href() {
var link = this.getAttribute('href');
if (!link) {
return '';
}
return Envjs.uri(link,
this.ownerDocument.location.toString());
},
set href(val) {
return this.setAttribute("href", val);
},
get hreflang() {
return this.getAttribute("hreflang")||'';
},
set hreflang(val) {
this.setAttribute("hreflang",val);
},
get name() {
return this.getAttribute("name")||'';
},
set name(val) {
this.setAttribute("name",val);
},
get rel() {
return this.getAttribute("rel")||'';
},
set rel(val) {
return this.setAttribute("rel", val);
},
get rev() {
return this.getAttribute("rev")||'';
},
set rev(val) {
return this.setAttribute("rev",val);
},
get shape() {
return this.getAttribute("shape")||'';
},
set shape(val) {
return this.setAttribute("shape",val);
},
get target() {
return this.getAttribute("target")||'';
},
set target(val) {
return this.setAttribute("target",val);
},
get type() {
return this.getAttribute("type")||'';
},
set type(val) {
return this.setAttribute("type",val);
},
blur: function() {
__blur__(this);
},
focus: function() {
__focus__(this);
},
/**
* Unlike other elements, toString returns the href
*/
toString: function() {
return this.href;
}
});
/*
* HTMLAreaElement - DOM Level 2
*
* HTML5: 4.8.13 The area element
* http://dev.w3.org/html5/spec/Overview.html#the-area-element
*/
HTMLAreaElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLAreaElement.prototype = new HTMLElement();
__extend__(HTMLAreaElement.prototype, {
get accessKey(){
return this.getAttribute('accesskey');
},
set accessKey(value){
this.setAttribute('accesskey',value);
},
get alt(){
return this.getAttribute('alt') || '';
},
set alt(value){
this.setAttribute('alt',value);
},
get coords(){
return this.getAttribute('coords');
},
set coords(value){
this.setAttribute('coords',value);
},
get href(){
return this.getAttribute('href') || '';
},
set href(value){
this.setAttribute('href',value);
},
get noHref(){
return this.hasAttribute('href');
},
get shape(){
//TODO
return 0;
},
/*get tabIndex(){
return this.getAttribute('tabindex');
},
set tabIndex(value){
this.setAttribute('tabindex',value);
},*/
get target(){
return this.getAttribute('target');
},
set target(value){
this.setAttribute('target',value);
},
/**
* toString like <a>, returns the href
*/
toString: function() {
return this.href;
}
});
/*
* HTMLBaseElement - DOM Level 2
*
* HTML5: 4.2.3 The base element
* http://dev.w3.org/html5/spec/Overview.html#the-base-element
*/
HTMLBaseElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLBaseElement.prototype = new HTMLElement();
__extend__(HTMLBaseElement.prototype, {
get href(){
return this.getAttribute('href');
},
set href(value){
this.setAttribute('href',value);
},
get target(){
return this.getAttribute('target');
},
set target(value){
this.setAttribute('target',value);
},
toString: function() {
return '[object HTMLBaseElement]';
}
});
/*
* HTMLQuoteElement - DOM Level 2
* HTML5: 4.5.5 The blockquote element
* http://dev.w3.org/html5/spec/Overview.html#htmlquoteelement
*/
HTMLQuoteElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
__extend__(HTMLQuoteElement.prototype, HTMLElement.prototype);
__extend__(HTMLQuoteElement.prototype, {
/**
* Quoth the spec:
* """
* If the cite attribute is present, it must be a valid URL. To
* obtain the corresponding citation link, the value of the
* attribute must be resolved relative to the element. User agents
* should allow users to follow such citation links.
* """
*
* TODO: normalize
*
*/
get cite() {
return this.getAttribute('cite') || '';
},
set cite(value) {
this.setAttribute('cite', value);
},
toString: function() {
return '[object HTMLQuoteElement]';
}
});
/*
* HTMLBodyElement - DOM Level 2
* HTML5: http://dev.w3.org/html5/spec/Overview.html#the-body-element-0
*/
HTMLBodyElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLBodyElement.prototype = new HTMLElement();
__extend__(HTMLBodyElement.prototype, {
onload: function(event){
__eval__(this.getAttribute('onload')||'', this);
},
onunload: function(event){
__eval__(this.getAttribute('onunload')||'', this);
},
toString: function() {
return '[object HTMLBodyElement]';
}
});
/*
* HTMLBRElement
* HTML5: 4.5.3 The hr Element
* http://dev.w3.org/html5/spec/Overview.html#the-br-element
*/
HTMLBRElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLBRElement.prototype = new HTMLElement();
__extend__(HTMLBRElement.prototype, {
// no additional properties or elements
toString: function() {
return '[object HTMLBRElement]';
}
});
/*
* HTMLButtonElement - DOM Level 2
*
* HTML5: 4.10.6 The button element
* http://dev.w3.org/html5/spec/Overview.html#the-button-element
*/
HTMLButtonElement = function(ownerDocument) {
HTMLTypeValueInputs.apply(this, arguments);
};
HTMLButtonElement.prototype = new HTMLTypeValueInputs();
__extend__(HTMLButtonElement.prototype, inputElements_status);
__extend__(HTMLButtonElement.prototype, {
get dataFormatAs(){
return this.getAttribute('dataFormatAs');
},
set dataFormatAs(value){
this.setAttribute('dataFormatAs',value);
},
get type() {
return this.getAttribute('type') || 'submit';
},
set type(value) {
this.setAttribute('type', value);
},
get value() {
return this.getAttribute('value') || '';
},
set value(value) {
this.setAttribute('value', value);
},
toString: function() {
return '[object HTMLButtonElement]';
}
});
// Named Element Support
HTMLElement.registerSetAttribute('BUTTON', 'name',
__updateFormForNamedElement__);
/*
* HTMLCanvasElement - DOM Level 2
* HTML5: 4.8.11 The canvas element
* http://dev.w3.org/html5/spec/Overview.html#the-canvas-element
*/
/*
* This is a "non-Abstract Base Class". For an implmentation that actually
* did something, all these methods would need to over-written
*/
CanvasRenderingContext2D = function() {
// NOP
};
var nullfunction = function() {};
CanvasRenderingContext2D.prototype = {
addColorStop: nullfunction,
arc: nullfunction,
beginPath: nullfunction,
bezierCurveTo: nullfunction,
clearRect: nullfunction,
clip: nullfunction,
closePath: nullfunction,
createLinearGradient: nullfunction,
createPattern: nullfunction,
createRadialGradient: nullfunction,
drawImage: nullfunction,
fill: nullfunction,
fillRect: nullfunction,
lineTo: nullfunction,
moveTo: nullfunction,
quadraticCurveTo: nullfunction,
rect: nullfunction,
restore: nullfunction,
rotate: nullfunction,
save: nullfunction,
scale: nullfunction,
setTranform: nullfunction,
stroke: nullfunction,
strokeRect: nullfunction,
transform: nullfunction,
translate: nullfunction,
toString: function() {
return '[object CanvasRenderingContext2D]';
}
};
HTMLCanvasElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLCanvasElement.prototype = new HTMLElement();
__extend__(HTMLCanvasElement.prototype, {
getContext: function(ctxtype) {
if (ctxtype === '2d') {
return new CanvasRenderingContext2D();
}
throw new Error("Unknown context type of '" + ctxtype + '"');
},
get height(){
return Number(this.getAttribute('height')|| 150);
},
set height(value){
this.setAttribute('height', value);
},
get width(){
return Number(this.getAttribute('width')|| 300);
},
set width(value){
this.setAttribute('width', value);
},
toString: function() {
return '[object HTMLCanvasElement]';
}
});
/*
* HTMLTableColElement - DOM Level 2
*
* HTML5: 4.9.3 The colgroup element
* http://dev.w3.org/html5/spec/Overview.html#the-colgroup-element
*/
HTMLTableColElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLTableColElement.prototype = new HTMLElement();
__extend__(HTMLTableColElement.prototype, {
get align(){
return this.getAttribute('align');
},
set align(value){
this.setAttribute('align', value);
},
get ch(){
return this.getAttribute('ch');
},
set ch(value){
this.setAttribute('ch', value);
},
get chOff(){
return this.getAttribute('ch');
},
set chOff(value){
this.setAttribute('ch', value);
},
get span(){
return this.getAttribute('span');
},
set span(value){
this.setAttribute('span', value);
},
get vAlign(){
return this.getAttribute('valign');
},
set vAlign(value){
this.setAttribute('valign', value);
},
get width(){
return this.getAttribute('width');
},
set width(value){
this.setAttribute('width', value);
},
toString: function() {
return '[object HTMLTableColElement]';
}
});
/*
* HTMLModElement - DOM Level 2
* http://dev.w3.org/html5/spec/Overview.html#htmlmodelement
*/
HTMLModElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLModElement.prototype = new HTMLElement();
__extend__(HTMLModElement.prototype, {
get cite(){
return this.getAttribute('cite');
},
set cite(value){
this.setAttribute('cite', value);
},
get dateTime(){
return this.getAttribute('datetime');
},
set dateTime(value){
this.setAttribute('datetime', value);
},
toString: function() {
return '[object HTMLModElement]';
}
});
/*
* HTMLDivElement - DOM Level 2
* HTML5: 4.5.12 The Div Element
* http://dev.w3.org/html5/spec/Overview.html#the-div-element
*/
HTMLDivElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLDivElement.prototype = new HTMLElement();
__extend__(HTMLDivElement.prototype, {
get align(){
return this.getAttribute('align') || 'left';
},
set align(value){
this.setAttribute('align', value);
},
toString: function() {
return '[object HTMLDivElement]';
}
});
/*
* HTMLDListElement
* HTML5: 4.5.7 The dl Element
* http://dev.w3.org/html5/spec/Overview.html#the-dl-element
*/
HTMLDListElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLDListElement.prototype = new HTMLElement();
__extend__(HTMLDListElement.prototype, {
// no additional properties or elements
toString: function() {
return '[object HTMLDListElement]';
}
});
/**
* HTMLLegendElement - DOM Level 2
*
* HTML5: 4.10.3 The legend element
* http://dev.w3.org/html5/spec/Overview.html#the-legend-element
*/
HTMLLegendElement = function(ownerDocument) {
HTMLInputCommon.apply(this, arguments);
};
HTMLLegendElement.prototype = new HTMLInputCommon();
__extend__(HTMLLegendElement.prototype, {
get align(){
return this.getAttribute('align');
},
set align(value){
this.setAttribute('align',value);
}
});
/*
* HTMLFieldSetElement - DOM Level 2
*
* HTML5: 4.10.2 The fieldset element
* http://dev.w3.org/html5/spec/Overview.html#the-fieldset-element
*/
HTMLFieldSetElement = function(ownerDocument) {
HTMLLegendElement.apply(this, arguments);
};
HTMLFieldSetElement.prototype = new HTMLLegendElement();
__extend__(HTMLFieldSetElement.prototype, {
get margin(){
return this.getAttribute('margin');
},
set margin(value){
this.setAttribute('margin',value);
},
toString: function() {
return '[object HTMLFieldSetElement]';
}
});
// Named Element Support
HTMLElement.registerSetAttribute('FIELDSET', 'name',
__updateFormForNamedElement__);
/*
* HTMLFormElement - DOM Level 2
*
* HTML5: http://dev.w3.org/html5/spec/Overview.html#the-form-element
*/
HTMLFormElement = function(ownerDocument){
HTMLElement.apply(this, arguments);
//TODO: on __elementPopped__ from the parser
// we need to determine all the forms default
// values
};
HTMLFormElement.prototype = new HTMLElement();
__extend__(HTMLFormElement.prototype,{
get acceptCharset(){
return this.getAttribute('accept-charset');
},
set acceptCharset(acceptCharset) {
this.setAttribute('accept-charset', acceptCharset);
},
get action() {
return this.getAttribute('action');
},
set action(action){
this.setAttribute('action', action);
},
get enctype() {
return this.getAttribute('enctype');
},
set enctype(enctype) {
this.setAttribute('enctype', enctype);
},
get method() {
return this.getAttribute('method');
},
set method(method) {
this.setAttribute('method', method);
},
get name() {
return this.getAttribute("name");
},
set name(val) {
return this.setAttribute("name",val);
},
get target() {
return this.getAttribute("target");
},
set target(val) {
return this.setAttribute("target",val);
},
/**
* "Named Elements"
*
*/
/**
* returns HTMLFormControlsCollection
* http://dev.w3.org/html5/spec/Overview.html#dom-form-elements
*
* button fieldset input keygen object output select textarea
*/
get elements() {
var nodes = this.getElementsByTagName('*');
var alist = [];
var i, tmp;
for (i = 0; i < nodes.length; ++i) {
nodename = nodes[i].nodeName;
// would like to replace switch with something else
// since it's redundant with the SetAttribute callbacks
switch (nodes[i].nodeName) {
case 'BUTTON':
case 'FIELDSET':
case 'INPUT':
case 'KEYGEN':
case 'OBJECT':
case 'OUTPUT':
case 'SELECT':
case 'TEXTAREA':
alist.push(nodes[i]);
this[i] = nodes[i];
tmp = nodes[i].name;
if (tmp) {
this[tmp] = nodes[i];
}
tmp = nodes[i].id;
if (tmp) {
this[tmp] = nodes[i];
}
}
}
return new HTMLCollection(alist);
},
_updateElements: function() {
this.elements;
},
get length() {
return this.elements.length;
},
item: function(idx) {
return this.elements[idx];
},
namedItem: function(aname) {
return this.elements.namedItem(aname);
},
toString: function() {
return '[object HTMLFormElement]';
},
submit: function() {
//TODO: this needs to perform the form inputs serialization
// and submission
// DONE: see xhr/form.js
var event = __submit__(this);
},
reset: function() {
//TODO: this needs to reset all values specified in the form
// to those which where set as defaults
__reset__(this);
},
onsubmit: HTMLEvents.prototype.onsubmit,
onreset: HTMLEvents.prototype.onreset
});
/**
* HTMLFrameElement - DOM Level 2
*/
HTMLFrameElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
// this is normally a getter but we need to be
// able to set it to correctly emulate behavior
this.contentDocument = null;
this.contentWindow = null;
};
HTMLFrameElement.prototype = new HTMLElement();
__extend__(HTMLFrameElement.prototype, {
get frameBorder(){
return this.getAttribute('border')||"";
},
set frameBorder(value){
this.setAttribute('border', value);
},
get longDesc(){
return this.getAttribute('longdesc')||"";
},
set longDesc(value){
this.setAttribute('longdesc', value);
},
get marginHeight(){
return this.getAttribute('marginheight')||"";
},
set marginHeight(value){
this.setAttribute('marginheight', value);
},
get marginWidth(){
return this.getAttribute('marginwidth')||"";
},
set marginWidth(value){
this.setAttribute('marginwidth', value);
},
get name(){
return this.getAttribute('name')||"";
},
set name(value){
this.setAttribute('name', value);
},
get noResize(){
return this.getAttribute('noresize')||false;
},
set noResize(value){
this.setAttribute('noresize', value);
},
get scrolling(){
return this.getAttribute('scrolling')||"";
},
set scrolling(value){
this.setAttribute('scrolling', value);
},
get src(){
return this.getAttribute('src')||"";
},
set src(value){
this.setAttribute('src', value);
},
toString: function(){
return '[object HTMLFrameElement]';
},
onload: HTMLEvents.prototype.onload
});
/**
* HTMLFrameSetElement - DOM Level 2
*
* HTML5: 12.3.3 Frames
* http://dev.w3.org/html5/spec/Overview.html#frameset
*/
HTMLFrameSetElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLFrameSetElement.prototype = new HTMLElement();
__extend__(HTMLFrameSetElement.prototype, {
get cols(){
return this.getAttribute('cols');
},
set cols(value){
this.setAttribute('cols', value);
},
get rows(){
return this.getAttribute('rows');
},
set rows(value){
this.setAttribute('rows', value);
},
toString: function() {
return '[object HTMLFrameSetElement]';
}
});
/*
* HTMLHeadingElement
* HTML5: 4.4.6 The h1, h2, h3, h4, h5, and h6 elements
* http://dev.w3.org/html5/spec/Overview.html#the-h1-h2-h3-h4-h5-and-h6-elements
*/
HTMLHeadingElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLHeadingElement.prototype = new HTMLElement();
__extend__(HTMLHeadingElement.prototype, {
toString: function() {
return '[object HTMLHeadingElement]';
}
});
/**
* HTMLHeadElement - DOM Level 2
*
* HTML5: 4.2.1 The head element
* http://dev.w3.org/html5/spec/Overview.html#the-head-element-0
*/
HTMLHeadElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLHeadElement.prototype = new HTMLElement();
__extend__(HTMLHeadElement.prototype, {
get profile(){
return this.getAttribute('profile');
},
set profile(value){
this.setAttribute('profile', value);
},
//we override this so we can apply browser behavior specific to head children
//like loading scripts
appendChild : function(newChild) {
newChild = HTMLElement.prototype.appendChild.apply(this,[newChild]);
//TODO: evaluate scripts which are appended to the head
//__evalScript__(newChild);
return newChild;
},
insertBefore : function(newChild, refChild) {
newChild = HTMLElement.prototype.insertBefore.apply(this,[newChild]);
//TODO: evaluate scripts which are appended to the head
//__evalScript__(newChild);
return newChild;
},
toString: function(){
return '[object HTMLHeadElement]';
}
});
/*
* HTMLHRElement
* HTML5: 4.5.2 The hr Element
* http://dev.w3.org/html5/spec/Overview.html#the-hr-element
*/
HTMLHRElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLHRElement.prototype = new HTMLElement();
__extend__(HTMLHRElement.prototype, {
// no additional properties or elements
toString: function() {
return '[object HTMLHRElement]';
}
});
/*
* HTMLHtmlElement
* HTML5: 4.1.1 The Html Element
* http://dev.w3.org/html5/spec/Overview.html#htmlhtmlelement
*/
HTMLHtmlElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLHtmlElement.prototype = new HTMLElement();
__extend__(HTMLHtmlElement.prototype, {
// no additional properties or elements
toString: function() {
return '[object HTMLHtmlElement]';
}
});
/*
* HTMLIFrameElement - DOM Level 2
*
* HTML5: 4.8.3 The iframe element
* http://dev.w3.org/html5/spec/Overview.html#the-iframe-element
*/
HTMLIFrameElement = function(ownerDocument) {
HTMLFrameElement.apply(this, arguments);
};
HTMLIFrameElement.prototype = new HTMLFrameElement();
__extend__(HTMLIFrameElement.prototype, {
get height() {
return this.getAttribute("height") || "";
},
set height(val) {
return this.setAttribute("height",val);
},
get width() {
return this.getAttribute("width") || "";
},
set width(val) {
return this.setAttribute("width",val);
},
toString: function(){
return '[object HTMLIFrameElement]';
}
});
/**
* HTMLImageElement and Image
*/
HTMLImageElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLImageElement.prototype = new HTMLElement();
__extend__(HTMLImageElement.prototype, {
get alt(){
return this.getAttribute('alt');
},
set alt(value){
this.setAttribute('alt', value);
},
get height(){
return parseInt(this.getAttribute('height'), 10) || 0;
},
set height(value){
this.setAttribute('height', value);
},
get isMap(){
return this.hasAttribute('map');
},
set useMap(value){
this.setAttribute('map', value);
},
get longDesc(){
return this.getAttribute('longdesc');
},
set longDesc(value){
this.setAttribute('longdesc', value);
},
get name(){
return this.getAttribute('name');
},
set name(value){
this.setAttribute('name', value);
},
get src(){
return this.getAttribute('src') || '';
},
set src(value){
this.setAttribute('src', value);
},
get width(){
return parseInt(this.getAttribute('width'), 10) || 0;
},
set width(value){
this.setAttribute('width', value);
},
toString: function(){
return '[object HTMLImageElement]';
}
});
/*
* html5 4.8.1
* http://dev.w3.org/html5/spec/Overview.html#the-img-element
*/
Image = function(width, height) {
// Not sure if "[global].document" satifies this requirement:
// "The element's document must be the active document of the
// browsing context of the Window object on which the interface
// object of the invoked constructor is found."
HTMLElement.apply(this, [document]);
// Note: firefox will throw an error if the width/height
// is not an integer. Safari just converts to 0 on error.
this.width = parseInt(width, 10) || 0;
this.height = parseInt(height, 10) || 0;
this.nodeName = 'IMG';
};
Image.prototype = new HTMLImageElement();
/*
* Image.src attribute events.
*
* Not sure where this should live... in events/img.js? in parser/img.js?
* Split out to make it easy to move.
*/
/**
* HTMLImageElement && Image are a bit odd in that the 'src' attribute
* is 'active' -- changing it triggers loading of the image from the
* network.
*
* This can occur by
* - Directly setting the Image.src =
* - Using one of the Element.setAttributeXXX methods
* - Node.importNode an image
* - The initial creation and parsing of an <img> tag
*
* __onImageRequest__ is a function that handles eventing
* and dispatches to a user-callback.
*
*/
__loadImage__ = function(node, value) {
var event;
if (value && (!Envjs.loadImage ||
(Envjs.loadImage &&
Envjs.loadImage(node, value)))) {
// value has to be something (easy)
// if the user-land API doesn't exist
// Or if the API exists and it returns true, then ok:
event = document.createEvent('Events');
event.initEvent('load');
} else {
// oops
event = document.createEvent('Events');
event.initEvent('error');
}
node.dispatchEvent(event, false);
};
__extend__(HTMLImageElement.prototype, {
onload: function(event){
__eval__(this.getAttribute('onload') || '', this);
}
});
/*
* Image Loading
*
* The difference between "owner.parsing" and "owner.fragment"
*
* If owner.parsing === true, then during the html5 parsing then,
* __elementPopped__ is called when a compete tag (with attrs and
* children) is full parsed and added the DOM.
*
* For images, __elementPopped__ is called with everything the
* tag has. which in turn looks for a "src" attr and calls
* __loadImage__
*
* If owner.parser === false (or non-existant), then we are not in
* a parsing step. For images, perhaps someone directly modified
* a 'src' attribute of an existing image.
*
* 'innerHTML' is tricky since we first create a "fake document",
* parse it, then import the right parts. This may call
* img.setAttributeNS twice. once during the parse and once
* during the clone of the node. We want event to trigger on the
* later and not during th fake doco. "owner.fragment" is set by
* the fake doco parser to indicate that events should not be
* triggered on this.
*
* We coud make 'owner.parser' == [ 'none', 'full', 'fragment']
* and just use one variable That was not done since the patch is
* quite large as is.
*
* This same problem occurs with scripts. innerHTML oddly does
* not eval any <script> tags inside.
*/
HTMLElement.registerSetAttribute('IMG', 'src', function(node, value) {
var owner = node.ownerDocument;
if (!owner.parsing && !owner.fragment) {
__loadImage__(node, value);
}
});
/**
* HTMLInputElement
*
* HTML5: 4.10.5 The input element
* http://dev.w3.org/html5/spec/Overview.html#the-input-element
*/
HTMLInputElement = function(ownerDocument) {
HTMLInputAreaCommon.apply(this, arguments);
this._dirty = false;
this._checked = null;
this._value = null;
};
HTMLInputElement.prototype = new HTMLInputAreaCommon();
__extend__(HTMLInputElement.prototype, {
get alt(){
return this.getAttribute('alt') || '';
},
set alt(value){
this.setAttribute('alt', value);
},
/**
* 'checked' returns state, NOT the value of the attribute
*/
get checked(){
if (this._checked === null) {
this._checked = this.defaultChecked;
}
return this._checked;
},
set checked(value){
// force to boolean value
this._checked = (value) ? true : false;
},
/**
* 'defaultChecked' actually reflects if the 'checked' attribute
* is present or not
*/
get defaultChecked(){
return this.hasAttribute('checked');
},
set defaultChecked(val){
if (val) {
this.setAttribute('checked', '');
} else {
if (this.defaultChecked) {
this.removeAttribute('checked');
}
}
},
get defaultValue() {
return this.getAttribute('value') || '';
},
set defaultValue(value) {
this._dirty = true;
this.setAttribute('value', value);
},
get value() {
return (this._value === null) ? this.defaultValue : this._value;
},
set value(newvalue) {
this._value = newvalue;
},
/**
* Height is a string
*/
get height(){
// spec says it is a string
return this.getAttribute('height') || '';
},
set height(value){
this.setAttribute('height',value);
},
/**
* MaxLength is a number
*/
get maxLength(){
return Number(this.getAttribute('maxlength')||'-1');
},
set maxLength(value){
this.setAttribute('maxlength', value);
},
/**
* Src is a URL string
*/
get src(){
return this.getAttribute('src') || '';
},
set src(value){
// TODO: make absolute any relative URLS
this.setAttribute('src', value);
},
get type() {
return this.getAttribute('type') || 'text';
},
set type(value) {
this.setAttribute('type', value);
},
get useMap(){
return this.getAttribute('map') || '';
},
/**
* Width: spec says it is a string
*/
get width(){
return this.getAttribute('width') || '';
},
set width(value){
this.setAttribute('width',value);
},
click:function(){
__click__(this);
},
toString: function() {
return '[object HTMLInputElement]';
}
});
//http://dev.w3.org/html5/spec/Overview.html#dom-input-value
// if someone directly modifies the value attribute, then the input's value
// also directly changes.
HTMLElement.registerSetAttribute('INPUT', 'value', function(node, value) {
if (!node._dirty) {
node._value = value;
node._dirty = true;
}
});
/*
*The checked content attribute is a boolean attribute that gives the
*default checkedness of the input element. When the checked content
*attribute is added, if the control does not have dirty checkedness,
*the user agent must set the checkedness of the element to true; when
*the checked content attribute is removed, if the control does not
*have dirty checkedness, the user agent must set the checkedness of
*the element to false.
*/
// Named Element Support
HTMLElement.registerSetAttribute('INPUT', 'name',
__updateFormForNamedElement__);
/**
* HTMLLabelElement - DOM Level 2
* HTML5 4.10.4 The label element
* http://dev.w3.org/html5/spec/Overview.html#the-label-element
*/
HTMLLabelElement = function(ownerDocument) {
HTMLInputCommon.apply(this, arguments);
};
HTMLLabelElement.prototype = new HTMLInputCommon();
__extend__(HTMLLabelElement.prototype, inputElements_dataProperties);
__extend__(HTMLLabelElement.prototype, {
get htmlFor() {
return this.getAttribute('for');
},
set htmlFor(value) {
this.setAttribute('for',value);
},
get dataFormatAs() {
return this.getAttribute('dataFormatAs');
},
set dataFormatAs(value) {
this.setAttribute('dataFormatAs',value);
},
toString: function() {
return '[object HTMLLabelElement]';
}
});
/*
* HTMLLIElement
* HTML5: 4.5.8 The li Element
* http://dev.w3.org/html5/spec/Overview.html#the-li-element
*/
HTMLLIElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLLIElement.prototype = new HTMLElement();
__extend__(HTMLLIElement.prototype, {
// TODO: attribute long value;
toString: function() {
return '[object HTMLLIElement]';
}
});
/*
* HTMLLinkElement - DOM Level 2
*
* HTML5: 4.8.12 The map element
* http://dev.w3.org/html5/spec/Overview.html#the-map-element
*/
HTMLLinkElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLLinkElement.prototype = new HTMLElement();
__extend__(HTMLLinkElement.prototype, {
get disabled(){
return this.getAttribute('disabled');
},
set disabled(value){
this.setAttribute('disabled',value);
},
get charset(){
return this.getAttribute('charset');
},
set charset(value){
this.setAttribute('charset',value);
},
get href(){
return this.getAttribute('href');
},
set href(value){
this.setAttribute('href',value);
},
get hreflang(){
return this.getAttribute('hreflang');
},
set hreflang(value){
this.setAttribute('hreflang',value);
},
get media(){
return this.getAttribute('media');
},
set media(value){
this.setAttribute('media',value);
},
get rel(){
return this.getAttribute('rel');
},
set rel(value){
this.setAttribute('rel',value);
},
get rev(){
return this.getAttribute('rev');
},
set rev(value){
this.setAttribute('rev',value);
},
get target(){
return this.getAttribute('target');
},
set target(value){
this.setAttribute('target',value);
},
get type(){
return this.getAttribute('type');
},
set type(value){
this.setAttribute('type',value);
},
toString: function() {
return '[object HTMLLinkElement]';
}
});
__loadLink__ = function(node, value) {
var event;
var owner = node.ownerDocument;
if (owner.fragment) {
/**
* if we are in an innerHTML fragment parsing step
* then ignore. It will be handled once the fragment is
* added to the real doco
*/
return;
}
if (node.parentNode === null) {
/*
* if a <link> is parentless (normally by create a new link
* via document.createElement('link'), then do *not* fire an
* event, even if it has a valid 'href' attribute.
*/
return;
}
if (value != '' && (!Envjs.loadLink ||
(Envjs.loadLink &&
Envjs.loadLink(node, value)))) {
// value has to be something (easy)
// if the user-land API doesn't exist
// Or if the API exists and it returns true, then ok:
event = document.createEvent('Events');
event.initEvent('load');
} else {
// oops
event = document.createEvent('Events');
event.initEvent('error');
}
node.dispatchEvent(event, false);
};
HTMLElement.registerSetAttribute('LINK', 'href', function(node, value) {
__loadLink__(node, value);
});
/**
* Event stuff, not sure where it goes
*/
__extend__(HTMLLinkElement.prototype, {
onload: function(event){
__eval__(this.getAttribute('onload')||'', this);
},
});
/**
* HTMLMapElement
*
* 4.8.12 The map element
* http://dev.w3.org/html5/spec/Overview.html#the-map-element
*/
HTMLMapElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLMapElement.prototype = new HTMLElement();
__extend__(HTMLMapElement.prototype, {
get areas(){
return this.getElementsByTagName('area');
},
get name(){
return this.getAttribute('name') || '';
},
set name(value){
this.setAttribute('name',value);
},
toString: function() {
return '[object HTMLMapElement]';
}
});
/**
* HTMLMetaElement - DOM Level 2
* HTML5: 4.2.5 The meta element
* http://dev.w3.org/html5/spec/Overview.html#meta
*/
HTMLMetaElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLMetaElement.prototype = new HTMLElement();
__extend__(HTMLMetaElement.prototype, {
get content() {
return this.getAttribute('content') || '';
},
set content(value){
this.setAttribute('content',value);
},
get httpEquiv(){
return this.getAttribute('http-equiv') || '';
},
set httpEquiv(value){
this.setAttribute('http-equiv',value);
},
get name(){
return this.getAttribute('name') || '';
},
set name(value){
this.setAttribute('name',value);
},
get scheme(){
return this.getAttribute('scheme');
},
set scheme(value){
this.setAttribute('scheme',value);
},
toString: function() {
return '[object HTMLMetaElement]';
}
});
/**
* HTMLObjectElement - DOM Level 2
* HTML5: 4.8.5 The object element
* http://dev.w3.org/html5/spec/Overview.html#the-object-element
*/
HTMLObjectElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLObjectElement.prototype = new HTMLElement();
__extend__(HTMLObjectElement.prototype, {
get code(){
return this.getAttribute('code');
},
set code(value){
this.setAttribute('code',value);
},
get archive(){
return this.getAttribute('archive');
},
set archive(value){
this.setAttribute('archive',value);
},
get codeBase(){
return this.getAttribute('codebase');
},
set codeBase(value){
this.setAttribute('codebase',value);
},
get codeType(){
return this.getAttribute('codetype');
},
set codeType(value){
this.setAttribute('codetype',value);
},
get data(){
return this.getAttribute('data');
},
set data(value){
this.setAttribute('data',value);
},
get declare(){
return this.getAttribute('declare');
},
set declare(value){
this.setAttribute('declare',value);
},
get height(){
return this.getAttribute('height');
},
set height(value){
this.setAttribute('height',value);
},
get standby(){
return this.getAttribute('standby');
},
set standby(value){
this.setAttribute('standby',value);
},
/*get tabIndex(){
return this.getAttribute('tabindex');
},
set tabIndex(value){
this.setAttribute('tabindex',value);
},*/
get type(){
return this.getAttribute('type');
},
set type(value){
this.setAttribute('type',value);
},
get useMap(){
return this.getAttribute('usemap');
},
set useMap(value){
this.setAttribute('usemap',value);
},
get width(){
return this.getAttribute('width');
},
set width(value){
this.setAttribute('width',value);
},
get contentDocument(){
return this.ownerDocument;
},
toString: function() {
return '[object HTMLObjectElement]';
}
});
// Named Element Support
HTMLElement.registerSetAttribute('OBJECT', 'name',
__updateFormForNamedElement__);
/*
* HTMLOListElement
* HTML5: 4.5.6 The ol Element
* http://dev.w3.org/html5/spec/Overview.html#the-ol-element
*/
HTMLOListElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLOListElement.prototype = new HTMLElement();
__extend__(HTMLOListElement.prototype, {
// TODO: attribute boolean reversed;
// TODO: attribute long start;
toString: function() {
return '[object HTMLOListElement]';
}
});
/**
* HTMLOptGroupElement - DOM Level 2
* HTML 5: 4.10.9 The optgroup element
* http://dev.w3.org/html5/spec/Overview.html#the-optgroup-element
*/
HTMLOptGroupElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLOptGroupElement.prototype = new HTMLElement();
__extend__(HTMLOptGroupElement.prototype, {
get disabled(){
return this.getAttribute('disabled');
},
set disabled(value){
this.setAttribute('disabled',value);
},
get label(){
return this.getAttribute('label');
},
set label(value){
this.setAttribute('label',value);
},
appendChild: function(node){
var i,
length,
selected = false;
//make sure at least one is selected by default
if(node.nodeType === Node.ELEMENT_NODE && node.tagName === 'OPTION'){
length = this.childNodes.length;
for(i=0;i<length;i++){
if(this.childNodes[i].nodeType === Node.ELEMENT_NODE &&
this.childNodes[i].tagName === 'OPTION'){
//check if it is selected
if(this.selected){
selected = true;
break;
}
}
}
if(!selected){
node.selected = true;
this.value = node.value?node.value:'';
}
}
return HTMLElement.prototype.appendChild.apply(this, [node]);
},
toString: function() {
return '[object HTMLOptGroupElement]';
}
});
/**
* HTMLOptionElement, Option
* HTML5: 4.10.10 The option element
* http://dev.w3.org/html5/spec/Overview.html#the-option-element
*/
HTMLOptionElement = function(ownerDocument) {
HTMLInputCommon.apply(this, arguments);
this._selected = null;
};
HTMLOptionElement.prototype = new HTMLInputCommon();
__extend__(HTMLOptionElement.prototype, {
/**
* defaultSelected actually reflects the presence of the
* 'selected' attribute.
*/
get defaultSelected() {
return this.hasAttribute('selected');
},
set defaultSelected(value) {
if (value) {
this.setAttribute('selected','');
} else {
if (this.hasAttribute('selected')) {
this.removeAttribute('selected');
}
}
},
/*
* HTML5: The form IDL attribute's behavior depends on whether the
* option element is in a select element or not. If the option has
* a select element as its parent, or has a colgroup element as
* its parent and that colgroup element has a select element as
* its parent, then the form IDL attribute must return the same
* value as the form IDL attribute on that select
* element. Otherwise, it must return null.
*/
_selectparent: function() {
var parent = this.parentNode;
if (!parent) {
return null;
}
if (parent.tagName === 'SELECT') {
return parent;
}
if (parent.tagName === 'COLGROUP') {
parent = parent.parentNode;
if (parent && parent.tagName === 'SELECT') {
return parent;
}
}
},
_updateoptions: function() {
var parent = this._selectparent();
if (parent) {
// has side effects and updates owner select's options
parent.options;
}
},
get form() {
var parent = this._selectparent();
return parent ? parent.form : null;
},
get index() {
var options, i;
if (! this.parentNode) {
return -1;
}
options = this.parentNode.options;
for (i=0; i < options.length; ++i) {
if (this === options[i]) {
return i;
}
}
return 0;
},
get label() {
return this.getAttribute('label');
},
set label(value) {
this.setAttribute('label', value);
},
/*
* This is not in the spec, but safari and firefox both
* use this
*/
get name() {
return this.getAttribute('name');
},
set name(value) {
this.setAttribute('name', value);
},
/**
*
*/
get selected() {
// if disabled, return false, no matter what
if (this.disabled) {
return false;
}
if (this._selected === null) {
return this.defaultSelected;
}
return this._selected;
},
set selected(value) {
this._selected = (value) ? true : false;
},
get text() {
var val = this.nodeValue;
return (val === null || this.value === undefined) ?
this.innerHTML :
val;
},
get value() {
var val = this.getAttribute('value');
return (val === null || val === undefined) ?
this.textContent :
val;
},
set value(value) {
this.setAttribute('value', value);
},
toString: function() {
return '[object HTMLOptionElement]';
}
});
Option = function(text, value, defaultSelected, selected) {
// Not sure if this is correct:
//
// The element's document must be the active document of the
// browsing context of the Window object on which the interface
// object of the invoked constructor is found.
HTMLOptionElement.apply(this, [document]);
this.nodeName = 'OPTION';
if (arguments.length >= 1) {
this.appendChild(document.createTextNode('' + text));
}
if (arguments.length >= 2) {
this.value = value;
}
if (arguments.length >= 3) {
if (defaultSelected) {
this.defaultSelected = '';
}
}
if (arguments.length >= 4) {
this.selected = (selected) ? true : false;
}
};
Option.prototype = new HTMLOptionElement();
// Named Element Support
function updater(node, value) {
node._updateoptions();
}
HTMLElement.registerSetAttribute('OPTION', 'name', updater);
HTMLElement.registerSetAttribute('OPTION', 'id', updater);
/*
* HTMLParagraphElement - DOM Level 2
*/
HTMLParagraphElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLParagraphElement.prototype = new HTMLElement();
__extend__(HTMLParagraphElement.prototype, {
toString: function(){
return '[object HTMLParagraphElement]';
}
});
/**
* HTMLParamElement
*
* HTML5: 4.8.6 The param element
* http://dev.w3.org/html5/spec/Overview.html#the-param-element
*/
HTMLParamElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLParamElement.prototype = new HTMLElement();
__extend__(HTMLParamElement.prototype, {
get name() {
return this.getAttribute('name') || '';
},
set name(value) {
this.setAttribute('name', value);
},
get type(){
return this.getAttribute('type');
},
set type(value){
this.setAttribute('type',value);
},
get value(){
return this.getAttribute('value');
},
set value(value){
this.setAttribute('value',value);
},
get valueType(){
return this.getAttribute('valuetype');
},
set valueType(value){
this.setAttribute('valuetype',value);
},
toString: function() {
return '[object HTMLParamElement]';
}
});
/**
* HTMLScriptElement - DOM Level 2
*
* HTML5: 4.3.1 The script element
* http://dev.w3.org/html5/spec/Overview.html#script
*/
HTMLScriptElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLScriptElement.prototype = new HTMLElement();
__extend__(HTMLScriptElement.prototype, {
/**
* HTML5 spec @ http://dev.w3.org/html5/spec/Overview.html#script
*
* "The IDL attribute text must return a concatenation of the
* contents of all the text nodes that are direct children of the
* script element (ignoring any other nodes such as comments or
* elements), in tree order. On setting, it must act the same way
* as the textContent IDL attribute."
*
* AND... "The term text node refers to any Text node,
* including CDATASection nodes; specifically, any Node with node
* type TEXT_NODE (3) or CDATA_SECTION_NODE (4)"
*/
get text() {
var kids = this.childNodes;
var kid;
var s = '';
var imax = kids.length;
for (var i = 0; i < imax; ++i) {
kid = kids[i];
if (kid.nodeType === Node.TEXT_NODE ||
kid.nodeType === Node.CDATA_SECTION_NODE) {
s += kid.nodeValue;
}
}
return s;
},
/**
* HTML5 spec "Can be set, to replace the element's children with
* the given value."
*/
set text(value) {
// this deletes all children, and make a new single text node
// with value
this.textContent = value;
/* Currently we always execute, but this isn't quite right if
* the node has *not* been inserted into the document, then it
* should *not* fire. The more detailed answer from the spec:
*
* When a script element that is neither marked as having
* "already started" nor marked as being "parser-inserted"
* experiences one of the events listed in the following list,
* the user agent must synchronously run the script element:
*
* * The script element gets inserted into a document.
* * The script element is in a Document and its child nodes
* are changed.
* * The script element is in a Document and has a src
* attribute set where previously the element had no such
* attribute.
*
* And no doubt there are other cases as well.
*/
Envjs.loadInlineScript(this);
},
get htmlFor(){
return this.getAttribute('for');
},
set htmlFor(value){
this.setAttribute('for',value);
},
get event(){
return this.getAttribute('event');
},
set event(value){
this.setAttribute('event',value);
},
get charset(){
return this.getAttribute('charset');
},
set charset(value){
this.setAttribute('charset',value);
},
get defer(){
return this.getAttribute('defer');
},
set defer(value){
this.setAttribute('defer',value);
},
get src(){
return this.getAttribute('src')||'';
},
set src(value){
this.setAttribute('src',value);
},
get type(){
return this.getAttribute('type')||'';
},
set type(value){
this.setAttribute('type',value);
},
onload: HTMLEvents.prototype.onload,
onerror: HTMLEvents.prototype.onerror,
toString: function() {
return '[object HTMLScriptElement]';
}
});
/**
* HTMLSelectElement
* HTML5: http://dev.w3.org/html5/spec/Overview.html#the-select-element
*/
HTMLSelectElement = function(ownerDocument) {
HTMLTypeValueInputs.apply(this, arguments);
this._oldIndex = -1;
};
HTMLSelectElement.prototype = new HTMLTypeValueInputs();
__extend__(HTMLSelectElement.prototype, inputElements_dataProperties);
__extend__(HTMLButtonElement.prototype, inputElements_size);
__extend__(HTMLSelectElement.prototype, inputElements_onchange);
__extend__(HTMLSelectElement.prototype, inputElements_focusEvents);
__extend__(HTMLSelectElement.prototype, {
get value() {
var index = this.selectedIndex;
return (index === -1) ? '' : this.options[index].value;
},
set value(newValue) {
var options = this.options;
var imax = options.length;
for (var i=0; i< imax; ++i) {
if (options[i].value == newValue) {
this.setAttribute('value', newValue);
this.selectedIndex = i;
return;
}
}
},
get multiple() {
return this.hasAttribute('multiple');
},
set multiple(value) {
if (value) {
this.setAttribute('multiple', '');
} else {
if (this.hasAttribute('multiple')) {
this.removeAttribute('multiple');
}
}
},
// Returns HTMLOptionsCollection
get options() {
var nodes = this.getElementsByTagName('option');
var alist = [];
var i, tmp;
for (i = 0; i < nodes.length; ++i) {
alist.push(nodes[i]);
this[i] = nodes[i];
tmp = nodes[i].name;
if (tmp) {
this[tmp] = nodes[i];
}
tmp = nodes[i].id;
if (tmp) {
this[tmp] = nodes[i];
}
}
return new HTMLCollection(alist);
},
get length() {
return this.options.length;
},
item: function(idx) {
return this.options[idx];
},
namedItem: function(aname) {
return this.options[aname];
},
get selectedIndex() {
var options = this.options;
var imax = options.length;
for (var i=0; i < imax; ++i) {
if (options[i].selected) {
//console.log('select get selectedIndex %s', i);
return i;
}
}
//console.log('select get selectedIndex %s', -1);
return -1;
},
set selectedIndex(value) {
var options = this.options;
var num = Number(value);
var imax = options.length;
for (var i = 0; i < imax; ++i) {
options[i].selected = (i === num);
}
},
get type() {
return this.multiple ? 'select-multiple' : 'select-one';
},
add: function(element, before) {
this.appendChild(element);
//__add__(this);
},
remove: function() {
__remove__(this);
},
toString: function() {
return '[object HTMLSelectElement]';
}
});
// Named Element Support
HTMLElement.registerSetAttribute('SELECT', 'name',
__updateFormForNamedElement__);
/**
* HTML 5: 4.6.22 The span element
* http://dev.w3.org/html5/spec/Overview.html#the-span-element
*
*/
HTMLSpanElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLSpanElement.prototype = new HTMLElement();
__extend__(HTMLSpanElement.prototype, {
toString: function(){
return '[object HTMLSpanElement]';
}
});
/**
* HTMLStyleElement - DOM Level 2
* HTML5 4.2.6 The style element
* http://dev.w3.org/html5/spec/Overview.html#the-style-element
*/
HTMLStyleElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLStyleElement.prototype = new HTMLElement();
__extend__(HTMLStyleElement.prototype, {
get disabled(){
return this.getAttribute('disabled');
},
set disabled(value){
this.setAttribute('disabled',value);
},
get media(){
return this.getAttribute('media');
},
set media(value){
this.setAttribute('media',value);
},
get type(){
return this.getAttribute('type');
},
set type(value){
this.setAttribute('type',value);
},
toString: function() {
return '[object HTMLStyleElement]';
}
});
/**
* HTMLTableElement - DOM Level 2
* Implementation Provided by Steven Wood
*
* HTML5: 4.9.1 The table element
* http://dev.w3.org/html5/spec/Overview.html#the-table-element
*/
HTMLTableElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLTableElement.prototype = new HTMLElement();
__extend__(HTMLTableElement.prototype, {
get tFoot() {
//tFoot returns the table footer.
return this.getElementsByTagName("tfoot")[0];
},
createTFoot : function () {
var tFoot = this.tFoot;
if (!tFoot) {
tFoot = document.createElement("tfoot");
this.appendChild(tFoot);
}
return tFoot;
},
deleteTFoot : function () {
var foot = this.tFoot;
if (foot) {
foot.parentNode.removeChild(foot);
}
},
get tHead() {
//tHead returns the table head.
return this.getElementsByTagName("thead")[0];
},
createTHead : function () {
var tHead = this.tHead;
if (!tHead) {
tHead = document.createElement("thead");
this.insertBefore(tHead, this.firstChild);
}
return tHead;
},
deleteTHead : function () {
var head = this.tHead;
if (head) {
head.parentNode.removeChild(head);
}
},
/*appendChild : function (child) {
var tagName;
if(child&&child.nodeType==Node.ELEMENT_NODE){
tagName = child.tagName.toLowerCase();
if (tagName === "tr") {
// need an implcit <tbody> to contain this...
if (!this.currentBody) {
this.currentBody = document.createElement("tbody");
Node.prototype.appendChild.apply(this, [this.currentBody]);
}
return this.currentBody.appendChild(child);
} else if (tagName === "tbody" || tagName === "tfoot" && this.currentBody) {
this.currentBody = child;
return Node.prototype.appendChild.apply(this, arguments);
} else {
return Node.prototype.appendChild.apply(this, arguments);
}
}else{
//tables can still have text node from white space
return Node.prototype.appendChild.apply(this, arguments);
}
},*/
get tBodies() {
return new HTMLCollection(this.getElementsByTagName("tbody"));
},
get rows() {
return new HTMLCollection(this.getElementsByTagName("tr"));
},
insertRow : function (idx) {
if (idx === undefined) {
throw new Error("Index omitted in call to HTMLTableElement.insertRow ");
}
var rows = this.rows,
numRows = rows.length,
node,
inserted,
lastRow;
if (idx > numRows) {
throw new Error("Index > rows.length in call to HTMLTableElement.insertRow");
}
inserted = document.createElement("tr");
// If index is -1 or equal to the number of rows,
// the row is appended as the last row. If index is omitted
// or greater than the number of rows, an error will result
if (idx === -1 || idx === numRows) {
this.appendChild(inserted);
} else {
rows[idx].parentNode.insertBefore(inserted, rows[idx]);
}
return inserted;
},
deleteRow : function (idx) {
var elem = this.rows[idx];
elem.parentNode.removeChild(elem);
},
get summary() {
return this.getAttribute("summary");
},
set summary(summary) {
this.setAttribute("summary", summary);
},
get align() {
return this.getAttribute("align");
},
set align(align) {
this.setAttribute("align", align);
},
get bgColor() {
return this.getAttribute("bgColor");
},
set bgColor(bgColor) {
return this.setAttribute("bgColor", bgColor);
},
get cellPadding() {
return this.getAttribute("cellPadding");
},
set cellPadding(cellPadding) {
return this.setAttribute("cellPadding", cellPadding);
},
get cellSpacing() {
return this.getAttribute("cellSpacing");
},
set cellSpacing(cellSpacing) {
this.setAttribute("cellSpacing", cellSpacing);
},
get frame() {
return this.getAttribute("frame");
},
set frame(frame) {
this.setAttribute("frame", frame);
},
get rules() {
return this.getAttribute("rules");
},
set rules(rules) {
this.setAttribute("rules", rules);
},
get width() {
return this.getAttribute("width");
},
set width(width) {
this.setAttribute("width", width);
},
toString: function() {
return '[object HTMLTableElement]';
}
});
/*
* HTMLxElement - DOM Level 2
* - Contributed by Steven Wood
*
* HTML5: 4.9.5 The tbody element
* http://dev.w3.org/html5/spec/Overview.html#the-tbody-element
* http://dev.w3.org/html5/spec/Overview.html#htmltablesectionelement
*/
HTMLTableSectionElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLTableSectionElement.prototype = new HTMLElement();
__extend__(HTMLTableSectionElement.prototype, {
/*appendChild : function (child) {
// disallow nesting of these elements.
if (child.tagName.match(/TBODY|TFOOT|THEAD/)) {
return this.parentNode.appendChild(child);
} else {
return Node.prototype.appendChild.apply(this, arguments);
}
},*/
get align() {
return this.getAttribute("align");
},
get ch() {
return this.getAttribute("ch");
},
set ch(ch) {
this.setAttribute("ch", ch);
},
// ch gets or sets the alignment character for cells in a column.
set chOff(chOff) {
this.setAttribute("chOff", chOff);
},
get chOff() {
return this.getAttribute("chOff");
},
get vAlign () {
return this.getAttribute("vAlign");
},
get rows() {
return new HTMLCollection(this.getElementsByTagName("tr"));
},
insertRow : function (idx) {
if (idx === undefined) {
throw new Error("Index omitted in call to HTMLTableSectionElement.insertRow ");
}
var numRows = this.rows.length,
node = null;
if (idx > numRows) {
throw new Error("Index > rows.length in call to HTMLTableSectionElement.insertRow");
}
var row = document.createElement("tr");
// If index is -1 or equal to the number of rows,
// the row is appended as the last row. If index is omitted
// or greater than the number of rows, an error will result
if (idx === -1 || idx === numRows) {
this.appendChild(row);
} else {
node = this.firstChild;
for (var i=0; i<idx; i++) {
node = node.nextSibling;
}
}
this.insertBefore(row, node);
return row;
},
deleteRow : function (idx) {
var elem = this.rows[idx];
this.removeChild(elem);
},
toString: function() {
return '[object HTMLTableSectionElement]';
}
});
/**
* HTMLTableCellElement
* base interface for TD and TH
*
* HTML5: 4.9.11 Attributes common to td and th elements
* http://dev.w3.org/html5/spec/Overview.html#htmltablecellelement
*/
HTMLTableCellElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLTableCellElement.prototype = new HTMLElement();
__extend__(HTMLTableCellElement.prototype, {
// TOOD: attribute unsigned long colSpan;
// TODO: attribute unsigned long rowSpan;
// TODO: attribute DOMString headers;
// TODO: readonly attribute long cellIndex;
// Not really necessary but might be helpful in debugging
toString: function() {
return '[object HTMLTableCellElement]';
}
});
/**
* HTMLTableDataCellElement
* HTML5: 4.9.9 The td Element
* http://dev.w3.org/html5/spec/Overview.html#the-td-element
*/
HTMLTableDataCellElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLTableDataCellElement.prototype = new HTMLTableCellElement();
__extend__(HTMLTableDataCellElement.prototype, {
// adds no new properties or methods
toString: function() {
return '[object HTMLTableDataCellElement]';
}
});
/**
* HTMLTableHeaderCellElement
* HTML5: 4.9.10 The th Element
* http://dev.w3.org/html5/spec/Overview.html#the-th-element
*/
HTMLTableHeaderCellElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLTableHeaderCellElement.prototype = new HTMLTableCellElement();
__extend__(HTMLTableHeaderCellElement.prototype, {
// TODO: attribute DOMString scope
toString: function() {
return '[object HTMLTableHeaderCellElement]';
}
});
/**
* HTMLTextAreaElement - DOM Level 2
* HTML5: 4.10.11 The textarea element
* http://dev.w3.org/html5/spec/Overview.html#the-textarea-element
*/
HTMLTextAreaElement = function(ownerDocument) {
HTMLInputAreaCommon.apply(this, arguments);
this._rawvalue = null;
};
HTMLTextAreaElement.prototype = new HTMLInputAreaCommon();
__extend__(HTMLTextAreaElement.prototype, {
get cols(){
return Number(this.getAttribute('cols')||'-1');
},
set cols(value){
this.setAttribute('cols', value);
},
get rows(){
return Number(this.getAttribute('rows')||'-1');
},
set rows(value){
this.setAttribute('rows', value);
},
/*
* read-only
*/
get type() {
return this.getAttribute('type') || 'textarea';
},
/**
* This modifies the text node under the widget
*/
get defaultValue() {
return this.textContent;
},
set defaultValue(value) {
this.textContent = value;
},
/**
* http://dev.w3.org/html5/spec/Overview.html#concept-textarea-raw-value
*/
get value() {
return (this._rawvalue === null) ? this.defaultValue : this._rawvalue;
},
set value(value) {
this._rawvalue = value;
},
toString: function() {
return '[object HTMLTextAreaElement]';
}
});
// Named Element Support
HTMLElement.registerSetAttribute('TEXTAREA', 'name',
__updateFormForNamedElement__);
/**
* HTMLTitleElement - DOM Level 2
*
* HTML5: 4.2.2 The title element
* http://dev.w3.org/html5/spec/Overview.html#the-title-element-0
*/
HTMLTitleElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLTitleElement.prototype = new HTMLElement();
__extend__(HTMLTitleElement.prototype, {
get text() {
return this.innerText;
},
set text(titleStr) {
this.textContent = titleStr;
},
toString: function() {
return '[object HTMLTitleElement]';
}
});
/**
* HTMLRowElement - DOM Level 2
* Implementation Provided by Steven Wood
*
* HTML5: 4.9.8 The tr element
* http://dev.w3.org/html5/spec/Overview.html#the-tr-element
*/
HTMLTableRowElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLTableRowElement.prototype = new HTMLElement();
__extend__(HTMLTableRowElement.prototype, {
/*appendChild : function (child) {
var retVal = Node.prototype.appendChild.apply(this, arguments);
retVal.cellIndex = this.cells.length -1;
return retVal;
},*/
// align gets or sets the horizontal alignment of data within cells of the row.
get align() {
return this.getAttribute("align");
},
get bgColor() {
return this.getAttribute("bgcolor");
},
get cells() {
var nl = this.getElementsByTagName("td");
return new HTMLCollection(nl);
},
get ch() {
return this.getAttribute("ch");
},
set ch(ch) {
this.setAttribute("ch", ch);
},
// ch gets or sets the alignment character for cells in a column.
set chOff(chOff) {
this.setAttribute("chOff", chOff);
},
get chOff() {
return this.getAttribute("chOff");
},
/**
* http://dev.w3.org/html5/spec/Overview.html#dom-tr-rowindex
*/
get rowIndex() {
var nl = this.parentNode.childNodes;
for (var i=0; i<nl.length; i++) {
if (nl[i] === this) {
return i;
}
}
return -1;
},
/**
* http://dev.w3.org/html5/spec/Overview.html#dom-tr-sectionrowindex
*/
get sectionRowIndex() {
var nl = this.parentNode.getElementsByTagName(this.tagName);
for (var i=0; i<nl.length; i++) {
if (nl[i] === this) {
return i;
}
}
return -1;
},
get vAlign () {
return this.getAttribute("vAlign");
},
insertCell : function (idx) {
if (idx === undefined) {
throw new Error("Index omitted in call to HTMLTableRow.insertCell");
}
var numCells = this.cells.length,
node = null;
if (idx > numCells) {
throw new Error("Index > rows.length in call to HTMLTableRow.insertCell");
}
var cell = document.createElement("td");
if (idx === -1 || idx === numCells) {
this.appendChild(cell);
} else {
node = this.firstChild;
for (var i=0; i<idx; i++) {
node = node.nextSibling;
}
}
this.insertBefore(cell, node);
cell.cellIndex = idx;
return cell;
},
deleteCell : function (idx) {
var elem = this.cells[idx];
this.removeChild(elem);
},
toString: function() {
return '[object HTMLTableRowElement]';
}
});
/*
* HTMLUListElement
* HTML5: 4.5.7 The ul Element
* http://dev.w3.org/html5/spec/Overview.html#htmlhtmlelement
*/
HTMLUListElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLUListElement.prototype = new HTMLElement();
__extend__(HTMLUListElement.prototype, {
// no additional properties or elements
toString: function() {
return '[object HTMLUListElement]';
}
});
/**
* HTMLUnknownElement DOM Level 2
*/
HTMLUnknownElement = function(ownerDocument) {
HTMLElement.apply(this, arguments);
};
HTMLUnknownElement.prototype = new HTMLElement();
__extend__(HTMLUnknownElement.prototype,{
toString: function(){
return '[object HTMLUnknownElement]';
}
});
/**
* @author john resig & the envjs team
* @uri http://www.envjs.com/
* @copyright 2008-2010
* @license MIT
*/
//CLOSURE_END
}());
/**
* DOM Style Level 2
*/
var CSS2Properties,
CSSRule,
CSSStyleRule,
CSSImportRule,
CSSMediaRule,
CSSFontFaceRule,
CSSPageRule,
CSSRuleList,
CSSStyleSheet,
StyleSheet,
StyleSheetList;
;
/*
* Envjs css.1.2.13
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*/
//CLOSURE_START
(function(){
/**
* @author john resig
*/
// Helper method for extending one object with another.
function __extend__(a,b) {
for ( var i in b ) {
var g = b.__lookupGetter__(i), s = b.__lookupSetter__(i);
if ( g || s ) {
if ( g ) { a.__defineGetter__(i, g); }
if ( s ) { a.__defineSetter__(i, s); }
} else {
a[i] = b[i];
}
} return a;
}
/**
* @author john resig
*/
//from jQuery
function __setArray__( target, array ) {
// Resetting the length to 0, then using the native Array push
// is a super-fast way to populate an object with array-like properties
target.length = 0;
Array.prototype.push.apply( target, array );
}
/**
* @author ariel flesler
* http://flesler.blogspot.com/2008/11/fast-trim-function-for-javascript.html
* @param {Object} str
*/
function __trim__( str ){
return (str || "").replace( /^\s+|\s+$/g, "" );
}
/*
* Interface DocumentStyle (introduced in DOM Level 2)
* http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/stylesheets.html#StyleSheets-StyleSheet-DocumentStyle
*
* interface DocumentStyle {
* readonly attribute StyleSheetList styleSheets;
* };
*
*/
__extend__(Document.prototype, {
get styleSheets() {
if (! this._styleSheets) {
this._styleSheets = new StyleSheetList();
}
return this._styleSheets;
}
});
/*
* CSS2Properties - DOM Level 2 CSS
* Renamed to CSSStyleDeclaration??
*/
var __toCamelCase__ = function(name) {
if (name) {
return name.replace(/\-(\w)/g, function(all, letter) {
return letter.toUpperCase();
});
}
return name;
};
var __toDashed__ = function(camelCaseName) {
if (camelCaseName) {
return camelCaseName.replace(/[A-Z]/g, function(all) {
return '-' + all.toLowerCase();
});
}
return camelCaseName;
};
CSS2Properties = function(element){
//console.log('css2properties %s', __cssproperties__++);
this.styleIndex = __supportedStyles__;//non-standard
this.type = element.tagName;//non-standard
__setArray__(this, []);
__cssTextToStyles__(this, element.cssText || '');
};
__extend__(CSS2Properties.prototype, {
get cssText() {
var i, css = [];
for (i = 0; i < this.length; ++i) {
css.push(this[i] + ': ' + this.getPropertyValue(this[i]) + ';');
}
return css.join(' ');
},
set cssText(cssText) {
__cssTextToStyles__(this, cssText);
},
getPropertyCSSValue: function(name) {
//?
},
getPropertyPriority: function() {
},
getPropertyValue: function(name) {
var index, cname = __toCamelCase__(name);
if (cname in this.styleIndex) {
return this[cname];
} else {
index = Array.prototype.indexOf.apply(this, [name]);
if (index > -1) {
return this[index];
}
}
return null;
},
item: function(index) {
return this[index];
},
removeProperty: function(name) {
this.styleIndex[name] = null;
name = __toDashed__(name);
var index = Array.prototype.indexOf.apply(this, [name]);
if (index > -1) {
Array.prototype.splice.apply(this, [1,index]);
}
},
setProperty: function(name, value, priority) {
var nval;
name = __toCamelCase__(name);
if (value !== undefined && name in this.styleIndex) {
// NOTE: parseFloat('300px') ==> 300 no
// NOTE: Number('300px') ==> Nan yes
nval = Number(value);
this.styleIndex[name] = isNaN(nval) ? value : nval;
name = __toDashed__(name);
if (Array.prototype.indexOf.apply(this, [name]) === -1 ){
Array.prototype.push.apply(this,[name]);
}
}
},
toString: function() {
return '[object CSS2Properties]';
}
});
var __cssTextToStyles__ = function(css2props, cssText) {
//console.log('__cssTextToStyles__ %s %s', css2props, cssText);
//var styleArray=[];
var i, style, styles = cssText.split(';');
for (i = 0; i < styles.length; ++i) {
style = styles[i].split(':');
if (style.length === 2) {
css2props.setProperty(style[0].replace(' ', '', 'g'),
style[1].replace(' ', '', 'g'));
}
}
};
//Obviously these arent all supported but by commenting out various
//sections this provides a single location to configure what is
//exposed as supported.
var __supportedStyles__ = {
azimuth: null,
background: null,
backgroundAttachment: null,
backgroundColor: 'rgb(0,0,0)',
backgroundImage: null,
backgroundPosition: null,
backgroundRepeat: null,
border: null,
borderBottom: null,
borderBottomColor: null,
borderBottomStyle: null,
borderBottomWidth: null,
borderCollapse: null,
borderColor: null,
borderLeft: null,
borderLeftColor: null,
borderLeftStyle: null,
borderLeftWidth: null,
borderRight: null,
borderRightColor: null,
borderRightStyle: null,
borderRightWidth: null,
borderSpacing: null,
borderStyle: null,
borderTop: null,
borderTopColor: null,
borderTopStyle: null,
borderTopWidth: null,
borderWidth: null,
bottom: null,
captionSide: null,
clear: null,
clip: null,
color: null,
content: null,
counterIncrement: null,
counterReset: null,
cssFloat: null,
cue: null,
cueAfter: null,
cueBefore: null,
cursor: null,
direction: 'ltr',
display: null,
elevation: null,
emptyCells: null,
font: null,
fontFamily: null,
fontSize: '1em',
fontSizeAdjust: null,
fontStretch: null,
fontStyle: null,
fontVariant: null,
fontWeight: null,
height: '',
left: null,
letterSpacing: null,
lineHeight: null,
listStyle: null,
listStyleImage: null,
listStylePosition: null,
listStyleType: null,
margin: null,
marginBottom: '0px',
marginLeft: '0px',
marginRight: '0px',
marginTop: '0px',
markerOffset: null,
marks: null,
maxHeight: null,
maxWidth: null,
minHeight: null,
minWidth: null,
opacity: 1,
orphans: null,
outline: null,
outlineColor: null,
outlineOffset: null,
outlineStyle: null,
outlineWidth: null,
overflow: null,
overflowX: null,
overflowY: null,
padding: null,
paddingBottom: '0px',
paddingLeft: '0px',
paddingRight: '0px',
paddingTop: '0px',
page: null,
pageBreakAfter: null,
pageBreakBefore: null,
pageBreakInside: null,
pause: null,
pauseAfter: null,
pauseBefore: null,
pitch: null,
pitchRange: null,
position: null,
quotes: null,
richness: null,
right: null,
size: null,
speak: null,
speakHeader: null,
speakNumeral: null,
speakPunctuation: null,
speechRate: null,
stress: null,
tableLayout: null,
textAlign: null,
textDecoration: null,
textIndent: null,
textShadow: null,
textTransform: null,
top: null,
unicodeBidi: null,
verticalAlign: null,
visibility: '',
voiceFamily: null,
volume: null,
whiteSpace: null,
widows: null,
width: '1px',
wordSpacing: null,
zIndex: 1
};
var __displayMap__ = {
DIV : 'block',
P : 'block',
A : 'inline',
CODE : 'inline',
PRE : 'block',
SPAN : 'inline',
TABLE : 'table',
THEAD : 'table-header-group',
TBODY : 'table-row-group',
TR : 'table-row',
TH : 'table-cell',
TD : 'table-cell',
UL : 'block',
LI : 'list-item'
};
for (var style in __supportedStyles__) {
if (__supportedStyles__.hasOwnProperty(style)) {
(function(name) {
if (name === 'width' || name === 'height') {
CSS2Properties.prototype.__defineGetter__(name, function() {
if (this.display === 'none'){
return '0px';
}
return this.styleIndex[name];
});
} else if (name === 'display') {
//display will be set to a tagName specific value if ''
CSS2Properties.prototype.__defineGetter__(name, function() {
var val = this.styleIndex[name];
val = val ? val :__displayMap__[this.type];
return val;
});
} else {
CSS2Properties.prototype.__defineGetter__(name, function() {
return this.styleIndex[name];
});
}
CSS2Properties.prototype.__defineSetter__(name, function(value) {
this.setProperty(name, value);
});
}(style));
}
}
/*
* CSSRule - DOM Level 2
*/
CSSRule = function(options) {
var $style,
$selectorText = options.selectorText ? options.selectorText : '';
$style = new CSS2Properties({
cssText: options.cssText ? options.cssText : null
});
return __extend__(this, {
get style(){
return $style;
},
get selectorText(){
return $selectorText;
},
set selectorText(selectorText){
$selectorText = selectorText;
},
toString : function(){
return "[object CSSRule]";
}
});
};
CSSRule.STYLE_RULE = 1;
CSSRule.IMPORT_RULE = 3;
CSSRule.MEDIA_RULE = 4;
CSSRule.FONT_FACE_RULE = 5;
CSSRule.PAGE_RULE = 6;
//CSSRule.NAMESPACE_RULE = 10;
CSSStyleRule = function() {
};
CSSImportRule = function() {
};
CSSMediaRule = function() {
};
CSSFontFaceRule = function() {
};
CSSPageRule = function() {
};
CSSRuleList = function(data) {
this.length = 0;
__setArray__(this, data);
};
__extend__(CSSRuleList.prototype, {
item : function(index) {
if ((index >= 0) && (index < this.length)) {
// bounds check
return this[index];
}
return null;
},
toString: function() {
return '[object CSSRuleList]';
}
});
/**
* StyleSheet
* http://dev.w3.org/csswg/cssom/#stylesheet
*
* interface StyleSheet {
* readonly attribute DOMString type;
* readonly attribute DOMString href;
* readonly attribute Node ownerNode;
* readonly attribute StyleSheet parentStyleSheet;
* readonly attribute DOMString title;
* [PutForwards=mediaText] readonly attribute MediaList media;
* attribute boolean disabled;
* };
*/
StyleSheet = function() {
}
/*
* CSSStyleSheet
* http://dev.w3.org/csswg/cssom/#cssstylesheet
*
* interface CSSStyleSheet : StyleSheet {
* readonly attribute CSSRule ownerRule;
* readonly attribute CSSRuleList cssRules;
* unsigned long insertRule(DOMString rule, unsigned long index);
* void deleteRule(unsigned long index);
* };
*/
CSSStyleSheet = function(options){
var $cssRules,
$disabled = options.disabled ? options.disabled : false,
$href = options.href ? options.href : null,
$parentStyleSheet = options.parentStyleSheet ? options.parentStyleSheet : null,
$title = options.title ? options.title : "",
$type = "text/css";
function parseStyleSheet(text){
//$debug("parsing css");
//this is pretty ugly, but text is the entire text of a stylesheet
var cssRules = [];
if (!text) {
text = '';
}
text = __trim__(text.replace(/\/\*(\r|\n|.)*\*\//g,""));
// TODO: @import
var blocks = text.split("}");
blocks.pop();
var i, j, len = blocks.length;
var definition_block, properties, selectors;
for (i=0; i<len; i++) {
definition_block = blocks[i].split("{");
if (definition_block.length === 2) {
selectors = definition_block[0].split(",");
for (j=0; j<selectors.length; j++) {
cssRules.push(new CSSRule({
selectorText : __trim__(selectors[j]),
cssText : definition_block[1]
}));
}
}
}
return cssRules;
}
$cssRules = new CSSRuleList(parseStyleSheet(options.textContent));
return __extend__(this, {
get cssRules(){
return $cssRules;
},
get rule(){
return $cssRules;
},//IE - may be deprecated
get href(){
return $href;
},
get parentStyleSheet(){
return $parentStyleSheet;
},
get title(){
return $title;
},
get type(){
return $type;
},
addRule: function(selector, style, index){/*TODO*/},
deleteRule: function(index){/*TODO*/},
insertRule: function(rule, index){/*TODO*/},
//IE - may be deprecated
removeRule: function(index){
this.deleteRule(index);
}
});
};
StyleSheetList = function() {
}
StyleSheetList.prototype = new Array();
__extend__(StyleSheetList.prototype, {
item : function(index) {
if ((index >= 0) && (index < this.length)) {
// bounds check
return this[index];
}
return null;
},
toString: function() {
return '[object StyleSheetList]';
}
});
/**
* This extends HTMLElement to handle CSS-specific interfaces.
*
* More work / research would be needed to extend just (DOM) Element
* for xml use and additional changes for just HTMLElement.
*/
/**
* Replace or add the getter for 'style'
*
* This could be wrapped in a closure
*/
var $css2properties = [{}];
__extend__(HTMLElement.prototype, {
get style(){
if ( !this.css2uuid ) {
this.css2uuid = $css2properties.length;
$css2properties[this.css2uuid] = new CSS2Properties(this);
}
return $css2properties[this.css2uuid];
},
});
/**
* Change for how 'setAttribute("style", ...)' works
*
* We are truly adding functionality to HtmlElement.setAttribute, not
* replacing it. So we need to save the old one first, call it, then
* do our stuff. If we need to do more hacks like this, HTMLElement
* (or regular Element) needs to have a hooks array or dispatch table
* for global changes.
*
* This could be wrapped in a closure if desired.
*/
var updateCss2Props = function(elem, values) {
//console.log('__updateCss2Props__ %s %s', elem, values);
if ( !elem.css2uuid ) {
elem.css2uuid = $css2properties.length;
$css2properties[elem.css2uuid] = new CSS2Properties(elem);
}
__cssTextToStyles__($css2properties[elem.css2uuid], values);
}
var origSetAttribute = HTMLElement.prototype.setAttribute;
HTMLElement.prototype.setAttribute = function(name, value) {
//console.log("CSS set attribute: " + name + ", " + value);
origSetAttribute.apply(this, arguments);
if (name === "style") {
updateCss2Props(this, value);
}
}
/**
* @author john resig & the envjs team
* @uri http://www.envjs.com/
* @copyright 2008-2010
* @license MIT
*/
//CLOSURE_END
}());
//these are both non-standard globals that
//provide static namespaces and functions
//to support the html 5 parser from nu.
var XMLParser = {},
HTMLParser = {};
/*
* Envjs parser.1.2.13
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*/
//CLOSURE_START
(function(){
/**
* @author john resig
*/
// Helper method for extending one object with another.
function __extend__(a,b) {
for ( var i in b ) {
var g = b.__lookupGetter__(i), s = b.__lookupSetter__(i);
if ( g || s ) {
if ( g ) { a.__defineGetter__(i, g); }
if ( s ) { a.__defineSetter__(i, s); }
} else {
a[i] = b[i];
}
} return a;
}
/**
* @author john resig
*/
//from jQuery
function __setArray__( target, array ) {
// Resetting the length to 0, then using the native Array push
// is a super-fast way to populate an object with array-like properties
target.length = 0;
Array.prototype.push.apply( target, array );
}
var __defineParser__;
(function () {
var $gwt_version = "1.5.1";
var $wnd = {};
var $doc = {};
var $moduleName, $moduleBase;
var $stats = $wnd.__gwtStatsEvent ? function(a) {$wnd.__gwtStatsEvent(a)} : null;
var cNh='',qPg='\n',n4h='\n ',Bxg=' which is not a legal XML 1.0 character.',cNg='#mathplayer',zOg='#renesis',rZg='(',vxg=').',iwh='): ',fPh='+//silmaril//dtd html pro v0r11 19970101//',cWg=', ',mih=', Size: ',dNh='-//W3C//DTD HTML 4.0 Frameset//EN',oNh='-//W3C//DTD HTML 4.0 Transitional//EN',zNh='-//W3C//DTD HTML 4.0//EN',eOh='-//W3C//DTD HTML 4.01 Frameset//EN',pOh='-//W3C//DTD HTML 4.01 Transitional//EN',AOh='-//W3C//DTD HTML 4.01//EN',utg='-//W3C//DTD XHTML 1.0 Strict//EN',lug='-//W3C//DTD XHTML 1.1//EN',qPh='-//advasoft ltd//dtd html 3.0 aswedit + extensions//',BPh='-//as//dtd html 3.0 aswedit + extensions//',gQh='-//ietf//dtd html 2.0 level 1//',sQh='-//ietf//dtd html 2.0 level 2//',DQh='-//ietf//dtd html 2.0 strict level 1//',iRh='-//ietf//dtd html 2.0 strict level 2//',tRh='-//ietf//dtd html 2.0 strict//',ERh='-//ietf//dtd html 2.0//',jSh='-//ietf//dtd html 2.1e//',uSh='-//ietf//dtd html 3.0//',FSh='-//ietf//dtd html 3.2 final//',kTh='-//ietf//dtd html 3.2//',vTh='-//ietf//dtd html 3//',bUh='-//ietf//dtd html level 0//',mUh='-//ietf//dtd html level 1//',xUh='-//ietf//dtd html level 2//',cVh='-//ietf//dtd html level 3//',nVh='-//ietf//dtd html strict level 0//',yVh='-//ietf//dtd html strict level 1//',dWh='-//ietf//dtd html strict level 2//',oWh='-//ietf//dtd html strict level 3//',zWh='-//ietf//dtd html strict//',eXh='-//ietf//dtd html//',qXh='-//metrius//dtd metrius presentational//',BXh='-//microsoft//dtd internet explorer 2.0 html strict//',gYh='-//microsoft//dtd internet explorer 2.0 html//',rYh='-//microsoft//dtd internet explorer 2.0 tables//',CYh='-//microsoft//dtd internet explorer 3.0 html strict//',hZh='-//microsoft//dtd internet explorer 3.0 html//',sZh='-//microsoft//dtd internet explorer 3.0 tables//',DZh='-//netscape comm. corp.//dtd html//',i0h='-//netscape comm. corp.//dtd strict html//',t0h="-//o'reilly and associates//dtd html 2.0//",F0h="-//o'reilly and associates//dtd html extended 1.0//",k1h="-//o'reilly and associates//dtd html extended relaxed 1.0//",v1h='-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//',a2h='-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//',l2h='-//spyglass//dtd html 2.0 extended//',w2h='-//sq//dtd html 2.0 hotmetal + extensions//',b3h='-//sun microsystems corp.//dtd hotjava html//',m3h='-//sun microsystems corp.//dtd hotjava strict html//',x3h='-//w3c//dtd html 3 1995-03-24//',c4h='-//w3c//dtd html 3.2 draft//',o4h='-//w3c//dtd html 3.2 final//',z4h='-//w3c//dtd html 3.2//',e5h='-//w3c//dtd html 3.2s draft//',p5h='-//w3c//dtd html 4.0 frameset//',A5h='-//w3c//dtd html 4.0 transitional//',Czg='-//w3c//dtd html 4.01 frameset//en',rzg='-//w3c//dtd html 4.01 transitional//en',f6h='-//w3c//dtd html experimental 19960712//',q6h='-//w3c//dtd html experimental 970421//',B6h='-//w3c//dtd w3 html//',gzg='-//w3c//dtd xhtml 1.0 frameset//en',Byg='-//w3c//dtd xhtml 1.0 transitional//en',g7h='-//w3o//dtd w3 html 3.0//',sAg='-//w3o//dtd w3 html strict 3.0//en//',r7h='-//webtechs//dtd mozilla html 2.0//',Cqg='-//webtechs//dtd mozilla html//',DAg='-/w3c/dtd html 4.0 transitional/en',Dxg='.',gyg='0123456789ABCDEF',iBg=':',Aqg=': ',q6g='=',zqg='@',txg='A character reference expanded to a form feed which is not legal XML 1.0 white space.',iyg='AElig',jyg='AElig;',wLh='ALLOW',fKh='ALMOST_STANDARDS_MODE',mMh='ALTER_INFOSET',kyg='AMP',lyg='AMP;',yzh='AUTO',myg='Aacute',nyg='Aacute;',oyg='Abreve;',DIh='AbstractCollection',rJh='AbstractHashMap',tJh='AbstractHashMap$EntrySet',uJh='AbstractHashMap$EntrySetIterator',wJh='AbstractHashMap$MapEntryNull',xJh='AbstractHashMap$MapEntryString',EIh='AbstractList',yJh='AbstractList$IteratorImpl',zJh='AbstractList$ListIteratorImpl',qJh='AbstractMap',vJh='AbstractMapEntry',BJh='AbstractSequentialList',sJh='AbstractSet',pyg='Acirc',ryg='Acirc;',syg='Acy;',ePg='Add not supported on this collection',obh='Add not supported on this list',tyg='Afr;',uyg='Agrave',vyg='Agrave;',wyg='Alpha;',xyg='Amacr;',yyg='And;',zyg='Aogon;',Ayg='Aopf;',Cyg='ApplyFunction;',Dyg='Aring',Eyg='Aring;',vLg='Array types must match',FIh='ArrayList',cJh='ArrayStoreException',Fyg='Ascr;',azg='Assign;',bzg='Atilde',czg='Atilde;',mxg='Attribute \u201C',vKh='AttributeName',uKh='AttributeName;',dzg='Auml',ezg='Auml;',fzg='Backslash;',hzg='Barv;',izg='Barwed;',jzg='Bcy;',kzg='Because;',lzg='Bernoullis;',mzg='Beta;',nzg='Bfr;',ozg='Bopf;',pzg='Breve;',mKh='BrowserTreeBuilder',nKh='BrowserTreeBuilder$ScriptHolder',qzg='Bscr;',szg='Bumpeq;',ixg='CDATA[',tzg='CHcy;',uzg='COPY',vzg='COPY;',wzg='Cacute;',Blh="Can't get element ",xxg="Can't use FATAL here.",xzg='Cap;',yzg='CapitalDifferentialD;',zzg='Cayleys;',Azg='Ccaron;',Bzg='Ccedil',Dzg='Ccedil;',Ezg='Ccirc;',Fzg='Cconint;',aAg='Cdot;',bAg='Cedilla;',cAg='CenterDot;',dAg='Cfr;',uxg='Character reference expands to a control character (',eAg='Chi;',fAg='CircleDot;',gAg='CircleMinus;',iAg='CirclePlus;',jAg='CircleTimes;',fJh='Class',gJh='ClassCastException',kAg='ClockwiseContourIntegral;',lAg='CloseCurlyDoubleQuote;',mAg='CloseCurlyQuote;',kKh='CoalescingTreeBuilder',nAg='Colon;',oAg='Colone;',CJh='Comparators$1',pAg='Congruent;',qAg='Conint;',rAg='ContourIntegral;',tAg='Copf;',uAg='Coproduct;',vAg='CounterClockwiseContourIntegral;',wAg='Cross;',xAg='Cscr;',yAg='Cup;',zAg='CupCap;',AAg='DD;',BAg='DDotrahd;',CAg='DJcy;',EAg='DScy;',FAg='DZcy;',aBg='Dagger;',bBg='Darr;',cBg='Dashv;',dBg='Dcaron;',eBg='Dcy;',fBg='Del;',gBg='Delta;',hBg='Dfr;',kBg='DiacriticalAcute;',lBg='DiacriticalDot;',mBg='DiacriticalDoubleAcute;',nBg='DiacriticalGrave;',oBg='DiacriticalTilde;',pBg='Diamond;',qBg='DifferentialD;',dKh='DoctypeExpectation',eKh='DocumentMode',rBg='Dopf;',sBg='Dot;',tBg='DotDot;',vBg='DotEqual;',wBg='DoubleContourIntegral;',xBg='DoubleDot;',yBg='DoubleDownArrow;',zBg='DoubleLeftArrow;',ABg='DoubleLeftRightArrow;',BBg='DoubleLeftTee;',CBg='DoubleLongLeftArrow;',DBg='DoubleLongLeftRightArrow;',EBg='DoubleLongRightArrow;',aCg='DoubleRightArrow;',bCg='DoubleRightTee;',cCg='DoubleUpArrow;',dCg='DoubleUpDownArrow;',eCg='DoubleVerticalBar;',fCg='DownArrow;',gCg='DownArrowBar;',hCg='DownArrowUpArrow;',iCg='DownBreve;',jCg='DownLeftRightVector;',lCg='DownLeftTeeVector;',mCg='DownLeftVector;',nCg='DownLeftVectorBar;',oCg='DownRightTeeVector;',pCg='DownRightVector;',qCg='DownRightVectorBar;',rCg='DownTee;',sCg='DownTeeArrow;',tCg='Downarrow;',uCg='Dscr;',wCg='Dstrok;',qxg='Duplicate attribute \u201C',xCg='ENG;',yCg='ETH',zCg='ETH;',ACg='Eacute',BCg='Eacute;',CCg='Ecaron;',DCg='Ecirc',ECg='Ecirc;',FCg='Ecy;',bDg='Edot;',cDg='Efr;',dDg='Egrave',eDg='Egrave;',isg='Element name \u201C',fDg='Element;',xKh='ElementName',wKh='ElementName;',gDg='Emacr;',hDg='EmptySmallSquare;',iDg='EmptyVerySmallSquare;',AIh='Enum',jDg='Eogon;',kDg='Eopf;',mDg='Epsilon;',nDg='Equal;',oDg='EqualTilde;',pDg='Equilibrium;',zKh='ErrorReportingTokenizer',qDg='Escr;',rDg='Esim;',sDg='Eta;',tDg='Euml',uDg='Euml;',sIh='Exception',vDg='Exists;',xDg='ExponentialE;',bMh='FATAL',yDg='Fcy;',zDg='Ffr;',ADg='FilledSmallSquare;',BDg='FilledVerySmallSquare;',CDg='Fopf;',DDg='ForAll;',Cxg='Forbidden code point ',EDg='Fouriertrf;',FDg='Fscr;',aEg='GJcy;',cEg='GT',dEg='GT;',eEg='Gamma;',fEg='Gammad;',gEg='Gbreve;',hEg='Gcedil;',iEg='Gcirc;',jEg='Gcy;',kEg='Gdot;',lEg='Gfr;',nEg='Gg;',oEg='Gopf;',pEg='GreaterEqual;',qEg='GreaterEqualLess;',rEg='GreaterFullEqual;',sEg='GreaterGreater;',tEg='GreaterLess;',uEg='GreaterSlantEqual;',vEg='GreaterTilde;',wEg='Gscr;',zEg='Gt;',AEg='HARDcy;',kph='HTML',jwh='HTML401_STRICT',zsh='HTML401_TRANSITIONAL',BEg='Hacek;',DJh='HashMap',CEg='Hat;',DEg='Hcirc;',EEg='Hfr;',FEg='HilbertSpace;',aFg='Hopf;',bFg='HorizontalLine;',cFg='Hscr;',eFg='Hstrok;',AKh='HtmlAttributes',oKh='HtmlParser',pKh='HtmlParser$1',fFg='HumpDownHump;',gFg='HumpEqual;',hFg='IEcy;',iFg='IJlig;',jFg='IOcy;',kFg='Iacute',lFg='Iacute;',mFg='Icirc',nFg='Icirc;',pFg='Icy;',qFg='Idot;',rFg='Ifr;',sFg='Igrave',tFg='Igrave;',hJh='IllegalArgumentException',uFg='Im;',vFg='Imacr;',wFg='ImaginaryI;',xFg='Implies;',Deh='Index: ',bJh='IndexOutOfBoundsException',yFg='Int;',AFg='Integral;',BFg='Intersection;',CFg='InvisibleComma;',DFg='InvisibleTimes;',EFg='Iogon;',FFg='Iopf;',aGg='Iota;',bGg='Iscr;',cGg='Itilde;',dGg='Iukcy;',fGg='Iuml',gGg='Iuml;',vIh='JavaScriptException',wIh='JavaScriptObject$',hGg='Jcirc;',iGg='Jcy;',jGg='Jfr;',kGg='Jopf;',lGg='Jscr;',mGg='Jsercy;',nGg='Jukcy;',oGg='KHcy;',qGg='KJcy;',rGg='Kappa;',sGg='Kcedil;',tGg='Kcy;',uGg='Kfr;',vGg='Kopf;',wGg='Kscr;',xGg='LJcy;',yGg='LT',zGg='LT;',BGg='Lacute;',CGg='Lambda;',DGg='Lang;',EGg='Laplacetrf;',FGg='Larr;',aHg='Lcaron;',bHg='Lcedil;',cHg='Lcy;',dHg='LeftAngleBracket;',eHg='LeftArrow;',gHg='LeftArrowBar;',hHg='LeftArrowRightArrow;',iHg='LeftCeiling;',jHg='LeftDoubleBracket;',kHg='LeftDownTeeVector;',lHg='LeftDownVector;',mHg='LeftDownVectorBar;',nHg='LeftFloor;',oHg='LeftRightArrow;',pHg='LeftRightVector;',rHg='LeftTee;',sHg='LeftTeeArrow;',tHg='LeftTeeVector;',uHg='LeftTriangle;',vHg='LeftTriangleBar;',wHg='LeftTriangleEqual;',xHg='LeftUpDownVector;',yHg='LeftUpTeeVector;',zHg='LeftUpVector;',AHg='LeftUpVectorBar;',CHg='LeftVector;',DHg='LeftVectorBar;',EHg='Leftarrow;',FHg='Leftrightarrow;',aIg='LessEqualGreater;',bIg='LessFullEqual;',cIg='LessGreater;',dIg='LessLess;',eIg='LessSlantEqual;',fIg='LessTilde;',iIg='Lfr;',EJh='LinkedList',FJh='LinkedList$ListIteratorImpl',aKh='LinkedList$Node',jIg='Ll;',kIg='Lleftarrow;',lIg='Lmidot;',BKh='LocatorImpl',mIg='LongLeftArrow;',nIg='LongLeftRightArrow;',oIg='LongRightArrow;',pIg='Longleftarrow;',qIg='Longleftrightarrow;',rIg='Longrightarrow;',tIg='Lopf;',uIg='LowerLeftArrow;',vIg='LowerRightArrow;',wIg='Lscr;',xIg='Lsh;',yIg='Lstrok;',zIg='Lt;',AIg='Map;',BIg='Mcy;',CIg='MediumSpace;',EIg='Mellintrf;',FIg='Mfr;',aJg='MinusPlus;',bJg='Mopf;',cJg='Mscr;',dJg='Mu;',gIg='Must be array types',eJg='NJcy;',hDh='NO_DOCTYPE_ERRORS',fJg='Nacute;',gJg='Ncaron;',hJg='Ncedil;',jJg='Ncy;',kJg='NegativeMediumSpace;',lJg='NegativeThickSpace;',mJg='NegativeThinSpace;',nJg='NegativeVeryThinSpace;',oJg='NestedGreaterGreater;',pJg='NestedLessLess;',qJg='NewLine;',rJg='Nfr;',sxg='No digits after \u201C',sJg='NoBreak;',bKh='NoSuchElementException',uJg='NonBreakingSpace;',vJg='Nopf;',wJg='Not;',xJg='NotCongruent;',yJg='NotCupCap;',zJg='NotDoubleVerticalBar;',AJg='NotElement;',BJg='NotEqual;',CJg='NotExists;',DJg='NotGreater;',FJg='NotGreaterEqual;',aKg='NotGreaterLess;',bKg='NotGreaterTilde;',cKg='NotLeftTriangle;',dKg='NotLeftTriangleEqual;',eKg='NotLess;',fKg='NotLessEqual;',gKg='NotLessGreater;',hKg='NotLessTilde;',iKg='NotPrecedes;',kKg='NotPrecedesSlantEqual;',lKg='NotReverseElement;',mKg='NotRightTriangle;',nKg='NotRightTriangleEqual;',oKg='NotSquareSubsetEqual;',pKg='NotSquareSupersetEqual;',qKg='NotSubsetEqual;',rKg='NotSucceeds;',sKg='NotSucceedsSlantEqual;',tKg='NotSupersetEqual;',vKg='NotTilde;',wKg='NotTildeEqual;',xKg='NotTildeFullEqual;',yKg='NotTildeTilde;',zKg='NotVerticalBar;',AKg='Nscr;',BKg='Ntilde',CKg='Ntilde;',DKg='Nu;',jJh='NullPointerException',EKg='OElig;',aLg='Oacute',bLg='Oacute;',nIh='Object',oJh='Object;',cLg='Ocirc',dLg='Ocirc;',eLg='Ocy;',fLg='Odblac;',gLg='Ofr;',hLg='Ograve',iLg='Ograve;',jLg='Omacr;',lLg='Omega;',mLg='Omicron;',nLg='Oopf;',oLg='OpenCurlyDoubleQuote;',pLg='OpenCurlyQuote;',qLg='Or;',rLg='Oscr;',sLg='Oslash',tLg='Oslash;',uLg='Otilde',xLg='Otilde;',yLg='Otimes;',zLg='Ouml',ALg='Ouml;',BLg='OverBar;',CLg='OverBrace;',DLg='OverBracket;',ELg='OverParenthesis;',qKh='ParseEndListener',FLg='PartialD;',aMg='Pcy;',cMg='Pfr;',dMg='Phi;',eMg='Pi;',fMg='PlusMinus;',gMg='Poincareplane;',hMg='Popf;',iMg='Pr;',jMg='Precedes;',kMg='PrecedesEqual;',lMg='PrecedesSlantEqual;',nMg='PrecedesTilde;',oMg='Prime;',pMg='Product;',qMg='Proportion;',rMg='Proportional;',sMg='Pscr;',tMg='Psi;',lLh='QUIRKS_MODE',uMg='QUOT',vMg='QUOT;',wMg='Qfr;',yMg='Qopf;',zMg='Qscr;',AMg='RBarr;',BMg='REG',CMg='REG;',DMg='Racute;',EMg='Rang;',FMg='Rarr;',aNg='Rarrtl;',bNg='Rcaron;',dNg='Rcedil;',eNg='Rcy;',fNg='Re;',gNg='ReverseElement;',hNg='ReverseEquilibrium;',iNg='ReverseUpEquilibrium;',jNg='Rfr;',kNg='Rho;',lNg='RightAngleBracket;',mNg='RightArrow;',oNg='RightArrowBar;',pNg='RightArrowLeftArrow;',qNg='RightCeiling;',rNg='RightDoubleBracket;',sNg='RightDownTeeVector;',tNg='RightDownVector;',uNg='RightDownVectorBar;',vNg='RightFloor;',wNg='RightTee;',xNg='RightTeeArrow;',zNg='RightTeeVector;',ANg='RightTriangle;',BNg='RightTriangleBar;',CNg='RightTriangleEqual;',DNg='RightUpDownVector;',ENg='RightUpTeeVector;',FNg='RightUpVector;',aOg='RightUpVectorBar;',bOg='RightVector;',cOg='RightVectorBar;',eOg='Rightarrow;',fOg='Ropf;',gOg='RoundImplies;',hOg='Rrightarrow;',iOg='Rscr;',jOg='Rsh;',kOg='RuleDelayed;',tIh='RuntimeException',cLh='SAXException',dLh='SAXParseException',lOg='SHCHcy;',mOg='SHcy;',nOg='SOFTcy;',wGh='STANDARDS_MODE',pOg='Sacute;',dyg='Saw an xmlns attribute.',qOg='Sc;',rOg='Scaron;',sOg='Scedil;',tOg='Scirc;',uOg='Scy;',vOg='Sfr;',wOg='ShortDownArrow;',xOg='ShortLeftArrow;',yOg='ShortRightArrow;',AOg='ShortUpArrow;',BOg='Sigma;',COg='SmallCircle;',DOg='Sopf;',EOg='Sqrt;',FOg='Square;',aPg='SquareIntersection;',bPg='SquareSubset;',cPg='SquareSubsetEqual;',dPg='SquareSuperset;',gPg='SquareSupersetEqual;',hPg='SquareUnion;',iPg='Sscr;',EKh='StackNode',FKh='StackNode;',jPg='Star;',aUh='String',xEg='String index out of range: ',yIh='String;',kJh='StringBuffer',lJh='StringBuilder',mJh='StringIndexOutOfBoundsException',kPg='Sub;',lPg='Subset;',mPg='SubsetEqual;',nPg='Succeeds;',oPg='SucceedsEqual;',pPg='SucceedsSlantEqual;',rPg='SucceedsTilde;',sPg='SuchThat;',tPg='Sum;',uPg='Sup;',vPg='Superset;',wPg='SupersetEqual;',xPg='Supset;',yPg='THORN',zPg='THORN;',APg='TRADE;',CPg='TSHcy;',DPg='TScy;',EPg='Tab;',FPg='Tau;',aQg='Tcaron;',bQg='Tcedil;',cQg='Tcy;',dQg='Tfr;',wxg='The document is not mappable to XML 1.0 due to a trailing hyphen in a comment.',pxg='The document is not mappable to XML 1.0 due to two consecutive hyphens in a comment.',eQg='Therefore;',fQg='Theta;',hQg='ThinSpace;',yxg='This document is not mappable to XML 1.0 without data loss due to ',xMh='This is a searchable index. Insert your search keywords here: ',rIh='Throwable',iQg='Tilde;',jQg='TildeEqual;',kQg='TildeFullEqual;',lQg='TildeTilde;',qIh='Timer',aJh='Timer$1',yKh='Tokenizer',mQg='Topf;',jKh='TreeBuilder',nQg='TripleDot;',oQg='Tscr;',pQg='Tstrok;',hyg='U',byg='U+',ayg='U+0',Fxg='U+00',Exg='U+000',aLh='UTF16Buffer',qQg='Uacute',sQg='Uacute;',tQg='Uarr;',uQg='Uarrocir;',vQg='Ubrcy;',wQg='Ubreve;',xQg='Ucirc',yQg='Ucirc;',zQg='Ucy;',AQg='Udblac;',BQg='Ufr;',DQg='Ugrave',EQg='Ugrave;',FQg='Umacr;',aRg='UnderBar;',bRg='UnderBrace;',cRg='UnderBracket;',dRg='UnderParenthesis;',eRg='Union;',fRg='UnionPlus;',uKg='Unreachable',cyg='Unreachable.',nJh='UnsupportedOperationException',gRg='Uogon;',iRg='Uopf;',jRg='UpArrow;',kRg='UpArrowBar;',lRg='UpArrowDownArrow;',mRg='UpDownArrow;',nRg='UpEquilibrium;',oRg='UpTee;',pRg='UpTeeArrow;',qRg='Uparrow;',rRg='Updownarrow;',tRg='UpperLeftArrow;',uRg='UpperRightArrow;',vRg='Upsi;',wRg='Upsilon;',xRg='Uring;',yRg='Uscr;',zRg='Utilde;',ARg='Uuml',BRg='Uuml;',CRg='VDash;',ERg='Vbar;',FRg='Vcy;',aSg='Vdash;',bSg='Vdashl;',cSg='Vee;',dSg='Verbar;',eSg='Vert;',fSg='VerticalBar;',gSg='VerticalLine;',hSg='VerticalSeparator;',jSg='VerticalTilde;',kSg='VeryThinSpace;',lSg='Vfr;',mSg='Vopf;',nSg='Vscr;',oSg='Vvdash;',pSg='Wcirc;',qSg='Wedge;',rSg='Wfr;',sSg='Wopf;',vSg='Wscr;',wSg='Xfr;',xSg='Xi;',hKh='XmlViolationPolicy',ySg='Xopf;',zSg='Xscr;',ASg='YAcy;',BSg='YIcy;',CSg='YUcy;',DSg='Yacute',ESg='Yacute;',aTg='Ycirc;',bTg='Ycy;',cTg='Yfr;',dTg='Yopf;',eTg='Yscr;',fTg='Yuml;',gTg='ZHcy;',hTg='Zacute;',iTg='Zcaron;',jTg='Zcy;',lTg='Zdot;',mTg='ZeroWidthSpace;',nTg='Zeta;',oTg='Zfr;',pTg='Zopf;',qTg='Zscr;',tSg='[',dJh='[C',iJh='[I',xIh='[Ljava.lang.',tKh='[Lnu.validator.htmlparser.impl.',sKh='[Z',DKh='[[C',BIh='[[D',sZg=']',oFg='a',rTg='aacute',sTg='aacute;',C6g='abbr',bvg='about:legacy-compat',tTg='abreve;',C2h='abs',uTg='ac;',Cuh='accent',gWh='accent-height',wSh='accentunder',ruh='accept',DXh='accept-charset',cPh='accesskey',bRh='accumulate',wTg='acd;',xTg='acirc',yTg='acirc;',rrg='acronym',kwh='action',aRh='actiontype',svh='active',zXh='actuate',zTg='acute',ATg='acute;',BTg='acy;',hNh='additive',yEg='address',CTg='aelig',DTg='aelig;',ETg='af;',FTg='afr;',bUg='agrave',cUg='agrave;',dUg='alefsym;',eUg='aleph;',ojh='align',w0h='alignment-baseline',EXh='alignmentscope',djh='alink',fUg='alpha;',FQh='alphabetic',l2g='alt',atg='altGlyph',Fug='altGlyphDef',qvg='altGlyphItem',Fsg='altglyph',Eug='altglyphdef',pvg='altglyphitem',Dvh='altimg',hLh='alttext',gUg='amacr;',hUg='amalg;',iUg='amp',jUg='amp;',gPh='amplitude',A2h='and',kUg='and;',mUg='andand;',nUg='andd;',oUg='andslope;',pUg='andv;',qUg='ang;',rUg='ange;',sUg='angle;',tUg='angmsd;',uUg='angmsdaa;',vUg='angmsdab;',xUg='angmsdac;',yUg='angmsdad;',zUg='angmsdae;',AUg='angmsdaf;',BUg='angmsdag;',CUg='angmsdah;',DUg='angrt;',EUg='angrtvb;',FUg='angrtvbd;',aVg='angsph;',cVg='angst;',dVg='angzarr;',krg='animate',svg='animateColor',Evg='animateMotion',zwg='animateTransform',rvg='animatecolor',Dvg='animatemotion',xwg='animatetransform',aug='animation',sug='annotation',kwg='annotation-xml',eVg='aogon;',fVg='aopf;',gVg='ap;',hVg='apE;',iVg='apacir;',jVg='ape;',kVg='apid;',lVg='apos;',A6h='applet',w5h='apply',D6h='approx',nVg='approx;',oVg='approxeq;',BSh='arabic-form',z6h='arccos',prg='arccosh',C6h='arccot',qrg='arccoth',w6h='arccsc',mrg='arccsch',iLh='archive',CXh='arcrole',v6h='arcsec',lrg='arcsech',y6h='arcsin',org='arcsinh',x6h='arctan',nrg='arctanh',i4h='area',B2h='arg',h1h='aria-activedescendant',ySh='aria-atomic',e0h='aria-autocomplete',dPh='aria-busy',uUh='aria-channel',rUh='aria-checked',eWh='aria-controls',vWh='aria-datatype',iZh='aria-describedby',qWh='aria-disabled',xYh='aria-dropeffect',pWh='aria-expanded',ASh='aria-flowto',ePh='aria-grab',fWh='aria-haspopup',zSh='aria-hidden',pUh='aria-invalid',yYh='aria-labelledby',cRh='aria-level',hPh='aria-live',FXh='aria-multiline',f1h='aria-multiselectable',FOh='aria-owns',jWh='aria-posinset',qUh='aria-pressed',lWh='aria-readonly',iWh='aria-relevant',nWh='aria-required',xSh='aria-secret',mWh='aria-selected',tUh='aria-setsize',bPh='aria-sort',zYh='aria-templateid',kWh='aria-valuemax',wWh='aria-valuemin',hWh='aria-valuenow',pVg='aring',qVg='aring;',jrg='article',hvh='ascent',rVg='ascr;',u5h='aside',sVg='ast;',tVg='asymp;',uVg='asympeq;',yih='async',vVg='atilde',wVg='atilde;',uWh='attributeName',sWh='attributeType',tWh='attributename',rWh='attributetype',v5h='audio',yVg='auml',zVg='auml;',sUh='autocomplete',aPh='autofocus',gNh='autoplay',EQh='autosubmit',AVg='awconint;',BVg='awint;',r6g='axis',jLh='azimuth',t1h='b',CVg='bNot;',DVg='backcong;',EVg='backepsilon;',fRh='background',FVg='backprime;',aWg='backsim;',bWg='backsimeq;',eWg='barvee;',fWg='barwed;',gWg='barwedge;',u9g='base',yWh='baseFrequency',eTh='baseProfile',btg='basefont',xWh='basefrequency',pNh='baseline',aYh='baseline-shift',dTh='baseprofile',h7g='bbox',hWg='bbrk;',iWg='bbrktbrk;',jWg='bcong;',kWg='bcy;',E2h='bdo',lWg='bdquo;',mWg='becaus;',nWg='because;',flh='begin',pWg='bemptyv;',qWg='bepsi;',rWg='bernou;',sWg='beta;',tWg='beth;',uWg='between;',nNh='bevelled',vWg='bfr;',oLh='bgcolor',trg='bgsound',i8g='bias',D2h='big',wWg='bigcap;',xWg='bigcirc;',yWg='bigcup;',AWg='bigodot;',BWg='bigoplus;',CWg='bigotimes;',DWg='bigsqcup;',EWg='bigstar;',FWg='bigtriangledown;',aXg='bigtriangleup;',bXg='biguplus;',cXg='bigvee;',dXg='bigwedge;',fXg='bkarow;',gXg='blacklozenge;',hXg='blacksquare;',iXg='blacktriangle;',jXg='blacktriangledown;',kXg='blacktriangleleft;',lXg='blacktriangleright;',mXg='blank;',nXg='blk12;',oXg='blk14;',qXg='blk34;',rXg='block;',tug='blockquote',sXg='bnot;',lDg='body',tXg='bopf;',vwh='border',uXg='bot;',vXg='bottom;',wXg='bowtie;',xXg='boxDL;',yXg='boxDR;',zXg='boxDl;',BXg='boxDr;',CXg='boxH;',DXg='boxHD;',EXg='boxHU;',FXg='boxHd;',aYg='boxHu;',bYg='boxUL;',cYg='boxUR;',dYg='boxUl;',eYg='boxUr;',gYg='boxV;',hYg='boxVH;',iYg='boxVL;',jYg='boxVR;',kYg='boxVh;',lYg='boxVl;',mYg='boxVr;',nYg='boxbox;',oYg='boxdL;',pYg='boxdR;',rYg='boxdl;',sYg='boxdr;',tYg='boxh;',uYg='boxhD;',vYg='boxhU;',wYg='boxhd;',xYg='boxhu;',yYg='boxminus;',zYg='boxplus;',AYg='boxtimes;',CYg='boxuL;',DYg='boxuR;',EYg='boxul;',FYg='boxur;',aZg='boxv;',bZg='boxvH;',cZg='boxvL;',dZg='boxvR;',eZg='boxvh;',fZg='boxvl;',hZg='boxvr;',iZg='bprime;',z1h='br',jZg='breve;',kZg='brvbar',lZg='brvbar;',mZg='bscr;',nZg='bsemi;',oZg='bsim;',pZg='bsime;',qZg='bsol;',uZg='bsolb;',vZg='bull;',wZg='bullet;',xZg='bump;',yZg='bumpE;',zZg='bumpe;',AZg='bumpeq;',E6h='button',j4h='bvar',aUg='by',BZg='cacute;',jNh='calcMode',iNh='calcmode',b7h='canvas',eRh='cap-height',CZg='cap;',DZg='capand;',FZg='capbrcup;',a0g='capcap;',b0g='capcup;',c0g='capdot;',nwg='caption',k4h='card',d0g='caret;',e0g='caron;',Awg='cartesianproduct',f0g='ccaps;',g0g='ccaron;',h0g='ccedil',i0g='ccedil;',k0g='ccirc;',l0g='ccups;',m0g='ccupssm;',n0g='cdot;',o0g='cedil',p0g='cedil;',wrg='ceiling',CSh='cellpadding',DSh='cellspacing',q0g='cemptyv;',r0g='cent',s0g='cent;',a7h='center',t0g='centerdot;',v0g='cfr;',j9g='char',nLh='charoff',qLh='charset',w0g='chcy;',x0g='check;',mLh='checked',y0g='checkmark;',z0g='chi;',A1h='ci',A0g='cir;',B0g='cirE;',C0g='circ;',D0g='circeq;',F6h='circle',E0g='circlearrowleft;',a1g='circlearrowright;',b1g='circledR;',c1g='circledS;',d1g='circledast;',e1g='circledcirc;',f1g='circleddash;',g1g='cire;',h1g='cirfnint;',i1g='cirmid;',j1g='cirscir;',s7g='cite',pkh='class',zxg='class ',bMg='classid',Akh='clear',E8g='clip',jPh='clip-path',iPh='clip-rule',dtg='clipPath',DWh='clipPathUnits',ctg='clippath',CWh='clippathunits',zjh='close',kLh='closure',mMg='clsid:32F66A20-7614-11D4-BD11-00104BD3F987',dOg='clsid:AC159093-1683-4BA2-9DCF-0C350141D7F2',l1g='clubs;',m1g='clubsuit;',B1h='cn',D7g='code',lNh='codebase',kNh='codetype',etg='codomain',a3h='col',aDg='colgroup',n1g='colon;',o1g='colone;',p1g='coloneq;',ekh='color',D0h='color-interpolation',q1h='color-interpolation-filters',BWh='color-profile',AYh='color-rendering',t8g='cols',pLh='colspan',aTh='columnalign',bTh='columnlines',AWh='columnspacing',dRh='columnspan',ESh='columnwidth',uIh='com.google.gwt.core.client.',pIh='com.google.gwt.user.client.',q1g='comma;',urg='command',r1g='commat;',s1g='comp;',rLh='compact',t1g='compfn;',u1g='complement;',dug='complexes',w1g='complexes;',vrg='compose',cug='condition',x1g='cong;',y1g='congdot;',z1g='conint;',bug='conjugate',sLh='content',g0h='contentScriptType',kZh='contentStyleType',BYh='contenteditable',f0h='contentscripttype',jZh='contentstyletype',cTh='contextmenu',mNh='controls',lxh='coords',A1g='copf;',B1g='coprod;',C1g='copy',D1g='copy;',E1g='copysr;',c3h='cos',m4h='cosh',d3h='cot',p4h='coth',F1g='crarr;',b2g='cross;',F2h='csc',l4h='csch',c2g='cscr;',d2g='csub;',e2g='csube;',f2g='csup;',g2g='csupe;',xrg='csymbol',h2g='ctdot;',i2g='cudarrl;',j2g='cudarrr;',k2g='cuepr;',m2g='cuesc;',n2g='cularr;',o2g='cularrp;',p2g='cup;',q2g='cupbrcap;',r2g='cupcap;',s2g='cupcup;',t2g='cupdot;',u2g='cupor;',v2g='curarr;',x2g='curarrm;',q4h='curl',y2g='curlyeqprec;',z2g='curlyeqsucc;',A2g='curlyvee;',B2g='curlywedge;',C2g='curren',D2g='curren;',axh='cursor',E2g='curvearrowleft;',F2g='curvearrowright;',a3g='cuvee;',d3g='cuwed;',e3g='cwconint;',f3g='cwint;',lUg='cx',wUg='cy',g3g='cylcty;',DRg='d',h3g='dArr;',i3g='dHar;',j3g='dagger;',k3g='daleth;',l3g='darr;',m3g='dash;',o3g='dashv;',l$g='data',vLh='datafld',yUh='dataformatas',ftg='datagrid',uLh='datasrc',tvg='datatemplate',wNh='datetime',p3g='dbkarow;',q3g='dblac;',r3g='dcaron;',s3g='dcy;',C1h='dd',t3g='dd;',u3g='ddagger;',v3g='ddarr;',w3g='ddotseq;',xLh='declare',ALh='default',Clh='defer',lwg='definition-src',FWh='definitionURL',EWh='definitionurl',t4h='defs',x3g='deg',z3g='deg;',d7h='degree',e3h='del',A3g='delta;',B3g='demptyv;',qlh='depth',r4h='desc',BLh='descent',zrg='details',avg='determinant',C3g='dfisht;',f3h='dfn',D3g='dfr;',E3g='dharl;',F3g='dharr;',e7h='dialog',a4g='diam;',b4g='diamond;',c4g='diamondsuit;',e4g='diams;',f4g='die;',s4h='diff',EYh='diffuseConstant',DYh='diffuseconstant',g4g='digamma;',w2g='dir',mPh='direction',xNh='disabled',yrg='discard',h4g='disin;',yLh='display',wUh='displaystyle',dFg='div',i4g='div;',uug='divergence',c7h='divide',j4g='divide;',k4g='divideontimes;',zLh='divisor',l4g='divonx;',m4g='djcy;',D1h='dl',n4g='dlcorn;',p4g='dlcrop;',q4g='dollar;',f7h='domain',fxg='domainofapplication',j0h='dominant-baseline',r4g='dopf;',s4g='dot;',t4g='doteq;',u4g='doteqdot;',v4g='dotminus;',w4g='dotplus;',x4g='dotsquare;',y4g='doublebarwedge;',A4g='downarrow;',B4g='downdownarrows;',C4g='downharpoonleft;',D4g='downharpoonright;',nPh='draggable',E4g='drbkarow;',F4g='drcorn;',a5g='drcrop;',b5g='dscr;',c5g='dscy;',d5g='dsol;',f5g='dstrok;',E1h='dt',g5g='dtdot;',h5g='dtri;',i5g='dtrif;',j5g='duarr;',k5g='duhar;',c3g='dur',l5g='dwangle;',bVg='dx',mVg='dy',m5g='dzcy;',n5g='dzigrarr;',o5g='eDDot;',q5g='eDot;',r5g='eacute',s5g='eacute;',t5g='easter;',u5g='ecaron;',v5g='ecir;',w5g='ecirc',x5g='ecirc;',y5g='ecolon;',z5g='ecy;',a$g='edge',sNh='edgeMode',rNh='edgemode',B5g='edot;',C5g='ee;',D5g='efDot;',E5g='efr;',F5g='eg;',a6g='egrave',b6g='egrave;',c6g='egs;',d6g='egsdot;',e6g='el;',lPh='elevation',g6g='elinters;',h6g='ell;',Arg='ellipse',i6g='els;',j6g='elsdot;',F1h='em',k6g='emacr;',x5h='embed',l6g='empty;',gtg='emptyset',m6g='emptyset;',n6g='emptyv;',o6g='emsp13;',p6g='emsp14;',s6g='emsp;',h0h='enable-background',tNh='encoding',tLh='enctype',n3g='end',t6g='eng;',u6g='ensp;',v6g='eogon;',w6g='eopf;',x6g='epar;',y6g='eparsl;',z6g='eplus;',A6g='epsi;',B6g='epsilon;',D6g='epsiv;',b2h='eq',E6g='eqcirc;',F6g='eqcolon;',a7g='eqsim;',b7g='eqslantgtr;',c7g='eqslantless;',vUh='equalcolumns',kPh='equalrows',d7g='equals;',e7g='equest;',f7g='equiv;',g7g='equivDD;',xug='equivalent',i7g='eqvparsl;',j7g='erDot;',k7g='erarr;',l7g='escr;',m7g='esdot;',n7g='esim;',o7g='eta;',p7g='eth',q7g='eth;',vug='eulergamma',r7g='euml',t7g='euml;',u7g='euro;',cvg='eventsource',v7g='excl;',w7g='exist;',h7h='exists',g3h='exp',x7g='expectation;',qNh='exponent',uvg='exponentiale',y7g='exponentiale;',o1h='externalResourcesRequired',n1h='externalresourcesrequired',m_g='face',fug='factorial',htg='factorof',z7g='fallingdotseq;',y5h='false',A7g='fcy;',bsg='feBlend',fwg='feColorMatrix',hxg='feComponentTransfer',gvg='feComposite',Dwg='feConvolveMatrix',Fwg='feDiffuseLighting',bxg='feDisplacementMap',rwg='feDistantLight',dsg='feFlood',Crg='feFuncA',Frg='feFuncB',ksg='feFuncG',msg='feFuncR',pwg='feGaussianBlur',fsg='feImage',hsg='feMerge',evg='feMergeNode',Bvg='feMorphology',ltg='feOffset',zvg='fePointLight',exg='feSpecularLighting',ivg='feSpotLight',j7h='feTile',wvg='feTurbulence',asg='feblend',ewg='fecolormatrix',gxg='fecomponenttransfer',fvg='fecomposite',Cwg='feconvolvematrix',Ewg='fediffuselighting',axg='fedisplacementmap',qwg='fedistantlight',csg='feflood',Brg='fefunca',Erg='fefuncb',jsg='fefuncg',lsg='fefuncr',owg='fegaussianblur',esg='feimage',B7g='female;',gsg='femerge',dvg='femergenode',Avg='femorphology',hmh='fence',ktg='feoffset',yvg='fepointlight',cxg='fespecularlighting',hvg='fespotlight',i7h='fetile',vvg='feturbulence',C7g='ffilig;',E7g='fflig;',F7g='ffllig;',a8g='ffr;',itg='fieldset',k7h='figure',b8g='filig;',w$g='fill',zUh='fill-opacity',rPh='fill-rule',wxh='filter',pPh='filterRes',iTh='filterUnits',oPh='filterres',hTh='filterunits',c8g='flat;',d8g='fllig;',jTh='flood-color',cXh='flood-opacity',z5h='floor',e8g='fltns;',c2h='fn',f8g='fnof;',u4h='font',eug='font-face',Bwg='font-face-format',mwg='font-face-name',Fvg='font-face-src',awg='font-face-uri',fTh='font-family',tPh='font-size',lZh='font-size-adjust',BUh='font-stretch',lRh='font-style',AUh='font-variant',lTh='font-weight',jRh='fontfamily',yNh='fontsize',sPh='fontstyle',kRh='fontweight',m7h='footer',g8g='fopf;',y3g='for',l7h='forall',h8g='forall;',dwg='foreignObject',bwg='foreignobject',j8g='fork;',k8g='forkv;',srg='form',byh='format',l8g='fpartint;',m8g='frac12',n8g='frac12;',o8g='frac13;',p8g='frac14',q8g='frac14;',r8g='frac15;',s8g='frac16;',u8g='frac18;',v8g='frac23;',w8g='frac25;',x8g='frac34',y8g='frac34;',z8g='frac35;',A8g='frac38;',B8g='frac45;',C8g='frac56;',D8g='frac58;',F8g='frac78;',smh='frame',gTh='frameborder',Axg='frameset',CUh='framespacing',a9g='frasl;',b_g='from',b9g='frown;',c9g='fscr;',oWg='fx',zWg='fy',u1h='g',dWg='g1',xVg='g2',d9g='gE;',e9g='gEl;',f9g='gacute;',g9g='gamma;',h9g='gammad;',i9g='gap;',k9g='gbreve;',h3h='gcd',l9g='gcirc;',m9g='gcy;',n9g='gdot;',o9g='ge;',p9g='gel;',i3h='geq',q9g='geq;',r9g='geqq;',s9g='geqslant;',t9g='ges;',v9g='gescc;',w9g='gesdot;',x9g='gesdoto;',y9g='gesdotol;',z9g='gesles;',A9g='gfr;',B9g='gg;',C9g='ggg;',D9g='gimel;',E9g='gjcy;',b$g='gl;',c$g='glE;',d$g='gla;',e$g='glj;',B5h='glyph',gRh='glyph-name',r1h='glyph-orientation-horizontal',p1h='glyph-orientation-vertical',vNh='glyphRef',uNh='glyphref',f$g='gnE;',g$g='gnap;',h$g='gnapprox;',i$g='gne;',j$g='gneq;',k$g='gneqq;',m$g='gnsim;',n$g='gopf;',v4h='grad',l0h='gradientTransform',bXh='gradientUnits',k0h='gradienttransform',aXh='gradientunits',o$g='grave;',hRh='groupalign',p$g='gscr;',q$g='gsim;',r$g='gsime;',s$g='gsiml;',j2h='gt',t$g='gt;',u$g='gtcc;',v$g='gtcir;',x$g='gtdot;',y$g='gtlPar;',z$g='gtquest;',A$g='gtrapprox;',B$g='gtrarr;',C$g='gtrdot;',D$g='gtreqless;',E$g='gtreqqless;',F$g='gtrless;',a_g='gtrsim;',d2h='h1',e2h='h2',f2h='h3',g2h='h4',h2h='h5',i2h='h6',c_g='hArr;',d_g='hairsp;',e_g='half;',f_g='hamilt;',nsg='handler',DLh='hanging',g_g='hardcy;',h_g='harr;',i_g='harrcir;',j_g='harrw;',k_g='hbar;',l_g='hcirc;',Drg='head',n7h='header',ELh='headers',n_g='hearts;',o_g='heartsuit;',xyh='height',p_g='hellip;',q_g='hercon;',r_g='hfr;',mEg='hidden',wPh='hidefocus',x_g='high',C5h='hkern',s_g='hksearow;',t_g='hkswarow;',u_g='hoarr;',v_g='homtht;',w_g='hookleftarrow;',y_g='hookrightarrow;',z_g='hopf;',A_g='horbar;',mTh='horiz-adv-x',bYh='horiz-origin-x',cYh='horiz-origin-y',k2h='hr',cah='href',DNh='hreflang',B_g='hscr;',C_g='hslash;',myh='hspace',D_g='hstrok;',hAg='html',oRh='http-equiv',jKg='http://n.validator.nu/placeholder/',jBg='http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd',wDg='http://www.w3.org/1998/Math/MathML',hrg='http://www.w3.org/1999/xhtml',rQg='http://www.w3.org/1999/xlink',bEg='http://www.w3.org/2000/svg',BPg='http://www.w3.org/2000/xmlns/',Esg='http://www.w3.org/TR/REC-html40/strict.dtd',mvg='http://www.w3.org/TR/html4/loose.dtd',jtg='http://www.w3.org/TR/html4/strict.dtd',Ftg='http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd',wug='http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd',gQg='http://www.w3.org/XML/1998/namespace',E_g='hybull;',F_g='hyphen;',w1h='i',aah='iacute',bah='iacute;',dah='ic;',eah='icirc',fah='icirc;',yah='icon',gah='icy;',kLg='id',E5h='ident',tTh='ideographic',hah='iecy;',iah='iexcl',jah='iexcl;',kah='iff;',lah='ifr;',DIg='iframe',mah='igrave',oah='igrave;',pah='ii;',qah='iiiint;',rah='iiint;',sah='iinfin;',tah='iiota;',uah='ijlig;',vah='imacr;',D5h='image',bZh='image-rendering',wah='image;',hug='imaginary',yug='imaginaryi',xah='imagline;',zah='imagpart;',Aah='imath;',j3h='img',Bah='imof;',Cah='imped;',psg='implies',qYg='in',d4g='in2',Dah='in;',Eah='incare;',tnh='index',Fah='infin;',otg='infinity',abh='infintie;',bbh='inodot;',pGg='input',aQh='inputmode',k3h='ins',l3h='int',cbh='int;',ebh='intcal;',ntg='integers',fbh='integers;',gbh='intercal;',yPh='intercept',kug='interface ',gug='intersect',mtg='interval',hbh='intlarhk;',ibh='intprod;',osg='inverse',jbh='iocy;',kbh='iogon;',lbh='iopf;',mbh='iota;',nbh='iprod;',qbh='iquest',rbh='iquest;',rRh='irrelevant',sbh='iscr;',tbh='isin;',ubh='isinE;',eGg='isindex',vbh='isindot;',wbh='isins;',xbh='isinsv;',ybh='isinv;',Dmh='ismap',zbh='it;',Bbh='itilde;',Cbh='iukcy;',Dbh='iuml',Ebh='iuml;',mIh='java.lang.',CIh='java.util.',Fbh='jcirc;',ach='jcy;',bch='jfr;',cch='jmath;',dch='jopf;',ech='jscr;',gch='jsercy;',hch='jukcy;',iSg='k',fYg='k1',pXg='k2',AXg='k3',eXg='k4',ich='kappa;',jch='kappav;',n3h='kbd',kch='kcedil;',lch='kcy;',EUh='kernelMatrix',nZh='kernelUnitLength',DUh='kernelmatrix',mZh='kernelunitlength',CLh='kerning',vPh='keyPoints',nRh='keySplines',BNh='keyTimes',o7h='keygen',uPh='keypoints',mRh='keysplines',ANh='keytimes',mch='kfr;',nch='kgreen;',och='khcy;',pch='kjcy;',rch='kopf;',sch='kscr;',tch='lAarr;',uch='lArr;',vch='lAtail;',wch='lBarr;',xch='lE;',ych='lEg;',zch='lHar;',wph='label',Ach='lacute;',Cch='laemptyv;',Dch='lagran;',p7h='lambda',Ech='lambda;',fch='lang',Fch='lang;',adh='langd;',bdh='langle;',rOh='language',cdh='lap;',iug='laplacian',ddh='laquo',edh='laquo;',rMh='largeop',fdh='larr;',hdh='larrb;',idh='larrbfs;',jdh='larrfs;',kdh='larrhk;',ldh='larrlp;',mdh='larrpl;',ndh='larrsim;',odh='larrtl;',pdh='lat;',qdh='latail;',sdh='late;',tdh='lbarr;',udh='lbbrk;',vdh='lbrace;',wdh='lbrack;',xdh='lbrke;',ydh='lbrksld;',zdh='lbrkslu;',Adh='lcaron;',Bdh='lcedil;',Ddh='lceil;',p3h='lcm',Edh='lcub;',Fdh='lcy;',aeh='ldca;',beh='ldquo;',ceh='ldquor;',deh='ldrdhar;',eeh='ldrushar;',feh='ldsh;',geh='le;',ieh='leftarrow;',jeh='leftarrowtail;',keh='leftharpoondown;',leh='leftharpoonup;',meh='leftleftarrows;',neh='leftrightarrow;',oeh='leftrightarrows;',peh='leftrightharpoons;',qeh='leftrightsquigarrow;',reh='leftthreetimes;',teh='leg;',q7h='legend',qVh='lengthAdjust',pVh='lengthadjust',q3h='leq',ueh='leq;',veh='leqq;',weh='leqslant;',xeh='les;',yeh='lescc;',zeh='lesdot;',Aeh='lesdoto;',Beh='lesdotor;',Ceh='lesges;',Feh='lessapprox;',afh='lessdot;',bfh='lesseqgtr;',cfh='lesseqqgtr;',dfh='lessgtr;',efh='lesssim;',jYh='letter-spacing',ffh='lfisht;',gfh='lfloor;',hfh='lfr;',ifh='lg;',kfh='lgE;',lfh='lhard;',mfh='lharu;',nfh='lharul;',ofh='lhblk;',m2h='li',kYh='lighting-color',F5h='limit',r0h='limitingConeAngle',q0h='limitingconeangle',w4h='line',twg='linearGradient',swg='lineargradient',hQh='linebreak',mXh='linethickness',Abh='link',qch='list',ptg='listener',rsg='listing',pfh='ljcy;',qfh='ll;',rfh='llarr;',sfh='llcorner;',tfh='llhard;',vfh='lltri;',wfh='lmidot;',xfh='lmoust;',yfh='lmoustache;',n2h='ln',zfh='lnE;',Afh='lnap;',Bfh='lnapprox;',Cfh='lne;',Dfh='lneq;',Efh='lneqq;',agh='lnsim;',bgh='loang;',cgh='loarr;',dgh='lobrk;',bqh='local',o3h='log',qsg='logbase',qOh='longdesc',egh='longleftarrow;',fgh='longleftrightarrow;',ggh='longmapsto;',hgh='longrightarrow;',igh='looparrowleft;',jgh='looparrowright;',qMh='loopend',iQh='loopstart',lgh='lopar;',mgh='lopf;',ngh='loplus;',ogh='lotimes;',e5g='low',pgh='lowast;',qgh='lowbar;',qtg='lowlimit',uEh='lowsrc',rgh='loz;',sgh='lozenge;',tgh='lozf;',ugh='lpar;',wgh='lparlt;',kFh='lquote',xgh='lrarr;',ygh='lrcorner;',zgh='lrhar;',Agh='lrhard;',Bgh='lrm;',Cgh='lrtri;',Dgh='lsaquo;',Egh='lscr;',Fgh='lsh;',bhh='lsim;',chh='lsime;',dhh='lsimg;',FEh='lspace',ehh='lsqb;',fhh='lsquo;',ghh='lsquor;',hhh='lstrok;',o2h='lt',ihh='lt;',jhh='ltcc;',khh='ltcir;',mhh='ltdot;',nhh='lthree;',ohh='ltimes;',phh='ltlarr;',qhh='ltquest;',rhh='ltrPar;',shh='ltri;',thh='ltrie;',uhh='ltrif;',vhh='lurdshar;',xhh='luruhar;',xMg='m',nNg='m:',yhh='mDDot;',zhh='macr',Ahh='macr;',EDh='macros',wsg='maction',Bhh='male;',jvg='maligngroup',zug='malignmark',Chh='malt;',Dhh='maltese;',mOh='manifest',s3h='map',Ehh='map;',Fhh='mapsto;',aih='mapstodown;',cih='mapstoleft;',dih='mapstoup;',jVh='marginheight',CTh='marginwidth',B4h='mark',y7h='marker',DRh='marker-end',CRh='marker-mid',mVh='marker-start',eih='marker;',lVh='markerHeight',ATh='markerUnits',ETh='markerWidth',kVh='markerheight',zTh='markerunits',DTh='markerwidth',vsg='marquee',pbh='mask',tZh='maskContentUnits',eQh='maskUnits',rZh='maskcontentunits',dQh='maskunits',A4h='math',iYh='mathbackground',cQh='mathcolor',oVh='mathematical',wLg='mathplayer',nOh='mathsize',BTh='mathvariant',B7h='matrix',jug='matrixrow',o4g='max',fQh='maxlength',pMh='maxsize',fih='mcomma;',gih='mcy;',hih='mdash;',C4h='mean',iih='measuredangle;',lph='media',w7h='median',cZh='mediummathspace',stg='menclose',E4h='menu',z7h='merror',E0h='message',x4h='meta',rtg='metadata',c6h='meter',jEh='method',ssg='mfenced',jih='mfr;',a6h='mfrac',v7h='mglyph',kih='mho;',p2h='mi',lih='micro',oih='micro;',pih='mid;',qih='midast;',rih='midcir;',sih='middot',tih='middot;',z4g='min',oMh='minsize',e6h='minus',uih='minus;',vih='minusb;',wih='minusd;',xih='minusdu;',gwg='missing-glyph',Bug='mlabeledtr',zih='mlcp;',Aih='mldr;',hwg='mmultiscripts',q2h='mn',Bih='mnplus;',r2h='mo',dbh='mode',Cih='models;',jIh='moduleStartup',A7h='moment',lvg='momentabout',Dih='mopf;',lXh='movablelimits',d6h='mover',Eih='mp;',usg='mpadded',b6h='mpath',ttg='mphantom',kvg='mprescripts',g6h='mroot',F4h='mrow',s2h='ms',Fih='mscr;',s7h='mspace',h6h='msqrt',ajh='mstpos;',u7h='mstyle',y4h='msub',xsg='msubsup',D4h='msup',t7h='mtable',r3h='mtd',i6h='mtext',t3h='mtr',bjh='mu;',cjh='multimap;',oOh='multiple',ejh='mumap;',x7h='munder',Aug='munderover',Bqg='must be positive',fjh='nLeftarrow;',gjh='nLeftrightarrow;',hjh='nRightarrow;',ijh='nVDash;',jjh='nVdash;',kjh='nabla;',ljh='nacute;',pXh='name',mjh='nap;',njh='napos;',pjh='napprox;',Foh='nargs',qjh='natur;',rjh='natural;',uwg='naturalnumbers',sjh='naturals;',w3h='nav',tjh='nbsp',ujh='nbsp;',vjh='ncap;',wjh='ncaron;',xjh='ncedil;',yjh='ncong;',Ajh='ncup;',Bjh='ncy;',Cjh='ndash;',Djh='ne;',Ejh='neArr;',Fjh='nearhk;',akh='nearr;',bkh='nearrow;',u3h='neq',ckh='nequiv;',dkh='nesear;',b5h='nest',fkh='nexist;',gkh='nexists;',hkh='nfr;',ikh='nge;',jkh='ngeq;',kkh='ngsim;',lkh='ngt;',mkh='ngtr;',nkh='nhArr;',okh='nharr;',qkh='nhpar;',rkh='ni;',skh='nis;',tkh='nisd;',ukh='niv;',vkh='njcy;',wkh='nlArr;',xkh='nlarr;',ykh='nldr;',zkh='nle;',Bkh='nleftarrow;',Ckh='nleftrightarrow;',Dkh='nleq;',Ekh='nless;',Fkh='nlsim;',alh='nlt;',blh='nltri;',clh='nltrie;',dlh='nmid;',zFg='nobr',iJg='noembed',tJg='noframes',tDh='nohref',a5h='none',elh='nopf;',lOh='noresize',vtg='noscript',nMh='noshade',v3h='not',glh='not;',Cug='notanumber',kOh='notation',j6h='notin',hlh='notin;',ilh='notinva;',jlh='notinvb;',klh='notinvc;',llh='notni;',mlh='notniva;',nlh='notnivb;',olh='notnivc;',nvg='notprsubset',mug='notsubset',iDh='nowrap',plh='npar;',rlh='nparallel;',slh='npolint;',tlh='npr;',ulh='nprcue;',vlh='nprec;',wlh='nrArr;',xlh='nrarr;',ylh='nrightarrow;',zlh='nrtri;',Alh='nrtrie;',Dlh='nsc;',Elh='nsccue;',Flh='nscr;',amh='nshortmid;',bmh='nshortparallel;',cmh='nsim;',dmh='nsime;',emh='nsimeq;',fmh='nsmid;',gmh='nspar;',imh='nsqsube;',jmh='nsqsupe;',kmh='nsub;',lmh='nsube;',mmh='nsubseteq;',nmh='nsucc;',omh='nsup;',pmh='nsupe;',qmh='nsupseteq;',rmh='ntgl;',tmh='ntilde',umh='ntilde;',vmh='ntlg;',wmh='ntriangleleft;',xmh='ntrianglelefteq;',ymh='ntriangleright;',zmh='ntrianglerighteq;',cKh='nu.validator.htmlparser.common.',lKh='nu.validator.htmlparser.gwt.',lIh='nu.validator.htmlparser.gwt.HtmlParserModule',iKh='nu.validator.htmlparser.impl.',Amh='nu;',rQh='null',Bmh='num;',BRh='numOctaves',Cmh='numero;',ARh='numoctaves',Emh='numsp;',Fmh='nvDash;',anh='nvHarr;',bnh='nvdash;',cnh='nvinfin;',dnh='nvlArr;',enh='nvrArr;',fnh='nwArr;',gnh='nwarhk;',hnh='nwarr;',jnh='nwarrow;',knh='nwnear;',lnh='oS;',mnh='oacute',nnh='oacute;',onh='oast;',FKg='object',qRh='occurrence',pnh='ocir;',qnh='ocirc',rnh='ocirc;',jxg='octype',snh='ocy;',unh='odash;',vnh='odblac;',wnh='odiv;',xnh='odot;',ynh='odsold;',znh='oelig;',Anh='ofcir;',gCh='offset',Bnh='ofr;',Cnh='ogon;',Dnh='ograve',Fnh='ograve;',aoh='ogt;',boh='ohbar;',coh='ohm;',doh='oint;',t2h='ol',eoh='olarr;',foh='olcir;',goh='olcross;',hoh='oline;',ioh='olt;',koh='omacr;',loh='omega;',moh='omicron;',noh='omid;',ooh='ominus;',kIh='onModuleLoadStart',iMh='onabort',pRh='onactivate',hVh='onafterprint',dXh='onafterupdate',m0h='onbefordeactivate',oZh='onbeforeactivate',iVh='onbeforecopy',uTh='onbeforecut',p0h='onbeforeeditfocus',gXh='onbeforepaste',kXh='onbeforeprint',hYh='onbeforeunload',dYh='onbeforeupdate',dMh='onbegin',BBh='onblur',aOh='onbounce',eVh='oncellchange',FNh='onchange',aMh='onclick',iXh='oncontextmenu',aZh='oncontrolselect',CCh='oncopy',uoh='oncut',FYh='ondataavailable',qZh='ondatasetchanged',n0h='ondatasetcomplete',sRh='ondblclick',FUh='ondeactivate',zzh='ondrag',uRh='ondragdrop',zPh='ondragend',sTh='ondragenter',nTh='ondragleave',xRh='ondragover',xTh='ondragstart',qBh='ondrop',inh='onend',gMh='onerror',fXh='onerrorupdate',eYh='onfilterchange',cOh='onfinish',fMh='onfocus',EPh='onfocusin',yRh='onfocusout',dVh='onformchange',wTh='onforminput',AAh='onhelp',hMh='oninput',CPh='oninvalid',DPh='onkeydown',vRh='onkeypress',eMh='onkeyup',nzh='onload',hXh='onlosecapture',xPh='onmessage',qTh='onmousedown',gVh='onmouseenter',bVh='onmouseleave',oTh='onmousemove',zRh='onmouseout',rTh='onmouseover',FPh='onmouseup',fVh='onmousewheel',czh='onmove',APh='onmoveend',yTh='onmovestart',FLh='onpaste',pZh='onpropertychange',x0h='onreadystatechange',iOh='onrepeat',kMh='onreset',ENh='onresize',wRh='onrowenter',bQh='onrowexit',aVh='onrowsdelete',fYh='onrowsinserted',dOh='onscroll',jOh='onselect',jXh='onselectstart',jMh='onstart',fBh='onstop',hOh='onsubmit',bOh='onunload',pAh='onzoom',poh='oopf;',lMh='opacity',qoh='opar;',nah='open',fOh='operator',roh='operp;',soh='oplus;',oxg='optgroup',cMh='optimum',dxg='option',u2h='or',toh='or;',voh='orarr;',woh='ord;',Enh='order',xoh='order;',yoh='orderof;',zoh='ordf',Aoh='ordf;',Boh='ordm',Coh='ordm;',bLh='org.xml.sax.',rCh='orient',pTh='orientation',eAh='origin',Doh='origof;',Eoh='oror;',aph='orslope;',bph='orv;',cph='oscr;',dph='oslash',eph='oslash;',fph='osol;',joh='other',nug='otherwise',gph='otilde',hph='otilde;',iph='otimes;',jph='otimesas;',mph='ouml',nph='ouml;',Cvg='outerproduct',Dqg='output',oph='ovbar;',gOh='overflow',o0h='overline-position',y0h='overline-thickness',ywg='p',CNh='panose-1',pph='par;',qph='para',rph='para;',sph='parallel;',l6h='param',tph='parsim;',uph='parsl;',vph='part;',ovg='partialdiff',heh='path',gSh='pathLength',fSh='pathlength',BMh='pattern',e1h='patternContentUnits',vZh='patternTransform',zVh='patternUnits',d1h='patterncontentunits',uZh='patterntransform',xVh='patternunits',xph='pcy;',yph='percnt;',zph='period;',Aph='permil;',Bph='perp;',Cph='pertenk;',Dph='pfr;',Eph='phi;',Fph='phiv;',aqh='phmmat;',cqh='phone;',v2h='pi',dqh='pi;',k6h='piece',oug='piecewise',seh='ping',eqh='pitchfork;',fqh='piv;',EJg='plaintext',gqh='planck;',hqh='planckh;',iqh='plankv;',uQh='playcount',c5h='plus',jqh='plus;',kqh='plusacir;',lqh='plusb;',nqh='pluscir;',oqh='plusdo;',pqh='plusdu;',qqh='pluse;',rqh='plusmn',sqh='plusmn;',tqh='plussim;',uqh='plustwo;',vqh='pm;',oYh='pointer-events',wqh='pointint;',dIh='points',pQh='pointsAtX',tQh='pointsAtY',nQh='pointsAtZ',oQh='pointsatx',qQh='pointsaty',mQh='pointsatz',ysg='polygon',wtg='polyline',yqh='popf;',yHh='poster',zqh='pound',Aqh='pound;',m6h='power',Bqh='pr;',Cqh='prE;',Dqh='prap;',Eqh='prcue;',y3h='pre',Fqh='pre;',arh='prec;',brh='precapprox;',drh='preccurlyeq;',erh='preceq;',frh='precnapprox;',grh='precneqq;',hrh='precnsim;',irh='precsim;',xtg='prefetch',vXh='preserveAlpha',c1h='preserveAspectRatio',uXh='preservealpha',b1h='preserveaspectratio',jrh='prime;',Eqg='primes',krh='primes;',qYh='primitiveUnits',pYh='primitiveunits',lrh='prnE;',mrh='prnap;',orh='prnsim;',prh='prod;',zsg='product',qrh='profalar;',CMh='profile',rrh='profline;',srh='profsurf;',ytg='progress',oIh='prompt',trh='prop;',urh='propto;',vrh='prsim;',ztg='prsubset',wrh='prurel;',xrh='pscr;',zrh='psi;',Arh='puncsp;',x1h='q',Brh='qfr;',Crh='qint;',Drh='qopf;',Erh='qprime;',Frh='qscr;',ash='quaternions;',bsh='quatint;',csh='quest;',esh='questeq;',fsh='quot',gsh='quot;',Atg='quotient',uSg='r',hsh='rAarr;',ish='rArr;',jsh='rAtail;',ksh='rBarr;',lsh='rHar;',msh='race;',nsh='racute;',wwg='radialGradient',vwg='radialgradient',psh='radic;',iSh='radiogroup',gKh='radius',qsh='raemptyv;',rsh='rang;',ssh='rangd;',tsh='range;',ush='rangle;',vsh='raquo',wsh='raquo;',xsh='rarr;',ysh='rarrap;',Bsh='rarrb;',Csh='rarrbfs;',Dsh='rarrc;',Esh='rarrfs;',Fsh='rarrhk;',ath='rarrlp;',bth='rarrpl;',cth='rarrsim;',dth='rarrtl;',eth='rarrw;',gth='ratail;',hth='ratio;',pug='rationals',ith='rationals;',jth='rbarr;',kth='rbbrk;',lth='rbrace;',mth='rbrack;',nth='rbrke;',oth='rbrksld;',pth='rbrkslu;',rth='rcaron;',sth='rcedil;',tth='rceil;',uth='rcub;',vth='rcy;',wth='rdca;',xth='rdldhar;',yth='rdquo;',zth='rdquor;',Ath='rdsh;',uOh='readonly',f5h='real',Cth='real;',Dth='realine;',Eth='realpart;',n6h='reals',Fth='reals;',h5h='rect',auh='rect;',jfh='refX',Ffh='refY',Eeh='refx',ufh='refy',buh='reg',cuh='reg;',p5g='rel',g5h='reln',z3h='rem',yZh='rendering-intent',yNg='renesis',CKh='repeat',hSh='repeat-max',mSh='repeat-min',FVh='repeat-start',gZh='repeat-template',gUh='repeatCount',yQh='repeatDur',fUh='repeatcount',xQh='repeatdur',fNh='replace',BOh='required',C0h='requiredExtensions',xZh='requiredFeatures',B0h='requiredextensions',wZh='requiredfeatures',EMh='restart',rKh='result',A5g='rev',duh='rfisht;',euh='rfloor;',fuh='rfr;',huh='rhard;',iuh='rharu;',juh='rharul;',kuh='rho;',luh='rhov;',muh='rightarrow;',nuh='rightarrowtail;',ouh='rightharpoondown;',puh='rightharpoonup;',quh='rightleftarrows;',suh='rightleftharpoons;',tuh='rightrightarrows;',uuh='rightsquigarrow;',vuh='rightthreetimes;',wuh='ring;',xuh='risingdotseq;',yuh='rlarr;',zuh='rlhar;',Auh='rlm;',Buh='rmoust;',Duh='rmoustache;',Euh='rnmid;',Fuh='roang;',avh='roarr;',bvh='robrk;',bih='role',i5h='root',cvh='ropar;',dvh='ropf;',evh='roplus;',fLh='rotate',fvh='rotimes;',yOh='rowalign',wOh='rowlines',ahh='rows',nSh='rowspacing',FMh='rowspan',x2h='rp',gvh='rpar;',ivh='rpargt;',jvh='rppolint;',gLh='rquote',kvh='rrarr;',lvh='rsaquo;',mvh='rscr;',nvh='rsh;',eLh='rspace',ovh='rsqb;',pvh='rsquo;',qvh='rsquor;',tZg='rt',rvh='rthree;',tvh='rtimes;',uvh='rtri;',vvh='rtrie;',wvh='rtrif;',xvh='rtriltri;',AGg='ruby',d5h='rule',fth='rules',yvh='ruluhar;',EZg='rx',zvh='rx;',j0g='ry',oOg='s',fPg='s:',Avh='sacute;',l5h='samp',aNh='sandbox',Bvh='sbquo;',Cvh='sc;',Evh='scE;',iwg='scalarproduct',osh='scale',Fvh='scap;',awh='scaron;',bwh='sccue;',cwh='sce;',dwh='scedil;',pJh='scheme',ewh='scirc;',fwh='scnE;',gwh='scnap;',hwh='scnsim;',dsh='scope',zIh='scoped',lwh='scpolint;',hIg='script',eUh='scriptlevel',wXh='scriptminsize',g1h='scriptsizemultiplier',lUh='scrolldelay',wQh='scrolling',mwh='scsim;',nwh='scy;',n5h='sdev',owh='sdot;',pwh='sdotb;',qwh='sdote;',rwh='seArr;',xOh='seamless',swh='searhk;',twh='searr;',uwh='searrow;',B3h='sec',j5h='sech',wwh='sect',xwh='sect;',Bsg='section',vgh='seed',xvg='select',vOh='selected',zQh='selection',Btg='selector',qug='semantics',ywh='semi;',F3h='sep',AQh='separator',lSh='separators',zwh='seswar;',b4h='set',Asg='setdiff',Awh='setminus;',Bwh='setmn;',Cwh='sext;',Dwh='sfr;',Ewh='sfrown;',yrh='shape',eZh='shape-rendering',Fwh='sharp;',bxh='shchcy;',cxh='shcy;',dxh='shortmid;',exh='shortparallel;',vSh='show',fxh='shy',gxh='shy;',hxh='sigma;',ixh='sigmaf;',jxh='sigmav;',kxh='sim;',mxh='simdot;',nxh='sime;',oxh='simeq;',pxh='simg;',qxh='simgE;',rxh='siml;',sxh='simlE;',txh='simne;',uxh='simplus;',vxh='simrarr;',E3h='sin',k5h='sinh',kgh='size',xxh='slarr;',nrh='slope',o6h='small',yxh='smallsetminus;',zxh='smashp;',Axh='smeparsl;',Bxh='smid;',Cxh='smile;',Dxh='smt;',Exh='smte;',Fxh='softcy;',ayh='sol;',cyh='solb;',dyh='solbar;',Dug='solidcolor',eyh='sopf;',Fqg='source',CQh='space',erg='spacer',DMh='spacing',fyh='spades;',gyh='spadesuit;',lhh='span',hyh='spar;',xXh='specification',CZh='specularConstant',AZh='specularExponent',BZh='specularconstant',zZh='specularexponent',Ash='speed',BVh='spreadMethod',AVh='spreadmethod',iyh='sqcap;',jyh='sqcup;',kyh='sqsub;',lyh='sqsube;',nyh='sqsubset;',oyh='sqsubseteq;',pyh='sqsup;',qyh='sqsupe;',ryh='sqsupset;',syh='sqsupseteq;',tyh='squ;',uyh='square;',vyh='squarf;',wyh='squf;',yyh='srarr;',f6g='src',zyh='sscr;',Ayh='ssetmn;',Byh='ssmile;',Cyh='sstarf;',eNh='standby',Dyh='star;',Eyh='starf;',guh='start',kUh='startOffset',jUh='startoffset',iIh='startup',bWh='stdDeviation',aWh='stddeviation',qth='stemh',Bth='stemv',whh='step',iUh='stitchTiles',hUh='stitchtiles',m5h='stop',kSh='stop-color',cWh='stop-opacity',Fyh='straightepsilon;',azh='straightphi;',zOh='stretchy',arg='strike',l1h='strikethrough-position',m1h='strikethrough-thickness',eJh='string',bzh='strns;',AJh='stroke',FZh='stroke-dasharray',u0h='stroke-dashoffset',uYh='stroke-linecap',fZh='stroke-linejoin',v0h='stroke-miterlimit',wYh='stroke-opacity',EVh='stroke-width',brg='strong',BHg='style',A3h='sub',dzh='sub;',ezh='subE;',fzh='subdot;',gzh='sube;',hzh='subedot;',izh='submult;',jzh='subnE;',kzh='subne;',lzh='subplus;',mzh='subrarr;',vYh='subscriptshift',frg='subset',ozh='subset;',pzh='subseteq;',qzh='subseteqq;',rzh='subsetneq;',szh='subsetneqq;',tzh='subsim;',uzh='subsub;',vzh='subsup;',wzh='succ;',xzh='succapprox;',Azh='succcurlyeq;',Bzh='succeq;',Czh='succnapprox;',Dzh='succneqq;',Ezh='succnsim;',Fzh='succsim;',D3h='sum',aAh='sum;',bNh='summary',bAh='sung;',a4h='sup',cAh='sup1',dAh='sup1;',fAh='sup2',gAh='sup2;',hAh='sup3',iAh='sup3;',jAh='sup;',kAh='supE;',lAh='supdot;',mAh='supdsub;',nAh='supe;',oAh='supedot;',EZh='superscriptshift',qAh='suphsub;',rAh='suplarr;',sAh='supmult;',tAh='supnE;',uAh='supne;',vAh='supplus;',wAh='supset;',xAh='supseteq;',yAh='supseteqq;',zAh='supsetneq;',BAh='supsetneqq;',CAh='supsim;',DAh='supsub;',EAh='supsup;',DVh='surfaceScale',CVh='surfacescale',C3h='svg',FAh='swArr;',aBh='swarhk;',bBh='swarr;',cBh='swarrow;',crg='switch',dBh='swnwar;',drg='symbol',vQh='symmetric',tYh='systemLanguage',sYh='systemlanguage',eBh='szlig',gBh='szlig;',tOh='tabindex',cwg='table',dUh='tableValues',cUh='tablevalues',d4h='tan',s5h='tanh',lGh='target',hBh='target;',uMh='targetX',wMh='targetY',tMh='targetx',vMh='targety',iBh='tau;',FBg='tbody',grg='tbreak',jBh='tbrk;',kBh='tcaron;',lBh='tcedil;',mBh='tcy;',fyg='td',nBh='tdot;',oBh='telrec;',sOh='template',Csg='tendsto',Cdh='text',FTh='text-anchor',dZh='text-decoration',mYh='text-rendering',aSh='textLength',Dtg='textPath',qHg='textarea',FRh='textlength',Ctg='textpath',vCg='tfoot',pBh='tfr;',qyg='th',kCg='thead',rBh='there4;',sBh='therefore;',tBh='theta;',uBh='thetasym;',vBh='thetav;',wBh='thickapprox;',lYh='thickmathspace',xBh='thicksim;',oXh='thinmathspace',yBh='thinsp;',zBh='thkap;',ABh='thksim;',CBh='thorn',DBh='thorn;',EBh='tilde;',o5h='time',r6h='times',FBh='times;',aCh='timesb;',bCh='timesbar;',cCh='timesd;',dCh='tint;',fHg='title',u0g='to',eCh='toea;',fCh='top;',hCh='topbot;',iCh='topcir;',jCh='topf;',kCh='topfork;',lCh='tosa;',mCh='tprime;',uBg='tr',nCh='trade;',jQh='transform',rug='transpose',r5h='tref',oCh='triangle;',pCh='triangledown;',qCh='triangleleft;',sCh='trianglelefteq;',tCh='triangleq;',uCh='triangleright;',vCh='trianglerighteq;',wCh='tridot;',xCh='trie;',yCh='triminus;',zCh='triplus;',ACh='trisb;',BCh='tritime;',DCh='trpezium;',q5h='true',ECh='tscr;',FCh='tscy;',aDh='tshcy;',p6h='tspan',bDh='tstrok;',y2h='tt',cDh='twixt;',dDh='twoheadleftarrow;',eDh='twoheadrightarrow;',Bch='type',y1h='u',gZg='u1',BYg='u2',fDh='uArr;',gDh='uHar;',jDh='uacute',kDh='uacute;',lDh='uarr;',kxg='ublic',mDh='ubrcy;',nDh='ubreve;',oDh='ucirc',pDh='ucirc;',qDh='ucy;',rDh='udarr;',sDh='udblac;',uDh='udhar;',vDh='ufisht;',wDh='ufr;',xDh='ugrave',yDh='ugrave;',zDh='uharl;',ADh='uharr;',BDh='uhblk;',z2h='ul',CDh='ulcorn;',DDh='ulcorner;',FDh='ulcrop;',aEh='ultri;',bEh='umacr;',cEh='uml',dEh='uml;',z0h='underline-position',a1h='underline-thickness',sMh='unicode',sVh='unicode-bidi',nXh='unicode-range',s6h='union',tVh='units-per-em',rVh='unselectable',eEh='uogon;',fEh='uopf;',gEh='uparrow;',hEh='updownarrow;',iEh='upharpoonleft;',kEh='upharpoonright;',Dsg='uplimit',lEh='uplus;',mEh='upsi;',nEh='upsih;',oEh='upsilon;',pEh='upuparrows;',qEh='urcorn;',rEh='urcorner;',sEh='urcrop;',tEh='uring;',vEh='urtri;',wEh='uscr;',e4h='use',vFh='usemap',xEh='utdot;',yEh='utilde;',zEh='utri;',AEh='utrif;',BEh='uuarr;',CEh='uuml',DEh='uuml;',EEh='uwangle;',wVh='v-alphabetic',kQh='v-hanging',tXh='v-ideographic',nYh='v-mathematical',aFh='vArr;',bFh='vBar;',cFh='vBarv;',dFh='vDash;',cHh='valign',crh='value',xGh='values',lQh='valuetype',eFh='vangrt;',f4h='var',fFh='varepsilon;',Etg='variance',gFh='varkappa;',hFh='varnothing;',iFh='varphi;',jFh='varpi;',lFh='varpropto;',mFh='varr;',nFh='varrho;',oFh='varsigma;',pFh='vartheta;',qFh='vartriangleleft;',rFh='vartriangleright;',sFh='vcy;',tFh='vdash;',irg='vector',jwg='vectorproduct',uFh='vee;',wFh='veebar;',xFh='veeeq;',yFh='vellip;',zFh='verbar;',AMh='version',eSh='vert-adv-y',rXh='vert-origin-x',sXh='vert-origin-y',AFh='vert;',A0h='verythickmathspace',s0h='verythinmathspace',j1h='veryverythickmathspace',i1h='veryverythinmathspace',BFh='vfr;',u6h='video',t5h='view',zMh='viewBox',dSh='viewTarget',yMh='viewbox',cSh='viewtarget',bSh='visibility',t6h='vkern',xqh='vlink',CFh='vltri;',DFh='vopf;',EFh='vprop;',FFh='vrtri;',bGh='vscr;',nHh='vspace',cGh='vzigzag;',g4h='wbr',dGh='wcirc;',eGh='wedbar;',fGh='wedge;',gGh='wedgeq;',hGh='weierp;',iGh='wfr;',gdh='when',mqh='width',aGh='widths',jGh='wopf;',uVh='word-spacing',kGh='wp;',mGh='wr;',rdh='wrap',nGh='wreath;',vVh='writing-mode',oGh='wscr;',FSg='x',EOh='x-height',v1g='x1',a2g='x2',b0h='xChannelSelector',pGh='xcap;',a0h='xchannelselector',qGh='xcirc;',rGh='xcup;',sGh='xdtri;',tGh='xfr;',uGh='xhArr;',vGh='xharr;',yGh='xi;',zGh='xlArr;',AGh='xlarr;',hRg='xlink',yXh='xlink:actuate',AXh='xlink:arcrole',sSh='xlink:href',rSh='xlink:role',tSh='xlink:show',oUh='xlink:title',qSh='xlink:type',BGh='xmap;',sRg='xml',COh='xml:base',DOh='xml:lang',BQh='xml:space',CQg='xmlns',s1h='xmlns:',nUh='xmlns:xlink',sIg='xmp',CGh='xnis;',DGh='xodot;',EGh='xopf;',FGh='xoplus;',h4h='xor',aHh='xotime;',bHh='xrArr;',dHh='xrarr;',nih='xref',eHh='xscr;',fHh='xsqcup;',gHh='xuplus;',hHh='xutri;',iHh='xvee;',jHh='xwedge;',kTg='y',k1g='y1',F0g='y2',d0h='yChannelSelector',kHh='yacute',lHh='yacute;',mHh='yacy;',c0h='ychannelselector',oHh='ycirc;',pHh='ycy;',qHh='yen',rHh='yen;',sHh='yfr;',tHh='yicy;',uHh='yopf;',vHh='yscr;',lxg='ystem',wHh='yucy;',xHh='yuml',zHh='yuml;',vTg='z',AHh='zacute;',BHh='zcaron;',CHh='zcy;',DHh='zdot;',EHh='zeetrf;',FHh='zeta;',aIh='zfr;',bIh='zhcy;',cIh='zigrarr;',pSh='zoomAndPan',oSh='zoomandpan',eIh='zopf;',fIh='zscr;',gIh='zwj;',hIh='zwnj;',b3g='{',F9g='}',tsg='\u201D cannot be represented as XML 1.0.',eyg='\u201D is not serializable as XML 1.0.',nxg='\u201D without an explicit value seen. The attribute may be dropped by IE7.',rxg='\u201D.';var _,C7h=[0,-9223372036854775808],D7h=[16777216,0],E7h=[4294967295,9223372032559808512];
function zdi(a){return (this==null?null:this)===(a==null?null:a)}
function Adi(){return k$h}
function Bdi(){return this.$H||(this.$H=++D8h)}
function Cdi(){return (this.tM==v0i||this.tI==2?this.gC():F9h).b+zqg+idi(this.tM==v0i||this.tI==2?this.hC():this.$H||(this.$H=++D8h),4)}
function xdi(){}
_=xdi.prototype={};_.eQ=zdi;_.gC=Adi;_.hC=Bdi;_.tS=Cdi;_.toString=function(){return this.tS()};_.tM=v0i;_.tI=1;function agi(c){var a,b;a=c.gC().b;b=c.Bb();if(b!=null){return a+Aqg+b}else{return a}}
function bgi(){return q$h}
function cgi(){return this.b}
function dgi(){return agi(this)}
function Efi(){}
_=Efi.prototype=new xdi();_.gC=bgi;_.Bb=cgi;_.tS=dgi;_.tI=3;_.b=null;function Bci(b,a){b.b=a;return b}
function Dci(){return g$h}
function Aci(){}
_=Aci.prototype=new Efi();_.gC=Dci;_.tI=4;function Edi(b,a){b.b=a;return b}
function aei(){return l$h}
function Ddi(){}
_=Ddi.prototype=new Aci();_.gC=aei;_.tI=5;function a8h(b,a){Bci(b,rZg+h8h(a)+iwh+e8h(a)+(a!=null&&(a.tM!=v0i&&a.tI!=2)?i8h(o9h(a)):cNh));h8h(a);e8h(a);f8h(a);return b}
function c8h(){return E9h}
function e8h(a){if(a!=null&&(a.tM!=v0i&&a.tI!=2)){return d8h(o9h(a))}else{return a+cNh}}
function d8h(a){return a==null?null:a.message}
function f8h(a){if(a!=null&&(a.tM!=v0i&&a.tI!=2)){return o9h(a)}else{return null}}
function h8h(a){if(a==null){return rQh}else if(a!=null&&(a.tM!=v0i&&a.tI!=2)){return g8h(o9h(a))}else if(a!=null&&n9h(a.tI,1)){return aUh}else{return (a.tM==v0i||a.tI==2?a.gC():F9h).b}}
function g8h(a){return a==null?null:a.name}
function i8h(a){var b=cNh;for(prop in a){if(prop!=pXh&&prop!=E0h){b+=n4h+prop+Aqg+a[prop]}}return b}
function F7h(){}
_=F7h.prototype=new Ddi();_.gC=c8h;_.tI=6;function q8h(){return function(){}}
function s8h(b,a){return b.tM==v0i||b.tI==2?b.eQ(a):(b==null?null:b)===(a==null?null:a)}
function w8h(a){return a.tM==v0i||a.tI==2?a.hC():a.$H||(a.$H=++D8h)}
var D8h=0;function c9h(e,c){var d=[null,0,false,[0,0]];var f=d[e];var a=new Array(c);for(var b=0;b<c;++b){a[b]=f}return a}
function d9h(){return this.aC}
function e9h(a,f,c,b,e){var d;d=c9h(e,b);f9h(a,f,c,d);return d}
function f9h(b,d,c,a){if(!g9h){g9h=new E8h()}j9h(a,g9h);a.aC=b;a.tI=d;a.qI=c;return a}
function h9h(a,b,c){if(c!=null){if(a.qI>0&&!m9h(c.tI,a.qI)){throw new Ebi()}if(a.qI<0&&(c.tM==v0i||c.tI==2)){throw new Ebi()}}return a[b]=c}
function j9h(a,c){for(var b in c){var d=c[b];if(d){a[b]=d}}return a}
function E8h(){}
_=E8h.prototype=new xdi();_.gC=d9h;_.tI=0;_.aC=null;_.length=0;_.qI=0;var g9h=null;function n9h(b,a){return b&&!!B9h[b][a]}
function m9h(b,a){return b&&B9h[b][a]}
function p9h(b,a){if(b!=null&&!m9h(b.tI,a)){throw new eci()}return b}
function o9h(a){if(a!=null&&(a.tM==v0i||a.tI==2)){throw new eci()}return a}
function s9h(b,a){return b!=null&&n9h(b.tI,a)}
var B9h=[{},{},{1:1,6:1,7:1,8:1},{2:1,6:1},{2:1,6:1},{2:1,6:1},{2:1,6:1,19:1},{4:1},{2:1,6:1},{2:1,6:1},{2:1,6:1},{2:1,6:1},{2:1,6:1},{6:1,8:1},{2:1,6:1},{2:1,6:1},{2:1,6:1},{7:1},{7:1},{2:1,6:1},{2:1,6:1},{18:1},{14:1},{14:1},{14:1},{15:1},{15:1},{6:1,15:1},{6:1,16:1},{6:1,15:1},{2:1,6:1,17:1},{6:1,8:1},{6:1,8:1},{6:1,8:1},{20:1},{3:1},{9:1},{10:1},{11:1},{21:1},{2:1,6:1,22:1},{2:1,6:1,22:1},{12:1},{13:1},{5:1},{5:1},{5:1},{5:1},{5:1},{5:1},{5:1},{5:1},{5:1},{5:1}];function gai(a){if(a!=null&&n9h(a.tI,2)){return a}return a8h(new F7h(),a)}
function rai(d,c){var a,b;c%=1.8446744073709552E19;d%=1.8446744073709552E19;a=c%4294967296;b=Math.floor(d/4294967296)*4294967296;c=c-a+b;d=d-b+a;while(d<0){d+=4294967296;c-=4294967296}while(d>4294967295){d-=4294967296;c+=4294967296}c=c%1.8446744073709552E19;while(c>9223372032559808512){c-=1.8446744073709552E19}while(c<-9223372036854775808){c+=1.8446744073709552E19}return [d,c]}
function sai(a){if(isNaN(a)){return mai(),pai}if(a<-9223372036854775808){return mai(),oai}if(a>=9223372036854775807){return mai(),nai}if(a>0){return rai(Math.floor(a),0)}else{return rai(Math.ceil(a),0)}}
function tai(c){var a,b;if(c>-129&&c<128){a=c+128;b=(jai(),kai)[a];if(b==null){b=kai[a]=uai(c)}return b}return uai(c)}
function uai(a){if(a>=0){return [a,0]}else{return [a+4294967296,-4294967296]}}
function jai(){jai=v0i;kai=e9h(dai,53,13,256,0)}
var kai;function mai(){mai=v0i;Math.log(2);nai=E7h;oai=C7h;tai(-1);tai(1);tai(2);pai=tai(0)}
var nai,oai,pai;function gbi(){gbi=v0i;obi=fji(new eji());sbi(new bbi())}
function fbi(a){if(a.b){clearInterval(a.c)}else{clearTimeout(a.c)}lji(obi,a)}
function hbi(a){if(!a.b){lji(obi,a)}rni(a)}
function ibi(b,a){if(a<=0){throw Fci(new Eci(),Bqg)}fbi(b);b.b=false;b.c=lbi(b,a);gji(obi,b)}
function lbi(b,a){return setTimeout(function(){b.zb()},a)}
function mbi(){hbi(this)}
function nbi(){return b$h}
function abi(){}
_=abi.prototype=new xdi();_.zb=mbi;_.gC=nbi;_.tI=0;_.b=false;_.c=0;var obi;function dbi(){while((gbi(),obi).b>0){fbi(p9h(iji(obi,0),3))}}
function ebi(){return a$h}
function bbi(){}
_=bbi.prototype=new xdi();_.gC=ebi;_.tI=7;
function sbi(a){ybi();if(!tbi){tbi=fji(new eji())}gji(tbi,a)}
function ubi(){var a;if(tbi){for(a=zhi(new xhi(),tbi);a.a<a.b.bc();){p9h(Chi(a),4);dbi()}}}
function vbi(){var a,b;b=null;if(tbi){for(a=zhi(new xhi(),tbi);a.a<a.b.bc();){p9h(Chi(a),4);b=null}}return b}
function xbi(){__gwt_initHandlers(function(){},function(){return vbi()},function(){ubi()})}
function ybi(){if(!wbi){xbi();wbi=true}}
var tbi=null,wbi=false;function Fbi(b,a){b.b=a;return b}
function bci(){return c$h}
function Ebi(){}
_=Ebi.prototype=new Ddi();_.gC=bci;_.tI=9;function ici(c,a){var b;b=new dci();b.b=c+a;b.a=4;return b}
function jci(c,a){var b;b=new dci();b.b=c+a;return b}
function kci(c,a){var b;b=new dci();b.b=c+a;b.a=8;return b}
function mci(){return e$h}
function nci(){return ((this.a&2)!=0?kug:(this.a&1)!=0?cNh:zxg)+this.b}
function dci(){}
_=dci.prototype=new xdi();_.gC=mci;_.tS=nci;_.tI=0;_.a=0;_.b=null;function gci(){return d$h}
function eci(){}
_=eci.prototype=new Ddi();_.gC=gci;_.tI=12;function vci(a){return this.b-a.b}
function wci(a){return (this==null?null:this)===(a==null?null:a)}
function xci(){return f$h}
function yci(){return this.$H||(this.$H=++D8h)}
function zci(){return this.a}
function tci(){}
_=tci.prototype=new xdi();_.cT=vci;_.eQ=wci;_.gC=xci;_.hC=yci;_.tS=zci;_.tI=13;_.a=null;_.b=0;function Fci(b,a){b.b=a;return b}
function bdi(){return h$h}
function Eci(){}
_=Eci.prototype=new Ddi();_.gC=bdi;_.tI=14;function ddi(b,a){b.b=a;return b}
function fdi(){return i$h}
function cdi(){}
_=cdi.prototype=new Ddi();_.gC=fdi;_.tI=15;function idi(f,e){var a,b,c,d;c=~~(32/e);a=(1<<e)-1;b=e9h(A_h,42,-1,c,1);d=c-1;if(f>=0){while(f>a){b[d--]=(udi(),vdi)[f&a];f>>=e}}else{while(d>0){b[d--]=(udi(),vdi)[f&a];f>>=e}}b[d]=(udi(),vdi)[f&a];return ofi(b,d,c)}
function rdi(){return j$h}
function pdi(){}
_=pdi.prototype=new Ddi();_.gC=rdi;_.tI=16;function udi(){udi=v0i;vdi=f9h(A_h,42,-1,[48,49,50,51,52,53,54,55,56,57,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122])}
var vdi;function efi(b,a){if(!(a!=null&&n9h(a.tI,1))){return false}return String(b)==a}
function ffi(f,c,d,a,b){var e;for(e=c;e<d;++e){a[b++]=f.charCodeAt(e)}}
function lfi(c){var a,b;b=c.length;a=e9h(A_h,42,-1,b,1);ffi(c,0,b,a,0);return a}
function mfi(b,c,a){if(c<0){throw Fei(new Eei(),c)}if(a<c){throw Fei(new Eei(),a-c)}if(a>b){throw Fei(new Eei(),a)}}
function ofi(c,b,a){c=c.slice(b,a);return String.fromCharCode.apply(null,c)}
function qfi(b,a){b=String(b);if(b==a){return 0}return b<a?-1:1}
function pfi(a){return qfi(this,a)}
function rfi(a){return efi(this,a)}
function sfi(){return p$h}
function tfi(){return iei(this)}
function ufi(){return this}
function xfi(d,c,a){var b;b=c+a;mfi(d.length,c,b);return ofi(d,c,b)}
_=String.prototype;_.cT=pfi;_.eQ=rfi;_.gC=sfi;_.hC=tfi;_.tS=ufi;_.tI=2;function dei(){dei=v0i;eei={};hei={}}
function fei(e){var a,b,c,d;d=e.length;c=d<64?1:~~(d/32);a=0;for(b=0;b<d;b+=c){a<<=1;a+=e.charCodeAt(b)}a|=0;return a}
function iei(c){dei();var a=iBg+c;var b=hei[a];if(b!=null){return b}b=eei[a];if(b==null){b=fei(c)}jei();return hei[a]=b}
function jei(){if(gei==256){eei=hei;hei={};gei=0}++gei}
var eei,gei=0,hei;function mei(a){a.a=tei(new rei());return a}
function nei(a,b){uei(a.a,b);return a}
function pei(){return m$h}
function qei(){return zei(this.a)}
function kei(){}
_=kei.prototype=new xdi();_.gC=pei;_.tS=qei;_.tI=17;function tei(a){a.b=e9h(D_h,48,1,0,0);return a}
function uei(b,c){var a;if(c==null){c=rQh}a=c.length;if(a>0){b.b[b.a++]=c;b.c+=a;if(b.a>1024){zei(b);b.b.length=1024}}return b}
function wei(f,e,d,a,b){var c;mfi(f.c,e,d);mfi(a.length,b,b+(d-e));c=zei(f);while(e<d){a[b++]=c.charCodeAt(e++)}}
function yei(d,b){var c,a;c=d.c;if(b<c){a=zei(d);d.b=f9h(D_h,48,1,[a.substr(0,b-0),cNh,a.substr(c,a.length-c)]);d.a=3;d.c+=cNh.length-(c-b)}else if(b>c){uei(d,String.fromCharCode.apply(null,e9h(A_h,42,-1,b-c,1)))}}
function zei(b){var a;if(b.a!=1){b.b.length=b.a;a=b.b.join(cNh);b.b=f9h(D_h,48,1,[a]);b.a=1}return b.b[0]}
function Aei(){return n$h}
function Dei(){return zei(this)}
function rei(){}
_=rei.prototype=new xdi();_.gC=Aei;_.tS=Dei;_.tI=18;_.a=0;_.c=0;function Fei(b,a){b.b=xEg+a;return b}
function bfi(){return o$h}
function Eei(){}
_=Eei.prototype=new cdi();_.gC=bfi;_.tI=19;function Afi(h,j,a,d,g){var b,c,e,f,i,k,l;if(h==null||a==null){throw new pdi()}k=(h.tM==v0i||h.tI==2?h.gC():F9h).b;e=(a.tM==v0i||a.tI==2?a.gC():F9h).b;if(k.charCodeAt(0)!=91||e.charCodeAt(0)!=91){throw Fbi(new Ebi(),gIg)}if(k.charCodeAt(1)!=e.charCodeAt(1)){throw Fbi(new Ebi(),vLg)}l=h.length;f=a.length;if(j<0||d<0||g<0||j+g>l||d+g>f){throw new cdi()}if((k.charCodeAt(1)==76||k.charCodeAt(1)==91)&&!efi(k,e)){i=p9h(h,5);b=p9h(a,5);if((h==null?null:h)===(a==null?null:a)&&j<d){j+=g;for(c=d+g;c-->d;){h9h(b,c,i[--j])}}else{for(c=d+g;d<c;){h9h(b,d++,i[j++])}}}else{Array.prototype.splice.apply(a,[d,g].concat(h.slice(j,j+g)))}}
function fgi(b,a){b.b=a;return b}
function hgi(){return r$h}
function egi(){}
_=egi.prototype=new Ddi();_.gC=hgi;_.tI=20;function jgi(a,b){var c;while(a.Eb()){c=a.ac();if(b==null?c==null:s8h(b,c)){return a}}return null}
function lgi(a){throw fgi(new egi(),ePg)}
function mgi(b){var a;a=jgi(this.Fb(),b);return !!a}
function ngi(){return s$h}
function ogi(){var a,b,c;c=mei(new kei());a=null;uei(c.a,tSg);b=this.Fb();while(b.Eb()){if(a!=null){uei(c.a,a)}else{a=cWg}nei(c,cNh+b.ac())}uei(c.a,sZg);return zei(c.a)}
function igi(){}
_=igi.prototype=new xdi();_.vb=lgi;_.wb=mgi;_.gC=ngi;_.tS=ogi;_.tI=0;function vii(c){var a,b,d,e,f;if((c==null?null:c)===(this==null?null:this)){return true}if(!(c!=null&&n9h(c.tI,16))){return false}e=p9h(c,16);if(p9h(this,16).d!=e.d){return false}for(b=sgi(new rgi(),xgi(new qgi(),e).a);Bhi(b.a);){a=p9h(Chi(b.a),14);d=a.Ab();f=a.Cb();if(!(d==null?p9h(this,16).c:d!=null?thi(p9h(this,16),d):shi(p9h(this,16),d,~~iei(d)))){return false}if(!pli(f,d==null?p9h(this,16).b:d!=null?p9h(this,16).e[iBg+d]:phi(p9h(this,16),d,~~iei(d)))){return false}}return true}
function wii(){return C$h}
function xii(){var a,b,c;c=0;for(b=sgi(new rgi(),xgi(new qgi(),p9h(this,16)).a);Bhi(b.a);){a=p9h(Chi(b.a),14);c+=a.hC();c=~~c}return c}
function yii(){var a,b,c,d;d=b3g;a=false;for(c=sgi(new rgi(),xgi(new qgi(),p9h(this,16)).a);Bhi(c.a);){b=p9h(Chi(c.a),14);if(a){d+=cWg}else{a=true}d+=cNh+b.Ab();d+=q6g;d+=cNh+b.Cb()}return d+F9g}
function nii(){}
_=nii.prototype=new xdi();_.eQ=vii;_.gC=wii;_.hC=xii;_.tS=yii;_.tI=0;function khi(g,c){var e=g.a;for(var d in e){if(d==parseInt(d)){var a=e[d];for(var f=0,b=a.length;f<b;++f){c.vb(a[f])}}}}
function lhi(e,a){var d=e.e;for(var c in d){if(c.charCodeAt(0)==58){var b=jhi(e,c.substring(1));a.vb(b)}}}
function mhi(a){a.a=[];a.e={};a.c=false;a.b=null;a.d=0}
function ohi(b,a){return a==null?b.c:a!=null?iBg+a in b.e:shi(b,a,~~iei(a))}
function rhi(b,a){return a==null?b.b:a!=null?b.e[iBg+a]:phi(b,a,~~iei(a))}
function phi(h,g,e){var a=h.a[e];if(a){for(var f=0,b=a.length;f<b;++f){var c=a[f];var d=c.Ab();if(h.yb(g,d)){return c.Cb()}}}return null}
function shi(h,g,e){var a=h.a[e];if(a){for(var f=0,b=a.length;f<b;++f){var c=a[f];var d=c.Ab();if(h.yb(g,d)){return true}}}return false}
function thi(b,a){return iBg+a in b.e}
function uhi(a,b){return (a==null?null:a)===(b==null?null:b)||a!=null&&s8h(a,b)}
function vhi(){return x$h}
function pgi(){}
_=pgi.prototype=new nii();_.yb=uhi;_.gC=vhi;_.tI=0;_.a=null;_.b=null;_.c=false;_.d=0;_.e=null;function bji(b){var a,c,d;if((b==null?null:b)===(this==null?null:this)){return true}if(!(b!=null&&n9h(b.tI,18))){return false}c=p9h(b,18);if(c.a.d!=this.bc()){return false}for(a=sgi(new rgi(),c.a);Bhi(a.a);){d=p9h(Chi(a.a),14);if(!this.wb(d)){return false}}return true}
function cji(){return E$h}
function dji(){var a,b,c;a=0;for(b=this.Fb();b.Eb();){c=b.ac();if(c!=null){a+=w8h(c);a=~~a}}return a}
function Fii(){}
_=Fii.prototype=new igi();_.eQ=bji;_.gC=cji;_.hC=dji;_.tI=0;function xgi(b,a){b.a=a;return b}
function zgi(c){var a,b,d;if(c!=null&&n9h(c.tI,14)){a=p9h(c,14);b=a.Ab();if(ohi(this.a,b)){d=rhi(this.a,b);return eki(a.Cb(),d)}}return false}
function Agi(){return u$h}
function Bgi(){return sgi(new rgi(),this.a)}
function Cgi(){return this.a.d}
function qgi(){}
_=qgi.prototype=new Fii();_.wb=zgi;_.gC=Agi;_.Fb=Bgi;_.bc=Cgi;_.tI=21;_.a=null;function sgi(c,b){var a;c.b=b;a=fji(new eji());if(c.b.c){gji(a,Egi(new Dgi(),c.b))}lhi(c.b,a);khi(c.b,a);c.a=zhi(new xhi(),a);return c}
function ugi(){return t$h}
function vgi(){return Bhi(this.a)}
function wgi(){return p9h(Chi(this.a),14)}
function rgi(){}
_=rgi.prototype=new xdi();_.gC=ugi;_.Eb=vgi;_.ac=wgi;_.tI=0;_.a=null;_.b=null;function qii(b){var a;if(b!=null&&n9h(b.tI,14)){a=p9h(b,14);if(pli(this.Ab(),a.Ab())&&pli(this.Cb(),a.Cb())){return true}}return false}
function rii(){return B$h}
function sii(){var a,b;a=0;b=0;if(this.Ab()!=null){a=iei(this.Ab())}if(this.Cb()!=null){b=w8h(this.Cb())}return a^b}
function tii(){return this.Ab()+q6g+this.Cb()}
function oii(){}
_=oii.prototype=new xdi();_.eQ=qii;_.gC=rii;_.hC=sii;_.tS=tii;_.tI=22;function Egi(b,a){b.a=a;return b}
function ahi(){return v$h}
function bhi(){return null}
function chi(){return this.a.b}
function Dgi(){}
_=Dgi.prototype=new oii();_.gC=ahi;_.Ab=bhi;_.Cb=chi;_.tI=23;_.a=null;function ehi(c,a,b){c.b=b;c.a=a;return c}
function ghi(){return w$h}
function hhi(){return this.a}
function ihi(){return this.b.e[iBg+this.a]}
function jhi(b,a){return ehi(new dhi(),a,b)}
function dhi(){}
_=dhi.prototype=new oii();_.gC=ghi;_.Ab=hhi;_.Cb=ihi;_.tI=24;_.a=null;_.b=null;function gii(a){this.ub(this.bc(),a);return true}
function fii(b,a){throw fgi(new egi(),obh)}
function hii(a,b){if(a<0||a>=b){lii(a,b)}}
function iii(e){var a,b,c,d,f;if((e==null?null:e)===(this==null?null:this)){return true}if(!(e!=null&&n9h(e.tI,15))){return false}f=p9h(e,15);if(this.bc()!=f.bc()){return false}c=this.Fb();d=f.Fb();while(c.a<c.b.bc()){a=Chi(c);b=Chi(d);if(!(a==null?b==null:s8h(a,b))){return false}}return true}
function jii(){return A$h}
function kii(){var a,b,c;b=1;a=this.Fb();while(a.a<a.b.bc()){c=Chi(a);b=31*b+(c==null?0:w8h(c));b=~~b}return b}
function lii(a,b){throw ddi(new cdi(),Deh+a+mih+b)}
function mii(){return zhi(new xhi(),this)}
function whi(){}
_=whi.prototype=new igi();_.vb=gii;_.ub=fii;_.eQ=iii;_.gC=jii;_.hC=kii;_.Fb=mii;_.tI=25;function zhi(b,a){b.b=a;return b}
function Bhi(a){return a.a<a.b.bc()}
function Chi(a){if(a.a>=a.b.bc()){throw new hli()}return a.b.Db(a.a++)}
function Dhi(){return y$h}
function Ehi(){return this.a<this.b.bc()}
function Fhi(){return Chi(this)}
function xhi(){}
_=xhi.prototype=new xdi();_.gC=Dhi;_.Eb=Ehi;_.ac=Fhi;_.tI=0;_.a=0;_.b=null;function bii(b,a){b.b=a;return b}
function dii(){return z$h}
function aii(){}
_=aii.prototype=new xhi();_.gC=dii;_.tI=0;function Bii(b,a){var c;c=Dki(this,b);yki(c.d,a,c.b);++c.a;c.c=null}
function Dii(c){var a,d;d=Dki(this,c);try{return nki(d)}catch(a){a=gai(a);if(s9h(a,17)){throw ddi(new cdi(),Blh+c)}else throw a}}
function Cii(){return D$h}
function Eii(){return bii(new aii(),this)}
function zii(){}
_=zii.prototype=new whi();_.ub=Bii;_.Db=Dii;_.gC=Cii;_.Fb=Eii;_.tI=26;function fji(a){a.a=e9h(C_h,47,0,0,0);a.b=0;return a}
function gji(b,a){h9h(b.a,b.b++,a);return true}
function iji(b,a){hii(a,b.b);return b.a[a]}
function jji(c,b,a){for(;a<c.b;++a){if(pli(b,c.a[a])){return a}}return -1}
function lji(d,c){var a,b;a=jji(d,c,0);if(a==-1){return false}b=(hii(a,d.b),d.a[a]);d.a.splice(a,1);--d.b;return true}
function nji(a){return h9h(this.a,this.b++,a),true}
function mji(a,b){if(a<0||a>this.b){lii(a,this.b)}this.a.splice(a,0,b);++this.b}
function oji(a){return jji(this,a,0)!=-1}
function qji(a){return hii(a,this.b),this.a[a]}
function pji(){return F$h}
function rji(){return this.b}
function eji(){}
_=eji.prototype=new whi();_.vb=nji;_.ub=mji;_.wb=oji;_.Db=qji;_.gC=pji;_.bc=rji;_.tI=27;_.a=null;_.b=0;function wji(f,b){var a,c,d,e;c=0;a=f.length-1;while(c<=a){d=c+(a-c>>1);e=f[d];if(e<b){c=d+1}else if(e>b){a=d-1}else{return d}}return -c-1}
function xji(h,d,a){var b,c,e,f,g;if(!a){a=(Eji(),Fji)}e=0;c=h.length-1;while(e<=c){f=e+(c-e>>1);g=h[f];b=g.cT(d);if(b<0){e=f+1}else if(b>0){c=f-1}else{return f}}return -e-1}
function Eji(){Eji=v0i;Fji=new Bji()}
var Fji;function Dji(){return a_h}
function Bji(){}
_=Bji.prototype=new xdi();_.gC=Dji;_.tI=0;function cki(a){mhi(a);return a}
function eki(a,b){return (a==null?null:a)===(b==null?null:b)||a!=null&&s8h(a,b)}
function fki(){return b_h}
function bki(){}
_=bki.prototype=new pgi();_.gC=fki;_.tI=28;function xki(a){a.a=ski(new rki());a.b=0;return a}
function yki(c,a,b){tki(new rki(),a,b);++c.b}
function zki(b,a){tki(new rki(),a,b.a);++b.b}
function Aki(a){a.a=ski(new rki());a.b=0}
function Cki(a){Fki(a);return a.a.b.c}
function Dki(d,b){var a,c;if(b<0||b>d.b){lii(b,d.b)}if(b>=d.b>>1){c=d.a;for(a=d.b;a>b;--a){c=c.b}}else{c=d.a.a;for(a=0;a<b;++a){c=c.a}}return kki(new iki(),b,c,d)}
function Eki(b){var a;Fki(b);--b.b;a=b.a.b;a.a.b=a.b;a.b.a=a.a;a.a=a.b=a;return a.c}
function Fki(a){if(a.b==0){throw new hli()}}
function ali(a){tki(new rki(),a,this.a);++this.b;return true}
function bli(){return e_h}
function cli(){return this.b}
function hki(){}
_=hki.prototype=new zii();_.vb=ali;_.gC=bli;_.bc=cli;_.tI=29;_.a=null;_.b=0;function kki(d,a,b,c){d.d=c;d.b=b;d.a=a;return d}
function nki(a){if(a.b==a.d.a){throw new hli()}a.c=a.b;a.b=a.b.a;++a.a;return a.c.c}
function oki(){return c_h}
function pki(){return this.b!=this.d.a}
function qki(){return nki(this)}
function iki(){}
_=iki.prototype=new xdi();_.gC=oki;_.Eb=pki;_.ac=qki;_.tI=0;_.a=0;_.b=null;_.c=null;_.d=null;function ski(a){a.a=a.b=a;return a}
function tki(b,c,a){b.c=c;b.a=a;b.b=a.b;a.b.a=b;a.b=b;return b}
function wki(){return d_h}
function rki(){}
_=rki.prototype=new xdi();_.gC=wki;_.tI=0;_.a=null;_.b=null;_.c=null;function jli(){return f_h}
function hli(){}
_=hli.prototype=new Ddi();_.gC=jli;_.tI=30;function pli(a,b){return (a==null?null:a)===(b==null?null:b)||a!=null&&s8h(a,b)}
function sli(){sli=v0i;tli=rli(new qli(),kph,0);rli(new qli(),zsh,1);rli(new qli(),jwh,2);rli(new qli(),yzh,3);rli(new qli(),hDh,4)}
function rli(c,a,b){sli();c.a=a;c.b=b;return c}
function uli(){return g_h}
function qli(){}
_=qli.prototype=new tci();_.gC=uli;_.tI=31;var tli;function xli(){xli=v0i;Ali=wli(new vli(),wGh,0);yli=wli(new vli(),fKh,1);zli=wli(new vli(),lLh,2)}
function wli(c,a,b){xli();c.a=a;c.b=b;return c}
function Bli(){return h_h}
function vli(){}
_=vli.prototype=new tci();_.gC=Bli;_.tI=32;var yli,zli,Ali;function Fli(){Fli=v0i;ami=Eli(new Dli(),wLh,0);cmi=Eli(new Dli(),bMh,1);bmi=Eli(new Dli(),mMh,2)}
function Eli(c,a,b){Fli();c.a=a;c.b=b;return c}
function dmi(){return i_h}
function Dli(){}
_=Dli.prototype=new tci();_.gC=dmi;_.tI=33;var ami,bmi,cmi;function CYi(){CYi=v0i;l0i=lfi(xMh);k0i=f9h(D_h,48,1,[dNh,oNh,zNh,eOh,pOh,AOh]);m0i=f9h(D_h,48,1,[fPh,qPh,BPh,gQh,sQh,DQh,iRh,tRh,ERh,jSh,uSh,FSh,kTh,vTh,bUh,mUh,xUh,cVh,nVh,yVh,dWh,oWh,zWh,eXh,qXh,BXh,gYh,rYh,CYh,hZh,sZh,DZh,i0h,t0h,F0h,k1h,v1h,a2h,l2h,w2h,b3h,m3h,x3h,c4h,o4h,z4h,e5h,p5h,A5h,f6h,q6h,B6h,g7h,r7h,Cqg])}
function eYi(d,a){var b,c;c=d.g+1;if(c>d.f.length){b=e9h(A_h,42,-1,c,1);Afi(d.f,0,b,0,d.g);d.f=b}d.f[d.g]=a;d.g=c}
function fYi(c,a){var b;FUi(a,c,c.u);if(c.j>=1){b=c.y[1];if(b.c==3){lmi(c,b.e,a)}}}
function gYi(u,m){var a,b,c,d,e,f,g,h,i,j,k,l,n,o,p,q;rZi(u);for(;;){f=u.s;while(f>-1){l=u.r[f];if(!l){f=-1;break}else if(l.d==m){break}--f}if(f==-1){return}e=u.r[f];g=u.j;j=true;while(g>-1){o=u.y[g];if(o==e){break}else if(o.i){j=false}--g}if(g==-1){c0i(u,f);return}if(!j){return}i=g+1;while(i<=u.j){o=u.y[i];if(o.i||o.j){break}++i}if(i>u.j){while(u.j>=g){EZi(u)}c0i(u,f);return}c=u.y[g-1];h=u.y[i];a=f;q=i;k=h;for(;;){--q;o=u.y[q];p=iZi(u,o);if(p==-1){d0i(u,q);--i;continue}if(q==g){break}if(q==i){a=p+1}b=smi(u,hrg,o.d,xUi(o.a));n=CVi(new AVi(),o.c,o.f,o.d,b,o.i,o.j,o.b,o.g,o.a);o.a=null;u.y[q]=n;++n.h;u.r[p]=n;--o.h;--o.h;o=n;vmi(u,k.e);qmi(u,k.e,o.e);k=o}if(c.b){vmi(u,k.e);wZi(u,k.e)}else{vmi(u,k.e);qmi(u,k.e,c.e)}b=smi(u,hrg,e.d,xUi(e.a));d=CVi(new AVi(),e.c,e.f,e.d,b,e.i,e.j,e.b,e.g,e.a);e.a=null;nmi(u,h.e,b);qmi(u,b,h.e);c0i(u,f);xZi(u,d,a);d0i(u,g);yZi(u,d,i)}}
function vYi(c,b){var a;++c.s;if(c.s==c.r.length){a=e9h(aai,51,11,c.r.length+64,0);Afi(c.r,0,a,0,c.r.length);c.r=a}c.r[c.s]=b}
function hYi(d,a){var b,c;FUi(a,d,d.u);b=umi(d,a);c=DVi(new AVi(),hrg,(wHi(),gNi),b);a0i(d,c)}
function nYi(f,e,b,a){var c,d;rZi(f);FUi(a,f,f.u);c=smi(f,e,b.e,a);qmi(f,c,f.y[f.j].e);d=DVi(new AVi(),e,b,c);a0i(f,d)}
function lYi(h,f,c,a){var b,d,e,g;rZi(h);g=c.e;FUi(a,h,h.u);if(c.b){g=zYi(h,g)}d=smi(h,f,g,a);b=h.y[h.j];if(b.b){wZi(h,d)}else{qmi(h,d,b.e)}e=EVi(new AVi(),f,c,d,g);a0i(h,e)}
function mYi(g,f,c,a){var b,d,e;rZi(g);FUi(a,g,g.u);d=tmi(g,f,c.e,a);b=g.y[g.j];if(b.b){wZi(g,d)}else{qmi(g,d,b.e)}e=DVi(new AVi(),f,c,d);a0i(g,e)}
function jYi(h,f,c,a){var b,d,e,g;rZi(h);g=c.a;FUi(a,h,h.u);if(c.b){g=zYi(h,g)}d=smi(h,f,g,a);b=h.y[h.j];if(b.b){wZi(h,d)}else{qmi(h,d,b.e)}e=FVi(new AVi(),f,c,d,g,(wHi(),qMi)==c);a0i(h,e)}
function kYi(h,f,c,a){var b,d,e,g;rZi(h);g=c.e;FUi(a,h,h.u);if(c.b){g=zYi(h,g)}d=smi(h,f,g,a);b=h.y[h.j];if(b.b){wZi(h,d)}else{qmi(h,d,b.e)}e=FVi(new AVi(),f,c,d,g,false);a0i(h,e)}
function oYi(e,a){var b,c,d;rZi(e);FUi(a,e,e.u);c=smi(e,hrg,srg,a);e.m=c;b=e.y[e.j];if(b.b){wZi(e,c)}else{qmi(e,c,b.e)}d=DVi(new AVi(),hrg,(wHi(),rMi),c);a0i(e,d)}
function pYi(g,f,c,a){var b,d,e;rZi(g);FUi(a,g,g.u);d=smi(g,f,c.e,a);b=g.y[g.j];if(b.b){wZi(g,d)}else{qmi(g,d,b.e)}e=aWi(new AVi(),f,c,d,xUi(a));a0i(g,e);vYi(g,e);++e.h}
function qYi(d,a){var b,c;rZi(d);FUi(a,d,d.u);b=smi(d,hrg,Drg,a);qmi(d,b,d.y[d.j].e);d.o=b;c=DVi(new AVi(),hrg,(wHi(),cNi),b);a0i(d,c)}
function sYi(f,e,d,a){var b,c;rZi(f);FUi(a,f,f.u);c=tmi(f,e,d,a);b=f.y[f.j];if(b.b){wZi(f,c)}else{qmi(f,c,b.e)}wmi(f,e,d,c)}
function tYi(g,e,c,a){var b,d,f;rZi(g);f=c.e;FUi(a,g,g.u);if(c.b){f=zYi(g,f)}d=smi(g,e,f,a);b=g.y[g.j];if(b.b){wZi(g,d)}else{qmi(g,d,b.e)}wmi(g,e,f,d)}
function rYi(g,e,c,a){var b,d,f;rZi(g);f=c.a;FUi(a,g,g.u);if(c.b){f=zYi(g,f)}d=smi(g,e,f,a);b=g.y[g.j];if(b.b){wZi(g,d)}else{qmi(g,d,b.e)}wmi(g,e,f,d)}
function wYi(b){var a;for(a=0;a<b.g;++a){switch(b.f[a]){case 32:case 9:case 10:case 12:continue;default:return true;}}return false}
function xYi(p,a,o,e){var c,d;if(p.v){if(a[o]==10){++o;--e;if(e==0){return}}p.v=false}switch(p.t){case 6:case 12:case 8:b0i(p);case 20:pHi(p,a,o,e);return;default:c=o+e;b:for(d=o;d<c;++d){switch(a[d]){case 32:case 9:case 10:case 12:switch(p.t){case 0:case 1:case 2:o=d+1;continue;case 21:case 3:case 4:case 5:case 9:case 16:case 17:continue;case 6:case 12:case 8:if(o<d){pHi(p,a,o,d-o);o=d}b0i(p);break b;case 7:case 10:case 11:b0i(p);eYi(p,a[d]);o=d+1;continue;case 15:if(o<d){pHi(p,a,o,d-o);o=d}b0i(p);continue;case 18:case 19:if(o<d){pHi(p,a,o,d-o);o=d}b0i(p);continue;}default:switch(p.t){case 0:aZi(p,(xli(),zli));p.t=1;--d;continue;case 1:hYi(p,AWi(p.z));p.t=2;--d;continue;case 2:if(o<d){pHi(p,a,o,d-o);o=d}qYi(p,(wUi(),bVi));p.t=3;--d;continue;case 3:if(o<d){pHi(p,a,o,d-o);o=d}EZi(p);p.t=5;--d;continue;case 4:if(o<d){pHi(p,a,o,d-o);o=d}EZi(p);p.t=3;--d;continue;case 5:if(o<d){pHi(p,a,o,d-o);o=d}nYi(p,hrg,(wHi(),cJi),AWi(p.z));p.t=21;--d;continue;case 21:p.t=6;--d;continue;case 6:case 12:case 8:if(o<d){pHi(p,a,o,d-o);o=d}b0i(p);break b;case 7:case 10:case 11:b0i(p);eYi(p,a[d]);o=d+1;continue;case 9:if(o<d){pHi(p,a,o,d-o);o=d}if(p.j==0){o=d+1;continue}EZi(p);p.t=7;--d;continue;break b;case 15:p.t=6;--d;continue;case 16:if(o<d){pHi(p,a,o,d-o);o=d}o=d+1;continue;case 17:if(o<d){pHi(p,a,o,d-o);o=d}o=d+1;continue;case 18:p.t=6;--d;continue;case 19:p.t=16;--d;continue;}}}if(o<c){pHi(p,a,o,c-o)}}}
function yYi(e,a){var b,c,d;b=EUi(a,(koi(),nsi));d=null;if(b!=null){d=n0i(b)}if(d==null){c=EUi(a,pri);if(c!=null){e.z.jb=true}}else{e.z.jb=true}}
function zYi(b,a){if(pVi(a)){return a}else{switch(b.u.b){case 0:return a;case 2:return mVi(a);case 1:gZi(b,isg+a+tsg);}}return null}
function AYi(e,a){while(e.j>a){EZi(e)}}
function BYi(a){while(a.s>-1){if(!a.r[a.s]){--a.s;return}--a.r[a.s].h;--a.s}}
function DYi(e,a){tZi(e);while(e.j>=a){EZi(e)}BYi(e);e.t=11;return}
function EYi(h,a,g,f){var c,d,e;h.v=false;if(!h.A){return}b:for(;;){switch(h.l){case 0:break b;default:switch(h.t){case 0:case 1:case 18:case 19:omi(h,(c=g+f,mfi(a.length,g,c),ofi(a,g,c)));return;case 15:rZi(h);pmi(h,h.y[0].e,(d=g+f,mfi(a.length,g,d),ofi(a,g,d)));return;default:break b;}}}rZi(h);pmi(h,h.y[h.j].e,(e=g+f,mfi(a.length,g,e),ofi(a,g,e)));return}
function FYi(f,c,d,e,b){f.v=false;a:for(;;){switch(f.l){case 0:break a;default:switch(f.t){case 0:switch(f.k.b){case 0:if(CZi(c,d,e,b)){aZi(f,(xli(),zli))}else if(zZi(d,e)){aZi(f,(xli(),yli))}else{if(efi(zNh,d)&&(e==null||efi(Esg,e))||efi(AOh,d)&&(e==null||efi(jtg,e))||efi(utg,d)&&efi(Ftg,e)||efi(lug,d)&&efi(wug,e)){}else !((e==null||efi(bvg,e))&&d==null);aZi(f,(xli(),Ali))}break;case 2:f.p=true;f.z.A=true;if(CZi(c,d,e,b)){aZi(f,(xli(),zli))}else if(zZi(d,e)){aZi(f,(xli(),yli))}else{if(efi(AOh,d)){!efi(jtg,e)}else{}aZi(f,(xli(),Ali))}break;case 1:f.p=true;f.z.A=true;if(CZi(c,d,e,b)){aZi(f,(xli(),zli))}else if(zZi(d,e)){if(efi(pOh,d)&&e!=null){!efi(mvg,e)}else{}aZi(f,(xli(),yli))}else{aZi(f,(xli(),Ali))}break;case 3:f.p=AZi(d);if(f.p){f.z.A=true}if(CZi(c,d,e,b)){aZi(f,(xli(),zli))}else if(zZi(d,e)){if(efi(pOh,d)){!efi(mvg,e)}else{}aZi(f,(xli(),yli))}else{if(efi(AOh,d)){!efi(jtg,e)}else{}aZi(f,(xli(),Ali))}break;case 4:if(CZi(c,d,e,b)){aZi(f,(xli(),zli))}else if(zZi(d,e)){aZi(f,(xli(),yli))}else{aZi(f,(xli(),Ali))}}f.t=1;return;default:break a;}}}return}
function aZi(b,a){b.x=a==(xli(),zli)}
function bZi(e){var a;a=nZi(e,xvg);if(a==2147483647){return}while(e.j>=a){EZi(e)}f0i(e)}
function cZi(ad,a){var b,d,e,f;ad.v=false;c:for(;;){d=a.d;e=a.e;switch(ad.t){case 11:switch(d){case 37:b=oZi(ad,37);if(b==0){break c}AYi(ad,b);EZi(ad);ad.t=10;break c;case 34:b=oZi(ad,37);if(b==0){break c}AYi(ad,b);EZi(ad);ad.t=10;continue;case 39:if(nZi(ad,e)==2147483647){break c}b=oZi(ad,37);if(b==0){break c}AYi(ad,b);EZi(ad);ad.t=10;continue;break c;}case 10:switch(d){case 39:b=pZi(ad,e);if(b==0){break c}AYi(ad,b);EZi(ad);ad.t=7;break c;case 34:b=lZi(ad);if(b==0){break c}AYi(ad,b);EZi(ad);ad.t=7;continue;break c;}case 7:switch(d){case 34:b=qZi(ad,cwg);if(b==2147483647){break c}while(ad.j>=b){EZi(ad)}f0i(ad);break c;}case 8:switch(d){case 6:b=nZi(ad,nwg);if(b==2147483647){break c}tZi(ad);while(ad.j>=b){EZi(ad)}BYi(ad);ad.t=7;break c;case 34:b=nZi(ad,nwg);if(b==2147483647){break c}tZi(ad);while(ad.j>=b){EZi(ad)}BYi(ad);ad.t=7;continue;break c;}case 12:switch(d){case 40:b=nZi(ad,e);if(b==2147483647){break c}tZi(ad);while(ad.j>=b){EZi(ad)}BYi(ad);ad.t=11;break c;case 34:case 39:case 37:if(nZi(ad,e)==2147483647){break c}DYi(ad,mZi(ad));continue;break c;}case 21:case 6:switch(d){case 3:if(!(ad.j>=1&&ad.y[1].c==3)){break c}ad.t=15;break c;case 23:if(!(ad.j>=1&&ad.y[1].c==3)){break c}ad.t=15;continue;case 50:case 46:case 44:case 61:case 51:b=kZi(ad,e);if(b==2147483647){}else{tZi(ad);while(ad.j>=b){EZi(ad)}}break c;case 9:if(!ad.m){break c}ad.m=null;b=kZi(ad,e);if(b==2147483647){break c}tZi(ad);d0i(ad,b);break c;case 29:b=kZi(ad,ywg);if(b==2147483647){if(ad.l==0){while(ad.y[ad.j].f!=hrg){EZi(ad)}ad.l=1}tYi(ad,hrg,a,(wUi(),bVi));break c}sZi(ad,ywg);while(ad.j>=b){EZi(ad)}break c;case 41:case 15:b=kZi(ad,e);if(b==2147483647){}else{sZi(ad,e);while(ad.j>=b){EZi(ad)}}break c;case 42:b=jZi(ad);if(b==2147483647){}else{tZi(ad);while(ad.j>=b){EZi(ad)}}break c;case 1:case 45:case 64:case 24:gYi(ad,e);break c;case 5:case 63:case 43:b=kZi(ad,e);if(b==2147483647){}else{tZi(ad);while(ad.j>=b){EZi(ad)}BYi(ad)}break c;case 4:if(ad.l==0){while(ad.y[ad.j].f!=hrg){EZi(ad)}ad.l=1}b0i(ad);tYi(ad,hrg,a,(wUi(),bVi));break c;case 49:case 55:case 48:case 12:case 13:case 65:case 22:case 14:case 47:case 60:case 25:case 32:case 34:case 35:break c;case 26:default:if(e==ad.y[ad.j].d){EZi(ad);break c}b=ad.j;for(;;){f=ad.y[b];if(f.d==e){tZi(ad);while(ad.j>=b){EZi(ad)}break c}else if(f.i||f.j){break c}--b}}case 9:switch(d){case 8:if(ad.j==0){break c}EZi(ad);ad.t=7;break c;case 7:break c;default:if(ad.j==0){break c}EZi(ad);ad.t=7;continue;}case 14:switch(d){case 6:case 34:case 39:case 37:case 40:if(nZi(ad,e)!=2147483647){bZi(ad);continue}else{break c}}case 13:switch(d){case 28:if(dxg==ad.y[ad.j].d){EZi(ad);break c}else{break c}case 27:if(dxg==ad.y[ad.j].d&&oxg==ad.y[ad.j-1].d){EZi(ad)}if(oxg==ad.y[ad.j].d){EZi(ad)}else{}break c;case 32:bZi(ad);break c;default:break c;}case 15:switch(d){case 23:if(ad.n){break c}else{ad.t=18;break c}default:ad.t=6;continue;}case 16:switch(d){case 11:if(ad.j==0){break c}EZi(ad);if(!ad.n&&Axg!=ad.y[ad.j].d){ad.t=17}break c;default:break c;}case 17:switch(d){case 23:ad.t=19;break c;default:break c;}case 0:aZi(ad,(xli(),zli));ad.t=1;continue;case 1:hYi(ad,AWi(ad.z));ad.t=2;continue;case 2:switch(d){case 20:case 4:case 23:case 3:qYi(ad,(wUi(),bVi));ad.t=3;continue;default:break c;}case 3:switch(d){case 20:EZi(ad);ad.t=5;break c;case 4:case 23:case 3:EZi(ad);ad.t=5;continue;default:break c;}case 4:switch(d){case 26:EZi(ad);ad.t=3;break c;case 4:EZi(ad);ad.t=3;continue;default:break c;}case 5:switch(d){case 23:case 3:case 4:nYi(ad,hrg,(wHi(),cJi),AWi(ad.z));ad.t=21;continue;default:break c;}case 18:ad.t=6;continue;case 19:ad.t=16;continue;case 20:if(ad.w==5){EZi(ad)}EZi(ad);ad.t=ad.w;break c;}}if(ad.l==0&&!uZi(ad)){ad.l=1}}
function dZi(a){a.m=null;a.o=null;while(a.j>-1){--a.y[a.j].h;--a.j}a.y=null;while(a.s>-1){if(a.r[a.s]){--a.r[a.s].h}--a.s}a.r=null;mhi(a.q);a.f=null}
function eZi(C){var b,c;rZi(C);switch(C.l){case 0:while(C.y[C.j].f!=hrg){DZi(C)}C.l=1;}a:for(;;){switch(C.t){case 0:aZi(C,(xli(),zli));C.t=1;continue;case 1:hYi(C,AWi(C.z));C.t=2;continue;case 2:qYi(C,(wUi(),bVi));C.t=3;continue;case 3:while(C.j>0){DZi(C)}C.t=5;continue;case 4:while(C.j>1){DZi(C)}C.t=3;continue;case 5:nYi(C,hrg,(wHi(),cJi),AWi(C.z));C.t=6;continue;case 9:if(C.j==0){break a}else{DZi(C);C.t=7;continue}case 21:case 8:case 12:case 6:B:for(c=C.j;c>=0;--c){b=C.y[c].c;switch(b){case 41:case 15:case 29:case 39:case 40:case 3:case 23:break;default:break B;}}break a;case 20:if(C.w==5){DZi(C)}DZi(C);C.t=C.w;continue;case 10:case 11:case 7:case 13:case 14:case 16:break a;case 15:case 17:case 18:case 19:default:if(C.j==0){sai((new Date()).getTime())}break a;}}while(C.j>0){DZi(C)}if(!C.n){DZi(C)}}
function fZi(c,a){var b;b=b1i(new F0i(),a.b,c.z,a);throw b}
function gZi(c,a){var b;b=a1i(new F0i(),a,c.z);throw b}
function iZi(c,b){var a;for(a=c.s;a>=0;--a){if(b==c.r[a]){return a}}return -1}
function hZi(d,b){var a,c;for(a=d.s;a>=0;--a){c=d.r[a];if(!c){return -1}else if(c.d==b){return a}}return -1}
function qZi(c,b){var a;for(a=c.j;a>0;--a){if(c.y[a].d==b){return a}}return 2147483647}
function kZi(c,b){var a;for(a=c.j;a>0;--a){if(c.y[a].d==b){return a}else if(c.y[a].i){return 2147483647}}return 2147483647}
function jZi(b){var a;for(a=b.j;a>0;--a){if(b.y[a].c==42){return a}else if(b.y[a].i){return 2147483647}}return 2147483647}
function nZi(c,b){var a;for(a=c.j;a>0;--a){if(c.y[a].d==b){return a}else if(c.y[a].d==cwg){return 2147483647}}return 2147483647}
function lZi(b){var a;for(a=b.j;a>0;--a){if(b.y[a].c==39){return a}}return 0}
function mZi(c){var a,b;for(a=c.j;a>0;--a){b=c.y[a].d;if(fyg==b||qyg==b){return a}else if(b==cwg){return 2147483647}}return 2147483647}
function pZi(c,b){var a;for(a=c.j;a>0;--a){if(c.y[a].d==b){return a}}return 0}
function oZi(c,a){var b;for(b=c.j;b>0;--b){if(c.y[b].c==a){return b}}return 0}
function rZi(e){var a,b,c,d;if(e.g>0){a=e.y[e.j];if(a.b&&wYi(e)){c=oZi(e,34);d=e.y[c];b=d.e;if(c==0){mmi(e,b,xfi(e.f,0,e.g));e.g=0;return}rHi(e,e.f,0,e.g,b,e.y[c-1].e);e.g=0;return}mmi(e,e.y[e.j].e,xfi(e.f,0,e.g));e.g=0}}
function tZi(d){for(;;){switch(d.y[d.j].c){case 29:case 15:case 41:case 28:case 27:case 53:EZi(d);continue;default:return;}}}
function sZi(f,a){var b;for(;;){b=f.y[f.j];switch(b.c){case 29:case 15:case 41:case 28:case 27:case 53:if(b.d==a){return}EZi(f);continue;default:return;}}}
function uZi(b){var a;for(a=b.j;a>0;--a){if(b.y[a].f!=hrg){return true}else if(b.y[a].i){return false}}return false}
function vZi(e){var a;a=kZi(e,ywg);if(a==2147483647){return}sZi(e,ywg);while(e.j>=a){EZi(e)}}
function wZi(e,a){var b,c,d;c=oZi(e,34);d=e.y[c];b=d.e;if(c==0){qmi(e,a,b);return}zmi(e,a,b,e.y[c-1].e)}
function xZi(c,b,a){++b.h;if(a<=c.s){Afi(c.r,a,c.r,a+1,c.s-a+1)}++c.s;c.r[a]=b}
function yZi(c,a,b){if(b==c.j+1){rZi(c);a0i(c,a)}else{Afi(c.y,b,c.y,b+1,c.j-b+1);++c.j;c.y[b]=a}}
function zZi(a,b){if(yVi(Byg,a)){return true}if(yVi(gzg,a)){return true}if(b!=null){if(yVi(rzg,a)){return true}if(yVi(Czg,a)){return true}}return false}
function AZi(a){if(a!=null&&xji(k0i,a,(Eji(),Fji))>-1){return true}return false}
function BZi(c,b){var a;for(a=c.j;a>=0;--a){if(c.y[a]==b){return true}}return false}
function CZi(c,d,e,a){var b;if(a){return true}if(c!=hAg){return true}if(d!=null){for(b=0;b<m0i.length;++b){if(zVi(m0i[b],d)){return true}}if(yVi(sAg,d)||yVi(DAg,d)||yVi(hAg,d)){return true}}if(e==null){if(yVi(rzg,d)){return true}else if(yVi(Czg,d)){return true}}else if(yVi(jBg,e)){return true}return false}
function EZi(b){var a;rZi(b);a=b.y[b.j];--b.j;wmi(b,a.f,a.g,a.e);--a.h}
function DZi(b){var a;rZi(b);a=b.y[b.j];--b.j;wmi(b,a.f,a.g,a.e);--a.h}
function a0i(c,b){var a;++c.j;if(c.j==c.y.length){a=e9h(aai,51,11,c.y.length+64,0);Afi(c.y,0,a,0,c.y.length);c.y=a}c.y[c.j]=b}
function FZi(a){rZi(a);if(!a.o){a0i(a,a.y[a.j])}else{a0i(a,DVi(new AVi(),hrg,(wHi(),cNi),a.o))}}
function b0i(g){var a,b,c,d,e,f;if(g.s==-1){return}f=g.r[g.s];if(!f||BZi(g,f)){return}e=g.s;for(;;){--e;if(e==-1){break}if(!g.r[e]){break}if(BZi(g,g.r[e])){break}}if(e<g.s){rZi(g)}while(e<g.s){++e;c=g.r[e];a=smi(g,hrg,c.d,xUi(c.a));d=CVi(new AVi(),c.c,c.f,c.d,a,c.i,c.j,c.b,c.g,c.a);c.a=null;b=g.y[g.j];if(b.b){wZi(g,a)}else{qmi(g,a,b.e)}a0i(g,d);g.r[e]=d;--c.h;++d.h}}
function c0i(b,a){--b.r[a].h;if(a==b.s){--b.s;return}Afi(b.r,a+1,b.r,a,b.s-a);--b.s}
function d0i(e,d){if(e.j==d){EZi(e)}else{--e.y[d].h;Afi(e.y,d+1,e.y,d,e.j-d);--e.j}}
function e0i(f,a){var e;if(f.y[f.j]==a){EZi(f)}else{e=f.j-1;while(e>=0&&f.y[e]!=a){--e}if(e==-1){return}--a.h;Afi(f.y,e+1,f.y,e,f.j-e);--f.j}}
function f0i(d){var a,b,c;d.l=1;for(a=d.j;a>=0;--a){c=d.y[a];b=c.d;if(a==0){if(d.i==hrg&&(d.h==fyg||d.h==qyg)){d.t=6;return}else{b=d.h}}if(xvg==b){d.t=13;return}else if(fyg==b||qyg==b){d.t=12;return}else if(uBg==b){d.t=11;return}else if(FBg==b||kCg==b||vCg==b){d.t=10;return}else if(nwg==b){d.t=8;return}else if(aDg==b){d.t=9;return}else if(cwg==b){d.t=7;return}else if(hrg!=c.f){d.l=0;d.t=6;return}else if(Drg==b){d.t=6;return}else if(lDg==b){d.t=6;return}else if(Axg==b){d.t=16;return}else if(hAg==b){if(!d.o){d.t=2}else{d.t=5}return}else if(a==0){d.t=6;return}}}
function g0i(b,a){b.h=a;b.i=hrg;b.n=false;b.x=false}
function i0i(wg,i,e,ug){var a,b,c,d,f,g,h,j,k,l,m,p,r,s,t,sg,tg,ae,be;wg.v=false;s=false;vg:for(;;){l=i.d;r=i.e;switch(wg.l){case 0:h=wg.y[wg.j];g=h.f;f=h.c;if(hrg==g||wDg==g&&(56!=l&&57==f||19==l&&58==f)||bEg==g&&(36==f||59==f)){s=true}else{switch(l){case 45:case 50:case 3:case 4:case 52:case 41:case 46:case 48:case 42:case 20:case 22:case 15:case 18:case 24:case 29:case 44:case 34:while(wg.y[wg.j].f!=hrg){EZi(wg)}wg.l=1;continue vg;case 64:if(yUi(e,(koi(),Fri))||yUi(e,Ati)||yUi(e,nDi)){while(wg.y[wg.j].f!=hrg){EZi(wg)}wg.l=1;continue vg}default:if(bEg==g){e.b=2;if(ug){rYi(wg,g,i,e);ug=false}else{jYi(wg,g,i,e)}e=null;break vg}else{e.b=1;if(ug){tYi(wg,g,i,e);ug=false}else{kYi(wg,g,i,e)}e=null;break vg}}}default:switch(wg.t){case 10:switch(l){case 37:AYi(wg,lZi(wg));nYi(wg,hrg,i,e);wg.t=11;e=null;break vg;case 40:AYi(wg,lZi(wg));nYi(wg,hrg,(wHi(),lTi),(wUi(),bVi));wg.t=11;continue;case 6:case 7:case 8:case 39:j=lZi(wg);if(j==0){break vg}else{AYi(wg,j);EZi(wg);wg.t=7;continue}}case 11:switch(l){case 40:AYi(wg,oZi(wg,37));nYi(wg,hrg,i,e);wg.t=12;vYi(wg,null);e=null;break vg;case 6:case 7:case 8:case 39:case 37:j=oZi(wg,37);if(j==0){break vg}AYi(wg,j);EZi(wg);wg.t=10;continue;}case 7:q:for(;;){switch(l){case 6:AYi(wg,oZi(wg,34));vYi(wg,null);nYi(wg,hrg,i,e);wg.t=8;e=null;break vg;case 8:AYi(wg,oZi(wg,34));nYi(wg,hrg,i,e);wg.t=9;e=null;break vg;case 7:AYi(wg,oZi(wg,34));nYi(wg,hrg,(wHi(),uJi),(wUi(),bVi));wg.t=9;continue vg;case 39:AYi(wg,oZi(wg,34));nYi(wg,hrg,i,e);wg.t=10;e=null;break vg;case 37:case 40:AYi(wg,oZi(wg,34));nYi(wg,hrg,(wHi(),ESi),(wUi(),bVi));wg.t=10;continue vg;case 34:j=nZi(wg,r);if(j==2147483647){break vg}tZi(wg);while(wg.j>=j){EZi(wg)}f0i(wg);continue vg;case 31:case 33:nYi(wg,hrg,i,e);wg.w=wg.t;wg.t=20;eXi(wg.z,2,i);e=null;break vg;case 13:if(!yVi(mEg,EUi(e,(koi(),fFi)))){break q}rZi(wg);FUi(e,wg,wg.u);be=tmi(wg,hrg,r,e);ae=wg.y[wg.j];qmi(wg,be,ae.e);wmi(wg,hrg,r,be);ug=false;e=null;break vg;default:break q;}}case 8:switch(l){case 6:case 7:case 8:case 39:case 37:case 40:j=nZi(wg,nwg);if(j==2147483647){break vg}tZi(wg);while(wg.j>=j){EZi(wg)}BYi(wg);wg.t=7;continue;}case 12:switch(l){case 6:case 7:case 8:case 39:case 37:case 40:j=mZi(wg);if(j==2147483647){break vg}else{DYi(wg,j);continue}}case 21:switch(l){case 11:if(wg.t==21){if(wg.j==0||wg.y[1].c!=3){break vg}else{vmi(wg,wg.y[1].e);while(wg.j>0){EZi(wg)}nYi(wg,hrg,i,e);wg.t=16;e=null;break vg}}else{break vg}case 44:case 15:case 41:case 5:case 43:case 63:case 34:case 49:case 4:case 48:case 13:case 65:case 22:case 35:case 38:case 47:case 32:if(wg.t==21){wg.t=6}}case 6:n:for(;;){switch(l){case 23:FUi(e,wg,wg.u);lmi(wg,wg.y[0].e,e);e=null;break vg;case 2:case 16:case 18:case 33:case 31:case 36:case 54:break n;case 3:fYi(wg,e);e=null;break vg;case 29:case 50:case 46:case 51:vZi(wg);lYi(wg,hrg,i,e);e=null;break vg;case 42:vZi(wg);if(wg.y[wg.j].c==42){EZi(wg)}lYi(wg,hrg,i,e);e=null;break vg;case 61:vZi(wg);mYi(wg,hrg,i,e);e=null;break vg;case 44:vZi(wg);lYi(wg,hrg,i,e);wg.v=true;e=null;break vg;case 9:if(wg.m){break vg}else{vZi(wg);oYi(wg,e);e=null;break vg}case 15:case 41:j=wg.j;for(;;){t=wg.y[j];if(t.c==l){sZi(wg,t.d);while(wg.j>=j){EZi(wg)}break}else if(t.i||t.j&&t.d!=ywg&&t.d!=yEg&&t.d!=dFg){break}--j}vZi(wg);lYi(wg,hrg,i,e);e=null;break vg;case 30:vZi(wg);lYi(wg,hrg,i,e);eXi(wg.z,3,i);e=null;break vg;case 1:c=hZi(wg,oFg);if(c!=-1){b=wg.r[c];++b.h;gYi(wg,oFg);e0i(wg,b);c=iZi(wg,b);if(c!=-1){c0i(wg,c)}--b.h}b0i(wg);pYi(wg,hrg,i,e);e=null;break vg;case 45:case 64:b0i(wg);pYi(wg,hrg,i,e);e=null;break vg;case 24:b0i(wg);if(2147483647!=kZi(wg,zFg)){gYi(wg,zFg)}pYi(wg,hrg,i,e);e=null;break vg;case 5:j=kZi(wg,r);if(j!=2147483647){tZi(wg);while(wg.j>=j){EZi(wg)}BYi(wg);continue vg}else{b0i(wg);mYi(wg,hrg,i,e);vYi(wg,null);e=null;break vg}case 63:b0i(wg);mYi(wg,hrg,i,e);vYi(wg,null);e=null;break vg;case 43:b0i(wg);lYi(wg,hrg,i,e);vYi(wg,null);e=null;break vg;case 38:b0i(wg);lYi(wg,hrg,i,e);wg.w=wg.t;wg.t=20;eXi(wg.z,2,i);e=null;break vg;case 34:if(!wg.x){vZi(wg)}lYi(wg,hrg,i,e);wg.t=7;e=null;break vg;case 4:case 48:case 49:b0i(wg);case 55:tYi(wg,hrg,i,e);ug=false;e=null;break vg;case 22:vZi(wg);tYi(wg,hrg,i,e);ug=false;e=null;break vg;case 12:i=(wHi(),nNi);continue vg;case 65:case 13:b0i(wg);sYi(wg,hrg,r,e);ug=false;e=null;break vg;case 14:if(wg.m){break vg}vZi(wg);k=sUi(new rUi(),0);a=AUi(e,(koi(),zoi));if(a>-1){tUi(k,zoi,DUi(e,a),(Fli(),ami))}oYi(wg,k);tYi(wg,hrg,(wHi(),fNi),(wUi(),bVi));lYi(wg,hrg,AQi,bVi);lYi(wg,hrg,BNi,bVi);tg=AUi(e,wBi);if(tg>-1){sg=lfi(DUi(e,tg));mmi(wg,wg.y[wg.j].e,xfi(sg,0,sg.length))}else{mmi(wg,wg.y[wg.j].e,xfi(l0i,0,l0i.length))}p=sUi(new rUi(),0);tUi(p,yxi,eGg,(Fli(),ami));for(m=0;m<e.a;++m){d=zUi(e,m);if(yxi==d||wBi==d){}else if(zoi!=d){tUi(p,d,DUi(e,m),ami)}}uUi(e);sYi(wg,hrg,pGg,p);EZi(wg);EZi(wg);tYi(wg,hrg,fNi,bVi);EZi(wg);ug=false;e=null;break vg;case 35:mYi(wg,hrg,i,e);eXi(wg.z,1,i);wg.w=wg.t;wg.t=20;wg.v=true;e=null;break vg;case 26:{b0i(wg);lYi(wg,hrg,i,e);e=null;break vg}case 25:case 47:case 60:lYi(wg,hrg,i,e);wg.w=wg.t;wg.t=20;eXi(wg.z,2,i);e=null;break vg;case 32:b0i(wg);mYi(wg,hrg,i,e);switch(wg.t){case 7:case 8:case 9:case 10:case 11:case 12:wg.t=14;break;default:wg.t=13;}e=null;break vg;case 27:case 28:if(kZi(wg,dxg)!=2147483647){rg:for(;;){if(dxg==wg.y[wg.j].d){EZi(wg);break rg}j=wg.j;for(;;){if(wg.y[j].d==dxg){tZi(wg);while(wg.j>=j){EZi(wg)}break rg}--j}}}b0i(wg);lYi(wg,hrg,i,e);e=null;break vg;case 53:j=kZi(wg,AGg);if(j!=2147483647){tZi(wg)}if(j!=wg.j){while(wg.j>j){EZi(wg)}}lYi(wg,hrg,i,e);e=null;break vg;case 17:b0i(wg);e.b=1;if(ug){tYi(wg,wDg,i,e);ug=false}else{lYi(wg,wDg,i,e);wg.l=0}e=null;break vg;case 19:b0i(wg);e.b=2;if(ug){rYi(wg,bEg,i,e);ug=false}else{lYi(wg,bEg,i,e);wg.l=0}e=null;break vg;case 6:case 7:case 8:case 39:case 37:case 40:case 10:case 11:case 20:break vg;case 62:b0i(wg);mYi(wg,hrg,i,e);e=null;break vg;default:b0i(wg);lYi(wg,hrg,i,e);e=null;break vg;}}case 3:o:for(;;){switch(l){case 23:FUi(e,wg,wg.u);lmi(wg,wg.y[0].e,e);e=null;break vg;case 2:case 54:tYi(wg,hrg,i,e);ug=false;e=null;break vg;case 18:case 16:break o;case 36:lYi(wg,hrg,i,e);wg.w=wg.t;wg.t=20;eXi(wg.z,1,i);e=null;break vg;case 26:{lYi(wg,hrg,i,e);wg.t=4}e=null;break vg;case 31:case 33:case 25:lYi(wg,hrg,i,e);wg.w=wg.t;wg.t=20;eXi(wg.z,2,i);e=null;break vg;case 20:break vg;default:EZi(wg);wg.t=5;continue vg;}}case 4:switch(l){case 23:FUi(e,wg,wg.u);lmi(wg,wg.y[0].e,e);e=null;break vg;case 16:tYi(wg,hrg,i,e);ug=false;e=null;break vg;case 18:yYi(wg,e);tYi(wg,hrg,i,e);ug=false;e=null;break vg;case 33:case 25:nYi(wg,hrg,i,e);wg.w=wg.t;wg.t=20;eXi(wg.z,2,i);e=null;break vg;case 20:break vg;case 26:break vg;default:EZi(wg);wg.t=3;continue;}case 9:switch(l){case 23:FUi(e,wg,wg.u);lmi(wg,wg.y[0].e,e);e=null;break vg;case 7:tYi(wg,hrg,i,e);ug=false;e=null;break vg;default:if(wg.j==0){break vg}EZi(wg);wg.t=7;continue;}case 14:switch(l){case 6:case 39:case 37:case 40:case 34:bZi(wg);continue;}case 13:switch(l){case 23:FUi(e,wg,wg.u);lmi(wg,wg.y[0].e,e);e=null;break vg;case 28:if(dxg==wg.y[wg.j].d){EZi(wg)}nYi(wg,hrg,i,e);e=null;break vg;case 27:if(dxg==wg.y[wg.j].d){EZi(wg)}if(oxg==wg.y[wg.j].d){EZi(wg)}nYi(wg,hrg,i,e);e=null;break vg;case 32:j=nZi(wg,r);if(j==2147483647){break vg}else{while(wg.j>=j){EZi(wg)}f0i(wg);break vg}case 13:case 35:bZi(wg);continue;case 31:lYi(wg,hrg,i,e);wg.w=wg.t;wg.t=20;eXi(wg.z,2,i);e=null;break vg;default:break vg;}case 15:switch(l){case 23:FUi(e,wg,wg.u);lmi(wg,wg.y[0].e,e);e=null;break vg;default:wg.t=6;continue;}case 16:switch(l){case 11:nYi(wg,hrg,i,e);e=null;break vg;case 10:tYi(wg,hrg,i,e);ug=false;e=null;break vg;}case 17:switch(l){case 23:FUi(e,wg,wg.u);lmi(wg,wg.y[0].e,e);e=null;break vg;case 25:nYi(wg,hrg,i,e);wg.w=wg.t;wg.t=20;eXi(wg.z,2,i);e=null;break vg;default:break vg;}case 0:aZi(wg,(xli(),zli));wg.t=1;continue;case 1:switch(l){case 23:if(e==(wUi(),bVi)){hYi(wg,AWi(wg.z))}else{hYi(wg,e)}wg.t=2;e=null;break vg;default:hYi(wg,AWi(wg.z));wg.t=2;continue;}case 2:switch(l){case 23:FUi(e,wg,wg.u);lmi(wg,wg.y[0].e,e);e=null;break vg;case 20:qYi(wg,e);wg.t=3;e=null;break vg;default:qYi(wg,(wUi(),bVi));wg.t=3;continue;}case 5:switch(l){case 23:FUi(e,wg,wg.u);lmi(wg,wg.y[0].e,e);e=null;break vg;case 3:if(e.a==0){nYi(wg,hrg,(wHi(),cJi),AWi(wg.z))}else{nYi(wg,hrg,(wHi(),cJi),e)}wg.t=21;e=null;break vg;case 11:nYi(wg,hrg,i,e);wg.t=16;e=null;break vg;case 2:FZi(wg);tYi(wg,hrg,i,e);ug=false;EZi(wg);e=null;break vg;case 16:FZi(wg);tYi(wg,hrg,i,e);ug=false;EZi(wg);e=null;break vg;case 18:yYi(wg,e);FZi(wg);tYi(wg,hrg,i,e);ug=false;EZi(wg);e=null;break vg;case 31:FZi(wg);nYi(wg,hrg,i,e);wg.w=wg.t;wg.t=20;eXi(wg.z,2,i);e=null;break vg;case 33:case 25:FZi(wg);nYi(wg,hrg,i,e);wg.w=wg.t;wg.t=20;eXi(wg.z,2,i);e=null;break vg;case 36:FZi(wg);nYi(wg,hrg,i,e);wg.w=wg.t;wg.t=20;eXi(wg.z,1,i);e=null;break vg;case 20:break vg;default:nYi(wg,hrg,(wHi(),cJi),AWi(wg.z));wg.t=21;continue;}case 18:switch(l){case 23:FUi(e,wg,wg.u);lmi(wg,wg.y[0].e,e);e=null;break vg;default:wg.t=6;continue;}case 19:switch(l){case 25:lYi(wg,hrg,i,e);wg.w=wg.t;wg.t=20;eXi(wg.z,2,i);e=null;break vg;default:break vg;}}}}if(s&&wg.l==0&&!uZi(wg)){wg.l=1}e!=(wUi(),bVi)}
function j0i(d,c){var a,b;d.z=c;d.y=e9h(aai,51,11,64,0);d.r=e9h(aai,51,11,64,0);d.v=false;d.w=0;d.j=-1;d.s=-1;d.m=null;d.o=null;d.p=false;mhi(d.q);d.A=d.A;d.d=null;d.b=null;d.c=false;d.g=0;d.f=e9h(A_h,42,-1,1024,1);if(d.n){a=umi(d,AWi(d.z));b=DVi(new AVi(),hrg,(wHi(),gNi),a);++d.j;d.y[d.j]=b;f0i(d);if(fHg==d.h||qHg==d.h){dXi(d.z,1)}else if(BHg==d.h||hIg==d.h||sIg==d.h||DIg==d.h||iJg==d.h||tJg==d.h){dXi(d.z,2)}else if(EJg==d.h){dXi(d.z,3)}else{dXi(d.z,0)}d.h=null}else{d.t=0;d.l=1}}
function n0i(a){var b,c,d,e,g,h,o;e=0;o=-1;g=-1;b=lfi(a);f:for(h=0;h<b.length;++h){c=b[h];switch(e){case 0:switch(c){case 99:case 67:e=1;continue;default:continue;}case 1:switch(c){case 104:case 72:e=2;continue;default:e=0;continue;}case 2:switch(c){case 97:case 65:e=3;continue;default:e=0;continue;}case 3:switch(c){case 114:case 82:e=4;continue;default:e=0;continue;}case 4:switch(c){case 115:case 83:e=5;continue;default:e=0;continue;}case 5:switch(c){case 101:case 69:e=6;continue;default:e=0;continue;}case 6:switch(c){case 116:case 84:e=7;continue;default:e=0;continue;}case 7:switch(c){case 9:case 10:case 12:case 13:case 32:continue;case 61:e=8;continue;default:return null;}case 8:switch(c){case 9:case 10:case 12:case 13:case 32:continue;case 39:o=h+1;e=9;continue;case 34:o=h+1;e=10;continue;default:o=h;e=11;continue;}case 9:switch(c){case 39:g=h;break f;default:continue;}case 10:switch(c){case 34:g=h;break f;default:continue;}case 11:switch(c){case 9:case 10:case 12:case 13:case 32:case 59:g=h;break f;default:continue;}}}d=null;if(o!=-1){if(g==-1){g=b.length}d=xfi(b,o,g-o)}return d}
function o0i(){return w_h}
function bYi(){}
_=bYi.prototype=new xdi();_.gC=o0i;_.tI=0;_.f=null;_.g=0;_.h=null;_.i=null;_.j=-1;_.l=1;_.m=null;_.n=false;_.o=null;_.p=false;_.r=null;_.s=-1;_.t=0;_.v=false;_.w=0;_.x=false;_.y=null;_.z=null;_.A=false;var k0i,l0i,m0i;function qHi(){qHi=v0i;CYi()}
function pHi(f,a,e,b){var c,d;d=f.g+b;if(d>f.f.length){c=e9h(A_h,42,-1,d,1);Afi(f.f,0,c,0,f.g);f.f=c}Afi(a,e,f.f,f.g,b);f.g=d}
function rHi(g,a,e,c,f,d){var b;ymi(g,(b=e+c,mfi(a.length,e,b),ofi(a,e,b)),f,d)}
function sHi(){return p_h}
function oHi(){}
_=oHi.prototype=new bYi();_.gC=sHi;_.tI=0;function rmi(){rmi=v0i;qHi()}
function kmi(b,a){rmi();b.k=(sli(),tli);b.u=(Fli(),bmi);b.q=cki(new bki());b.n=false;b.e=xki(new hki());b.a=a;jni(a);return b}
function lmi(h,e,c){var a,d,f,g,i;try{for(f=0;f<c.a;++f){g=BUi(c,f);i=CUi(c,f);if(!e.hasAttributeNS(i,g)){e.setAttributeNS(i,g,DUi(c,f))}}}catch(a){a=gai(a);if(s9h(a,19)){d=a;fZi(h,d)}else throw a}}
function mmi(f,d,e){var a,c;try{if(d==f.b){f.d.appendChild(f.a.createTextNode(e))}d.appendChild(f.a.createTextNode(e))}catch(a){a=gai(a);if(s9h(a,19)){c=a;fZi(f,c)}else throw a}}
function nmi(f,e,d){var a,c;try{while(e.hasChildNodes()){d.appendChild(e.firstChild)}}catch(a){a=gai(a);if(s9h(a,19)){c=a;fZi(f,c)}else throw a}}
function pmi(f,e,c){var a,d;try{if(e==f.b){f.d.appendChild(f.a.createComment(c))}e.appendChild(f.a.createComment(c))}catch(a){a=gai(a);if(s9h(a,19)){d=a;fZi(f,d)}else throw a}}
function omi(e,c){var a,d;try{e.a.appendChild(e.a.createComment(c))}catch(a){a=gai(a);if(s9h(a,19)){d=a;fZi(e,d)}else throw a}}
function qmi(f,c,e){var a,d;try{if(e==f.b){f.d.appendChild(c.cloneNode(true))}e.appendChild(c)}catch(a){a=gai(a);if(s9h(a,19)){d=a;fZi(f,d)}else throw a}}
function smi(i,g,f,c){var a,d,e,h;try{h=i.a.createElementNS(g,f);for(e=0;e<c.a;++e){h.setAttributeNS(CUi(c,e),BUi(c,e),DUi(c,e))}if(hIg==f){if(i.b){zki(i.e,gmi(new fmi(),i.d,i.b))}i.d=h;i.b=i.a.createElementNS(jKg,hIg);h=i.b;for(e=0;e<c.a;++e){h.setAttributeNS(CUi(c,e),BUi(c,e),DUi(c,e))}}return h}catch(a){a=gai(a);if(s9h(a,19)){d=a;fZi(i,d);throw Edi(new Ddi(),uKg)}else throw a}}
function tmi(h,f,e,c){var a,d,g;try{g=smi(h,f,e,c);return g}catch(a){a=gai(a);if(s9h(a,19)){d=a;fZi(h,d);return null}else throw a}}
function umi(g,c){var a,d,e,f;try{f=g.a.createElementNS(hrg,hAg);for(e=0;e<c.a;++e){f.setAttributeNS(CUi(c,e),BUi(c,e),DUi(c,e))}g.a.appendChild(f);return f}catch(a){a=gai(a);if(s9h(a,19)){d=a;fZi(g,d);throw Edi(new Ddi(),uKg)}else throw a}}
function vmi(f,d){var a,c,e;try{e=d.parentNode;if(e){e.removeChild(d)}}catch(a){a=gai(a);if(s9h(a,19)){c=a;fZi(f,c)}else throw a}}
function wmi(d,c,a,b){if(b==d.b){d.c=true;d.z.jb=true}__elementPopped__(c,a,b)}
function xmi(b){var a;a=b.a;b.a=null;return a}
function ymi(i,h,g,f){var a,c,d,e;try{c=i.a.createTextNode(h);e=g.parentNode;if(!!e&&e.nodeType==1){e.insertBefore(c,g)}else{f.appendChild(c)}}catch(a){a=gai(a);if(s9h(a,19)){d=a;fZi(i,d)}else throw a}}
function zmi(h,c,g,f){var a,d,e;e=g.parentNode;try{if(!!e&&e.nodeType==1){e.insertBefore(c,g)}else{f.appendChild(c)}}catch(a){a=gai(a);if(s9h(a,19)){d=a;fZi(h,d)}else throw a}}
function Ami(b){var a;if(b.c){b.c=false;lni(b.b,b.d);if(b.e.b==0){b.d=null;b.b=null}else{a=p9h(Eki(b.e),20);b.d=a.b;b.b=a.a}}}
function cni(){return k_h}
function jni(d){if(!d.createElementNS){d.createElementNS=function(c,a){if(hrg==c){return d.createElement(a)}else if(wDg==c){if(!d.mathplayerinitialized){var b=document.createElement(FKg);b.setAttribute(kLg,wLg);b.setAttribute(bMg,mMg);document.getElementsByTagName(Drg)[0].appendChild(b);document.namespaces.add(xMg,wDg,cNg);d.mathplayerinitialized=true}return d.createElement(nNg+a)}else if(bEg==c){if(!d.renesisinitialized){var b=document.createElement(FKg);b.setAttribute(kLg,yNg);b.setAttribute(bMg,dOg);document.getElementsByTagName(Drg)[0].appendChild(b);document.namespaces.add(oOg,bEg,zOg);d.renesisinitialized=true}return d.createElement(fPg+a)}else{}}}}
function lni(b,a){b.parentNode.replaceChild(a,b);__elementPopped__(cNh,a.nodeName,a)}
function emi(){}
_=emi.prototype=new oHi();_.gC=cni;_.tI=0;_.a=null;_.b=null;_.c=false;_.d=null;function gmi(c,b,a){c.b=b;c.a=a;return c}
function imi(){return j_h}
function fmi(){}
_=fmi.prototype=new xdi();_.gC=imi;_.tI=34;_.a=null;_.b=null;function Ani(b,a){b.b=tei(new rei());b.a=xki(new hki());b.c=kmi(new emi(),a);b.i=fUi(new dUi(),b.c);b.c.u=(Fli(),bmi);b.i.p=bmi;b.i.e=bmi;b.i.t=bmi;b.i.db=bmi;hXi(b.i,bmi);return b}
function Cni(i,h,j,a){i.f=a;g0i(i.c,null);i.e=false;i.d=false;yei(i.b,0);i.h=h.length;i.g=q0i(new p0i(),lfi(h),0,i.h<512?i.h:512);Aki(i.a);zki(i.a,i.g);g0i(i.c,null);iXi(i.i);Dni(i,j)}
function Dni(g,i){var a,c,d,e,f,h;if(g.d){BWi(g.i);xmi(g.c);g.f.a();return}d=g.b.c;if(d>0){e=e9h(A_h,42,-1,d,1);wei(g.b,0,d,e,0);zki(g.a,q0i(new p0i(),e,0,d));yei(g.b,0)}for(;;){c=p9h(Cki(g.a),21);if(c.c>=c.b){if(c==g.g){if(c.b==g.h){CWi(g.i);g.d=true;break}else{f=c.c+512;c.b=f<g.h?f:g.h;continue}}else{p9h(Eki(g.a),21);continue}}r0i(c,g.e);g.e=false;if(c.c<c.b){g.e=kXi(g.i,c);Ami(g.c);break}else{continue}}if(i){h=pni(new oni(),g);ibi(h,1)}else{try{Dni(g,false)}catch(a){a=gai(a);if(s9h(a,22)){g.d=true}else throw a}}}
function aoi(h){var a;a=q0i(new p0i(),lfi(h),0,h.length);while(a.c<a.b){r0i(a,this.e);this.e=false;if(a.c<a.b){this.e=kXi(this.i,a);Ami(this.c)}}}
function boi(){return m_h}
function nni(){}
_=nni.prototype=new xdi();_.xb=aoi;_.gC=boi;_.tI=0;_.c=null;_.d=false;_.e=false;_.f=null;_.g=null;_.h=0;_.i=null;function qni(){qni=v0i;gbi()}
function pni(b,a){qni();b.a=a;return b}
function rni(c){var a;try{Dni(c.a,true)}catch(a){a=gai(a);if(s9h(a,22)){c.a.d=true}else throw a}}
function sni(){return l_h}
function oni(){}
_=oni.prototype=new abi();_.gC=sni;_.tI=35;_.a=null;function wni(c,d){c.write=function(){if(arguments.length==0){return}var b=arguments[0];for(var a=1;a<arguments.length;a++){b+=arguments[a]}d.xb(b)};c.writeln=function(){if(arguments.length==0){d.xb(qPg);return}var b=arguments[0];for(var a=1;a<arguments.length;a++){b+=arguments[a]}b+=qPg;d.xb(b)}}
function xni(e,a,f,d,b){var c;if(!d){d=q8h()}yni(a);c=Ani(new nni(),a);wni(a,c);Cni(c,e,f,doi(new coi(),d))}
function yni(a){while(a.hasChildNodes()){a.removeChild(a.lastChild)}}
function doi(b,a){b.a=a;return b}
function goi(){return n_h}
function coi(){}
_=coi.prototype=new xdi();_.gC=goi;_.tI=0;_.a=null;function koi(){var bb;koi=v0i;dpi=f9h(D_h,48,1,[cNh,cNh,cNh,cNh]);zGi=f9h(D_h,48,1,[cNh,BPg,BPg,cNh]);EGi=f9h(D_h,48,1,[cNh,gQg,gQg,cNh]);sGi=f9h(D_h,48,1,[cNh,rQg,rQg,cNh]);hwi=f9h(D_h,48,1,[cNh,cNh,cNh,gQg]);epi=f9h(D_h,48,1,[null,null,null,null]);AGi=f9h(D_h,48,1,[null,CQg,CQg,null]);tGi=f9h(D_h,48,1,[null,hRg,hRg,null]);FGi=f9h(D_h,48,1,[null,sRg,sRg,null]);iwi=f9h(D_h,48,1,[null,null,null,sRg]);bpi=f9h(bai,0,-1,[true,true,true,true]);cpi=f9h(bai,0,-1,[false,false,false,false]);xsi=ioi(new hoi(),dpi,ACi(DRg),epi,bpi,false);zvi=ioi(new hoi(),dpi,ACi(iSg),epi,bpi,false);xBi=ioi(new hoi(),dpi,ACi(uSg),epi,bpi,false);lGi=ioi(new hoi(),dpi,ACi(FSg),epi,bpi,false);dHi=ioi(new hoi(),dpi,ACi(kTg),epi,bpi,false);hHi=ioi(new hoi(),dpi,ACi(vTg),epi,bpi,false);iri=ioi(new hoi(),dpi,ACi(aUg),epi,bpi,false);vsi=ioi(new hoi(),dpi,ACi(lUg),epi,bpi,false);wsi=ioi(new hoi(),dpi,ACi(wUg),epi,bpi,false);nti=ioi(new hoi(),dpi,ACi(bVg),epi,bpi,false);oti=ioi(new hoi(),dpi,ACi(mVg),epi,bpi,false);zui=ioi(new hoi(),dpi,ACi(xVg),epi,bpi,false);yui=ioi(new hoi(),dpi,ACi(dWg),epi,bpi,false);wui=ioi(new hoi(),dpi,ACi(oWg),epi,bpi,false);xui=ioi(new hoi(),dpi,ACi(zWg),epi,bpi,false);Dvi=ioi(new hoi(),dpi,ACi(eXg),epi,bpi,false);Bvi=ioi(new hoi(),dpi,ACi(pXg),epi,bpi,false);Cvi=ioi(new hoi(),dpi,ACi(AXg),epi,bpi,false);Avi=ioi(new hoi(),dpi,ACi(fYg),epi,bpi,false);pvi=joi(new hoi(),dpi,ACi(kLg),epi,bpi,false);svi=ioi(new hoi(),dpi,ACi(qYg),epi,bpi,false);hFi=ioi(new hoi(),dpi,ACi(BYg),epi,bpi,false);gFi=ioi(new hoi(),dpi,ACi(gZg),epi,bpi,false);wCi=ioi(new hoi(),dpi,ACi(tZg),epi,bpi,false);yCi=ioi(new hoi(),dpi,ACi(EZg),epi,bpi,false);zCi=ioi(new hoi(),dpi,ACi(j0g),epi,bpi,false);dFi=ioi(new hoi(),dpi,ACi(u0g),epi,bpi,false);fHi=ioi(new hoi(),dpi,ACi(F0g),epi,bpi,false);eHi=ioi(new hoi(),dpi,ACi(k1g),epi,bpi,false);mGi=ioi(new hoi(),dpi,ACi(v1g),epi,bpi,false);nGi=ioi(new hoi(),dpi,ACi(a2g),epi,bpi,false);gpi=ioi(new hoi(),dpi,ACi(l2g),epi,bpi,false);eti=ioi(new hoi(),dpi,ACi(w2g),epi,bpi,false);mti=ioi(new hoi(),dpi,ACi(c3g),epi,bpi,false);vti=ioi(new hoi(),dpi,ACi(n3g),epi,bpi,false);pui=ioi(new hoi(),dpi,ACi(y3g),epi,bpi,false);tvi=ioi(new hoi(),dpi,ACi(d4g),epi,bpi,false);nxi=ioi(new hoi(),dpi,ACi(o4g),epi,bpi,false);txi=ioi(new hoi(),dpi,ACi(z4g),epi,bpi,false);wwi=ioi(new hoi(),dpi,ACi(e5g),epi,bpi,false);DBi=ioi(new hoi(),dpi,ACi(p5g),epi,bpi,false);mCi=ioi(new hoi(),dpi,ACi(A5g),epi,bpi,false);wDi=ioi(new hoi(),dpi,ACi(f6g),epi,bpi,false);Aqi=ioi(new hoi(),dpi,ACi(r6g),epi,bpi,false);roi=ioi(new hoi(),dpi,ACi(C6g),epi,bpi,false);cri=ioi(new hoi(),dpi,ACi(h7g),epi,bpi,false);rri=ioi(new hoi(),dpi,ACi(s7g),epi,bpi,false);Bri=ioi(new hoi(),dpi,ACi(D7g),epi,bpi,false);gri=ioi(new hoi(),dpi,ACi(i8g),epi,bpi,false);esi=ioi(new hoi(),dpi,ACi(t8g),epi,bpi,false);vri=ioi(new hoi(),dpi,ACi(E8g),epi,bpi,false);nri=ioi(new hoi(),dpi,ACi(j9g),epi,bpi,false);Dqi=ioi(new hoi(),dpi,ACi(u9g),epi,bpi,false);pti=ioi(new hoi(),dpi,ACi(a$g),epi,bpi,false);ysi=ioi(new hoi(),dpi,ACi(l$g),epi,bpi,false);Cti=ioi(new hoi(),dpi,ACi(w$g),epi,bpi,false);vui=ioi(new hoi(),dpi,ACi(b_g),epi,bpi,false);qui=ioi(new hoi(),dpi,ACi(srg),epi,bpi,false);Ati=ioi(new hoi(),dpi,ACi(m_g),epi,bpi,false);gvi=ioi(new hoi(),dpi,ACi(x_g),epi,bpi,false);kvi=ioi(new hoi(),dpi,ACi(cah),epi,bpi,false);yAi=ioi(new hoi(),dpi,ACi(nah),epi,bpi,false);ovi=ioi(new hoi(),dpi,ACi(yah),epi,bpi,false);yxi=ioi(new hoi(),dpi,ACi(pXh),epi,bpi,false);vxi=ioi(new hoi(),dpi,ACi(dbh),epi,bpi,false);exi=ioi(new hoi(),dpi,ACi(pbh),epi,bpi,false);qwi=ioi(new hoi(),dpi,ACi(Abh),epi,bpi,false);fwi=ioi(new hoi(),hwi,ACi(fch),iwi,bpi,false);rwi=ioi(new hoi(),dpi,ACi(qch),epi,bpi,false);fFi=ioi(new hoi(),dpi,ACi(Bch),epi,bpi,false);fGi=ioi(new hoi(),dpi,ACi(gdh),epi,bpi,false);jGi=ioi(new hoi(),dpi,ACi(rdh),epi,bpi,false);BEi=ioi(new hoi(),dpi,ACi(Cdh),epi,bpi,false);eBi=ioi(new hoi(),dpi,ACi(heh),epi,bpi,false);kBi=ioi(new hoi(),dpi,ACi(seh),epi,bpi,false);BBi=ioi(new hoi(),dpi,sEi(Eeh,jfh),epi,bpi,false);CBi=ioi(new hoi(),dpi,sEi(ufh,Ffh),epi,bpi,false);nDi=ioi(new hoi(),dpi,ACi(kgh),epi,bpi,false);gDi=ioi(new hoi(),dpi,ACi(vgh),epi,bpi,false);rCi=ioi(new hoi(),dpi,ACi(ahh),epi,bpi,false);qDi=ioi(new hoi(),dpi,ACi(lhh),epi,bpi,false);DDi=ioi(new hoi(),dpi,ACi(whh),epi,bpi,false);nCi=ioi(new hoi(),dpi,ACi(bih),epi,bpi,false);bHi=ioi(new hoi(),dpi,ACi(nih),epi,bpi,false);rqi=ioi(new hoi(),dpi,ACi(yih),epi,bpi,false);api=ioi(new hoi(),dpi,ACi(djh),epi,bpi,false);Doi=ioi(new hoi(),dpi,ACi(ojh),epi,bpi,false);zri=ioi(new hoi(),dpi,ACi(zjh),epi,bpi,false);Fri=ioi(new hoi(),dpi,ACi(ekh),epi,bpi,false);sri=ioi(new hoi(),dpi,ACi(pkh),epi,bpi,false);uri=ioi(new hoi(),dpi,ACi(Akh),epi,bpi,false);dri=ioi(new hoi(),dpi,ACi(flh),epi,bpi,false);bti=ioi(new hoi(),dpi,ACi(qlh),epi,bpi,false);Fsi=ioi(new hoi(),dpi,ACi(Clh),epi,bpi,false);Bti=ioi(new hoi(),dpi,ACi(hmh),epi,bpi,false);sui=ioi(new hoi(),dpi,ACi(smh),epi,bpi,false);yvi=ioi(new hoi(),dpi,ACi(Dmh),epi,bpi,false);hzi=ioi(new hoi(),dpi,ACi(inh),epi,bpi,false);uvi=ioi(new hoi(),dpi,ACi(tnh),epi,bpi,false);BAi=ioi(new hoi(),dpi,ACi(Enh),epi,bpi,false);FAi=ioi(new hoi(),dpi,ACi(joh),epi,bpi,false);zyi=ioi(new hoi(),dpi,ACi(uoh),epi,bpi,false);zxi=ioi(new hoi(),dpi,ACi(Foh),epi,bpi,false);qxi=ioi(new hoi(),dpi,ACi(lph),epi,bpi,false);ewi=ioi(new hoi(),dpi,ACi(wph),epi,bpi,false);swi=ioi(new hoi(),dpi,ACi(bqh),epi,bpi,false);gGi=ioi(new hoi(),dpi,ACi(mqh),epi,bpi,false);cFi=ioi(new hoi(),dpi,ACi(fHg),epi,bpi,false);FFi=ioi(new hoi(),dpi,ACi(xqh),epi,bpi,false);rFi=ioi(new hoi(),dpi,ACi(crh),epi,bpi,false);oDi=ioi(new hoi(),dpi,ACi(nrh),epi,bpi,false);lDi=ioi(new hoi(),dpi,ACi(yrh),epi,bpi,false);ECi=ioi(new hoi(),dpi,ACi(dsh),epi,bpi,false);CCi=ioi(new hoi(),dpi,ACi(osh),epi,bpi,false);uDi=ioi(new hoi(),dpi,ACi(Ash),epi,bpi,false);nEi=ioi(new hoi(),dpi,ACi(BHg),epi,bpi,false);xCi=ioi(new hoi(),dpi,ACi(fth),epi,bpi,false);BDi=ioi(new hoi(),dpi,ACi(qth),epi,bpi,false);CDi=ioi(new hoi(),dpi,ACi(Bth),epi,bpi,false);yDi=ioi(new hoi(),dpi,ACi(guh),epi,bpi,false);yGi=ioi(new hoi(),zGi,ACi(CQg),epi,f9h(bai,0,-1,[false,false,false,false]),true);voi=ioi(new hoi(),dpi,ACi(ruh),epi,bpi,false);soi=ioi(new hoi(),dpi,ACi(Cuh),epi,bpi,false);qqi=ioi(new hoi(),dpi,ACi(hvh),epi,bpi,false);Boi=ioi(new hoi(),dpi,ACi(svh),epi,bpi,false);hpi=ioi(new hoi(),dpi,ACi(Dvh),epi,bpi,false);zoi=ioi(new hoi(),dpi,ACi(kwh),epi,bpi,false);hri=ioi(new hoi(),dpi,ACi(vwh),epi,bpi,false);usi=ioi(new hoi(),dpi,ACi(axh),epi,bpi,false);tsi=ioi(new hoi(),dpi,ACi(lxh),epi,bpi,false);Fti=ioi(new hoi(),dpi,ACi(wxh),epi,bpi,false);rui=ioi(new hoi(),dpi,ACi(byh),epi,bpi,false);evi=ioi(new hoi(),dpi,ACi(mEg),epi,bpi,false);mvi=ioi(new hoi(),dpi,ACi(myh),epi,bpi,false);dvi=ioi(new hoi(),dpi,ACi(xyh),epi,bpi,false);cAi=ioi(new hoi(),dpi,ACi(czh),epi,bpi,false);xzi=ioi(new hoi(),dpi,ACi(nzh),epi,bpi,false);Fyi=ioi(new hoi(),dpi,ACi(zzh),epi,bpi,false);EAi=ioi(new hoi(),dpi,ACi(eAh),epi,bpi,false);wAi=ioi(new hoi(),dpi,ACi(pAh),epi,bpi,false);rzi=ioi(new hoi(),dpi,ACi(AAh),epi,bpi,false);tAi=ioi(new hoi(),dpi,ACi(fBh),epi,bpi,false);gzi=ioi(new hoi(),dpi,ACi(qBh),epi,bpi,false);ryi=ioi(new hoi(),dpi,ACi(BBh),epi,bpi,false);ayi=ioi(new hoi(),dpi,ACi(FKg),epi,bpi,false);cyi=ioi(new hoi(),dpi,ACi(gCh),epi,bpi,false);CAi=ioi(new hoi(),dpi,ACi(rCh),epi,bpi,false);yyi=ioi(new hoi(),dpi,ACi(CCh),epi,bpi,false);Exi=ioi(new hoi(),dpi,ACi(iDh),epi,bpi,false);Axi=ioi(new hoi(),dpi,ACi(tDh),epi,bpi,false);Awi=ioi(new hoi(),dpi,ACi(EDh),epi,bpi,false);sxi=ioi(new hoi(),dpi,ACi(jEh),epi,bpi,false);xwi=ioi(new hoi(),dpi,ACi(uEh),epi,bpi,false);zwi=ioi(new hoi(),dpi,ACi(FEh),epi,bpi,false);ywi=ioi(new hoi(),dpi,ACi(kFh),epi,bpi,false);pFi=ioi(new hoi(),dpi,ACi(vFh),epi,bpi,false);hGi=ioi(new hoi(),dpi,ACi(aGh),epi,bpi,false);xEi=ioi(new hoi(),dpi,ACi(lGh),epi,bpi,false);sFi=ioi(new hoi(),dpi,ACi(xGh),epi,bpi,false);qFi=ioi(new hoi(),dpi,ACi(cHh),epi,bpi,false);aGi=ioi(new hoi(),dpi,ACi(nHh),epi,bpi,false);rBi=ioi(new hoi(),dpi,ACi(yHh),epi,bpi,false);nBi=ioi(new hoi(),dpi,ACi(dIh),epi,bpi,false);wBi=ioi(new hoi(),dpi,ACi(oIh),epi,bpi,false);FCi=ioi(new hoi(),dpi,ACi(zIh),epi,bpi,false);eEi=ioi(new hoi(),dpi,ACi(eJh),epi,bpi,false);DCi=ioi(new hoi(),dpi,ACi(pJh),epi,bpi,false);fEi=ioi(new hoi(),dpi,ACi(AJh),epi,bpi,false);zBi=ioi(new hoi(),dpi,ACi(gKh),epi,bpi,false);lCi=ioi(new hoi(),dpi,ACi(rKh),epi,bpi,false);FBi=ioi(new hoi(),dpi,ACi(CKh),epi,bpi,false);vCi=ioi(new hoi(),dpi,ACi(eLh),epi,bpi,false);oCi=ioi(new hoi(),dpi,ACi(fLh),epi,bpi,false);uCi=ioi(new hoi(),dpi,ACi(gLh),epi,bpi,false);ipi=ioi(new hoi(),dpi,ACi(hLh),epi,bpi,false);lpi=ioi(new hoi(),dpi,ACi(iLh),epi,bpi,false);Bqi=ioi(new hoi(),dpi,ACi(jLh),epi,bpi,false);Ari=ioi(new hoi(),dpi,ACi(kLh),epi,bpi,false);qri=ioi(new hoi(),dpi,ACi(mLh),epi,bpi,false);tri=ioi(new hoi(),dpi,ACi(bMg),epi,bpi,false);ori=ioi(new hoi(),dpi,ACi(nLh),epi,bpi,false);fri=ioi(new hoi(),dpi,ACi(oLh),epi,bpi,false);fsi=ioi(new hoi(),dpi,ACi(pLh),epi,bpi,false);pri=ioi(new hoi(),dpi,ACi(qLh),epi,bpi,false);lsi=ioi(new hoi(),dpi,ACi(rLh),epi,bpi,false);nsi=ioi(new hoi(),dpi,ACi(sLh),epi,bpi,false);uti=ioi(new hoi(),dpi,ACi(tLh),epi,bpi,false);Bsi=ioi(new hoi(),dpi,ACi(uLh),epi,bpi,false);zsi=ioi(new hoi(),dpi,ACi(vLh),epi,bpi,false);Dsi=ioi(new hoi(),dpi,ACi(xLh),epi,bpi,false);hti=ioi(new hoi(),dpi,ACi(yLh),epi,bpi,false);jti=ioi(new hoi(),dpi,ACi(zLh),epi,bpi,false);Esi=ioi(new hoi(),dpi,ACi(ALh),epi,bpi,false);cti=ioi(new hoi(),dpi,ACi(BLh),epi,bpi,false);awi=ioi(new hoi(),dpi,ACi(CLh),epi,bpi,false);bvi=ioi(new hoi(),dpi,ACi(DLh),epi,bpi,false);cvi=ioi(new hoi(),dpi,ACi(ELh),epi,bpi,false);fAi=ioi(new hoi(),dpi,ACi(FLh),epi,bpi,false);vyi=ioi(new hoi(),dpi,ACi(aMh),epi,bpi,false);AAi=ioi(new hoi(),dpi,ACi(cMh),epi,bpi,false);qyi=ioi(new hoi(),dpi,ACi(dMh),epi,bpi,false);wzi=ioi(new hoi(),dpi,ACi(eMh),epi,bpi,false);mzi=ioi(new hoi(),dpi,ACi(fMh),epi,bpi,false);izi=ioi(new hoi(),dpi,ACi(gMh),epi,bpi,false);szi=ioi(new hoi(),dpi,ACi(hMh),epi,bpi,false);dyi=ioi(new hoi(),dpi,ACi(iMh),epi,bpi,false);sAi=ioi(new hoi(),dpi,ACi(jMh),epi,bpi,false);jAi=ioi(new hoi(),dpi,ACi(kMh),epi,bpi,false);xAi=ioi(new hoi(),dpi,ACi(lMh),epi,bpi,false);Cxi=ioi(new hoi(),dpi,ACi(nMh),epi,bpi,false);uxi=ioi(new hoi(),dpi,ACi(oMh),epi,bpi,false);pxi=ioi(new hoi(),dpi,ACi(pMh),epi,bpi,false);uwi=ioi(new hoi(),dpi,ACi(qMh),epi,bpi,false);jwi=ioi(new hoi(),dpi,ACi(rMh),epi,bpi,false);kFi=ioi(new hoi(),dpi,ACi(sMh),epi,bpi,false);yEi=ioi(new hoi(),dpi,sEi(tMh,uMh),epi,bpi,false);zEi=ioi(new hoi(),dpi,sEi(vMh,wMh),epi,bpi,false);CFi=ioi(new hoi(),dpi,sEi(yMh,zMh),epi,bpi,false);uFi=ioi(new hoi(),dpi,ACi(AMh),epi,bpi,false);gBi=ioi(new hoi(),dpi,ACi(BMh),epi,bpi,false);vBi=ioi(new hoi(),dpi,ACi(CMh),epi,bpi,false);pDi=ioi(new hoi(),dpi,ACi(DMh),epi,bpi,false);kCi=ioi(new hoi(),dpi,ACi(EMh),epi,bpi,false);tCi=ioi(new hoi(),dpi,ACi(FMh),epi,bpi,false);BCi=ioi(new hoi(),dpi,ACi(aNh),epi,bpi,false);pEi=ioi(new hoi(),dpi,ACi(bNh),epi,bpi,false);xDi=ioi(new hoi(),dpi,ACi(eNh),epi,bpi,false);gCi=ioi(new hoi(),dpi,ACi(fNh),epi,bpi,false);yqi=ioi(new hoi(),dpi,ACi(gNh),epi,bpi,false);Coi=ioi(new hoi(),dpi,ACi(hNh),epi,bpi,false);jri=ioi(new hoi(),dpi,sEi(iNh,jNh),epi,bpi,false);Dri=ioi(new hoi(),dpi,ACi(kNh),epi,bpi,false);Cri=ioi(new hoi(),dpi,ACi(lNh),epi,bpi,false);ssi=ioi(new hoi(),dpi,ACi(mNh),epi,bpi,false);eri=ioi(new hoi(),dpi,ACi(nNh),epi,bpi,false);Fqi=ioi(new hoi(),dpi,ACi(pNh),epi,bpi,false);yti=ioi(new hoi(),dpi,ACi(qNh),epi,bpi,false);qti=ioi(new hoi(),dpi,sEi(rNh,sNh),epi,bpi,false);tti=ioi(new hoi(),dpi,ACi(tNh),epi,bpi,false);Aui=ioi(new hoi(),dpi,sEi(uNh,vNh),epi,bpi,false);Csi=ioi(new hoi(),dpi,ACi(wNh),epi,bpi,false);gti=ioi(new hoi(),dpi,ACi(xNh),epi,bpi,false);fui=ioi(new hoi(),dpi,ACi(yNh),epi,bpi,false);dwi=ioi(new hoi(),dpi,sEi(ANh,BNh),epi,bpi,false);dBi=ioi(new hoi(),dpi,ACi(CNh),epi,bpi,false);lvi=ioi(new hoi(),dpi,ACi(DNh),epi,bpi,false);kAi=ioi(new hoi(),dpi,ACi(ENh),epi,bpi,false);uyi=ioi(new hoi(),dpi,ACi(FNh),epi,bpi,false);syi=ioi(new hoi(),dpi,ACi(aOh),epi,bpi,false);vAi=ioi(new hoi(),dpi,ACi(bOh),epi,bpi,false);lzi=ioi(new hoi(),dpi,ACi(cOh),epi,bpi,false);pAi=ioi(new hoi(),dpi,ACi(dOh),epi,bpi,false);zAi=ioi(new hoi(),dpi,ACi(fOh),epi,bpi,false);aBi=ioi(new hoi(),dpi,ACi(gOh),epi,bpi,false);uAi=ioi(new hoi(),dpi,ACi(hOh),epi,bpi,false);iAi=ioi(new hoi(),dpi,ACi(iOh),epi,bpi,false);qAi=ioi(new hoi(),dpi,ACi(jOh),epi,bpi,false);Dxi=ioi(new hoi(),dpi,ACi(kOh),epi,bpi,false);Bxi=ioi(new hoi(),dpi,ACi(lOh),epi,bpi,false);Bwi=ioi(new hoi(),dpi,ACi(mOh),epi,bpi,false);kxi=ioi(new hoi(),dpi,ACi(nOh),epi,bpi,false);xxi=ioi(new hoi(),dpi,ACi(oOh),epi,bpi,false);twi=ioi(new hoi(),dpi,ACi(qOh),epi,bpi,false);gwi=ioi(new hoi(),dpi,ACi(rOh),epi,bpi,false);AEi=ioi(new hoi(),dpi,ACi(sOh),epi,bpi,false);vEi=ioi(new hoi(),dpi,ACi(tOh),epi,bpi,false);ABi=ioi(new hoi(),dpi,ACi(uOh),epi,bpi,false);hDi=ioi(new hoi(),dpi,ACi(vOh),epi,bpi,false);qCi=ioi(new hoi(),dpi,ACi(wOh),epi,bpi,false);fDi=ioi(new hoi(),dpi,ACi(xOh),epi,bpi,false);pCi=ioi(new hoi(),dpi,ACi(yOh),epi,bpi,false);bEi=ioi(new hoi(),dpi,ACi(zOh),epi,bpi,false);hCi=ioi(new hoi(),dpi,ACi(BOh),epi,bpi,false);CGi=ioi(new hoi(),EGi,Eri(COh,u9g),FGi,f9h(bai,0,-1,[false,true,true,false]),false);DGi=ioi(new hoi(),EGi,Eri(DOh,fch),FGi,f9h(bai,0,-1,[false,true,true,false]),false);cHi=ioi(new hoi(),dpi,ACi(EOh),epi,bpi,false);cqi=ioi(new hoi(),dpi,ACi(FOh),epi,bpi,false);xqi=ioi(new hoi(),dpi,ACi(aPh),epi,bpi,false);lqi=ioi(new hoi(),dpi,ACi(bPh),epi,bpi,false);xoi=ioi(new hoi(),dpi,ACi(cPh),epi,bpi,false);ppi=ioi(new hoi(),dpi,ACi(dPh),epi,bpi,false);zpi=ioi(new hoi(),dpi,ACi(ePh),epi,bpi,false);jpi=ioi(new hoi(),dpi,ACi(gPh),epi,bpi,false);Fpi=ioi(new hoi(),dpi,ACi(hPh),epi,bpi,false);yri=ioi(new hoi(),dpi,ACi(iPh),epi,bpi,false);xri=ioi(new hoi(),dpi,ACi(jPh),epi,bpi,false);xti=ioi(new hoi(),dpi,ACi(kPh),epi,bpi,false);rti=ioi(new hoi(),dpi,ACi(lPh),epi,bpi,false);fti=ioi(new hoi(),dpi,ACi(mPh),epi,bpi,false);lti=ioi(new hoi(),dpi,ACi(nPh),epi,bpi,false);aui=ioi(new hoi(),dpi,sEi(oPh,pPh),epi,bpi,false);Eti=ioi(new hoi(),dpi,ACi(rPh),epi,bpi,false);gui=ioi(new hoi(),dpi,ACi(sPh),epi,bpi,false);jui=ioi(new hoi(),dpi,ACi(tPh),epi,bpi,false);bwi=ioi(new hoi(),dpi,sEi(uPh,vPh),epi,bpi,false);fvi=ioi(new hoi(),dpi,ACi(wPh),epi,bpi,false);zzi=ioi(new hoi(),dpi,ACi(xPh),epi,bpi,false);wvi=ioi(new hoi(),dpi,ACi(yPh),epi,bpi,false);bzi=ioi(new hoi(),dpi,ACi(zPh),epi,bpi,false);dAi=ioi(new hoi(),dpi,ACi(APh),epi,bpi,false);tzi=ioi(new hoi(),dpi,ACi(CPh),epi,bpi,false);uzi=ioi(new hoi(),dpi,ACi(DPh),epi,bpi,false);nzi=ioi(new hoi(),dpi,ACi(EPh),epi,bpi,false);aAi=ioi(new hoi(),dpi,ACi(FPh),epi,bpi,false);vvi=ioi(new hoi(),dpi,ACi(aQh),epi,bpi,false);mAi=ioi(new hoi(),dpi,ACi(bQh),epi,bpi,false);ixi=ioi(new hoi(),dpi,ACi(cQh),epi,bpi,false);gxi=ioi(new hoi(),dpi,sEi(dQh,eQh),epi,bpi,false);oxi=ioi(new hoi(),dpi,ACi(fQh),epi,bpi,false);owi=ioi(new hoi(),dpi,ACi(hQh),epi,bpi,false);vwi=ioi(new hoi(),dpi,ACi(iQh),epi,bpi,false);eFi=ioi(new hoi(),dpi,ACi(jQh),epi,bpi,false);cGi=ioi(new hoi(),dpi,ACi(kQh),epi,bpi,false);tFi=ioi(new hoi(),dpi,ACi(lQh),epi,bpi,false);qBi=ioi(new hoi(),dpi,sEi(mQh,nQh),epi,bpi,false);oBi=ioi(new hoi(),dpi,sEi(oQh,pQh),epi,bpi,false);pBi=ioi(new hoi(),dpi,sEi(qQh,tQh),epi,bpi,false);lBi=ioi(new hoi(),dpi,ACi(uQh),epi,bpi,false);tEi=ioi(new hoi(),dpi,ACi(vQh),epi,bpi,false);eDi=ioi(new hoi(),dpi,ACi(wQh),epi,bpi,false);bCi=ioi(new hoi(),dpi,sEi(xQh,yQh),epi,bpi,false);iDi=ioi(new hoi(),dpi,ACi(zQh),epi,bpi,false);jDi=ioi(new hoi(),dpi,ACi(AQh),epi,bpi,false);aHi=ioi(new hoi(),EGi,Eri(BQh,CQh),FGi,f9h(bai,0,-1,[false,true,true,false]),false);zqi=ioi(new hoi(),dpi,ACi(EQh),epi,bpi,false);fpi=ioi(new hoi(),dpi,ACi(FQh),epi,bpi,false);Aoi=ioi(new hoi(),dpi,ACi(aRh),epi,bpi,false);yoi=ioi(new hoi(),dpi,ACi(bRh),epi,bpi,false);Epi=ioi(new hoi(),dpi,ACi(cRh),epi,bpi,false);jsi=ioi(new hoi(),dpi,ACi(dRh),epi,bpi,false);kri=ioi(new hoi(),dpi,ACi(eRh),epi,bpi,false);Cqi=ioi(new hoi(),dpi,ACi(fRh),epi,bpi,false);Bui=ioi(new hoi(),dpi,ACi(gRh),epi,bpi,false);avi=ioi(new hoi(),dpi,ACi(hRh),epi,bpi,false);eui=ioi(new hoi(),dpi,ACi(jRh),epi,bpi,false);hui=ioi(new hoi(),dpi,ACi(kRh),epi,bpi,false);mui=ioi(new hoi(),dpi,ACi(lRh),epi,bpi,false);cwi=ioi(new hoi(),dpi,sEi(mRh,nRh),epi,bpi,false);nvi=ioi(new hoi(),dpi,ACi(oRh),epi,bpi,false);eyi=ioi(new hoi(),dpi,ACi(pRh),epi,bpi,false);byi=ioi(new hoi(),dpi,ACi(qRh),epi,bpi,false);xvi=ioi(new hoi(),dpi,ACi(rRh),epi,bpi,false);Dyi=ioi(new hoi(),dpi,ACi(sRh),epi,bpi,false);azi=ioi(new hoi(),dpi,ACi(uRh),epi,bpi,false);vzi=ioi(new hoi(),dpi,ACi(vRh),epi,bpi,false);lAi=ioi(new hoi(),dpi,ACi(wRh),epi,bpi,false);ezi=ioi(new hoi(),dpi,ACi(xRh),epi,bpi,false);ozi=ioi(new hoi(),dpi,ACi(yRh),epi,bpi,false);Ezi=ioi(new hoi(),dpi,ACi(zRh),epi,bpi,false);Fxi=ioi(new hoi(),dpi,sEi(ARh,BRh),epi,bpi,false);cxi=ioi(new hoi(),dpi,ACi(CRh),epi,bpi,false);bxi=ioi(new hoi(),dpi,ACi(DRh),epi,bpi,false);CEi=ioi(new hoi(),dpi,sEi(FRh,aSh),epi,bpi,false);EFi=ioi(new hoi(),dpi,ACi(bSh),epi,bpi,false);DFi=ioi(new hoi(),dpi,sEi(cSh,dSh),epi,bpi,false);vFi=ioi(new hoi(),dpi,ACi(eSh),epi,bpi,false);fBi=ioi(new hoi(),dpi,sEi(fSh,gSh),epi,bpi,false);cCi=ioi(new hoi(),dpi,ACi(hSh),epi,bpi,false);yBi=ioi(new hoi(),dpi,ACi(iSh),epi,bpi,false);FDi=ioi(new hoi(),dpi,ACi(kSh),epi,bpi,false);kDi=ioi(new hoi(),dpi,ACi(lSh),epi,bpi,false);dCi=ioi(new hoi(),dpi,ACi(mSh),epi,bpi,false);sCi=ioi(new hoi(),dpi,ACi(nSh),epi,bpi,false);iHi=ioi(new hoi(),dpi,sEi(oSh,pSh),epi,bpi,false);xGi=ioi(new hoi(),sGi,Eri(qSh,Bch),tGi,f9h(bai,0,-1,[false,true,true,false]),false);uGi=ioi(new hoi(),sGi,Eri(rSh,bih),tGi,f9h(bai,0,-1,[false,true,true,false]),false);rGi=ioi(new hoi(),sGi,Eri(sSh,cah),tGi,f9h(bai,0,-1,[false,true,true,false]),false);vGi=ioi(new hoi(),sGi,Eri(tSh,vSh),tGi,f9h(bai,0,-1,[false,true,true,false]),false);toi=ioi(new hoi(),dpi,ACi(wSh),epi,bpi,false);iqi=ioi(new hoi(),dpi,ACi(xSh),epi,bpi,false);npi=ioi(new hoi(),dpi,ACi(ySh),epi,bpi,false);Bpi=ioi(new hoi(),dpi,ACi(zSh),epi,bpi,false);ypi=ioi(new hoi(),dpi,ACi(ASh),epi,bpi,false);kpi=ioi(new hoi(),dpi,ACi(BSh),epi,bpi,false);lri=ioi(new hoi(),dpi,ACi(CSh),epi,bpi,false);mri=ioi(new hoi(),dpi,ACi(DSh),epi,bpi,false);ksi=ioi(new hoi(),dpi,ACi(ESh),epi,bpi,false);gsi=ioi(new hoi(),dpi,ACi(aTh),epi,bpi,false);hsi=ioi(new hoi(),dpi,ACi(bTh),epi,bpi,false);rsi=ioi(new hoi(),dpi,ACi(cTh),epi,bpi,false);bri=ioi(new hoi(),dpi,sEi(dTh,eTh),epi,bpi,false);iui=ioi(new hoi(),dpi,ACi(fTh),epi,bpi,false);tui=ioi(new hoi(),dpi,ACi(gTh),epi,bpi,false);bui=ioi(new hoi(),dpi,sEi(hTh,iTh),epi,bpi,false);cui=ioi(new hoi(),dpi,ACi(jTh),epi,bpi,false);oui=ioi(new hoi(),dpi,ACi(lTh),epi,bpi,false);hvi=ioi(new hoi(),dpi,ACi(mTh),epi,bpi,false);dzi=ioi(new hoi(),dpi,ACi(nTh),epi,bpi,false);Dzi=ioi(new hoi(),dpi,ACi(oTh),epi,bpi,false);DAi=ioi(new hoi(),dpi,ACi(pTh),epi,bpi,false);Azi=ioi(new hoi(),dpi,ACi(qTh),epi,bpi,false);Fzi=ioi(new hoi(),dpi,ACi(rTh),epi,bpi,false);czi=ioi(new hoi(),dpi,ACi(sTh),epi,bpi,false);qvi=ioi(new hoi(),dpi,ACi(tTh),epi,bpi,false);kyi=ioi(new hoi(),dpi,ACi(uTh),epi,bpi,false);qzi=ioi(new hoi(),dpi,ACi(wTh),epi,bpi,false);fzi=ioi(new hoi(),dpi,ACi(xTh),epi,bpi,false);eAi=ioi(new hoi(),dpi,ACi(yTh),epi,bpi,false);Fwi=ioi(new hoi(),dpi,sEi(zTh,ATh),epi,bpi,false);lxi=ioi(new hoi(),dpi,ACi(BTh),epi,bpi,false);Dwi=ioi(new hoi(),dpi,ACi(CTh),epi,bpi,false);axi=ioi(new hoi(),dpi,sEi(DTh,ETh),epi,bpi,false);DEi=ioi(new hoi(),dpi,ACi(FTh),epi,bpi,false);wEi=ioi(new hoi(),dpi,sEi(cUh,dUh),epi,bpi,false);aDi=ioi(new hoi(),dpi,ACi(eUh),epi,bpi,false);aCi=ioi(new hoi(),dpi,sEi(fUh,gUh),epi,bpi,false);EDi=ioi(new hoi(),dpi,sEi(hUh,iUh),epi,bpi,false);zDi=ioi(new hoi(),dpi,sEi(jUh,kUh),epi,bpi,false);dDi=ioi(new hoi(),dpi,ACi(lUh),epi,bpi,false);BGi=ioi(new hoi(),zGi,Eri(nUh,hRg),AGi,f9h(bai,0,-1,[false,false,false,false]),true);wGi=ioi(new hoi(),sGi,Eri(oUh,fHg),tGi,f9h(bai,0,-1,[false,true,true,false]),false);Cpi=ioi(new hoi(),dpi,ACi(pUh),epi,bpi,false);eqi=ioi(new hoi(),dpi,ACi(qUh),epi,bpi,false);rpi=ioi(new hoi(),dpi,ACi(rUh),epi,bpi,false);wqi=ioi(new hoi(),dpi,ACi(sUh),epi,bpi,false);kqi=ioi(new hoi(),dpi,ACi(tUh),epi,bpi,false);qpi=ioi(new hoi(),dpi,ACi(uUh),epi,bpi,false);wti=ioi(new hoi(),dpi,ACi(vUh),epi,bpi,false);iti=ioi(new hoi(),dpi,ACi(wUh),epi,bpi,false);Asi=ioi(new hoi(),dpi,ACi(yUh),epi,bpi,false);Dti=ioi(new hoi(),dpi,ACi(zUh),epi,bpi,false);nui=ioi(new hoi(),dpi,ACi(AUh),epi,bpi,false);lui=ioi(new hoi(),dpi,ACi(BUh),epi,bpi,false);uui=ioi(new hoi(),dpi,ACi(CUh),epi,bpi,false);Evi=ioi(new hoi(),dpi,sEi(DUh,EUh),epi,bpi,false);Eyi=ioi(new hoi(),dpi,ACi(FUh),epi,bpi,false);nAi=ioi(new hoi(),dpi,ACi(aVh),epi,bpi,false);Czi=ioi(new hoi(),dpi,ACi(bVh),epi,bpi,false);pzi=ioi(new hoi(),dpi,ACi(dVh),epi,bpi,false);tyi=ioi(new hoi(),dpi,ACi(eVh),epi,bpi,false);bAi=ioi(new hoi(),dpi,ACi(fVh),epi,bpi,false);Bzi=ioi(new hoi(),dpi,ACi(gVh),epi,bpi,false);fyi=ioi(new hoi(),dpi,ACi(hVh),epi,bpi,false);jyi=ioi(new hoi(),dpi,ACi(iVh),epi,bpi,false);Cwi=ioi(new hoi(),dpi,ACi(jVh),epi,bpi,false);Ewi=ioi(new hoi(),dpi,sEi(kVh,lVh),epi,bpi,false);dxi=ioi(new hoi(),dpi,ACi(mVh),epi,bpi,false);jxi=ioi(new hoi(),dpi,ACi(oVh),epi,bpi,false);kwi=ioi(new hoi(),dpi,sEi(pVh,qVh),epi,bpi,false);oFi=ioi(new hoi(),dpi,ACi(rVh),epi,bpi,false);lFi=ioi(new hoi(),dpi,ACi(sVh),epi,bpi,false);nFi=ioi(new hoi(),dpi,ACi(tVh),epi,bpi,false);iGi=ioi(new hoi(),dpi,ACi(uVh),epi,bpi,false);kGi=ioi(new hoi(),dpi,ACi(vVh),epi,bpi,false);bGi=ioi(new hoi(),dpi,ACi(wVh),epi,bpi,false);jBi=ioi(new hoi(),dpi,sEi(xVh,zVh),epi,bpi,false);vDi=ioi(new hoi(),dpi,sEi(AVh,BVh),epi,bpi,false);rEi=ioi(new hoi(),dpi,sEi(CVh,DVh),epi,bpi,false);mEi=ioi(new hoi(),dpi,ACi(EVh),epi,bpi,false);eCi=ioi(new hoi(),dpi,ACi(FVh),epi,bpi,false);ADi=ioi(new hoi(),dpi,sEi(aWh,bWh),epi,bpi,false);aEi=ioi(new hoi(),dpi,ACi(cWh),epi,bpi,false);spi=ioi(new hoi(),dpi,ACi(eWh),epi,bpi,false);Api=ioi(new hoi(),dpi,ACi(fWh),epi,bpi,false);uoi=ioi(new hoi(),dpi,ACi(gWh),epi,bpi,false);pqi=ioi(new hoi(),dpi,ACi(hWh),epi,bpi,false);gqi=ioi(new hoi(),dpi,ACi(iWh),epi,bpi,false);dqi=ioi(new hoi(),dpi,ACi(jWh),epi,bpi,false);nqi=ioi(new hoi(),dpi,ACi(kWh),epi,bpi,false);fqi=ioi(new hoi(),dpi,ACi(lWh),epi,bpi,false);jqi=ioi(new hoi(),dpi,ACi(mWh),epi,bpi,false);hqi=ioi(new hoi(),dpi,ACi(nWh),epi,bpi,false);xpi=ioi(new hoi(),dpi,ACi(pWh),epi,bpi,false);vpi=ioi(new hoi(),dpi,ACi(qWh),epi,bpi,false);tqi=ioi(new hoi(),dpi,sEi(rWh,sWh),epi,bpi,false);sqi=ioi(new hoi(),dpi,sEi(tWh,uWh),epi,bpi,false);tpi=ioi(new hoi(),dpi,ACi(vWh),epi,bpi,false);oqi=ioi(new hoi(),dpi,ACi(wWh),epi,bpi,false);Eqi=ioi(new hoi(),dpi,sEi(xWh,yWh),epi,bpi,false);isi=ioi(new hoi(),dpi,ACi(AWh),epi,bpi,false);csi=ioi(new hoi(),dpi,ACi(BWh),epi,bpi,false);wri=ioi(new hoi(),dpi,sEi(CWh,DWh),epi,bpi,false);ati=ioi(new hoi(),dpi,(bb=e9h(D_h,48,1,4,0),bb[0]=EWh,bb[1]=FWh,bb[2]=EWh,bb[3]=EWh,bb),epi,bpi,false);Fui=ioi(new hoi(),dpi,sEi(aXh,bXh),epi,bpi,false);dui=ioi(new hoi(),dpi,ACi(cXh),epi,bpi,false);gyi=ioi(new hoi(),dpi,ACi(dXh),epi,bpi,false);jzi=ioi(new hoi(),dpi,ACi(fXh),epi,bpi,false);myi=ioi(new hoi(),dpi,ACi(gXh),epi,bpi,false);yzi=ioi(new hoi(),dpi,ACi(hXh),epi,bpi,false);wyi=ioi(new hoi(),dpi,ACi(iXh),epi,bpi,false);rAi=ioi(new hoi(),dpi,ACi(jXh),epi,bpi,false);nyi=ioi(new hoi(),dpi,ACi(kXh),epi,bpi,false);wxi=ioi(new hoi(),dpi,ACi(lXh),epi,bpi,false);pwi=ioi(new hoi(),dpi,ACi(mXh),epi,bpi,false);mFi=ioi(new hoi(),dpi,ACi(nXh),epi,bpi,false);bFi=ioi(new hoi(),dpi,ACi(oXh),epi,bpi,false);wFi=ioi(new hoi(),dpi,ACi(rXh),epi,bpi,false);xFi=ioi(new hoi(),dpi,ACi(sXh),epi,bpi,false);dGi=ioi(new hoi(),dpi,ACi(tXh),epi,bpi,false);sBi=ioi(new hoi(),dpi,sEi(uXh,vXh),epi,bpi,false);bDi=ioi(new hoi(),dpi,ACi(wXh),epi,bpi,false);rDi=ioi(new hoi(),dpi,ACi(xXh),epi,bpi,false);pGi=ioi(new hoi(),sGi,Eri(yXh,zXh),tGi,f9h(bai,0,-1,[false,true,true,false]),false);qGi=ioi(new hoi(),sGi,Eri(AXh,CXh),tGi,f9h(bai,0,-1,[false,true,true,false]),false);woi=ioi(new hoi(),dpi,ACi(DXh),epi,bpi,false);Eoi=ioi(new hoi(),dpi,ACi(EXh),epi,bpi,false);aqi=ioi(new hoi(),dpi,ACi(FXh),epi,bpi,false);ari=ioi(new hoi(),dpi,ACi(aYh),epi,bpi,false);ivi=ioi(new hoi(),dpi,ACi(bYh),epi,bpi,false);jvi=ioi(new hoi(),dpi,ACi(cYh),epi,bpi,false);pyi=ioi(new hoi(),dpi,ACi(dYh),epi,bpi,false);kzi=ioi(new hoi(),dpi,ACi(eYh),epi,bpi,false);oAi=ioi(new hoi(),dpi,ACi(fYh),epi,bpi,false);oyi=ioi(new hoi(),dpi,ACi(hYh),epi,bpi,false);hxi=ioi(new hoi(),dpi,ACi(iYh),epi,bpi,false);lwi=ioi(new hoi(),dpi,ACi(jYh),epi,bpi,false);mwi=ioi(new hoi(),dpi,ACi(kYh),epi,bpi,false);aFi=ioi(new hoi(),dpi,ACi(lYh),epi,bpi,false);FEi=ioi(new hoi(),dpi,ACi(mYh),epi,bpi,false);eGi=ioi(new hoi(),dpi,ACi(nYh),epi,bpi,false);mBi=ioi(new hoi(),dpi,ACi(oYh),epi,bpi,false);uBi=ioi(new hoi(),dpi,sEi(pYh,qYh),epi,bpi,false);uEi=ioi(new hoi(),dpi,sEi(sYh,tYh),epi,bpi,false);iEi=ioi(new hoi(),dpi,ACi(uYh),epi,bpi,false);oEi=ioi(new hoi(),dpi,ACi(vYh),epi,bpi,false);lEi=ioi(new hoi(),dpi,ACi(wYh),epi,bpi,false);wpi=ioi(new hoi(),dpi,ACi(xYh),epi,bpi,false);Dpi=ioi(new hoi(),dpi,ACi(yYh),epi,bpi,false);mqi=ioi(new hoi(),dpi,ACi(zYh),epi,bpi,false);dsi=ioi(new hoi(),dpi,ACi(AYh),epi,bpi,false);osi=ioi(new hoi(),dpi,ACi(BYh),epi,bpi,false);dti=ioi(new hoi(),dpi,sEi(DYh,EYh),epi,bpi,false);Ayi=ioi(new hoi(),dpi,ACi(FYh),epi,bpi,false);xyi=ioi(new hoi(),dpi,ACi(aZh),epi,bpi,false);rvi=ioi(new hoi(),dpi,ACi(bZh),epi,bpi,false);rxi=ioi(new hoi(),dpi,ACi(cZh),epi,bpi,false);EEi=ioi(new hoi(),dpi,ACi(dZh),epi,bpi,false);mDi=ioi(new hoi(),dpi,ACi(eZh),epi,bpi,false);jEi=ioi(new hoi(),dpi,ACi(fZh),epi,bpi,false);fCi=ioi(new hoi(),dpi,ACi(gZh),epi,bpi,false);upi=ioi(new hoi(),dpi,ACi(iZh),epi,bpi,false);qsi=ioi(new hoi(),dpi,sEi(jZh,kZh),epi,bpi,false);kui=ioi(new hoi(),dpi,ACi(lZh),epi,bpi,false);Fvi=ioi(new hoi(),dpi,sEi(mZh,nZh),epi,bpi,false);iyi=ioi(new hoi(),dpi,ACi(oZh),epi,bpi,false);gAi=ioi(new hoi(),dpi,ACi(pZh),epi,bpi,false);Byi=ioi(new hoi(),dpi,ACi(qZh),epi,bpi,false);fxi=ioi(new hoi(),dpi,sEi(rZh,tZh),epi,bpi,false);iBi=ioi(new hoi(),dpi,sEi(uZh,vZh),epi,bpi,false);jCi=ioi(new hoi(),dpi,sEi(wZh,xZh),epi,bpi,false);EBi=ioi(new hoi(),dpi,ACi(yZh),epi,bpi,false);tDi=ioi(new hoi(),dpi,sEi(zZh,AZh),epi,bpi,false);sDi=ioi(new hoi(),dpi,sEi(BZh,CZh),epi,bpi,false);qEi=ioi(new hoi(),dpi,ACi(EZh),epi,bpi,false);gEi=ioi(new hoi(),dpi,ACi(FZh),epi,bpi,false);oGi=ioi(new hoi(),dpi,sEi(a0h,b0h),epi,bpi,false);gHi=ioi(new hoi(),dpi,sEi(c0h,d0h),epi,bpi,false);opi=ioi(new hoi(),dpi,ACi(e0h),epi,bpi,false);psi=ioi(new hoi(),dpi,sEi(f0h,g0h),epi,bpi,false);sti=ioi(new hoi(),dpi,ACi(h0h),epi,bpi,false);kti=ioi(new hoi(),dpi,ACi(j0h),epi,bpi,false);Eui=ioi(new hoi(),dpi,sEi(k0h,l0h),epi,bpi,false);hyi=ioi(new hoi(),dpi,ACi(m0h),epi,bpi,false);Cyi=ioi(new hoi(),dpi,ACi(n0h),epi,bpi,false);bBi=ioi(new hoi(),dpi,ACi(o0h),epi,bpi,false);lyi=ioi(new hoi(),dpi,ACi(p0h),epi,bpi,false);nwi=ioi(new hoi(),dpi,sEi(q0h,r0h),epi,bpi,false);zFi=ioi(new hoi(),dpi,ACi(s0h),epi,bpi,false);hEi=ioi(new hoi(),dpi,ACi(u0h),epi,bpi,false);kEi=ioi(new hoi(),dpi,ACi(v0h),epi,bpi,false);Foi=ioi(new hoi(),dpi,ACi(w0h),epi,bpi,false);hAi=ioi(new hoi(),dpi,ACi(x0h),epi,bpi,false);cBi=ioi(new hoi(),dpi,ACi(y0h),epi,bpi,false);iFi=ioi(new hoi(),dpi,ACi(z0h),epi,bpi,false);yFi=ioi(new hoi(),dpi,ACi(A0h),epi,bpi,false);iCi=ioi(new hoi(),dpi,sEi(B0h,C0h),epi,bpi,false);asi=ioi(new hoi(),dpi,ACi(D0h),epi,bpi,false);jFi=ioi(new hoi(),dpi,ACi(a1h),epi,bpi,false);tBi=ioi(new hoi(),dpi,sEi(b1h,c1h),epi,bpi,false);hBi=ioi(new hoi(),dpi,sEi(d1h,e1h),epi,bpi,false);bqi=ioi(new hoi(),dpi,ACi(f1h),epi,bpi,false);cDi=ioi(new hoi(),dpi,ACi(g1h),epi,bpi,false);mpi=ioi(new hoi(),dpi,ACi(h1h),epi,bpi,false);BFi=ioi(new hoi(),dpi,ACi(i1h),epi,bpi,false);AFi=ioi(new hoi(),dpi,ACi(j1h),epi,bpi,false);cEi=ioi(new hoi(),dpi,ACi(l1h),epi,bpi,false);dEi=ioi(new hoi(),dpi,ACi(m1h),epi,bpi,false);zti=ioi(new hoi(),dpi,sEi(n1h,o1h),epi,bpi,false);Dui=ioi(new hoi(),dpi,ACi(p1h),epi,bpi,false);bsi=ioi(new hoi(),dpi,ACi(q1h),epi,bpi,false);Cui=ioi(new hoi(),dpi,ACi(r1h),epi,bpi,false);vqi=f9h(E_h,49,9,[xsi,zvi,xBi,lGi,dHi,hHi,iri,vsi,wsi,nti,oti,zui,yui,wui,xui,Dvi,Bvi,Cvi,Avi,pvi,svi,hFi,gFi,wCi,yCi,zCi,dFi,fHi,eHi,mGi,nGi,gpi,eti,mti,vti,pui,tvi,nxi,txi,wwi,DBi,mCi,wDi,Aqi,roi,cri,rri,Bri,gri,esi,vri,nri,Dqi,pti,ysi,Cti,vui,qui,Ati,gvi,kvi,yAi,ovi,yxi,vxi,exi,qwi,fwi,rwi,fFi,fGi,jGi,BEi,eBi,kBi,BBi,CBi,nDi,gDi,rCi,qDi,DDi,nCi,bHi,rqi,api,Doi,zri,Fri,sri,uri,dri,bti,Fsi,Bti,sui,yvi,hzi,uvi,BAi,FAi,zyi,zxi,qxi,ewi,swi,gGi,cFi,FFi,rFi,oDi,lDi,ECi,CCi,uDi,nEi,xCi,BDi,CDi,yDi,yGi,voi,soi,qqi,Boi,hpi,zoi,hri,usi,tsi,Fti,rui,evi,mvi,dvi,cAi,xzi,Fyi,EAi,wAi,rzi,tAi,gzi,ryi,ayi,cyi,CAi,yyi,Exi,Axi,Awi,sxi,xwi,zwi,ywi,pFi,hGi,xEi,sFi,qFi,aGi,rBi,nBi,wBi,FCi,eEi,DCi,fEi,zBi,lCi,FBi,vCi,oCi,uCi,ipi,lpi,Bqi,Ari,qri,tri,ori,fri,fsi,pri,lsi,nsi,uti,Bsi,zsi,Dsi,hti,jti,Esi,cti,awi,bvi,cvi,fAi,vyi,AAi,qyi,wzi,mzi,izi,szi,dyi,sAi,jAi,xAi,Cxi,uxi,pxi,uwi,jwi,kFi,yEi,zEi,CFi,uFi,gBi,vBi,pDi,kCi,tCi,BCi,pEi,xDi,gCi,yqi,Coi,jri,Dri,Cri,ssi,eri,Fqi,yti,qti,tti,Aui,Csi,gti,fui,dwi,dBi,lvi,kAi,uyi,syi,vAi,lzi,pAi,zAi,aBi,uAi,iAi,qAi,Dxi,Bxi,Bwi,kxi,xxi,twi,gwi,AEi,vEi,ABi,hDi,qCi,fDi,pCi,bEi,hCi,CGi,DGi,cHi,cqi,xqi,lqi,xoi,ppi,zpi,jpi,Fpi,yri,xri,xti,rti,fti,lti,aui,Eti,gui,jui,bwi,fvi,zzi,wvi,bzi,dAi,tzi,uzi,nzi,aAi,vvi,mAi,ixi,gxi,oxi,owi,vwi,eFi,cGi,tFi,qBi,oBi,pBi,lBi,tEi,eDi,bCi,iDi,jDi,aHi,zqi,fpi,Aoi,yoi,Epi,jsi,kri,Cqi,Bui,avi,eui,hui,mui,cwi,nvi,eyi,byi,xvi,Dyi,azi,vzi,lAi,ezi,ozi,Ezi,Fxi,cxi,bxi,CEi,EFi,DFi,vFi,fBi,cCi,yBi,FDi,kDi,dCi,sCi,iHi,xGi,uGi,rGi,vGi,toi,iqi,npi,Bpi,ypi,kpi,lri,mri,ksi,gsi,hsi,rsi,bri,iui,tui,bui,cui,oui,hvi,dzi,Dzi,DAi,Azi,Fzi,czi,qvi,kyi,qzi,fzi,eAi,Fwi,lxi,Dwi,axi,DEi,wEi,aDi,aCi,EDi,zDi,dDi,BGi,wGi,Cpi,eqi,rpi,wqi,kqi,qpi,wti,iti,Asi,Dti,nui,lui,uui,Evi,Eyi,nAi,Czi,pzi,tyi,bAi,Bzi,fyi,jyi,Cwi,Ewi,dxi,jxi,kwi,oFi,lFi,nFi,iGi,kGi,bGi,jBi,vDi,rEi,mEi,eCi,ADi,aEi,spi,Api,uoi,pqi,gqi,dqi,nqi,fqi,jqi,hqi,xpi,vpi,tqi,sqi,tpi,oqi,Eqi,isi,csi,wri,ati,Fui,dui,gyi,jzi,myi,yzi,wyi,rAi,nyi,wxi,pwi,mFi,bFi,wFi,xFi,dGi,sBi,bDi,rDi,pGi,qGi,woi,Eoi,aqi,ari,ivi,jvi,pyi,kzi,oAi,oyi,hxi,lwi,mwi,aFi,FEi,eGi,mBi,uBi,uEi,iEi,oEi,lEi,wpi,Dpi,mqi,dsi,osi,dti,Ayi,xyi,rvi,rxi,EEi,mDi,jEi,fCi,upi,qsi,kui,Fvi,iyi,gAi,Byi,fxi,iBi,jCi,EBi,tDi,sDi,qEi,gEi,oGi,gHi,opi,psi,sti,kti,Eui,hyi,Cyi,bBi,lyi,nwi,zFi,hEi,kEi,Foi,hAi,cBi,iFi,yFi,iCi,asi,jFi,tBi,hBi,bqi,cDi,mpi,BFi,AFi,cEi,dEi,zti,Dui,bsi,Cui]);uqi=f9h(B_h,0,-1,[1153,1383,1601,1793,1827,1857,68600,69146,69177,70237,70270,71572,71669,72415,72444,74846,74904,74943,75001,75276,75590,84742,84839,85575,85963,85992,87204,88074,88171,89130,89163,3207892,3283895,3284791,3338752,3358197,3369562,3539124,3562402,3574260,3670335,3696933,3721879,135280021,135346322,136317019,136475749,136548517,136652214,136884919,136902418,136942992,137292068,139120259,139785574,142250603,142314056,142331176,142519584,144752417,145106895,146147200,146765926,148805544,149655723,149809441,150018784,150445028,150923321,152528754,152536216,152647366,152962785,155219321,155654904,157317483,157350248,157437941,157447478,157604838,157685404,157894402,158315188,166078431,169409980,169700259,169856932,170007032,170409695,170466488,170513710,170608367,173028944,173896963,176090625,176129212,179390001,179489057,179627464,179840468,179849042,180004216,181779081,183027151,183645319,183698797,185922012,185997252,188312483,188675799,190977533,190992569,191006194,191033518,191038774,191096249,191166163,191194426,191522106,191568039,200104642,202506661,202537381,202602917,203070590,203120766,203389054,203690071,203971238,203986524,209040857,209125756,212055489,212322418,212746849,213002877,213055164,213088023,213259873,213273386,213435118,213437318,213438231,213493071,213532268,213542834,213584431,213659891,215285828,215880731,216112976,216684637,217369699,217565298,217576549,218186795,219743185,220082234,221623802,221986406,222283890,223089542,223138630,223311265,224547358,224587256,224589550,224655650,224785518,224810917,224813302,225429618,225432950,225440869,236107233,236709921,236838947,237117095,237143271,237172455,237209953,237354143,237372743,237668065,237703073,237714273,239743521,240512803,240522627,240560417,240656513,241015715,241062755,241065383,243523041,245865199,246261793,246556195,246774817,246923491,246928419,246981667,247014847,247058369,247112833,247118177,247119137,247128739,247316903,249533729,250235623,250269543,251083937,251402351,252339047,253260911,253293679,254844367,255547879,256077281,256345377,258124199,258354465,258605063,258744193,258845603,258856961,258926689,269869248,270174334,270709417,270778994,270781796,271102503,271478858,271490090,272870654,273335275,273369140,273924313,274108530,274116736,276818662,277476156,279156579,279349675,280108533,280128712,280132869,280162403,280280292,280413430,280506130,280677397,280678580,280686710,280689066,282736758,283110901,283275116,283823226,283890012,284479340,284606461,286700477,286798916,291557706,291665349,291804100,292138018,292166446,292418738,292451039,300298041,300374839,300597935,303073389,303083839,303266673,303354997,303430688,303576261,303724281,303819694,304242723,304382625,306247792,307227811,307468786,307724489,309671175,310252031,310358241,310373094,311015256,313357609,313683893,313701861,313706996,313707317,313710350,314027746,314038181,314091299,314205627,314233813,316741830,316797986,317486755,317794164,318721061,320076137,322657125,322887778,323506876,323572412,323605180,323938869,325060058,325320188,325398738,325541490,325671619,333868843,336806130,337212108,337282686,337285434,337585223,338036037,338298087,338566051,340943551,341190970,342995704,343352124,343912673,344585053,346977248,347218098,347262163,347278576,347438191,347655959,347684788,347726430,347727772,347776035,347776629,349500753,350880161,350887073,353384123,355496998,355906922,355979793,356545959,358637867,358905016,359164318,359247286,359350571,359579447,365560330,367399355,367420285,367510727,368013212,370234760,370353345,370710317,371074566,371122285,371194213,371448425,371448430,371545055,371596922,371758751,371964792,372151328,376550136,376710172,376795771,376826271,376906556,380514830,380774774,380775037,381030322,381136500,381281631,381282269,381285504,381330595,381331422,381335911,381336484,383907298,383917408,384595009,384595013,387799894,387823201,392581647,392584937,392742684,392906485,393003349,400644707,400973830,404428547,404432113,404432865,404469244,404478897,404694860,406887479,408294949,408789955,410022510,410467324,410586448,410945965,411845275,414327152,414327932,414329781,414346257,414346439,414639928,414835998,414894517,414986533,417465377,417465381,417492216,418259232,419310946,420103495,420242342,420380455,420658662,420717432,423183880,424539259,425929170,425972964,426050649,426126450,426142833,426607922,437289840,437347469,437412335,437423943,437455540,437462252,437597991,437617485,437986305,437986507,437986828,437987072,438015591,438034813,438038966,438179623,438347971,438483573,438547062,438895551,441592676,442032555,443548979,447881379,447881655,447881895,447887844,448416189,448445746,448449012,450942191,452816744,453668677,454434495,456610076,456642844,456738709,457544600,459451897,459680944,468058810,468083581,470964084,471470955,471567278,472267822,481177859,481210627,481435874,481455115,481485378,481490218,485105638,486005878,486383494,487988916,488103783,490661867,491574090,491578272,493041952,493441205,493582844,493716979,504577572,504740359,505091638,505592418,505656212,509516275,514998531,515571132,515594682,518712698,521362273,526592419,526807354,527348842,538294791,539214049,544689535,545535009,548544752,548563346,548595116,551679010,558034099,560329411,560356209,560671018,560671152,560692590,560845442,569212097,569474241,572252718,572768481,575326764,576174758,576190819,582099184,582099438,582372519,582558889,586552164,591325418,594231990,594243961,605711268,615672071,616086845,621792370,624879850,627432831,640040548,654392808,658675477,659420283,672891587,694768102,705890982,725543146,759097578,761686526,795383908,843809551,878105336,908643300,945213471])}
function joi(d,e,a,c,b,f){koi();d.c=e;d.a=a;msi(a,c);d.b=b;d.d=f;return d}
function ioi(d,e,a,c,b,f){koi();d.c=e;d.a=a;msi(a,c);d.b=b;d.d=f;return d}
function ooi(a){return a==Boi||a==rqi||a==xqi||a==zqi||a==qri||a==lsi||a==Dsi||a==Esi||a==Fsi||a==gti||a==yvi||a==xxi||a==Axi||a==Bxi||a==Cxi||a==Exi||a==ABi||a==hCi||a==hDi}
function poi(a){return a==Boi||a==Doi||a==rqi||a==wqi||a==xqi||a==zqi||a==qri||a==uri||a==lsi||a==Asi||a==Dsi||a==Esi||a==Fsi||a==eti||a==gti||a==uti||a==sui||a==yvi||a==sxi||a==xxi||a==Axi||a==Bxi||a==Cxi||a==Exi||a==ABi||a==gCi||a==hCi||a==xCi||a==ECi||a==eDi||a==hDi||a==lDi||a==DDi||a==fFi||a==qFi||a==tFi}
function Eri(b,c){var a;a=e9h(D_h,48,1,4,0);a[0]=b;a[1]=c;a[2]=c;a[3]=b;return a}
function msi(c,d){var a,b;a=e9h(D_h,48,1,4,0);for(b=0;b<a.length;++b){if(d[b]==null){a[b]=c[b]}else{a[b]=String(d[b]+iBg+c[b])}}return a}
function ACi(b){var a;a=e9h(D_h,48,1,4,0);a[0]=b;a[1]=b;a[2]=b;a[3]=b;return a}
function sEi(c,b){var a;a=e9h(D_h,48,1,4,0);a[0]=c;a[1]=c;a[2]=b;a[3]=c;return a}
function jHi(a,f){var b,c,d,e;c=0;b=f;b<<=5;b+=a[0]-96;e=f;for(d=0;d<4&&e>0;++d){--e;b<<=5;b+=a[e]-96;c<<=6;c+=a[d]-95}return b^c}
function kHi(b,a){var c,g;c=true;g=b.indexOf(s1h)==0;if(a){if(g){c=false}else{c=pVi(b)}}return ioi(new hoi(),dpi,ACi(b),epi,c?bpi:cpi,g)}
function mHi(){return o_h}
function nHi(b,j,h,c){var f,g;koi();var a,d,e,i;d=jHi(b,h);e=wji(uqi,d);if(e<0){return kHi(String((f=j+h,mfi(b.length,j,f),ofi(b,j,f))),c)}else{a=vqi[e];i=a.a[0];if(!xVi(i,b,j,h)){return kHi(String((g=j+h,mfi(b.length,j,g),ofi(b,j,g))),c)}return a}}
function hoi(){}
_=hoi.prototype=new xdi();_.gC=mHi;_.tI=36;_.a=null;_.b=null;_.c=null;_.d=false;var roi,soi,toi,uoi,voi,woi,xoi,yoi,zoi,Aoi,Boi,Coi,Doi,Eoi,Foi,api,bpi,cpi,dpi,epi,fpi,gpi,hpi,ipi,jpi,kpi,lpi,mpi,npi,opi,ppi,qpi,rpi,spi,tpi,upi,vpi,wpi,xpi,ypi,zpi,Api,Bpi,Cpi,Dpi,Epi,Fpi,aqi,bqi,cqi,dqi,eqi,fqi,gqi,hqi,iqi,jqi,kqi,lqi,mqi,nqi,oqi,pqi,qqi,rqi,sqi,tqi,uqi,vqi,wqi,xqi,yqi,zqi,Aqi,Bqi,Cqi,Dqi,Eqi,Fqi,ari,bri,cri,dri,eri,fri,gri,hri,iri,jri,kri,lri,mri,nri,ori,pri,qri,rri,sri,tri,uri,vri,wri,xri,yri,zri,Ari,Bri,Cri,Dri,Fri,asi,bsi,csi,dsi,esi,fsi,gsi,hsi,isi,jsi,ksi,lsi,nsi,osi,psi,qsi,rsi,ssi,tsi,usi,vsi,wsi,xsi,ysi,zsi,Asi,Bsi,Csi,Dsi,Esi,Fsi,ati,bti,cti,dti,eti,fti,gti,hti,iti,jti,kti,lti,mti,nti,oti,pti,qti,rti,sti,tti,uti,vti,wti,xti,yti,zti,Ati,Bti,Cti,Dti,Eti,Fti,aui,bui,cui,dui,eui,fui,gui,hui,iui,jui,kui,lui,mui,nui,oui,pui,qui,rui,sui,tui,uui,vui,wui,xui,yui,zui,Aui,Bui,Cui,Dui,Eui,Fui,avi,bvi,cvi,dvi,evi,fvi,gvi,hvi,ivi,jvi,kvi,lvi,mvi,nvi,ovi,pvi,qvi,rvi,svi,tvi,uvi,vvi,wvi,xvi,yvi,zvi,Avi,Bvi,Cvi,Dvi,Evi,Fvi,awi,bwi,cwi,dwi,ewi,fwi,gwi,hwi,iwi,jwi,kwi,lwi,mwi,nwi,owi,pwi,qwi,rwi,swi,twi,uwi,vwi,wwi,xwi,ywi,zwi,Awi,Bwi,Cwi,Dwi,Ewi,Fwi,axi,bxi,cxi,dxi,exi,fxi,gxi,hxi,ixi,jxi,kxi,lxi,nxi,oxi,pxi,qxi,rxi,sxi,txi,uxi,vxi,wxi,xxi,yxi,zxi,Axi,Bxi,Cxi,Dxi,Exi,Fxi,ayi,byi,cyi,dyi,eyi,fyi,gyi,hyi,iyi,jyi,kyi,lyi,myi,nyi,oyi,pyi,qyi,ryi,syi,tyi,uyi,vyi,wyi,xyi,yyi,zyi,Ayi,Byi,Cyi,Dyi,Eyi,Fyi,azi,bzi,czi,dzi,ezi,fzi,gzi,hzi,izi,jzi,kzi,lzi,mzi,nzi,ozi,pzi,qzi,rzi,szi,tzi,uzi,vzi,wzi,xzi,yzi,zzi,Azi,Bzi,Czi,Dzi,Ezi,Fzi,aAi,bAi,cAi,dAi,eAi,fAi,gAi,hAi,iAi,jAi,kAi,lAi,mAi,nAi,oAi,pAi,qAi,rAi,sAi,tAi,uAi,vAi,wAi,xAi,yAi,zAi,AAi,BAi,CAi,DAi,EAi,FAi,aBi,bBi,cBi,dBi,eBi,fBi,gBi,hBi,iBi,jBi,kBi,lBi,mBi,nBi,oBi,pBi,qBi,rBi,sBi,tBi,uBi,vBi,wBi,xBi,yBi,zBi,ABi,BBi,CBi,DBi,EBi,FBi,aCi,bCi,cCi,dCi,eCi,fCi,gCi,hCi,iCi,jCi,kCi,lCi,mCi,nCi,oCi,pCi,qCi,rCi,sCi,tCi,uCi,vCi,wCi,xCi,yCi,zCi,BCi,CCi,DCi,ECi,FCi,aDi,bDi,cDi,dDi,eDi,fDi,gDi,hDi,iDi,jDi,kDi,lDi,mDi,nDi,oDi,pDi,qDi,rDi,sDi,tDi,uDi,vDi,wDi,xDi,yDi,zDi,ADi,BDi,CDi,DDi,EDi,FDi,aEi,bEi,cEi,dEi,eEi,fEi,gEi,hEi,iEi,jEi,kEi,lEi,mEi,nEi,oEi,pEi,qEi,rEi,tEi,uEi,vEi,wEi,xEi,yEi,zEi,AEi,BEi,CEi,DEi,EEi,FEi,aFi,bFi,cFi,dFi,eFi,fFi,gFi,hFi,iFi,jFi,kFi,lFi,mFi,nFi,oFi,pFi,qFi,rFi,sFi,tFi,uFi,vFi,wFi,xFi,yFi,zFi,AFi,BFi,CFi,DFi,EFi,FFi,aGi,bGi,cGi,dGi,eGi,fGi,gGi,hGi,iGi,jGi,kGi,lGi,mGi,nGi,oGi,pGi,qGi,rGi,sGi,tGi,uGi,vGi,wGi,xGi,yGi,zGi,AGi,BGi,CGi,DGi,EGi,FGi,aHi,bHi,cHi,dHi,eHi,fHi,gHi,hHi,iHi;function wHi(){wHi=v0i;uHi(new tHi(),null);xHi=vHi(new tHi(),oFg,oFg,1,false,false,false);BIi=vHi(new tHi(),t1h,t1h,45,false,false,false);uMi=vHi(new tHi(),u1h,u1h,0,false,false,false);hNi=vHi(new tHi(),w1h,w1h,45,false,false,false);AQi=vHi(new tHi(),ywg,ywg,29,true,false,false);nRi=vHi(new tHi(),x1h,x1h,0,false,false,false);BRi=vHi(new tHi(),oOg,oOg,45,false,false,false);rTi=vHi(new tHi(),y1h,y1h,45,false,false,false);dJi=vHi(new tHi(),z1h,z1h,4,true,false,false);mJi=vHi(new tHi(),A1h,A1h,0,false,false,false);qJi=vHi(new tHi(),B1h,B1h,0,false,false,false);gKi=vHi(new tHi(),C1h,C1h,41,true,false,false);xKi=vHi(new tHi(),D1h,D1h,46,true,false,false);AKi=vHi(new tHi(),E1h,E1h,41,true,false,false);EKi=vHi(new tHi(),F1h,F1h,45,false,false,false);bLi=vHi(new tHi(),b2h,b2h,0,false,false,false);hMi=vHi(new tHi(),c2h,c2h,0,false,false,false);BMi=vHi(new tHi(),d2h,d2h,42,true,false,false);CMi=vHi(new tHi(),e2h,e2h,42,true,false,false);DMi=vHi(new tHi(),f2h,f2h,42,true,false,false);EMi=vHi(new tHi(),g2h,g2h,42,true,false,false);FMi=vHi(new tHi(),h2h,h2h,42,true,false,false);aNi=vHi(new tHi(),i2h,i2h,42,true,false,false);AMi=vHi(new tHi(),j2h,j2h,0,false,false,false);fNi=vHi(new tHi(),k2h,k2h,22,true,false,false);pNi=vHi(new tHi(),qYg,qYg,0,false,false,false);bOi=vHi(new tHi(),m2h,m2h,15,true,false,false);jOi=vHi(new tHi(),n2h,n2h,0,false,false,false);nOi=vHi(new tHi(),o2h,o2h,0,false,false,false);fPi=vHi(new tHi(),p2h,p2h,57,false,false,false);lPi=vHi(new tHi(),q2h,q2h,57,false,false,false);mPi=vHi(new tHi(),r2h,r2h,57,false,false,false);xPi=vHi(new tHi(),s2h,s2h,57,false,false,false);tQi=vHi(new tHi(),t2h,t2h,46,true,false,false);wQi=vHi(new tHi(),u2h,u2h,0,false,false,false);FQi=vHi(new tHi(),v2h,v2h,0,false,false,false);xRi=vHi(new tHi(),x2h,x2h,53,false,false,false);yRi=vHi(new tHi(),tZg,tZg,53,false,false,false);aTi=vHi(new tHi(),fyg,fyg,40,false,true,false);gTi=vHi(new tHi(),qyg,qyg,40,false,true,false);lTi=vHi(new tHi(),uBg,uBg,37,true,false,true);qTi=vHi(new tHi(),y2h,y2h,45,false,false,false);sTi=vHi(new tHi(),z2h,z2h,46,true,false,false);FHi=vHi(new tHi(),A2h,A2h,0,false,false,false);xIi=vHi(new tHi(),B2h,B2h,0,false,false,false);zHi=vHi(new tHi(),C2h,C2h,0,false,false,false);aJi=vHi(new tHi(),D2h,D2h,45,false,false,false);EIi=vHi(new tHi(),E2h,E2h,0,false,false,false);FJi=vHi(new tHi(),F2h,F2h,0,false,false,false);tJi=vHi(new tHi(),a3h,a3h,7,true,false,false);BJi=vHi(new tHi(),c3h,c3h,0,false,false,false);DJi=vHi(new tHi(),d3h,d3h,0,false,false,false);lKi=vHi(new tHi(),e3h,e3h,0,false,false,false);pKi=vHi(new tHi(),f3h,f3h,0,false,false,false);sKi=vHi(new tHi(),w2g,w2g,51,true,false,false);uKi=vHi(new tHi(),dFg,dFg,50,true,false,false);gLi=vHi(new tHi(),g3h,g3h,0,false,false,false);vMi=vHi(new tHi(),h3h,h3h,0,false,false,false);wMi=vHi(new tHi(),i3h,i3h,0,false,false,false);nNi=vHi(new tHi(),j3h,j3h,48,true,false,false);sNi=vHi(new tHi(),k3h,k3h,0,false,false,false);tNi=vHi(new tHi(),l3h,l3h,0,false,false,false);zNi=vHi(new tHi(),n3h,n3h,0,false,false,false);kOi=vHi(new tHi(),o3h,o3h,0,false,false,false);ENi=vHi(new tHi(),p3h,p3h,0,false,false,false);aOi=vHi(new tHi(),q3h,q3h,0,false,false,false);FPi=vHi(new tHi(),r3h,r3h,0,false,false,false);gPi=vHi(new tHi(),z4g,z4g,0,false,false,false);rOi=vHi(new tHi(),s3h,s3h,0,false,false,false);bQi=vHi(new tHi(),t3h,t3h,0,false,false,false);zOi=vHi(new tHi(),o4g,o4g,0,false,false,false);gQi=vHi(new tHi(),u3h,u3h,0,false,false,false);nQi=vHi(new tHi(),v3h,v3h,0,false,false,false);fQi=vHi(new tHi(),w3h,w3h,51,true,false,false);hRi=vHi(new tHi(),y3h,y3h,44,true,false,false);vRi=vHi(new tHi(),z3h,z3h,0,false,false,false);uSi=vHi(new tHi(),A3h,A3h,52,false,false,false);aSi=vHi(new tHi(),B3h,B3h,0,false,false,false);ySi=vHi(new tHi(),C3h,C3h,19,false,false,false);wSi=vHi(new tHi(),D3h,D3h,0,false,false,false);jSi=vHi(new tHi(),E3h,E3h,0,false,false,false);gSi=vHi(new tHi(),F3h,F3h,0,false,false,false);xSi=vHi(new tHi(),a4h,a4h,52,false,false,false);hSi=vHi(new tHi(),b4h,b4h,0,false,false,false);CSi=vHi(new tHi(),d4h,d4h,0,false,false,false);vTi=vHi(new tHi(),e4h,e4h,0,false,false,false);wTi=vHi(new tHi(),f4h,f4h,52,false,false,false);DTi=vHi(new tHi(),g4h,g4h,49,true,false,false);ETi=vHi(new tHi(),sIg,sIg,38,false,false,false);FTi=vHi(new tHi(),h4h,h4h,0,false,false,false);wIi=vHi(new tHi(),i4h,i4h,49,true,false,false);yHi=vHi(new tHi(),C6g,C6g,0,false,false,false);CIi=vHi(new tHi(),u9g,u9g,2,true,false,false);fJi=vHi(new tHi(),j4h,j4h,0,false,false,false);cJi=vHi(new tHi(),lDg,lDg,3,true,false,false);iJi=vHi(new tHi(),k4h,k4h,0,false,false,false);rJi=vHi(new tHi(),D7g,D7g,45,false,false,false);oJi=vHi(new tHi(),s7g,s7g,0,false,false,false);aKi=vHi(new tHi(),l4h,l4h,0,false,false,false);CJi=vHi(new tHi(),m4h,m4h,0,false,false,false);EJi=vHi(new tHi(),p4h,p4h,0,false,false,false);cKi=vHi(new tHi(),q4h,q4h,0,false,false,false);mKi=vHi(new tHi(),r4h,r4h,59,false,false,false);rKi=vHi(new tHi(),s4h,s4h,0,false,false,false);jKi=vHi(new tHi(),t4h,t4h,0,false,false,false);rMi=vHi(new tHi(),srg,srg,9,true,false,false);iMi=vHi(new tHi(),u4h,u4h,64,false,false,false);zMi=vHi(new tHi(),v4h,v4h,0,false,false,false);cNi=vHi(new tHi(),Drg,Drg,20,true,false,false);gNi=vHi(new tHi(),hAg,hAg,23,false,true,false);dOi=vHi(new tHi(),w4h,w4h,0,false,false,false);fOi=vHi(new tHi(),Abh,Abh,16,true,false,false);gOi=vHi(new tHi(),qch,qch,0,false,false,false);FOi=vHi(new tHi(),x4h,x4h,18,true,false,false);BPi=vHi(new tHi(),y4h,y4h,0,false,false,false);nPi=vHi(new tHi(),dbh,dbh,0,false,false,false);wOi=vHi(new tHi(),A4h,A4h,17,false,false,false);sOi=vHi(new tHi(),B4h,B4h,0,false,false,false);vOi=vHi(new tHi(),pbh,pbh,0,false,false,false);AOi=vHi(new tHi(),C4h,C4h,0,false,false,false);DPi=vHi(new tHi(),D4h,D4h,0,false,false,false);DOi=vHi(new tHi(),E4h,E4h,50,true,false,false);wPi=vHi(new tHi(),F4h,F4h,0,false,false,false);lQi=vHi(new tHi(),a5h,a5h,0,false,false,false);iQi=vHi(new tHi(),zFg,zFg,24,false,false,false);hQi=vHi(new tHi(),b5h,b5h,0,false,false,false);DQi=vHi(new tHi(),heh,heh,0,false,false,false);dRi=vHi(new tHi(),c5h,c5h,0,false,false,false);ARi=vHi(new tHi(),d5h,d5h,0,false,false,false);rRi=vHi(new tHi(),f5h,f5h,0,false,false,false);uRi=vHi(new tHi(),g5h,g5h,0,false,false,false);tRi=vHi(new tHi(),h5h,h5h,0,false,false,false);wRi=vHi(new tHi(),i5h,i5h,0,false,false,false);zRi=vHi(new tHi(),AGg,AGg,52,false,false,false);bSi=vHi(new tHi(),j5h,j5h,0,false,false,false);kSi=vHi(new tHi(),k5h,k5h,0,false,false,false);pSi=vHi(new tHi(),lhh,lhh,52,false,false,false);CRi=vHi(new tHi(),l5h,l5h,0,false,false,false);qSi=vHi(new tHi(),m5h,m5h,0,false,false,false);FRi=vHi(new tHi(),n5h,n5h,0,false,false,false);iTi=vHi(new tHi(),o5h,o5h,0,false,false,false);oTi=vHi(new tHi(),q5h,q5h,0,false,false,false);nTi=vHi(new tHi(),r5h,r5h,0,false,false,false);DSi=vHi(new tHi(),s5h,s5h,0,false,false,false);cTi=vHi(new tHi(),Cdh,Cdh,0,false,false,false);BTi=vHi(new tHi(),t5h,t5h,0,false,false,false);zIi=vHi(new tHi(),u5h,u5h,51,true,false,false);AIi=vHi(new tHi(),v5h,v5h,0,false,false,false);iIi=vHi(new tHi(),w5h,w5h,0,false,false,false);FKi=vHi(new tHi(),x5h,x5h,48,true,false,false);sMi=vHi(new tHi(),smh,smh,10,true,false,false);kLi=vHi(new tHi(),y5h,y5h,0,false,false,false);gMi=vHi(new tHi(),z5h,z5h,0,false,false,false);xMi=vHi(new tHi(),B5h,B5h,0,false,false,false);eNi=vHi(new tHi(),C5h,C5h,0,false,false,false);kNi=vHi(new tHi(),D5h,D5h,12,true,false,false);iNi=vHi(new tHi(),E5h,E5h,0,false,false,false);rNi=vHi(new tHi(),pGg,pGg,13,true,false,false);BNi=vHi(new tHi(),wph,wph,62,false,false,false);cOi=vHi(new tHi(),F5h,F5h,0,false,false,false);dPi=vHi(new tHi(),a6h,a6h,0,false,false,false);sPi=vHi(new tHi(),b6h,b6h,0,false,false,false);bPi=vHi(new tHi(),c6h,c6h,0,false,false,false);qPi=vHi(new tHi(),d6h,d6h,0,false,false,false);hPi=vHi(new tHi(),e6h,e6h,0,false,false,false);vPi=vHi(new tHi(),g6h,g6h,0,false,false,false);zPi=vHi(new tHi(),h6h,h6h,0,false,false,false);aQi=vHi(new tHi(),i6h,i6h,57,false,false,false);pQi=vHi(new tHi(),j6h,j6h,0,false,false,false);aRi=vHi(new tHi(),k6h,k6h,0,false,false,false);BQi=vHi(new tHi(),l6h,l6h,55,true,false,false);gRi=vHi(new tHi(),m6h,m6h,0,false,false,false);sRi=vHi(new tHi(),n6h,n6h,0,false,false,false);tSi=vHi(new tHi(),BHg,BHg,33,true,false,false);lSi=vHi(new tHi(),o6h,o6h,45,false,false,false);hTi=vHi(new tHi(),kCg,kCg,39,true,false,true);BSi=vHi(new tHi(),cwg,cwg,34,false,true,true);kTi=vHi(new tHi(),fHg,fHg,36,true,false,false);pTi=vHi(new tHi(),p6h,p6h,0,false,false,false);jTi=vHi(new tHi(),r6h,r6h,0,false,false,false);fTi=vHi(new tHi(),vCg,vCg,39,true,false,true);ESi=vHi(new tHi(),FBg,FBg,39,true,false,true);tTi=vHi(new tHi(),s6h,s6h,0,false,false,false);CTi=vHi(new tHi(),t6h,t6h,0,false,false,false);ATi=vHi(new tHi(),u6h,u6h,0,false,false,false);qIi=vHi(new tHi(),v6h,v6h,0,false,false,false);oIi=vHi(new tHi(),w6h,w6h,0,false,false,false);uIi=vHi(new tHi(),x6h,x6h,0,false,false,false);sIi=vHi(new tHi(),y6h,y6h,0,false,false,false);kIi=vHi(new tHi(),z6h,z6h,0,false,false,false);hIi=vHi(new tHi(),A6h,A6h,43,false,true,false);mIi=vHi(new tHi(),C6h,C6h,0,false,false,false);jIi=vHi(new tHi(),D6h,D6h,0,false,false,false);eJi=vHi(new tHi(),E6h,E6h,5,false,true,false);nJi=vHi(new tHi(),F6h,F6h,0,false,false,false);lJi=vHi(new tHi(),a7h,a7h,50,true,false,false);dKi=vHi(new tHi(),axh,axh,0,false,false,false);gJi=vHi(new tHi(),b7h,b7h,0,false,false,false);wKi=vHi(new tHi(),c7h,c7h,0,false,false,false);kKi=vHi(new tHi(),d7h,d7h,0,false,false,false);qKi=vHi(new tHi(),e7h,e7h,51,true,false,false);yKi=vHi(new tHi(),f7h,f7h,0,false,false,false);fLi=vHi(new tHi(),h7h,h7h,0,false,false,false);bMi=vHi(new tHi(),i7h,j7h,0,false,false,false);eMi=vHi(new tHi(),k7h,k7h,51,true,false,false);pMi=vHi(new tHi(),l7h,l7h,0,false,false,false);fMi=vHi(new tHi(),wxh,wxh,0,false,false,false);oMi=vHi(new tHi(),m7h,m7h,51,true,false,false);dNi=vHi(new tHi(),n7h,n7h,51,true,false,false);jNi=vHi(new tHi(),DIg,DIg,47,true,false,false);ANi=vHi(new tHi(),o7h,o7h,65,true,false,false);CNi=vHi(new tHi(),p7h,p7h,0,false,false,false);FNi=vHi(new tHi(),q7h,q7h,0,false,false,false);yPi=vHi(new tHi(),s7h,s7h,0,false,false,false);EPi=vHi(new tHi(),t7h,t7h,0,false,false,false);APi=vHi(new tHi(),u7h,u7h,0,false,false,false);ePi=vHi(new tHi(),v7h,v7h,56,false,false,false);BOi=vHi(new tHi(),w7h,w7h,0,false,false,false);cQi=vHi(new tHi(),x7h,x7h,0,false,false,false);tOi=vHi(new tHi(),y7h,y7h,0,false,false,false);EOi=vHi(new tHi(),z7h,z7h,0,false,false,false);oPi=vHi(new tHi(),A7h,A7h,0,false,false,false);xOi=vHi(new tHi(),B7h,B7h,0,false,false,false);vQi=vHi(new tHi(),dxg,dxg,28,true,false,false);sQi=vHi(new tHi(),FKg,FKg,63,false,true,false);zQi=vHi(new tHi(),Dqg,Dqg,62,false,false,false);jRi=vHi(new tHi(),Eqg,Eqg,0,false,false,false);nSi=vHi(new tHi(),Fqg,Fqg,55,false,false,false);rSi=vHi(new tHi(),arg,arg,45,false,false,false);sSi=vHi(new tHi(),brg,brg,45,false,false,false);zSi=vHi(new tHi(),crg,crg,0,false,false,false);ASi=vHi(new tHi(),drg,drg,0,false,false,false);oSi=vHi(new tHi(),erg,erg,49,true,false,false);dSi=vHi(new tHi(),xvg,xvg,32,true,false,false);vSi=vHi(new tHi(),frg,frg,0,false,false,false);ERi=vHi(new tHi(),hIg,hIg,31,true,false,false);FSi=vHi(new tHi(),grg,grg,0,false,false,false);yTi=vHi(new tHi(),irg,irg,0,false,false,false);yIi=vHi(new tHi(),jrg,jrg,51,true,false,false);aIi=vHi(new tHi(),krg,krg,0,false,false,false);rIi=vHi(new tHi(),lrg,lrg,0,false,false,false);pIi=vHi(new tHi(),mrg,mrg,0,false,false,false);vIi=vHi(new tHi(),nrg,nrg,0,false,false,false);tIi=vHi(new tHi(),org,org,0,false,false,false);lIi=vHi(new tHi(),prg,prg,0,false,false,false);nIi=vHi(new tHi(),qrg,qrg,0,false,false,false);AHi=vHi(new tHi(),rrg,rrg,0,false,false,false);BHi=vHi(new tHi(),yEg,yEg,51,true,false,false);FIi=vHi(new tHi(),trg,trg,49,true,false,false);wJi=vHi(new tHi(),urg,urg,54,true,false,false);yJi=vHi(new tHi(),vrg,vrg,0,false,false,false);kJi=vHi(new tHi(),wrg,wrg,0,false,false,false);bKi=vHi(new tHi(),xrg,xrg,0,false,false,false);hJi=vHi(new tHi(),nwg,nwg,6,false,true,false);tKi=vHi(new tHi(),yrg,yrg,0,false,false,false);hKi=vHi(new tHi(),xLh,xLh,0,false,false,false);nKi=vHi(new tHi(),zrg,zrg,51,true,false,false);DKi=vHi(new tHi(),Arg,Arg,0,false,false,false);uLi=vHi(new tHi(),Brg,Crg,0,false,false,false);vLi=vHi(new tHi(),Erg,Frg,0,false,false,false);lLi=vHi(new tHi(),asg,bsg,0,false,false,false);tLi=vHi(new tHi(),csg,dsg,0,false,false,false);zLi=vHi(new tHi(),esg,fsg,0,false,false,false);ALi=vHi(new tHi(),gsg,hsg,0,false,false,false);wLi=vHi(new tHi(),jsg,ksg,0,false,false,false);xLi=vHi(new tHi(),lsg,msg,0,false,false,false);bNi=vHi(new tHi(),nsg,nsg,0,false,false,false);xNi=vHi(new tHi(),osg,osg,0,false,false,false);oNi=vHi(new tHi(),psg,psg,0,false,false,false);yNi=vHi(new tHi(),eGg,eGg,14,true,false,false);lOi=vHi(new tHi(),qsg,qsg,0,false,false,false);iOi=vHi(new tHi(),rsg,rsg,44,true,false,false);cPi=vHi(new tHi(),ssg,ssg,0,false,false,false);rPi=vHi(new tHi(),usg,usg,0,false,false,false);uOi=vHi(new tHi(),vsg,vsg,43,false,true,false);oOi=vHi(new tHi(),wsg,wsg,0,false,false,false);CPi=vHi(new tHi(),xsg,xsg,0,false,false,false);jQi=vHi(new tHi(),iJg,iJg,60,true,false,false);eRi=vHi(new tHi(),ysg,ysg,0,false,false,false);EQi=vHi(new tHi(),BMh,BMh,0,false,false,false);kRi=vHi(new tHi(),zsg,zsg,0,false,false,false);iSi=vHi(new tHi(),Asg,Asg,0,false,false,false);cSi=vHi(new tHi(),Bsg,Bsg,51,true,false,false);bTi=vHi(new tHi(),Csg,Csg,0,false,false,false);uTi=vHi(new tHi(),Dsg,Dsg,0,false,false,false);CHi=vHi(new tHi(),Fsg,atg,0,false,false,false);DIi=vHi(new tHi(),btg,btg,49,true,false,false);pJi=vHi(new tHi(),ctg,dtg,0,false,false,false);sJi=vHi(new tHi(),etg,etg,0,false,false,false);uJi=vHi(new tHi(),aDg,aDg,8,true,false,false);eKi=vHi(new tHi(),ftg,ftg,51,true,false,false);aLi=vHi(new tHi(),gtg,gtg,0,false,false,false);jLi=vHi(new tHi(),htg,htg,0,false,false,false);dMi=vHi(new tHi(),itg,itg,61,true,false,false);tMi=vHi(new tHi(),Axg,Axg,11,true,false,false);DLi=vHi(new tHi(),ktg,ltg,0,false,false,false);yMi=vHi(new tHi(),uNh,vNh,0,false,false,false);wNi=vHi(new tHi(),mtg,mtg,0,false,false,false);uNi=vHi(new tHi(),ntg,ntg,0,false,false,false);qNi=vHi(new tHi(),otg,otg,0,false,false,false);hOi=vHi(new tHi(),ptg,ptg,0,false,false,false);mOi=vHi(new tHi(),qtg,qtg,0,false,false,false);aPi=vHi(new tHi(),rtg,rtg,0,false,false,false);COi=vHi(new tHi(),stg,stg,0,false,false,false);tPi=vHi(new tHi(),ttg,ttg,0,false,false,false);kQi=vHi(new tHi(),tJg,tJg,25,true,false,false);mQi=vHi(new tHi(),vtg,vtg,26,true,false,false);uQi=vHi(new tHi(),oxg,oxg,27,true,false,false);fRi=vHi(new tHi(),wtg,wtg,0,false,false,false);iRi=vHi(new tHi(),xtg,xtg,0,false,false,false);lRi=vHi(new tHi(),ytg,ytg,0,false,false,false);mRi=vHi(new tHi(),ztg,ztg,0,false,false,false);oRi=vHi(new tHi(),Atg,Atg,0,false,false,false);eSi=vHi(new tHi(),Btg,Btg,0,false,false,false);dTi=vHi(new tHi(),qHg,qHg,35,true,false,false);eTi=vHi(new tHi(),Ctg,Dtg,0,false,false,false);xTi=vHi(new tHi(),Etg,Etg,0,false,false,false);eIi=vHi(new tHi(),aug,aug,0,false,false,false);AJi=vHi(new tHi(),bug,bug,0,false,false,false);zJi=vHi(new tHi(),cug,cug,0,false,false,false);xJi=vHi(new tHi(),dug,dug,0,false,false,false);jMi=vHi(new tHi(),eug,eug,0,false,false,false);iLi=vHi(new tHi(),fug,fug,0,false,false,false);vNi=vHi(new tHi(),gug,gug,0,false,false,false);lNi=vHi(new tHi(),hug,hug,0,false,false,false);DNi=vHi(new tHi(),iug,iug,0,false,false,false);yOi=vHi(new tHi(),jug,jug,0,false,false,false);rQi=vHi(new tHi(),mug,mug,0,false,false,false);xQi=vHi(new tHi(),nug,nug,0,false,false,false);bRi=vHi(new tHi(),oug,oug,0,false,false,false);cRi=vHi(new tHi(),EJg,EJg,30,true,false,false);qRi=vHi(new tHi(),pug,pug,0,false,false,false);fSi=vHi(new tHi(),qug,qug,0,false,false,false);mTi=vHi(new tHi(),rug,rug,0,false,false,false);fIi=vHi(new tHi(),sug,sug,0,false,false,false);bJi=vHi(new tHi(),tug,tug,50,true,false,false);vKi=vHi(new tHi(),uug,uug,0,false,false,false);dLi=vHi(new tHi(),vug,vug,0,false,false,false);cLi=vHi(new tHi(),xug,xug,0,false,false,false);mNi=vHi(new tHi(),yug,yug,0,false,false,false);qOi=vHi(new tHi(),zug,zug,56,false,false,false);dQi=vHi(new tHi(),Aug,Aug,0,false,false,false);jPi=vHi(new tHi(),Bug,Bug,0,false,false,false);oQi=vHi(new tHi(),Cug,Cug,0,false,false,false);mSi=vHi(new tHi(),Dug,Dug,0,false,false,false);DHi=vHi(new tHi(),Eug,Fug,0,false,false,false);oKi=vHi(new tHi(),avg,avg,0,false,false,false);eLi=vHi(new tHi(),cvg,cvg,54,true,false,false);BLi=vHi(new tHi(),dvg,evg,0,false,false,false);oLi=vHi(new tHi(),fvg,gvg,0,false,false,false);aMi=vHi(new tHi(),hvg,ivg,0,false,false,false);pOi=vHi(new tHi(),jvg,jvg,0,false,false,false);uPi=vHi(new tHi(),kvg,kvg,0,false,false,false);pPi=vHi(new tHi(),lvg,lvg,0,false,false,false);qQi=vHi(new tHi(),nvg,nvg,0,false,false,false);CQi=vHi(new tHi(),ovg,ovg,0,false,false,false);EHi=vHi(new tHi(),pvg,qvg,0,false,false,false);bIi=vHi(new tHi(),rvg,svg,0,false,false,false);fKi=vHi(new tHi(),tvg,tvg,0,false,false,false);hLi=vHi(new tHi(),uvg,uvg,0,false,false,false);cMi=vHi(new tHi(),vvg,wvg,0,false,false,false);ELi=vHi(new tHi(),yvg,zvg,0,false,false,false);CLi=vHi(new tHi(),Avg,Bvg,0,false,false,false);yQi=vHi(new tHi(),Cvg,Cvg,0,false,false,false);cIi=vHi(new tHi(),Dvg,Evg,0,false,false,false);vJi=vHi(new tHi(),BWh,BWh,0,false,false,false);mMi=vHi(new tHi(),Fvg,Fvg,0,false,false,false);nMi=vHi(new tHi(),awg,awg,0,false,false,false);qMi=vHi(new tHi(),bwg,dwg,59,false,false,false);mLi=vHi(new tHi(),ewg,fwg,0,false,false,false);iPi=vHi(new tHi(),gwg,gwg,0,false,false,false);kPi=vHi(new tHi(),hwg,hwg,0,false,false,false);DRi=vHi(new tHi(),iwg,iwg,0,false,false,false);zTi=vHi(new tHi(),jwg,jwg,0,false,false,false);gIi=vHi(new tHi(),kwg,kwg,58,false,false,false);iKi=vHi(new tHi(),lwg,lwg,0,false,false,false);lMi=vHi(new tHi(),mwg,mwg,0,false,false,false);yLi=vHi(new tHi(),owg,pwg,0,false,false,false);sLi=vHi(new tHi(),qwg,rwg,0,false,false,false);eOi=vHi(new tHi(),swg,twg,0,false,false,false);eQi=vHi(new tHi(),uwg,uwg,0,false,false,false);pRi=vHi(new tHi(),vwg,wwg,0,false,false,false);dIi=vHi(new tHi(),xwg,zwg,0,false,false,false);jJi=vHi(new tHi(),Awg,Awg,0,false,false,false);kMi=vHi(new tHi(),Bwg,Bwg,0,false,false,false);pLi=vHi(new tHi(),Cwg,Dwg,0,false,false,false);qLi=vHi(new tHi(),Ewg,Fwg,0,false,false,false);rLi=vHi(new tHi(),axg,bxg,0,false,false,false);FLi=vHi(new tHi(),cxg,exg,0,false,false,false);zKi=vHi(new tHi(),fxg,fxg,0,false,false,false);nLi=vHi(new tHi(),gxg,hxg,0,false,false,false);CKi=f9h(F_h,50,10,[xHi,BIi,uMi,hNi,AQi,nRi,BRi,rTi,dJi,mJi,qJi,gKi,xKi,AKi,EKi,bLi,hMi,BMi,CMi,DMi,EMi,FMi,aNi,AMi,fNi,pNi,bOi,jOi,nOi,fPi,lPi,mPi,xPi,tQi,wQi,FQi,xRi,yRi,aTi,gTi,lTi,qTi,sTi,FHi,xIi,zHi,aJi,EIi,FJi,tJi,BJi,DJi,lKi,pKi,sKi,uKi,gLi,vMi,wMi,nNi,sNi,tNi,zNi,kOi,ENi,aOi,FPi,gPi,rOi,bQi,zOi,gQi,nQi,fQi,hRi,vRi,uSi,aSi,ySi,wSi,jSi,gSi,xSi,hSi,CSi,vTi,wTi,DTi,ETi,FTi,wIi,yHi,CIi,fJi,cJi,iJi,rJi,oJi,aKi,CJi,EJi,cKi,mKi,rKi,jKi,rMi,iMi,zMi,cNi,gNi,dOi,fOi,gOi,FOi,BPi,nPi,wOi,sOi,vOi,AOi,DPi,DOi,wPi,lQi,iQi,hQi,DQi,dRi,ARi,rRi,uRi,tRi,wRi,zRi,bSi,kSi,pSi,CRi,qSi,FRi,iTi,oTi,nTi,DSi,cTi,BTi,zIi,AIi,iIi,FKi,sMi,kLi,gMi,xMi,eNi,kNi,iNi,rNi,BNi,cOi,dPi,sPi,bPi,qPi,hPi,vPi,zPi,aQi,pQi,aRi,BQi,gRi,sRi,tSi,lSi,hTi,BSi,kTi,pTi,jTi,fTi,ESi,tTi,CTi,ATi,qIi,oIi,uIi,sIi,kIi,hIi,mIi,jIi,eJi,nJi,lJi,dKi,gJi,wKi,kKi,qKi,yKi,fLi,bMi,eMi,pMi,fMi,oMi,dNi,jNi,ANi,CNi,FNi,yPi,EPi,APi,ePi,BOi,cQi,tOi,EOi,oPi,xOi,vQi,sQi,zQi,jRi,nSi,rSi,sSi,zSi,ASi,oSi,dSi,vSi,ERi,FSi,yTi,yIi,aIi,rIi,pIi,vIi,tIi,lIi,nIi,AHi,BHi,FIi,wJi,yJi,kJi,bKi,hJi,tKi,hKi,nKi,DKi,uLi,vLi,lLi,tLi,zLi,ALi,wLi,xLi,bNi,xNi,oNi,yNi,lOi,iOi,cPi,rPi,uOi,oOi,CPi,jQi,eRi,EQi,kRi,iSi,cSi,bTi,uTi,CHi,DIi,pJi,sJi,uJi,eKi,aLi,jLi,dMi,tMi,DLi,yMi,wNi,uNi,qNi,hOi,mOi,aPi,COi,tPi,kQi,mQi,uQi,fRi,iRi,lRi,mRi,oRi,eSi,dTi,eTi,xTi,eIi,AJi,zJi,xJi,jMi,iLi,vNi,lNi,DNi,yOi,rQi,xQi,bRi,cRi,qRi,fSi,mTi,fIi,bJi,vKi,dLi,cLi,mNi,qOi,dQi,jPi,oQi,mSi,DHi,oKi,eLi,BLi,oLi,aMi,pOi,uPi,pPi,qQi,CQi,EHi,bIi,fKi,hLi,cMi,ELi,CLi,yQi,cIi,vJi,mMi,nMi,qMi,mLi,iPi,kPi,DRi,zTi,gIi,iKi,lMi,yLi,sLi,eOi,eQi,pRi,dIi,jJi,kMi,pLi,qLi,rLi,FLi,zKi,nLi]);BKi=f9h(B_h,0,-1,[1057,1090,1255,1321,1552,1585,1651,1717,68162,68899,69059,69764,70020,70276,71077,71205,72134,72232,72264,72296,72328,72360,72392,73351,74312,75209,78124,78284,78476,79149,79309,79341,79469,81295,81487,82224,84498,84626,86164,86292,86612,86676,87445,3183041,3186241,3198017,3218722,3226754,3247715,3256803,3263971,3264995,3289252,3291332,3295524,3299620,3326725,3379303,3392679,3448233,3460553,3461577,3510347,3546604,3552364,3556524,3576461,3586349,3588141,3590797,3596333,3622062,3625454,3627054,3675728,3749042,3771059,3771571,3776211,3782323,3782963,3784883,3785395,3788979,3815476,3839605,3885110,3917911,3948984,3951096,135304769,135858241,136498210,136906434,137138658,137512995,137531875,137548067,137629283,137645539,137646563,137775779,138529956,138615076,139040932,140954086,141179366,141690439,142738600,143013512,146979116,147175724,147475756,147902637,147936877,148017645,148131885,148228141,148229165,148309165,148395629,148551853,148618829,149076462,149490158,149572782,151277616,151639440,153268914,153486514,153563314,153750706,153763314,153914034,154406067,154417459,154600979,154678323,154680979,154866835,155366708,155375188,155391572,155465780,155869364,158045494,168988979,169321621,169652752,173151309,174240818,174247297,174669292,175391532,176638123,177380397,177879204,177886734,180753473,181020073,181503558,181686320,181999237,181999311,182048201,182074866,182078003,182083764,182920847,184716457,184976961,185145071,187281445,187872052,188100653,188875944,188919873,188920457,189203987,189371817,189414886,189567458,190266670,191318187,191337609,202479203,202493027,202835587,202843747,203013219,203036048,203045987,203177552,203898516,204648562,205067918,205078130,205096654,205689142,205690439,205766017,205988909,207213161,207794484,207800999,208023602,208213644,208213647,210310273,210940978,213325049,213946445,214055079,215125040,215134273,215135028,215237420,215418148,215553166,215553394,215563858,215627949,215754324,217529652,217713834,217732628,218731945,221417045,221424946,221493746,221515401,221658189,221844577,221908140,221910626,221921586,222659762,225001091,236105833,236113965,236194995,236195427,236206132,236206387,236211683,236212707,236381647,236571826,237124271,238172205,238210544,238270764,238435405,238501172,239224867,239257644,239710497,240307721,241208789,241241557,241318060,241319404,241343533,241344069,241405397,241765845,243864964,244502085,244946220,245109902,247647266,247707956,248648814,248648836,248682161,248986932,249058914,249697357,252132601,252135604,252317348,255007012,255278388,256365156,257566121,269763372,271202790,271863856,272049197,272127474,272770631,274339449,274939471,275388004,275388005,275388006,275977800,278267602,278513831,278712622,281613765,281683369,282120228,282250732,282508942,283743649,283787570,284710386,285391148,285478533,285854898,285873762,286931113,288964227,289445441,289689648,291671489,303512884,305319975,305610036,305764101,308448294,308675890,312085683,312264750,315032867,316391000,317331042,317902135,318950711,319447220,321499182,322538804,323145200,337067316,337826293,339905989,340833697,341457068,345302593,349554733,349771471,349786245,350819405,356072847,370349192,373962798,374509141,375558638,375574835,376053993,383276530,383373833,383407586,384439906,386079012,404133513,404307343,407031852,408072233,409112005,409608425,409771500,419040932,437730612,439529766,442616365,442813037,443157674,443295316,450118444,450482697,456789668,459935396,471217869,474073645,476230702,476665218,476717289,483014825,485083298,489306281,538364390,540675748,543819186,543958612,576960820,577242548,610515252,642202932,644420819])}
function vHi(g,d,a,c,f,e,b){wHi();g.e=d;g.a=a;g.d=c;g.g=f;g.f=e;g.c=b;g.b=false;return g}
function uHi(b,a){wHi();b.e=a;b.a=a;b.d=0;b.g=false;b.f=false;b.c=false;b.b=true;return b}
function aUi(a,e){var b,c,d;b=e;b<<=5;b+=a[0]-96;d=e;for(c=0;c<4&&d>0;++c){--d;b<<=5;b+=a[d]-96}return b}
function bUi(a,i,g){var e,f;wHi();var b,c,d,h;c=aUi(a,g);d=wji(BKi,c);if(d<0){return uHi(new tHi(),String((e=i+g,mfi(a.length,i,e),ofi(a,i,e))))}else{b=CKi[d];h=b.e;if(!xVi(h,a,i,g)){return uHi(new tHi(),String((f=i+g,mfi(a.length,i,f),ofi(a,i,f))))}return b}}
function cUi(){return q_h}
function tHi(){}
_=tHi.prototype=new xdi();_.gC=cUi;_.tI=37;_.a=null;_.b=false;_.c=false;_.d=0;_.e=null;_.f=false;_.g=false;var xHi,yHi,zHi,AHi,BHi,CHi,DHi,EHi,FHi,aIi,bIi,cIi,dIi,eIi,fIi,gIi,hIi,iIi,jIi,kIi,lIi,mIi,nIi,oIi,pIi,qIi,rIi,sIi,tIi,uIi,vIi,wIi,xIi,yIi,zIi,AIi,BIi,CIi,DIi,EIi,FIi,aJi,bJi,cJi,dJi,eJi,fJi,gJi,hJi,iJi,jJi,kJi,lJi,mJi,nJi,oJi,pJi,qJi,rJi,sJi,tJi,uJi,vJi,wJi,xJi,yJi,zJi,AJi,BJi,CJi,DJi,EJi,FJi,aKi,bKi,cKi,dKi,eKi,fKi,gKi,hKi,iKi,jKi,kKi,lKi,mKi,nKi,oKi,pKi,qKi,rKi,sKi,tKi,uKi,vKi,wKi,xKi,yKi,zKi,AKi,BKi,CKi,DKi,EKi,FKi,aLi,bLi,cLi,dLi,eLi,fLi,gLi,hLi,iLi,jLi,kLi,lLi,mLi,nLi,oLi,pLi,qLi,rLi,sLi,tLi,uLi,vLi,wLi,xLi,yLi,zLi,ALi,BLi,CLi,DLi,ELi,FLi,aMi,bMi,cMi,dMi,eMi,fMi,gMi,hMi,iMi,jMi,kMi,lMi,mMi,nMi,oMi,pMi,qMi,rMi,sMi,tMi,uMi,vMi,wMi,xMi,yMi,zMi,AMi,BMi,CMi,DMi,EMi,FMi,aNi,bNi,cNi,dNi,eNi,fNi,gNi,hNi,iNi,jNi,kNi,lNi,mNi,nNi,oNi,pNi,qNi,rNi,sNi,tNi,uNi,vNi,wNi,xNi,yNi,zNi,ANi,BNi,CNi,DNi,ENi,FNi,aOi,bOi,cOi,dOi,eOi,fOi,gOi,hOi,iOi,jOi,kOi,lOi,mOi,nOi,oOi,pOi,qOi,rOi,sOi,tOi,uOi,vOi,wOi,xOi,yOi,zOi,AOi,BOi,COi,DOi,EOi,FOi,aPi,bPi,cPi,dPi,ePi,fPi,gPi,hPi,iPi,jPi,kPi,lPi,mPi,nPi,oPi,pPi,qPi,rPi,sPi,tPi,uPi,vPi,wPi,xPi,yPi,zPi,APi,BPi,CPi,DPi,EPi,FPi,aQi,bQi,cQi,dQi,eQi,fQi,gQi,hQi,iQi,jQi,kQi,lQi,mQi,nQi,oQi,pQi,qQi,rQi,sQi,tQi,uQi,vQi,wQi,xQi,yQi,zQi,AQi,BQi,CQi,DQi,EQi,FQi,aRi,bRi,cRi,dRi,eRi,fRi,gRi,hRi,iRi,jRi,kRi,lRi,mRi,nRi,oRi,pRi,qRi,rRi,sRi,tRi,uRi,vRi,wRi,xRi,yRi,zRi,ARi,BRi,CRi,DRi,ERi,FRi,aSi,bSi,cSi,dSi,eSi,fSi,gSi,hSi,iSi,jSi,kSi,lSi,mSi,nSi,oSi,pSi,qSi,rSi,sSi,tSi,uSi,vSi,wSi,xSi,ySi,zSi,ASi,BSi,CSi,DSi,ESi,FSi,aTi,bTi,cTi,dTi,eTi,fTi,gTi,hTi,iTi,jTi,kTi,lTi,mTi,nTi,oTi,pTi,qTi,rTi,sTi,tTi,uTi,vTi,wTi,xTi,yTi,zTi,ATi,BTi,CTi,DTi,ETi,FTi;function qWi(){qWi=v0i;oXi=f9h(A_h,42,-1,[60,62]);pXi=f9h(A_h,42,-1,[60,47]);wXi=f9h(A_h,42,-1,[93,93]);vXi=f9h(A_h,42,-1,[65533]);yXi=f9h(A_h,42,-1,[32]);nXi=f9h(A_h,42,-1,[10]);lXi=lfi(ixg);tXi=lfi(jxg);CXi=lfi(kxg);EXi=lfi(lxg);BXi=f9h(A_h,42,-1,[116,105,116,108,101]);xXi=f9h(A_h,42,-1,[115,99,114,105,112,116]);zXi=f9h(A_h,42,-1,[115,116,121,108,101]);uXi=f9h(A_h,42,-1,[112,108,97,105,110,116,101,120,116]);DXi=f9h(A_h,42,-1,[120,109,112]);AXi=f9h(A_h,42,-1,[116,101,120,116,97,114,101,97]);mXi=f9h(A_h,42,-1,[105,102,114,97,109,101]);qXi=f9h(A_h,42,-1,[110,111,101,109,98,101,100]);sXi=f9h(A_h,42,-1,[110,111,115,99,114,105,112,116]);rXi=f9h(A_h,42,-1,[110,111,102,114,97,109,101,115])}
function hWi(a){var b;a.cb&&(wHi(),FOi)==a.pb&&(koi(),pri)==a.l;if(a.l){b=xfi(a.F,0,a.ab);if(!a.w&&a.A&&a.B&&poi(a.l)){b=aYi(b)}tUi(a.m,a.l,b,a.tb)}}
function iWi(a){a.cb&&(koi(),pri)==a.l&&(wHi(),FOi)==a.pb;if(a.l){if(a.A){if(ooi(a.l)){if(a.B){tUi(a.m,a.l,a.l.a[0],a.tb)}else{tUi(a.m,a.l,cNh,a.tb)}}else{tUi(a.m,a.l,cNh,a.tb)}}else{if((koi(),wDi)==a.l||kvi==a.l){mxg+a.l.a[0]+nxg}tUi(a.m,a.l,cNh,a.tb)}}}
function jWi(b,a){switch(b.p.b){case 2:--b.ab;kWi(b,32);kWi(b,45);case 0:kWi(b,a);break;case 1:DWi(b,pxg);}}
function kWi(c,a){var b;if(c.ab==c.F.length){b=e9h(A_h,42,-1,c.ab+(c.ab>>1),1);Afi(c.F,0,b,0,c.F.length);c.F=b}c.F[c.ab++]=a}
function lWi(f,a,d,b){var c,e;e=f.ab+b;if(f.F.length<e){c=e9h(A_h,42,-1,e+(e>>1),1);Afi(f.F,0,c,0,f.F.length);f.F=c}Afi(a,d,f.F,f.ab,b);f.ab=e}
function mWi(a){switch(a.p.b){case 2:kWi(a,32);case 0:kWi(a,45);break;case 1:DWi(a,pxg);}}
function nWi(c,a){var b;if(c.mb==c.lb.length){b=e9h(A_h,42,-1,c.lb.length+1024,1);Afi(c.lb,0,b,0,c.lb.length);c.lb=b}c.lb[c.mb++]=a}
function oWi(a){a.l=nHi(a.lb,0,a.mb,a.db!=(Fli(),ami));if(!a.m){a.m=sUi(new rUi(),a.bb)}if(yUi(a.m,a.l)){qxg+a.l.a[0]+rxg;a.l=null}}
function rWi(a){switch(a.r.d){case 36:a.s=BXi;return;case 31:a.s=xXi;return;case 33:a.s=zXi;return;case 30:a.s=uXi;return;case 38:a.s=DXi;return;case 35:a.s=AXi;return;case 47:a.s=mXi;return;case 60:a.s=qXi;return;case 26:a.s=sXi;return;case 25:a.s=rXi;return;default:return;}}
function sWi(c,a,b){c.h=true;c.D=true;jUi(c,a,b);xYi(c.qb,nXi,0,1);c.u=2147483647}
function tWi(c,b,a){if(c.sb){EYi(c.qb,c.F,0,c.ab-b)}c.u=a+1}
function uWi(d,c,b){var a;d.u=b+1;d.kb=0;a=!d.m?(wUi(),bVi):d.m;if(d.w){cZi(d.qb,d.pb)}else{i0i(d.qb,d.pb,a,c)}bXi(d);return d.kb}
function xWi(b,c,a){if((a&-2)!=0){lWi(b,c,0,c.length)}else{xYi(b.qb,c,0,c.length)}}
function vWi(b,c,a){if((a&-2)!=0){kWi(b,c[0])}else{xYi(b.qb,c,0,1)}}
function wWi(b,a){if((a&-2)!=0){lWi(b,b.lb,0,b.mb)}else{zWi(b)}}
function yWi(c,a,b){c.h=true;c.D=true;jUi(c,a,b);xYi(c.qb,vXi,0,1);c.u=2147483647}
function zWi(a){if(a.mb>0){xYi(a.qb,a.lb,0,a.mb)}}
function AWi(a){if(a.eb){return sUi(new rUi(),a.bb)}else{return wUi(),bVi}}
function BWi(a){a.lb=null;a.F=null;a.ob=null;a.gb=null;a.v=null;a.pb=null;a.l=null;dZi(a.qb);if(a.m){vUi(a.m,a.bb);a.m=null}}
function CWi(j){var a,b,e,h,i,k;i=j.kb;h=j.hb;c:for(;;){switch(i){case 53:xYi(j.qb,oXi,0,1);break c;case 4:xYi(j.qb,oXi,0,1);break c;case 37:if(j.C<j.s.length){break c}else{break c}case 5:xYi(j.qb,pXi,0,2);break c;case 6:break c;case 7:case 14:case 48:break c;case 8:break c;case 9:case 10:break c;case 11:case 12:case 13:break c;case 15:tWi(j,0,0);break c;case 59:aXi(j);tWi(j,0,0);break c;case 16:j.ab=0;tWi(j,0,0);break c;case 38:tWi(j,0,0);break c;case 39:if(j.C<6){tWi(j,0,0)}else{j.v=cNh;j.gb=null;j.ob=null;j.y=true;j.u=1;FYi(j.qb,j.v,j.gb,j.ob,j.y);break c}break c;case 30:case 32:case 35:tWi(j,0,0);break c;case 34:tWi(j,2,0);break c;case 33:case 31:tWi(j,1,0);break c;case 36:tWi(j,3,0);break c;case 17:case 18:j.y=true;j.u=1;FYi(j.qb,j.v,j.gb,j.ob,j.y);break c;case 19:j.v=String(xfi(j.lb,0,j.mb));j.y=true;j.u=1;FYi(j.qb,j.v,j.gb,j.ob,j.y);break c;case 40:case 41:case 20:case 21:j.y=true;j.u=1;FYi(j.qb,j.v,j.gb,j.ob,j.y);break c;case 22:case 23:j.y=true;j.gb=xfi(j.F,0,j.ab);j.u=1;FYi(j.qb,j.v,j.gb,j.ob,j.y);break c;case 24:case 25:j.y=true;j.u=1;FYi(j.qb,j.v,j.gb,j.ob,j.y);break c;case 26:case 27:j.y=true;j.ob=xfi(j.F,0,j.ab);j.u=1;FYi(j.qb,j.v,j.gb,j.ob,j.y);break c;case 28:j.y=true;j.u=1;FYi(j.qb,j.v,j.gb,j.ob,j.y);break c;case 29:j.u=1;FYi(j.qb,j.v,j.gb,j.ob,j.y);break c;case 42:wWi(j,h);i=h;continue;case 44:g:for(;;){++j.x;d:for(;;){if(j.z==-1){break d}if(j.x==(rVi(),sVi)[j.z].length){break d}if(j.x>sVi[j.z].length){break g}else if(0<sVi[j.z][j.x]){--j.z}else{break d}}f:for(;;){if(j.z<j.E){break g}if(j.x==(rVi(),sVi)[j.E].length){j.o=j.E;j.nb=j.mb;++j.E}else if(j.x>sVi[j.E].length){break g}else if(0>sVi[j.E][j.x]){++j.E}else{break f}}if(j.z<j.E){break g}continue}if(j.o==-1){wWi(j,h);i=h;continue c}else{a=(rVi(),sVi)[j.o];if(a[a.length-1]!=59){if((h&-2)!=0){if(j.nb==j.mb){b=0}else{b=j.lb[j.nb]}if(b>=48&&b<=57||b>=65&&b<=90||b>=97&&b<=122){lWi(j,j.lb,0,j.mb);i=h;continue c}}}k=tVi[j.o];xWi(j,k,h);if(j.nb<j.mb){if((h&-2)!=0){for(e=j.nb;e<j.mb;++e){kWi(j,j.lb[e])}}else{xYi(j.qb,j.lb,j.nb,j.mb-j.nb)}}i=h;continue c}case 43:case 46:case 45:if(j.ib){}else{sxg+xfi(j.lb,0,j.mb)+rxg;wWi(j,h);i=h;continue}EWi(j,h);i=h;continue;case 0:default:break c;}}eZi(j.qb);return}
function DWi(c,a){var b;b=a1i(new F0i(),a,c);throw b}
function EWi(c,b){var a,d;if(c.rb>=128&&c.rb<=159){d=(rVi(),uVi)[c.rb-128];vWi(c,d,b)}else if(c.rb==13){vWi(c,nXi,b)}else if(c.rb==12&&c.t!=(Fli(),ami)){if(c.t==(Fli(),bmi)){vWi(c,yXi,b)}else if(c.t==cmi){DWi(c,txg)}}else if(c.rb>=0&&c.rb<=8||c.rb==11||c.rb>=14&&c.rb<=31||c.rb==127){uxg+oUi(c.rb&65535)+vxg;vWi(c,vXi,b)}else if((c.rb&63488)==55296){vWi(c,vXi,b)}else if((c.rb&65534)==65534){vWi(c,vXi,b)}else if(c.rb>=64976&&c.rb<=65007){vWi(c,vXi,b)}else if(c.rb<=65535){a=c.rb&65535;c.n[0]=a;vWi(c,c.n,b)}else if(c.rb<=1114111){c.k[0]=55232+(c.rb>>10)&65535;c.k[1]=56320+(c.rb&1023)&65535;xWi(c,c.k,b)}else{vWi(c,vXi,b)}}
function aXi(a){switch(a.p.b){case 2:kWi(a,32);break;case 1:DWi(a,wxg);}}
function bXi(a){if(a.eb){a.m=null}else{vUi(a.m,a.bb)}}
function dXi(c,b){var a;c.kb=b;if(b==0){return}a=null.dc();c.r=bUi(a,0,null.cc);rWi(c)}
function eXi(c,b,a){c.kb=b;c.r=a;rWi(c)}
function hXi(a,b){if(b==(Fli(),cmi)){throw Fci(new Eci(),xxg)}a.tb=b}
function iXi(a){a.q=false;a.lb=e9h(A_h,42,-1,64,1);a.mb=0;a.F=e9h(A_h,42,-1,1024,1);a.ab=0;a.kb=0;a.D=false;a.A=false;a.cb=false;j0i(a.qb,a);a.sb=a.qb.A;a.C=0;a.y=false;a.j=0;a.x=-1;a.E=0;a.z=(rVi(),sVi).length-1;a.o=-1;a.nb=0;a.fb=-1;a.rb=0;a.ib=false;a.jb=false;if(a.eb){a.m=null}else{a.m=sUi(new rUi(),a.bb)}a.a=false;a.f=a.g=0;a.c=a.d=1;a.h=true;a.i=0;a.b=false}
function jXi(Ab,vb,p,rb,o,tb,ub,cb){var q,u,bb,ib,kb,Bb;wb:for(;;){switch(vb){case 0:z:for(;;){if(tb){tb=false}else{if(++rb==cb){break wb}p=gUi(Ab,o,rb)}switch(p){case 38:jUi(Ab,o,rb);Ab.lb[0]=p;Ab.mb=1;Ab.j=0;fVi(new eVi(),Ab);ub=vb;vb=42;continue wb;case 60:jUi(Ab,o,rb);vb=4;break z;case 0:yWi(Ab,o,rb);continue;case 13:sWi(Ab,o,rb);break wb;case 10:Ab.h=true;default:continue;}}case 4:yb:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);if(p>=65&&p<=90){Ab.w=false;Ab.lb[0]=p+32&65535;Ab.mb=1;vb=6;break yb}else if(p>=97&&p<=122){Ab.w=false;Ab.lb[0]=p;Ab.mb=1;vb=6;break yb}switch(p){case 33:vb=16;continue wb;case 47:vb=5;continue wb;case 63:Ab.F[0]=p;Ab.ab=1;vb=15;continue wb;case 62:xYi(Ab.qb,oXi,0,2);Ab.u=rb+1;vb=0;continue wb;default:xYi(Ab.qb,oXi,0,1);Ab.u=rb;vb=0;tb=true;continue wb;}}case 6:xb:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 13:Ab.h=true;Ab.D=true;Ab.pb=bUi(Ab.lb,0,Ab.mb);vb=7;break wb;case 10:Ab.h=true;case 32:case 9:case 12:Ab.pb=bUi(Ab.lb,0,Ab.mb);vb=7;break xb;case 47:Ab.pb=bUi(Ab.lb,0,Ab.mb);vb=48;continue wb;case 62:Ab.pb=bUi(Ab.lb,0,Ab.mb);vb=uWi(Ab,false,rb);if(Ab.jb){break wb}continue wb;case 0:p=65533;default:if(p>=65&&p<=90){p+=32}nWi(Ab,p);continue;}}case 7:h:for(;;){if(tb){tb=false}else{if(++rb==cb){break wb}p=gUi(Ab,o,rb)}switch(p){case 13:Ab.h=true;Ab.D=true;break wb;case 10:Ab.h=true;case 32:case 9:case 12:continue;case 47:vb=48;continue wb;case 62:vb=uWi(Ab,false,rb);if(Ab.jb){break wb}continue wb;case 0:p=65533;case 34:case 39:case 60:case 61:default:if(p>=65&&p<=90){p+=32}Ab.lb[0]=p;Ab.mb=1;vb=8;break h;}}case 8:e:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 13:Ab.h=true;Ab.D=true;oWi(Ab);vb=9;break wb;case 10:Ab.h=true;case 32:case 9:case 12:oWi(Ab);vb=9;continue wb;case 47:oWi(Ab);iWi(Ab);vb=48;continue wb;case 61:oWi(Ab);vb=10;break e;case 62:oWi(Ab);iWi(Ab);vb=uWi(Ab,false,rb);if(Ab.jb){break wb}continue wb;case 0:p=65533;case 34:case 39:case 60:default:if(p>=65&&p<=90){p+=32}nWi(Ab,p);continue;}}case 10:i:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 13:Ab.h=true;Ab.D=true;break wb;case 10:Ab.h=true;case 32:case 9:case 12:continue;case 34:Ab.ab=0;vb=11;break i;case 38:Ab.ab=0;vb=13;tb=true;continue wb;case 39:Ab.ab=0;vb=12;continue wb;case 62:iWi(Ab);vb=uWi(Ab,false,rb);if(Ab.jb){break wb}continue wb;case 0:p=65533;case 60:case 61:iUi(p);default:Ab.F[0]=p;Ab.ab=1;vb=13;continue wb;}}case 11:f:for(;;){if(tb){tb=false}else{if(++rb==cb){break wb}p=gUi(Ab,o,rb)}switch(p){case 34:hWi(Ab);vb=14;break f;case 38:Ab.lb[0]=p;Ab.mb=1;Ab.j=34;fVi(new eVi(),Ab);ub=vb;vb=42;continue wb;case 13:Ab.h=true;Ab.D=true;kWi(Ab,10);break wb;case 10:Ab.h=true;kWi(Ab,10);continue;case 0:p=65533;default:kWi(Ab,p);continue;}}case 14:a:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 13:Ab.h=true;Ab.D=true;vb=7;break wb;case 10:Ab.h=true;case 32:case 9:case 12:vb=7;continue wb;case 47:vb=48;break a;case 62:vb=uWi(Ab,false,rb);if(Ab.jb){break wb}continue wb;default:vb=7;tb=true;continue wb;}}case 48:if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 62:vb=uWi(Ab,true,rb);if(Ab.jb){break wb}continue wb;default:vb=7;tb=true;continue wb;}case 13:for(;;){if(tb){tb=false}else{if(++rb==cb){break wb}p=gUi(Ab,o,rb)}switch(p){case 13:Ab.h=true;Ab.D=true;hWi(Ab);vb=7;break wb;case 10:Ab.h=true;case 32:case 9:case 12:hWi(Ab);vb=7;continue wb;case 38:Ab.lb[0]=p;Ab.mb=1;Ab.j=62;fVi(new eVi(),Ab);ub=vb;vb=42;continue wb;case 62:hWi(Ab);vb=uWi(Ab,false,rb);if(Ab.jb){break wb}continue wb;case 0:p=65533;case 60:case 34:case 39:case 61:default:kWi(Ab,p);continue;}}case 9:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 13:Ab.h=true;Ab.D=true;break wb;case 10:Ab.h=true;case 32:case 9:case 12:continue;case 47:iWi(Ab);vb=48;continue wb;case 61:vb=10;continue wb;case 62:iWi(Ab);vb=uWi(Ab,false,rb);if(Ab.jb){break wb}continue wb;case 0:p=65533;case 34:case 39:case 60:default:iWi(Ab);if(p>=65&&p<=90){p+=32}Ab.lb[0]=p;Ab.mb=1;vb=8;continue wb;}}case 15:n:for(;;){if(tb){tb=false}else{if(++rb==cb){break wb}p=gUi(Ab,o,rb)}switch(p){case 62:tWi(Ab,0,rb);vb=0;continue wb;case 45:kWi(Ab,p);vb=59;break n;case 13:Ab.h=true;Ab.D=true;kWi(Ab,10);break wb;case 10:Ab.h=true;kWi(Ab,10);continue;case 0:p=65533;default:kWi(Ab,p);continue;}}case 59:m:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 62:aXi(Ab);tWi(Ab,0,rb);vb=0;continue wb;case 45:mWi(Ab);continue m;case 13:Ab.h=true;Ab.D=true;kWi(Ab,10);vb=15;break wb;case 10:Ab.h=true;kWi(Ab,10);vb=15;continue wb;case 0:p=65533;default:kWi(Ab,p);vb=15;continue wb;}}case 16:ob:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 45:Ab.F[0]=p;Ab.ab=1;vb=38;break ob;case 100:case 68:Ab.F[0]=p;Ab.ab=1;Ab.C=0;vb=39;continue wb;case 91:if(Ab.qb.l==0){Ab.F[0]=p;Ab.ab=1;Ab.C=0;vb=49;continue wb}else{}default:Ab.ab=0;vb=15;tb=true;continue wb;}}case 38:nb:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 0:break wb;case 45:Ab.ab=0;vb=30;break nb;default:vb=15;tb=true;continue wb;}}case 30:y:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 45:kWi(Ab,p);vb=31;continue wb;case 62:tWi(Ab,0,rb);vb=0;continue wb;case 13:Ab.h=true;Ab.D=true;kWi(Ab,10);vb=32;break wb;case 10:Ab.h=true;kWi(Ab,10);vb=32;break y;case 0:p=65533;default:kWi(Ab,p);vb=32;break y;}}case 32:x:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 45:kWi(Ab,p);vb=33;break x;case 13:Ab.h=true;Ab.D=true;kWi(Ab,10);break wb;case 10:Ab.h=true;kWi(Ab,10);continue;case 0:p=65533;default:kWi(Ab,p);continue;}}case 33:v:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 45:kWi(Ab,p);vb=34;break v;case 13:Ab.h=true;Ab.D=true;kWi(Ab,10);vb=32;break wb;case 10:Ab.h=true;kWi(Ab,10);vb=32;continue wb;case 0:p=65533;default:kWi(Ab,p);vb=32;continue wb;}}case 34:w:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 62:tWi(Ab,2,rb);vb=0;continue wb;case 45:jWi(Ab,p);continue;case 32:case 9:case 12:jWi(Ab,p);vb=35;break w;case 13:Ab.h=true;Ab.D=true;jWi(Ab,10);vb=35;break wb;case 10:Ab.h=true;jWi(Ab,10);vb=35;break w;case 33:kWi(Ab,p);vb=36;continue wb;case 0:p=65533;default:jWi(Ab,p);vb=32;continue wb;}}case 35:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 62:tWi(Ab,0,rb);vb=0;continue wb;case 45:kWi(Ab,p);vb=33;continue wb;case 32:case 9:case 12:kWi(Ab,p);continue;case 13:Ab.h=true;Ab.D=true;kWi(Ab,10);break wb;case 10:Ab.h=true;kWi(Ab,10);continue;case 0:p=65533;default:kWi(Ab,p);vb=32;continue wb;}}case 36:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 62:tWi(Ab,3,rb);vb=0;continue wb;case 45:kWi(Ab,p);vb=33;continue wb;case 13:Ab.h=true;Ab.D=true;kWi(Ab,10);break wb;case 10:Ab.h=true;kWi(Ab,10);continue;case 0:p=65533;default:kWi(Ab,p);vb=32;continue wb;}}case 31:if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 45:kWi(Ab,p);vb=34;continue wb;case 62:tWi(Ab,1,rb);vb=0;continue wb;case 13:Ab.h=true;Ab.D=true;kWi(Ab,10);vb=32;break wb;case 10:Ab.h=true;kWi(Ab,10);vb=32;continue wb;case 0:p=65533;default:kWi(Ab,p);vb=32;continue wb;}case 39:mb:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);if(Ab.C<6){ib=p;if(p>=65&&p<=90){ib+=32}if(ib==tXi[Ab.C]){kWi(Ab,p)}else{vb=15;tb=true;continue wb}++Ab.C;continue}else{vb=17;tb=true;break mb}}case 17:B:for(;;){if(tb){tb=false}else{if(++rb==cb){break wb}p=gUi(Ab,o,rb)}Ab.v=cNh;Ab.ob=null;Ab.gb=null;Ab.y=false;switch(p){case 13:Ab.h=true;Ab.D=true;vb=18;break wb;case 10:Ab.h=true;case 32:case 9:case 12:vb=18;break B;default:vb=18;tb=true;break B;}}case 18:j:for(;;){if(tb){tb=false}else{if(++rb==cb){break wb}p=gUi(Ab,o,rb)}switch(p){case 13:Ab.h=true;Ab.D=true;break wb;case 10:Ab.h=true;case 32:case 9:case 12:continue;case 62:Ab.y=true;Ab.u=rb+1;FYi(Ab.qb,Ab.v,Ab.gb,Ab.ob,Ab.y);vb=0;continue wb;case 0:p=65533;default:if(p>=65&&p<=90){p+=32}Ab.lb[0]=p;Ab.mb=1;vb=19;break j;}}case 19:C:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 13:Ab.h=true;Ab.D=true;Ab.v=String(xfi(Ab.lb,0,Ab.mb));vb=20;break wb;case 10:Ab.h=true;case 32:case 9:case 12:Ab.v=String(xfi(Ab.lb,0,Ab.mb));vb=20;break C;case 62:Ab.v=String(xfi(Ab.lb,0,Ab.mb));Ab.u=rb+1;FYi(Ab.qb,Ab.v,Ab.gb,Ab.ob,Ab.y);vb=0;continue wb;case 0:p=65533;default:if(p>=65&&p<=90){p+=32}nWi(Ab,p);continue;}}case 20:b:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 13:Ab.h=true;Ab.D=true;break wb;case 10:Ab.h=true;case 32:case 9:case 12:continue;case 62:Ab.u=rb+1;FYi(Ab.qb,Ab.v,Ab.gb,Ab.ob,Ab.y);vb=0;continue wb;case 112:case 80:Ab.C=0;vb=40;break b;case 115:case 83:Ab.C=0;vb=41;continue wb;default:Ab.y=true;vb=29;continue wb;}}case 40:F:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);if(Ab.C<5){ib=p;if(p>=65&&p<=90){ib+=32}if(ib!=CXi[Ab.C]){Ab.y=true;vb=29;tb=true;continue wb}++Ab.C;continue}else{vb=21;tb=true;break F}}case 21:k:for(;;){if(tb){tb=false}else{if(++rb==cb){break wb}p=gUi(Ab,o,rb)}switch(p){case 13:Ab.h=true;Ab.D=true;break wb;case 10:Ab.h=true;case 32:case 9:case 12:continue;case 34:Ab.ab=0;vb=22;break k;case 39:Ab.ab=0;vb=23;continue wb;case 62:Ab.y=true;Ab.u=rb+1;FYi(Ab.qb,Ab.v,Ab.gb,Ab.ob,Ab.y);vb=0;continue wb;default:Ab.y=true;vb=29;continue wb;}}case 22:D:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 34:Ab.gb=xfi(Ab.F,0,Ab.ab);vb=24;break D;case 62:Ab.y=true;Ab.gb=xfi(Ab.F,0,Ab.ab);Ab.u=rb+1;FYi(Ab.qb,Ab.v,Ab.gb,Ab.ob,Ab.y);vb=0;continue wb;case 13:Ab.h=true;Ab.D=true;kWi(Ab,10);break wb;case 10:Ab.h=true;kWi(Ab,10);continue;case 0:p=65533;default:kWi(Ab,p);continue;}}case 24:c:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 13:Ab.h=true;Ab.D=true;break wb;case 10:Ab.h=true;case 32:case 9:case 12:continue;case 34:Ab.ab=0;vb=26;break c;case 39:Ab.ab=0;vb=27;continue wb;case 62:Ab.u=rb+1;FYi(Ab.qb,Ab.v,Ab.gb,Ab.ob,Ab.y);vb=0;continue wb;default:Ab.y=true;vb=29;continue wb;}}case 26:E:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 34:Ab.ob=xfi(Ab.F,0,Ab.ab);vb=28;continue wb;case 62:Ab.y=true;Ab.ob=xfi(Ab.F,0,Ab.ab);Ab.u=rb+1;FYi(Ab.qb,Ab.v,Ab.gb,Ab.ob,Ab.y);vb=0;continue wb;case 13:Ab.h=true;Ab.D=true;kWi(Ab,10);break wb;case 10:Ab.h=true;kWi(Ab,10);continue;case 0:p=65533;default:kWi(Ab,p);continue;}}case 28:d:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 13:Ab.h=true;Ab.D=true;break wb;case 10:Ab.h=true;case 32:case 9:case 12:continue;case 62:Ab.u=rb+1;FYi(Ab.qb,Ab.v,Ab.gb,Ab.ob,Ab.y);vb=0;continue wb;default:Ab.y=false;vb=29;break d;}}case 29:for(;;){if(tb){tb=false}else{if(++rb==cb){break wb}p=gUi(Ab,o,rb)}switch(p){case 62:Ab.u=rb+1;FYi(Ab.qb,Ab.v,Ab.gb,Ab.ob,Ab.y);vb=0;continue wb;case 13:Ab.h=true;Ab.D=true;break wb;case 10:Ab.h=true;default:continue;}}case 41:ab:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);if(Ab.C<5){ib=p;if(p>=65&&p<=90){ib+=32}if(ib!=EXi[Ab.C]){Ab.y=true;vb=29;tb=true;continue wb}++Ab.C;continue wb}else{vb=25;tb=true;break ab}}case 25:l:for(;;){if(tb){tb=false}else{if(++rb==cb){break wb}p=gUi(Ab,o,rb)}switch(p){case 13:Ab.h=true;Ab.D=true;break wb;case 10:Ab.h=true;case 32:case 9:case 12:continue;case 34:Ab.ab=0;vb=26;continue wb;case 39:Ab.ab=0;vb=27;break l;case 62:Ab.y=true;Ab.u=rb+1;FYi(Ab.qb,Ab.v,Ab.gb,Ab.ob,Ab.y);vb=0;continue wb;default:Ab.y=true;vb=29;continue wb;}}case 27:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 39:Ab.ob=xfi(Ab.F,0,Ab.ab);vb=28;continue wb;case 62:Ab.y=true;Ab.ob=xfi(Ab.F,0,Ab.ab);Ab.u=rb+1;FYi(Ab.qb,Ab.v,Ab.gb,Ab.ob,Ab.y);vb=0;continue wb;case 13:Ab.h=true;Ab.D=true;kWi(Ab,10);break wb;case 10:Ab.h=true;kWi(Ab,10);continue;case 0:p=65533;default:kWi(Ab,p);continue;}}case 23:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 39:Ab.gb=xfi(Ab.F,0,Ab.ab);vb=24;continue wb;case 62:Ab.y=true;Ab.gb=xfi(Ab.F,0,Ab.ab);Ab.u=rb+1;FYi(Ab.qb,Ab.v,Ab.gb,Ab.ob,Ab.y);vb=0;continue wb;case 13:Ab.h=true;Ab.D=true;kWi(Ab,10);break wb;case 10:Ab.h=true;kWi(Ab,10);continue;case 0:p=65533;default:kWi(Ab,p);continue;}}case 49:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);if(Ab.C<6){if(p==lXi[Ab.C]){kWi(Ab,p)}else{vb=15;tb=true;continue wb}++Ab.C;continue}else{Ab.u=rb;vb=50;tb=true;break}}case 50:t:for(;;){if(tb){tb=false}else{if(++rb==cb){break wb}p=gUi(Ab,o,rb)}switch(p){case 93:jUi(Ab,o,rb);vb=51;break t;case 0:yWi(Ab,o,rb);continue;case 13:sWi(Ab,o,rb);break wb;case 10:Ab.h=true;default:continue;}}case 51:s:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 93:vb=52;break s;default:xYi(Ab.qb,wXi,0,1);Ab.u=rb;vb=50;tb=true;continue wb;}}case 52:if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 62:Ab.u=rb+1;vb=0;continue wb;default:xYi(Ab.qb,wXi,0,2);Ab.u=rb;vb=50;tb=true;continue wb;}case 12:g:for(;;){if(tb){tb=false}else{if(++rb==cb){break wb}p=gUi(Ab,o,rb)}switch(p){case 39:hWi(Ab);vb=14;continue wb;case 38:Ab.lb[0]=p;Ab.mb=1;Ab.j=39;fVi(new eVi(),Ab);ub=vb;vb=42;break g;case 13:Ab.h=true;Ab.D=true;kWi(Ab,10);break wb;case 10:Ab.h=true;kWi(Ab,10);continue;case 0:p=65533;default:kWi(Ab,p);continue;}}case 42:if(++rb==cb){break wb}p=gUi(Ab,o,rb);if(p==0){break wb}switch(p){case 32:case 9:case 10:case 13:case 12:case 60:case 38:wWi(Ab,ub);if((ub&-2)==0){Ab.u=rb}vb=ub;tb=true;continue wb;case 35:nWi(Ab,35);vb=43;continue wb;default:if(p==Ab.j){wWi(Ab,ub);vb=ub;tb=true;continue wb}Ab.x=-1;Ab.E=0;Ab.z=(rVi(),sVi).length-1;Ab.o=-1;Ab.nb=0;vb=44;tb=true;}case 44:pb:for(;;){if(tb){tb=false}else{if(++rb==cb){break wb}p=gUi(Ab,o,rb)}if(p==0){break wb}++Ab.x;jb:for(;;){if(Ab.z==-1){break jb}if(Ab.x==(rVi(),sVi)[Ab.z].length){break jb}if(Ab.x>sVi[Ab.z].length){break pb}else if(p<sVi[Ab.z][Ab.x]){--Ab.z}else{break jb}}lb:for(;;){if(Ab.z<Ab.E){break pb}if(Ab.x==(rVi(),sVi)[Ab.E].length){Ab.o=Ab.E;Ab.nb=Ab.mb;++Ab.E}else if(Ab.x>sVi[Ab.E].length){break pb}else if(p>sVi[Ab.E][Ab.x]){++Ab.E}else{break lb}}if(Ab.z<Ab.E){break pb}nWi(Ab,p);continue}if(Ab.o==-1){wWi(Ab,ub);if((ub&-2)==0){Ab.u=rb}vb=ub;tb=true;continue wb}else{q=(rVi(),sVi)[Ab.o];if(q[q.length-1]!=59){if((ub&-2)!=0){if(Ab.nb==Ab.mb){u=p}else{u=Ab.lb[Ab.nb]}if(u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122){lWi(Ab,Ab.lb,0,Ab.mb);vb=ub;tb=true;continue wb}}}Bb=tVi[Ab.o];xWi(Ab,Bb,ub);if(Ab.nb<Ab.mb){if((ub&-2)!=0){for(kb=Ab.nb;kb<Ab.mb;++kb){kWi(Ab,Ab.lb[kb])}}else{xYi(Ab.qb,Ab.lb,Ab.nb,Ab.mb-Ab.nb)}}if((ub&-2)==0){Ab.u=rb}vb=ub;tb=true;continue wb}case 43:if(++rb==cb){break wb}p=gUi(Ab,o,rb);Ab.fb=-1;Ab.rb=0;Ab.ib=false;switch(p){case 120:case 88:nWi(Ab,p);vb=45;continue wb;default:vb=46;tb=true;}case 46:A:for(;;){if(tb){tb=false}else{if(++rb==cb){break wb}p=gUi(Ab,o,rb)}if(Ab.rb<Ab.fb){Ab.rb=1114112}Ab.fb=Ab.rb;if(p>=48&&p<=57){Ab.ib=true;Ab.rb*=10;Ab.rb+=p-48;continue}else if(p==59){if(Ab.ib){if((ub&-2)==0){Ab.u=rb+1}vb=47;break A}else{sxg+xfi(Ab.lb,0,Ab.mb)+rxg;nWi(Ab,59);wWi(Ab,ub);if((ub&-2)==0){Ab.u=rb+1}vb=ub;continue wb}}else{if(Ab.ib){if((ub&-2)==0){Ab.u=rb}vb=47;tb=true;break A}else{sxg+xfi(Ab.lb,0,Ab.mb)+rxg;wWi(Ab,ub);if((ub&-2)==0){Ab.u=rb}vb=ub;tb=true;continue wb}}}case 47:EWi(Ab,ub);vb=ub;continue wb;case 45:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);if(Ab.rb<Ab.fb){Ab.rb=1114112}Ab.fb=Ab.rb;if(p>=48&&p<=57){Ab.ib=true;Ab.rb*=16;Ab.rb+=p-48;continue}else if(p>=65&&p<=70){Ab.ib=true;Ab.rb*=16;Ab.rb+=p-65+10;continue}else if(p>=97&&p<=102){Ab.ib=true;Ab.rb*=16;Ab.rb+=p-97+10;continue}else if(p==59){if(Ab.ib){if((ub&-2)==0){Ab.u=rb+1}vb=47;continue wb}else{sxg+xfi(Ab.lb,0,Ab.mb)+rxg;nWi(Ab,59);wWi(Ab,ub);if((ub&-2)==0){Ab.u=rb+1}vb=ub;continue wb}}else{if(Ab.ib){if((ub&-2)==0){Ab.u=rb}vb=47;tb=true;continue wb}else{sxg+xfi(Ab.lb,0,Ab.mb)+rxg;wWi(Ab,ub);if((ub&-2)==0){Ab.u=rb}vb=ub;tb=true;continue wb}}}case 3:qb:for(;;){if(tb){tb=false}else{if(++rb==cb){break wb}p=gUi(Ab,o,rb)}switch(p){case 0:yWi(Ab,o,rb);continue;case 13:sWi(Ab,o,rb);break wb;case 10:Ab.h=true;default:continue;}}case 2:r:for(;;){if(tb){tb=false}else{if(++rb==cb){break wb}p=gUi(Ab,o,rb)}switch(p){case 60:jUi(Ab,o,rb);ub=vb;vb=53;break r;case 0:yWi(Ab,o,rb);continue;case 13:sWi(Ab,o,rb);break wb;case 10:Ab.h=true;default:continue;}}case 53:zb:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 33:xYi(Ab.qb,oXi,0,1);Ab.u=rb;vb=54;break zb;case 47:if(Ab.r){Ab.C=0;Ab.mb=0;vb=37;continue wb}default:xYi(Ab.qb,oXi,0,1);Ab.u=rb;vb=ub;tb=true;continue wb;}}case 54:eb:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 45:vb=55;break eb;default:vb=ub;tb=true;continue wb;}}case 55:db:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 45:vb=58;break db;default:vb=ub;tb=true;continue wb;}}case 58:fb:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 45:continue;case 62:vb=ub;continue wb;case 0:yWi(Ab,o,rb);vb=56;break fb;case 13:sWi(Ab,o,rb);vb=56;break wb;case 10:Ab.h=true;default:vb=56;break fb;}}case 56:hb:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 45:vb=57;break hb;case 0:yWi(Ab,o,rb);continue;case 13:sWi(Ab,o,rb);break wb;case 10:Ab.h=true;default:continue;}}case 57:gb:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 45:vb=58;continue wb;case 0:yWi(Ab,o,rb);vb=56;continue wb;case 13:sWi(Ab,o,rb);vb=56;continue wb;case 10:Ab.h=true;default:vb=56;continue wb;}}case 37:for(;;){if(++rb==cb){break wb}p=gUi(Ab,o,rb);if(Ab.C<Ab.s.length){bb=Ab.s[Ab.C];ib=p;if(p>=65&&p<=90){ib+=32}if(ib!=bb){Ab.A&&(Ab.C>0||ib>=97&&ib<=122)&&(wHi(),jNi)!=Ab.r;xYi(Ab.qb,pXi,0,2);zWi(Ab);Ab.u=rb;vb=ub;tb=true;continue wb}nWi(Ab,p);++Ab.C;continue}else{Ab.w=true;Ab.pb=Ab.r;switch(p){case 13:Ab.h=true;Ab.D=true;vb=7;break wb;case 10:Ab.h=true;case 32:case 9:case 12:vb=7;continue wb;case 62:vb=uWi(Ab,false,rb);if(Ab.jb){break wb}continue wb;case 47:vb=48;continue wb;default:xYi(Ab.qb,pXi,0,2);zWi(Ab);if(p==0){yWi(Ab,o,rb)}else{Ab.u=rb}vb=ub;continue wb;}}}case 5:if(++rb==cb){break wb}p=gUi(Ab,o,rb);switch(p){case 62:Ab.u=rb+1;vb=0;continue wb;case 13:Ab.h=true;Ab.D=true;Ab.F[0]=10;Ab.ab=1;vb=15;break wb;case 10:Ab.h=true;Ab.F[0]=10;Ab.ab=1;vb=15;continue wb;case 0:p=65533;default:if(p>=65&&p<=90){p+=32}if(p>=97&&p<=122){Ab.w=true;Ab.lb[0]=p;Ab.mb=1;vb=6;continue wb}else{Ab.F[0]=p;Ab.ab=1;vb=15;continue wb}}case 1:sb:for(;;){if(tb){tb=false}else{if(++rb==cb){break wb}p=gUi(Ab,o,rb)}switch(p){case 38:jUi(Ab,o,rb);Ab.lb[0]=p;Ab.mb=1;Ab.j=0;ub=vb;vb=42;continue wb;case 60:jUi(Ab,o,rb);ub=vb;vb=53;continue wb;case 0:yWi(Ab,o,rb);continue;case 13:sWi(Ab,o,rb);break wb;case 10:Ab.h=true;default:continue;}}}}jUi(Ab,o,rb);Ab.kb=vb;Ab.hb=ub;return rb}
function kXi(f,a){var b,c,d,e;e=f.kb;c=f.hb;f.jb=false;f.D=false;d=a.c;b=d-1;switch(e){case 0:case 1:case 2:case 3:case 50:case 56:case 54:case 55:case 57:case 58:f.u=d;break;default:f.u=2147483647;}b=jXi(f,e,0,b,a.a,false,c,a.b);if(b==a.b){a.c=b}else{a.c=b+1}return f.D}
function FXi(){return v_h}
function aYi(d){var a,b,c;if(d==null){return null}a=e9h(A_h,42,-1,d.length,1);for(c=0;c<d.length;++c){b=d.charCodeAt(c);if(b>=65&&b<=90){b+=32}a[c]=b}return String.fromCharCode.apply(null,a)}
function eWi(){}
_=eWi.prototype=new xdi();_.gC=FXi;_.tI=0;_.j=0;_.k=null;_.l=null;_.m=null;_.n=null;_.o=0;_.q=false;_.r=null;_.s=null;_.u=0;_.v=null;_.w=false;_.x=0;_.y=false;_.z=0;_.A=false;_.B=false;_.C=0;_.D=false;_.E=0;_.F=null;_.ab=0;_.bb=0;_.cb=false;_.eb=false;_.fb=0;_.gb=null;_.hb=0;_.ib=false;_.jb=false;_.kb=0;_.lb=null;_.mb=0;_.nb=0;_.ob=null;_.pb=null;_.qb=null;_.rb=0;_.sb=false;var lXi,mXi,nXi,oXi,pXi,qXi,rXi,sXi,tXi,uXi,vXi,wXi,xXi,yXi,zXi,AXi,BXi,CXi,DXi,EXi;function hUi(){hUi=v0i;qWi()}
function fUi(a,b){hUi();a.t=(Fli(),bmi);a.p=bmi;a.tb=bmi;a.db=bmi;a.qb=b;a.eb=false;a.n=e9h(A_h,42,-1,1,1);a.k=e9h(A_h,42,-1,2,1);a.e=bmi;return a}
function gUi(e,a,d){var b,c;e.g=e.f;e.d=e.c;if(e.h){++e.f;e.c=1;e.h=false}else{++e.c}b=a[d];if(!e.q&&!e.a&&b>127){e.a=true}switch(b){case 0:case 9:case 13:case 10:break;case 12:if(e.e==(Fli(),cmi)){DWi(e,yxg+oUi(b)+Bxg)}else{if(e.e==bmi){b=a[d]=32}yxg+oUi(b)+Bxg}break;default:if((b&64512)==56320){if((e.i&64512)==55296){c=(e.i<<10)+b+-56613888;if(c>=983040&&c<=1048573||c>=1048576&&c<=1114109){pUi(e)}}}else if(b<32||(b&65534)==65534){switch(e.e.b){case 1:DWi(e,Cxg+oUi(b)+Dxg);break;case 2:b=a[d]=65533;case 0:Cxg+oUi(b)+Dxg;}}else if(b>=127&&b<=159||b>=64976&&b<=64991){Cxg+oUi(b)+Dxg}else if(b>=57344&&b<=63743){pUi(e)}}e.i=b;return b}
function iUi(a){switch(a){case 61:return;case 60:return;}}
function jUi(e,a,d){var b,c;if(d>e.u){c=e.f;b=e.c;e.f=e.g;e.c=e.d;xYi(e.qb,a,e.u,d-e.u);e.f=c;e.c=b}e.u=2147483647}
function kUi(a){if(a.c>0){return a.c}else{return -1}}
function lUi(a){if(a.f>0){return a.f}else{return -1}}
function oUi(a){var b;b=idi(a,4);switch(b.length){case 1:return Exg+b;case 2:return Fxg+b;case 3:return ayg+b;case 4:return byg+b;default:throw Edi(new Ddi(),cyg);}}
function pUi(a){if(!a.b){a.b=true}}
function qUi(){return r_h}
function dUi(){}
_=dUi.prototype=new eWi();_.gC=qUi;_.tI=0;_.a=false;_.b=false;_.c=0;_.d=0;_.f=0;_.g=0;_.h=false;_.i=0;function wUi(){wUi=v0i;aVi=e9h(E_h,49,9,0,0);cVi=e9h(D_h,48,1,0,0);bVi=sUi(new rUi(),0)}
function sUi(b,a){wUi();b.b=a;b.a=0;b.c=e9h(E_h,49,9,5,0);b.d=e9h(D_h,48,1,5,0);b.e=0;b.f=aVi;b.g=cVi;return b}
function tUi(e,a,f,g){var b,c,d;a==(koi(),pvi);if(a.d){if(e.f.length==e.e){b=e.e==0?2:e.e<<1;c=e9h(E_h,49,9,b,0);Afi(e.f,0,c,0,e.f.length);e.f=c;d=e9h(D_h,48,1,b,0);Afi(e.g,0,d,0,e.g.length);e.g=d}e.f[e.e]=a;e.g[e.e]=f;++e.e;switch(g.b){case 1:throw z0i(new y0i(),dyg);case 2:return;}}if(e.c.length==e.a){b=e.a<<1;c=e9h(E_h,49,9,b,0);Afi(e.c,0,c,0,e.c.length);e.c=c;d=e9h(D_h,48,1,b,0);Afi(e.d,0,d,0,e.d.length);e.d=d}e.c[e.a]=a;e.d[e.a]=f;++e.a}
function vUi(c,b){var a;for(a=0;a<c.a;++a){h9h(c.c,a,null);h9h(c.d,a,null)}c.a=0;c.b=b;for(a=0;a<c.e;++a){h9h(c.f,a,null);h9h(c.g,a,null)}c.e=0}
function uUi(b){var a;for(a=0;a<b.a;++a){h9h(b.c,a,null);h9h(b.d,a,null)}b.a=0}
function xUi(c){var a,b;a=sUi(new rUi(),0);for(b=0;b<c.a;++b){tUi(a,c.c[b],c.d[b],(Fli(),ami))}for(b=0;b<c.e;++b){tUi(a,c.f[b],c.g[b],(Fli(),ami))}return a}
function yUi(c,b){var a;for(a=0;a<c.a;++a){if(b.a[0]==c.c[a].a[0]){return true}}for(a=0;a<c.e;++a){if(b.a[0]==c.f[a].a[0]){return true}}return false}
function zUi(b,a){if(a<b.a&&a>=0){return b.c[a]}else{return null}}
function AUi(c,b){var a;for(a=0;a<c.a;++a){if(c.c[a]==b){return a}}return -1}
function BUi(b,a){if(a<b.a&&a>=0){return b.c[a].a[b.b]}else{return null}}
function CUi(b,a){if(a<b.a&&a>=0){return b.c[a].c[b.b]}else{return null}}
function DUi(b,a){if(a<b.a&&a>=0){return b.d[a]}else{return null}}
function EUi(c,b){var a;a=AUi(c,b);if(a==-1){return null}else{return DUi(c,a)}}
function FUi(e,f,d){var a,b,c;for(b=0;b<e.a;++b){a=e.c[b];if(!a.b[e.b]){c=a.a[e.b];switch(d.b){case 2:e.c[b]=(koi(),ioi(new hoi(),dpi,ACi(mVi(c)),epi,bpi,false));case 0:a!=(koi(),DGi);break;case 1:gZi(f,mxg+c+eyg);}}}}
function dVi(){return s_h}
function rUi(){}
_=rUi.prototype=new xdi();_.gC=dVi;_.tI=0;_.a=0;_.b=0;_.c=null;_.d=null;_.e=0;_.f=null;_.g=null;var aVi,bVi,cVi;function fVi(b,a){kUi(a);lUi(a);return b}
function hVi(){return t_h}
function eVi(){}
_=eVi.prototype=new xdi();_.gC=hVi;_.tI=0;function jVi(){jVi=v0i;kVi=lfi(gyg)}
function lVi(c,a){var b;uei(c,hyg);for(b=0;b<6;++b){uei(c,String.fromCharCode(kVi[(a&15728640)>>20]));a<<=4}}
function mVi(e){jVi();var a,b,c,d;d=tei(new rei());for(b=0;b<e.length;++b){a=e.charCodeAt(b);if((a&64512)==55296){c=e.charCodeAt(++b);lVi(d,(a<<10)+c+-56613888)}else if(b==0&&!(a>=65&&a<=90||a>=97&&a<=122||a>=192&&a<=214||a>=216&&a<=246||a>=248&&a<=255||a>=256&&a<=305||a>=308&&a<=318||a>=321&&a<=328||a>=330&&a<=382||a>=384&&a<=451||a>=461&&a<=496||a>=500&&a<=501||a>=506&&a<=535||a>=592&&a<=680||a>=699&&a<=705||a==902||a>=904&&a<=906||a==908||a>=910&&a<=929||a>=931&&a<=974||a>=976&&a<=982||a==986||a==988||a==990||a==992||a>=994&&a<=1011||a>=1025&&a<=1036||a>=1038&&a<=1103||a>=1105&&a<=1116||a>=1118&&a<=1153||a>=1168&&a<=1220||a>=1223&&a<=1224||a>=1227&&a<=1228||a>=1232&&a<=1259||a>=1262&&a<=1269||a>=1272&&a<=1273||a>=1329&&a<=1366||a==1369||a>=1377&&a<=1414||a>=1488&&a<=1514||a>=1520&&a<=1522||a>=1569&&a<=1594||a>=1601&&a<=1610||a>=1649&&a<=1719||a>=1722&&a<=1726||a>=1728&&a<=1742||a>=1744&&a<=1747||a==1749||a>=1765&&a<=1766||a>=2309&&a<=2361||a==2365||a>=2392&&a<=2401||a>=2437&&a<=2444||a>=2447&&a<=2448||a>=2451&&a<=2472||a>=2474&&a<=2480||a==2482||a>=2486&&a<=2489||a>=2524&&a<=2525||a>=2527&&a<=2529||a>=2544&&a<=2545||a>=2565&&a<=2570||a>=2575&&a<=2576||a>=2579&&a<=2600||a>=2602&&a<=2608||a>=2610&&a<=2611||a>=2613&&a<=2614||a>=2616&&a<=2617||a>=2649&&a<=2652||a==2654||a>=2674&&a<=2676||a>=2693&&a<=2699||a==2701||a>=2703&&a<=2705||a>=2707&&a<=2728||a>=2730&&a<=2736||a>=2738&&a<=2739||a>=2741&&a<=2745||a==2749||a==2784||a>=2821&&a<=2828||a>=2831&&a<=2832||a>=2835&&a<=2856||a>=2858&&a<=2864||a>=2866&&a<=2867||a>=2870&&a<=2873||a==2877||a>=2908&&a<=2909||a>=2911&&a<=2913||a>=2949&&a<=2954||a>=2958&&a<=2960||a>=2962&&a<=2965||a>=2969&&a<=2970||a==2972||a>=2974&&a<=2975||a>=2979&&a<=2980||a>=2984&&a<=2986||a>=2990&&a<=2997||a>=2999&&a<=3001||a>=3077&&a<=3084||a>=3086&&a<=3088||a>=3090&&a<=3112||a>=3114&&a<=3123||a>=3125&&a<=3129||a>=3168&&a<=3169||a>=3205&&a<=3212||a>=3214&&a<=3216||a>=3218&&a<=3240||a>=3242&&a<=3251||a>=3253&&a<=3257||a==3294||a>=3296&&a<=3297||a>=3333&&a<=3340||a>=3342&&a<=3344||a>=3346&&a<=3368||a>=3370&&a<=3385||a>=3424&&a<=3425||a>=3585&&a<=3630||a==3632||a>=3634&&a<=3635||a>=3648&&a<=3653||a>=3713&&a<=3714||a==3716||a>=3719&&a<=3720||a==3722||a==3725||a>=3732&&a<=3735||a>=3737&&a<=3743||a>=3745&&a<=3747||a==3749||a==3751||a>=3754&&a<=3755||a>=3757&&a<=3758||a==3760||a>=3762&&a<=3763||a==3773||a>=3776&&a<=3780||a>=3904&&a<=3911||a>=3913&&a<=3945||a>=4256&&a<=4293||a>=4304&&a<=4342||a==4352||a>=4354&&a<=4355||a>=4357&&a<=4359||a==4361||a>=4363&&a<=4364||a>=4366&&a<=4370||a==4412||a==4414||a==4416||a==4428||a==4430||a==4432||a>=4436&&a<=4437||a==4441||a>=4447&&a<=4449||a==4451||a==4453||a==4455||a==4457||a>=4461&&a<=4462||a>=4466&&a<=4467||a==4469||a==4510||a==4520||a==4523||a>=4526&&a<=4527||a>=4535&&a<=4536||a==4538||a>=4540&&a<=4546||a==4587||a==4592||a==4601||a>=7680&&a<=7835||a>=7840&&a<=7929||a>=7936&&a<=7957||a>=7960&&a<=7965||a>=7968&&a<=8005||a>=8008&&a<=8013||a>=8016&&a<=8023||a==8025||a==8027||a==8029||a>=8031&&a<=8061||a>=8064&&a<=8116||a>=8118&&a<=8124||a==8126||a>=8130&&a<=8132||a>=8134&&a<=8140||a>=8144&&a<=8147||a>=8150&&a<=8155||a>=8160&&a<=8172||a>=8178&&a<=8180||a>=8182&&a<=8188||a==8486||a>=8490&&a<=8491||a==8494||a>=8576&&a<=8578||a>=12353&&a<=12436||a>=12449&&a<=12538||a>=12549&&a<=12588||a>=44032&&a<=55203||a>=19968&&a<=40869||a==12295||a>=12321&&a<=12329||a==95)){lVi(d,a)}else if(b!=0&&!(a>=48&&a<=57||a>=1632&&a<=1641||a>=1776&&a<=1785||a>=2406&&a<=2415||a>=2534&&a<=2543||a>=2662&&a<=2671||a>=2790&&a<=2799||a>=2918&&a<=2927||a>=3047&&a<=3055||a>=3174&&a<=3183||a>=3302&&a<=3311||a>=3430&&a<=3439||a>=3664&&a<=3673||a>=3792&&a<=3801||a>=3872&&a<=3881||a>=65&&a<=90||a>=97&&a<=122||a>=192&&a<=214||a>=216&&a<=246||a>=248&&a<=255||a>=256&&a<=305||a>=308&&a<=318||a>=321&&a<=328||a>=330&&a<=382||a>=384&&a<=451||a>=461&&a<=496||a>=500&&a<=501||a>=506&&a<=535||a>=592&&a<=680||a>=699&&a<=705||a==902||a>=904&&a<=906||a==908||a>=910&&a<=929||a>=931&&a<=974||a>=976&&a<=982||a==986||a==988||a==990||a==992||a>=994&&a<=1011||a>=1025&&a<=1036||a>=1038&&a<=1103||a>=1105&&a<=1116||a>=1118&&a<=1153||a>=1168&&a<=1220||a>=1223&&a<=1224||a>=1227&&a<=1228||a>=1232&&a<=1259||a>=1262&&a<=1269||a>=1272&&a<=1273||a>=1329&&a<=1366||a==1369||a>=1377&&a<=1414||a>=1488&&a<=1514||a>=1520&&a<=1522||a>=1569&&a<=1594||a>=1601&&a<=1610||a>=1649&&a<=1719||a>=1722&&a<=1726||a>=1728&&a<=1742||a>=1744&&a<=1747||a==1749||a>=1765&&a<=1766||a>=2309&&a<=2361||a==2365||a>=2392&&a<=2401||a>=2437&&a<=2444||a>=2447&&a<=2448||a>=2451&&a<=2472||a>=2474&&a<=2480||a==2482||a>=2486&&a<=2489||a>=2524&&a<=2525||a>=2527&&a<=2529||a>=2544&&a<=2545||a>=2565&&a<=2570||a>=2575&&a<=2576||a>=2579&&a<=2600||a>=2602&&a<=2608||a>=2610&&a<=2611||a>=2613&&a<=2614||a>=2616&&a<=2617||a>=2649&&a<=2652||a==2654||a>=2674&&a<=2676||a>=2693&&a<=2699||a==2701||a>=2703&&a<=2705||a>=2707&&a<=2728||a>=2730&&a<=2736||a>=2738&&a<=2739||a>=2741&&a<=2745||a==2749||a==2784||a>=2821&&a<=2828||a>=2831&&a<=2832||a>=2835&&a<=2856||a>=2858&&a<=2864||a>=2866&&a<=2867||a>=2870&&a<=2873||a==2877||a>=2908&&a<=2909||a>=2911&&a<=2913||a>=2949&&a<=2954||a>=2958&&a<=2960||a>=2962&&a<=2965||a>=2969&&a<=2970||a==2972||a>=2974&&a<=2975||a>=2979&&a<=2980||a>=2984&&a<=2986||a>=2990&&a<=2997||a>=2999&&a<=3001||a>=3077&&a<=3084||a>=3086&&a<=3088||a>=3090&&a<=3112||a>=3114&&a<=3123||a>=3125&&a<=3129||a>=3168&&a<=3169||a>=3205&&a<=3212||a>=3214&&a<=3216||a>=3218&&a<=3240||a>=3242&&a<=3251||a>=3253&&a<=3257||a==3294||a>=3296&&a<=3297||a>=3333&&a<=3340||a>=3342&&a<=3344||a>=3346&&a<=3368||a>=3370&&a<=3385||a>=3424&&a<=3425||a>=3585&&a<=3630||a==3632||a>=3634&&a<=3635||a>=3648&&a<=3653||a>=3713&&a<=3714||a==3716||a>=3719&&a<=3720||a==3722||a==3725||a>=3732&&a<=3735||a>=3737&&a<=3743||a>=3745&&a<=3747||a==3749||a==3751||a>=3754&&a<=3755||a>=3757&&a<=3758||a==3760||a>=3762&&a<=3763||a==3773||a>=3776&&a<=3780||a>=3904&&a<=3911||a>=3913&&a<=3945||a>=4256&&a<=4293||a>=4304&&a<=4342||a==4352||a>=4354&&a<=4355||a>=4357&&a<=4359||a==4361||a>=4363&&a<=4364||a>=4366&&a<=4370||a==4412||a==4414||a==4416||a==4428||a==4430||a==4432||a>=4436&&a<=4437||a==4441||a>=4447&&a<=4449||a==4451||a==4453||a==4455||a==4457||a>=4461&&a<=4462||a>=4466&&a<=4467||a==4469||a==4510||a==4520||a==4523||a>=4526&&a<=4527||a>=4535&&a<=4536||a==4538||a>=4540&&a<=4546||a==4587||a==4592||a==4601||a>=7680&&a<=7835||a>=7840&&a<=7929||a>=7936&&a<=7957||a>=7960&&a<=7965||a>=7968&&a<=8005||a>=8008&&a<=8013||a>=8016&&a<=8023||a==8025||a==8027||a==8029||a>=8031&&a<=8061||a>=8064&&a<=8116||a>=8118&&a<=8124||a==8126||a>=8130&&a<=8132||a>=8134&&a<=8140||a>=8144&&a<=8147||a>=8150&&a<=8155||a>=8160&&a<=8172||a>=8178&&a<=8180||a>=8182&&a<=8188||a==8486||a>=8490&&a<=8491||a==8494||a>=8576&&a<=8578||a>=12353&&a<=12436||a>=12449&&a<=12538||a>=12549&&a<=12588||a>=44032&&a<=55203||a>=19968&&a<=40869||a==12295||a>=12321&&a<=12329||a==95||a==46||a==45||a>=768&&a<=837||a>=864&&a<=865||a>=1155&&a<=1158||a>=1425&&a<=1441||a>=1443&&a<=1465||a>=1467&&a<=1469||a==1471||a>=1473&&a<=1474||a==1476||a>=1611&&a<=1618||a==1648||a>=1750&&a<=1756||a>=1757&&a<=1759||a>=1760&&a<=1764||a>=1767&&a<=1768||a>=1770&&a<=1773||a>=2305&&a<=2307||a==2364||a>=2366&&a<=2380||a==2381||a>=2385&&a<=2388||a>=2402&&a<=2403||a>=2433&&a<=2435||a==2492||a==2494||a==2495||a>=2496&&a<=2500||a>=2503&&a<=2504||a>=2507&&a<=2509||a==2519||a>=2530&&a<=2531||a==2562||a==2620||a==2622||a==2623||a>=2624&&a<=2626||a>=2631&&a<=2632||a>=2635&&a<=2637||a>=2672&&a<=2673||a>=2689&&a<=2691||a==2748||a>=2750&&a<=2757||a>=2759&&a<=2761||a>=2763&&a<=2765||a>=2817&&a<=2819||a==2876||a>=2878&&a<=2883||a>=2887&&a<=2888||a>=2891&&a<=2893||a>=2902&&a<=2903||a>=2946&&a<=2947||a>=3006&&a<=3010||a>=3014&&a<=3016||a>=3018&&a<=3021||a==3031||a>=3073&&a<=3075||a>=3134&&a<=3140||a>=3142&&a<=3144||a>=3146&&a<=3149||a>=3157&&a<=3158||a>=3202&&a<=3203||a>=3262&&a<=3268||a>=3270&&a<=3272||a>=3274&&a<=3277||a>=3285&&a<=3286||a>=3330&&a<=3331||a>=3390&&a<=3395||a>=3398&&a<=3400||a>=3402&&a<=3405||a==3415||a==3633||a>=3636&&a<=3642||a>=3655&&a<=3662||a==3761||a>=3764&&a<=3769||a>=3771&&a<=3772||a>=3784&&a<=3789||a>=3864&&a<=3865||a==3893||a==3895||a==3897||a==3902||a==3903||a>=3953&&a<=3972||a>=3974&&a<=3979||a>=3984&&a<=3989||a==3991||a>=3993&&a<=4013||a>=4017&&a<=4023||a==4025||a>=8400&&a<=8412||a==8417||a>=12330&&a<=12335||a==12441||a==12442||a==183||a==720||a==721||a==903||a==1600||a==3654||a==3782||a==12293||a>=12337&&a<=12341||a>=12445&&a<=12446||a>=12540&&a<=12542)){lVi(d,a)}else{uei(d,String.fromCharCode(a))}}return String(zei(d))}
function pVi(c){jVi();var a,b;if(c==null){return false}else{b=c.length;switch(b){case 0:return false;case 1:return nVi(c.charCodeAt(0));default:if(!nVi(c.charCodeAt(0))){return false}for(a=1;a<b;++a){if(!oVi(c.charCodeAt(a))){return false}}}return true}}
function nVi(a){return a>=65&&a<=90||a>=97&&a<=122||a>=192&&a<=214||a>=216&&a<=246||a>=248&&a<=255||a>=256&&a<=305||a>=308&&a<=318||a>=321&&a<=328||a>=330&&a<=382||a>=384&&a<=451||a>=461&&a<=496||a>=500&&a<=501||a>=506&&a<=535||a>=592&&a<=680||a>=699&&a<=705||a==902||a>=904&&a<=906||a==908||a>=910&&a<=929||a>=931&&a<=974||a>=976&&a<=982||a==986||a==988||a==990||a==992||a>=994&&a<=1011||a>=1025&&a<=1036||a>=1038&&a<=1103||a>=1105&&a<=1116||a>=1118&&a<=1153||a>=1168&&a<=1220||a>=1223&&a<=1224||a>=1227&&a<=1228||a>=1232&&a<=1259||a>=1262&&a<=1269||a>=1272&&a<=1273||a>=1329&&a<=1366||a==1369||a>=1377&&a<=1414||a>=1488&&a<=1514||a>=1520&&a<=1522||a>=1569&&a<=1594||a>=1601&&a<=1610||a>=1649&&a<=1719||a>=1722&&a<=1726||a>=1728&&a<=1742||a>=1744&&a<=1747||a==1749||a>=1765&&a<=1766||a>=2309&&a<=2361||a==2365||a>=2392&&a<=2401||a>=2437&&a<=2444||a>=2447&&a<=2448||a>=2451&&a<=2472||a>=2474&&a<=2480||a==2482||a>=2486&&a<=2489||a>=2524&&a<=2525||a>=2527&&a<=2529||a>=2544&&a<=2545||a>=2565&&a<=2570||a>=2575&&a<=2576||a>=2579&&a<=2600||a>=2602&&a<=2608||a>=2610&&a<=2611||a>=2613&&a<=2614||a>=2616&&a<=2617||a>=2649&&a<=2652||a==2654||a>=2674&&a<=2676||a>=2693&&a<=2699||a==2701||a>=2703&&a<=2705||a>=2707&&a<=2728||a>=2730&&a<=2736||a>=2738&&a<=2739||a>=2741&&a<=2745||a==2749||a==2784||a>=2821&&a<=2828||a>=2831&&a<=2832||a>=2835&&a<=2856||a>=2858&&a<=2864||a>=2866&&a<=2867||a>=2870&&a<=2873||a==2877||a>=2908&&a<=2909||a>=2911&&a<=2913||a>=2949&&a<=2954||a>=2958&&a<=2960||a>=2962&&a<=2965||a>=2969&&a<=2970||a==2972||a>=2974&&a<=2975||a>=2979&&a<=2980||a>=2984&&a<=2986||a>=2990&&a<=2997||a>=2999&&a<=3001||a>=3077&&a<=3084||a>=3086&&a<=3088||a>=3090&&a<=3112||a>=3114&&a<=3123||a>=3125&&a<=3129||a>=3168&&a<=3169||a>=3205&&a<=3212||a>=3214&&a<=3216||a>=3218&&a<=3240||a>=3242&&a<=3251||a>=3253&&a<=3257||a==3294||a>=3296&&a<=3297||a>=3333&&a<=3340||a>=3342&&a<=3344||a>=3346&&a<=3368||a>=3370&&a<=3385||a>=3424&&a<=3425||a>=3585&&a<=3630||a==3632||a>=3634&&a<=3635||a>=3648&&a<=3653||a>=3713&&a<=3714||a==3716||a>=3719&&a<=3720||a==3722||a==3725||a>=3732&&a<=3735||a>=3737&&a<=3743||a>=3745&&a<=3747||a==3749||a==3751||a>=3754&&a<=3755||a>=3757&&a<=3758||a==3760||a>=3762&&a<=3763||a==3773||a>=3776&&a<=3780||a>=3904&&a<=3911||a>=3913&&a<=3945||a>=4256&&a<=4293||a>=4304&&a<=4342||a==4352||a>=4354&&a<=4355||a>=4357&&a<=4359||a==4361||a>=4363&&a<=4364||a>=4366&&a<=4370||a==4412||a==4414||a==4416||a==4428||a==4430||a==4432||a>=4436&&a<=4437||a==4441||a>=4447&&a<=4449||a==4451||a==4453||a==4455||a==4457||a>=4461&&a<=4462||a>=4466&&a<=4467||a==4469||a==4510||a==4520||a==4523||a>=4526&&a<=4527||a>=4535&&a<=4536||a==4538||a>=4540&&a<=4546||a==4587||a==4592||a==4601||a>=7680&&a<=7835||a>=7840&&a<=7929||a>=7936&&a<=7957||a>=7960&&a<=7965||a>=7968&&a<=8005||a>=8008&&a<=8013||a>=8016&&a<=8023||a==8025||a==8027||a==8029||a>=8031&&a<=8061||a>=8064&&a<=8116||a>=8118&&a<=8124||a==8126||a>=8130&&a<=8132||a>=8134&&a<=8140||a>=8144&&a<=8147||a>=8150&&a<=8155||a>=8160&&a<=8172||a>=8178&&a<=8180||a>=8182&&a<=8188||a==8486||a>=8490&&a<=8491||a==8494||a>=8576&&a<=8578||a>=12353&&a<=12436||a>=12449&&a<=12538||a>=12549&&a<=12588||a>=44032&&a<=55203||a>=19968&&a<=40869||a==12295||a>=12321&&a<=12329||a==95}
function oVi(a){return a>=48&&a<=57||a>=1632&&a<=1641||a>=1776&&a<=1785||a>=2406&&a<=2415||a>=2534&&a<=2543||a>=2662&&a<=2671||a>=2790&&a<=2799||a>=2918&&a<=2927||a>=3047&&a<=3055||a>=3174&&a<=3183||a>=3302&&a<=3311||a>=3430&&a<=3439||a>=3664&&a<=3673||a>=3792&&a<=3801||a>=3872&&a<=3881||a>=65&&a<=90||a>=97&&a<=122||a>=192&&a<=214||a>=216&&a<=246||a>=248&&a<=255||a>=256&&a<=305||a>=308&&a<=318||a>=321&&a<=328||a>=330&&a<=382||a>=384&&a<=451||a>=461&&a<=496||a>=500&&a<=501||a>=506&&a<=535||a>=592&&a<=680||a>=699&&a<=705||a==902||a>=904&&a<=906||a==908||a>=910&&a<=929||a>=931&&a<=974||a>=976&&a<=982||a==986||a==988||a==990||a==992||a>=994&&a<=1011||a>=1025&&a<=1036||a>=1038&&a<=1103||a>=1105&&a<=1116||a>=1118&&a<=1153||a>=1168&&a<=1220||a>=1223&&a<=1224||a>=1227&&a<=1228||a>=1232&&a<=1259||a>=1262&&a<=1269||a>=1272&&a<=1273||a>=1329&&a<=1366||a==1369||a>=1377&&a<=1414||a>=1488&&a<=1514||a>=1520&&a<=1522||a>=1569&&a<=1594||a>=1601&&a<=1610||a>=1649&&a<=1719||a>=1722&&a<=1726||a>=1728&&a<=1742||a>=1744&&a<=1747||a==1749||a>=1765&&a<=1766||a>=2309&&a<=2361||a==2365||a>=2392&&a<=2401||a>=2437&&a<=2444||a>=2447&&a<=2448||a>=2451&&a<=2472||a>=2474&&a<=2480||a==2482||a>=2486&&a<=2489||a>=2524&&a<=2525||a>=2527&&a<=2529||a>=2544&&a<=2545||a>=2565&&a<=2570||a>=2575&&a<=2576||a>=2579&&a<=2600||a>=2602&&a<=2608||a>=2610&&a<=2611||a>=2613&&a<=2614||a>=2616&&a<=2617||a>=2649&&a<=2652||a==2654||a>=2674&&a<=2676||a>=2693&&a<=2699||a==2701||a>=2703&&a<=2705||a>=2707&&a<=2728||a>=2730&&a<=2736||a>=2738&&a<=2739||a>=2741&&a<=2745||a==2749||a==2784||a>=2821&&a<=2828||a>=2831&&a<=2832||a>=2835&&a<=2856||a>=2858&&a<=2864||a>=2866&&a<=2867||a>=2870&&a<=2873||a==2877||a>=2908&&a<=2909||a>=2911&&a<=2913||a>=2949&&a<=2954||a>=2958&&a<=2960||a>=2962&&a<=2965||a>=2969&&a<=2970||a==2972||a>=2974&&a<=2975||a>=2979&&a<=2980||a>=2984&&a<=2986||a>=2990&&a<=2997||a>=2999&&a<=3001||a>=3077&&a<=3084||a>=3086&&a<=3088||a>=3090&&a<=3112||a>=3114&&a<=3123||a>=3125&&a<=3129||a>=3168&&a<=3169||a>=3205&&a<=3212||a>=3214&&a<=3216||a>=3218&&a<=3240||a>=3242&&a<=3251||a>=3253&&a<=3257||a==3294||a>=3296&&a<=3297||a>=3333&&a<=3340||a>=3342&&a<=3344||a>=3346&&a<=3368||a>=3370&&a<=3385||a>=3424&&a<=3425||a>=3585&&a<=3630||a==3632||a>=3634&&a<=3635||a>=3648&&a<=3653||a>=3713&&a<=3714||a==3716||a>=3719&&a<=3720||a==3722||a==3725||a>=3732&&a<=3735||a>=3737&&a<=3743||a>=3745&&a<=3747||a==3749||a==3751||a>=3754&&a<=3755||a>=3757&&a<=3758||a==3760||a>=3762&&a<=3763||a==3773||a>=3776&&a<=3780||a>=3904&&a<=3911||a>=3913&&a<=3945||a>=4256&&a<=4293||a>=4304&&a<=4342||a==4352||a>=4354&&a<=4355||a>=4357&&a<=4359||a==4361||a>=4363&&a<=4364||a>=4366&&a<=4370||a==4412||a==4414||a==4416||a==4428||a==4430||a==4432||a>=4436&&a<=4437||a==4441||a>=4447&&a<=4449||a==4451||a==4453||a==4455||a==4457||a>=4461&&a<=4462||a>=4466&&a<=4467||a==4469||a==4510||a==4520||a==4523||a>=4526&&a<=4527||a>=4535&&a<=4536||a==4538||a>=4540&&a<=4546||a==4587||a==4592||a==4601||a>=7680&&a<=7835||a>=7840&&a<=7929||a>=7936&&a<=7957||a>=7960&&a<=7965||a>=7968&&a<=8005||a>=8008&&a<=8013||a>=8016&&a<=8023||a==8025||a==8027||a==8029||a>=8031&&a<=8061||a>=8064&&a<=8116||a>=8118&&a<=8124||a==8126||a>=8130&&a<=8132||a>=8134&&a<=8140||a>=8144&&a<=8147||a>=8150&&a<=8155||a>=8160&&a<=8172||a>=8178&&a<=8180||a>=8182&&a<=8188||a==8486||a>=8490&&a<=8491||a==8494||a>=8576&&a<=8578||a>=12353&&a<=12436||a>=12449&&a<=12538||a>=12549&&a<=12588||a>=44032&&a<=55203||a>=19968&&a<=40869||a==12295||a>=12321&&a<=12329||a==95||a==46||a==45||a>=768&&a<=837||a>=864&&a<=865||a>=1155&&a<=1158||a>=1425&&a<=1441||a>=1443&&a<=1465||a>=1467&&a<=1469||a==1471||a>=1473&&a<=1474||a==1476||a>=1611&&a<=1618||a==1648||a>=1750&&a<=1756||a>=1757&&a<=1759||a>=1760&&a<=1764||a>=1767&&a<=1768||a>=1770&&a<=1773||a>=2305&&a<=2307||a==2364||a>=2366&&a<=2380||a==2381||a>=2385&&a<=2388||a>=2402&&a<=2403||a>=2433&&a<=2435||a==2492||a==2494||a==2495||a>=2496&&a<=2500||a>=2503&&a<=2504||a>=2507&&a<=2509||a==2519||a>=2530&&a<=2531||a==2562||a==2620||a==2622||a==2623||a>=2624&&a<=2626||a>=2631&&a<=2632||a>=2635&&a<=2637||a>=2672&&a<=2673||a>=2689&&a<=2691||a==2748||a>=2750&&a<=2757||a>=2759&&a<=2761||a>=2763&&a<=2765||a>=2817&&a<=2819||a==2876||a>=2878&&a<=2883||a>=2887&&a<=2888||a>=2891&&a<=2893||a>=2902&&a<=2903||a>=2946&&a<=2947||a>=3006&&a<=3010||a>=3014&&a<=3016||a>=3018&&a<=3021||a==3031||a>=3073&&a<=3075||a>=3134&&a<=3140||a>=3142&&a<=3144||a>=3146&&a<=3149||a>=3157&&a<=3158||a>=3202&&a<=3203||a>=3262&&a<=3268||a>=3270&&a<=3272||a>=3274&&a<=3277||a>=3285&&a<=3286||a>=3330&&a<=3331||a>=3390&&a<=3395||a>=3398&&a<=3400||a>=3402&&a<=3405||a==3415||a==3633||a>=3636&&a<=3642||a>=3655&&a<=3662||a==3761||a>=3764&&a<=3769||a>=3771&&a<=3772||a>=3784&&a<=3789||a>=3864&&a<=3865||a==3893||a==3895||a==3897||a==3902||a==3903||a>=3953&&a<=3972||a>=3974&&a<=3979||a>=3984&&a<=3989||a==3991||a>=3993&&a<=4013||a>=4017&&a<=4023||a==4025||a>=8400&&a<=8412||a==8417||a>=12330&&a<=12335||a==12441||a==12442||a==183||a==720||a==721||a==903||a==1600||a==3654||a==3782||a==12293||a>=12337&&a<=12341||a>=12445&&a<=12446||a>=12540&&a<=12542}
var kVi;function rVi(){rVi=v0i;sVi=f9h(cai,52,12,[lfi(iyg),lfi(jyg),lfi(kyg),lfi(lyg),lfi(myg),lfi(nyg),lfi(oyg),lfi(pyg),lfi(ryg),lfi(syg),lfi(tyg),lfi(uyg),lfi(vyg),lfi(wyg),lfi(xyg),lfi(yyg),lfi(zyg),lfi(Ayg),lfi(Cyg),lfi(Dyg),lfi(Eyg),lfi(Fyg),lfi(azg),lfi(bzg),lfi(czg),lfi(dzg),lfi(ezg),lfi(fzg),lfi(hzg),lfi(izg),lfi(jzg),lfi(kzg),lfi(lzg),lfi(mzg),lfi(nzg),lfi(ozg),lfi(pzg),lfi(qzg),lfi(szg),lfi(tzg),lfi(uzg),lfi(vzg),lfi(wzg),lfi(xzg),lfi(yzg),lfi(zzg),lfi(Azg),lfi(Bzg),lfi(Dzg),lfi(Ezg),lfi(Fzg),lfi(aAg),lfi(bAg),lfi(cAg),lfi(dAg),lfi(eAg),lfi(fAg),lfi(gAg),lfi(iAg),lfi(jAg),lfi(kAg),lfi(lAg),lfi(mAg),lfi(nAg),lfi(oAg),lfi(pAg),lfi(qAg),lfi(rAg),lfi(tAg),lfi(uAg),lfi(vAg),lfi(wAg),lfi(xAg),lfi(yAg),lfi(zAg),lfi(AAg),lfi(BAg),lfi(CAg),lfi(EAg),lfi(FAg),lfi(aBg),lfi(bBg),lfi(cBg),lfi(dBg),lfi(eBg),lfi(fBg),lfi(gBg),lfi(hBg),lfi(kBg),lfi(lBg),lfi(mBg),lfi(nBg),lfi(oBg),lfi(pBg),lfi(qBg),lfi(rBg),lfi(sBg),lfi(tBg),lfi(vBg),lfi(wBg),lfi(xBg),lfi(yBg),lfi(zBg),lfi(ABg),lfi(BBg),lfi(CBg),lfi(DBg),lfi(EBg),lfi(aCg),lfi(bCg),lfi(cCg),lfi(dCg),lfi(eCg),lfi(fCg),lfi(gCg),lfi(hCg),lfi(iCg),lfi(jCg),lfi(lCg),lfi(mCg),lfi(nCg),lfi(oCg),lfi(pCg),lfi(qCg),lfi(rCg),lfi(sCg),lfi(tCg),lfi(uCg),lfi(wCg),lfi(xCg),lfi(yCg),lfi(zCg),lfi(ACg),lfi(BCg),lfi(CCg),lfi(DCg),lfi(ECg),lfi(FCg),lfi(bDg),lfi(cDg),lfi(dDg),lfi(eDg),lfi(fDg),lfi(gDg),lfi(hDg),lfi(iDg),lfi(jDg),lfi(kDg),lfi(mDg),lfi(nDg),lfi(oDg),lfi(pDg),lfi(qDg),lfi(rDg),lfi(sDg),lfi(tDg),lfi(uDg),lfi(vDg),lfi(xDg),lfi(yDg),lfi(zDg),lfi(ADg),lfi(BDg),lfi(CDg),lfi(DDg),lfi(EDg),lfi(FDg),lfi(aEg),lfi(cEg),lfi(dEg),lfi(eEg),lfi(fEg),lfi(gEg),lfi(hEg),lfi(iEg),lfi(jEg),lfi(kEg),lfi(lEg),lfi(nEg),lfi(oEg),lfi(pEg),lfi(qEg),lfi(rEg),lfi(sEg),lfi(tEg),lfi(uEg),lfi(vEg),lfi(wEg),lfi(zEg),lfi(AEg),lfi(BEg),lfi(CEg),lfi(DEg),lfi(EEg),lfi(FEg),lfi(aFg),lfi(bFg),lfi(cFg),lfi(eFg),lfi(fFg),lfi(gFg),lfi(hFg),lfi(iFg),lfi(jFg),lfi(kFg),lfi(lFg),lfi(mFg),lfi(nFg),lfi(pFg),lfi(qFg),lfi(rFg),lfi(sFg),lfi(tFg),lfi(uFg),lfi(vFg),lfi(wFg),lfi(xFg),lfi(yFg),lfi(AFg),lfi(BFg),lfi(CFg),lfi(DFg),lfi(EFg),lfi(FFg),lfi(aGg),lfi(bGg),lfi(cGg),lfi(dGg),lfi(fGg),lfi(gGg),lfi(hGg),lfi(iGg),lfi(jGg),lfi(kGg),lfi(lGg),lfi(mGg),lfi(nGg),lfi(oGg),lfi(qGg),lfi(rGg),lfi(sGg),lfi(tGg),lfi(uGg),lfi(vGg),lfi(wGg),lfi(xGg),lfi(yGg),lfi(zGg),lfi(BGg),lfi(CGg),lfi(DGg),lfi(EGg),lfi(FGg),lfi(aHg),lfi(bHg),lfi(cHg),lfi(dHg),lfi(eHg),lfi(gHg),lfi(hHg),lfi(iHg),lfi(jHg),lfi(kHg),lfi(lHg),lfi(mHg),lfi(nHg),lfi(oHg),lfi(pHg),lfi(rHg),lfi(sHg),lfi(tHg),lfi(uHg),lfi(vHg),lfi(wHg),lfi(xHg),lfi(yHg),lfi(zHg),lfi(AHg),lfi(CHg),lfi(DHg),lfi(EHg),lfi(FHg),lfi(aIg),lfi(bIg),lfi(cIg),lfi(dIg),lfi(eIg),lfi(fIg),lfi(iIg),lfi(jIg),lfi(kIg),lfi(lIg),lfi(mIg),lfi(nIg),lfi(oIg),lfi(pIg),lfi(qIg),lfi(rIg),lfi(tIg),lfi(uIg),lfi(vIg),lfi(wIg),lfi(xIg),lfi(yIg),lfi(zIg),lfi(AIg),lfi(BIg),lfi(CIg),lfi(EIg),lfi(FIg),lfi(aJg),lfi(bJg),lfi(cJg),lfi(dJg),lfi(eJg),lfi(fJg),lfi(gJg),lfi(hJg),lfi(jJg),lfi(kJg),lfi(lJg),lfi(mJg),lfi(nJg),lfi(oJg),lfi(pJg),lfi(qJg),lfi(rJg),lfi(sJg),lfi(uJg),lfi(vJg),lfi(wJg),lfi(xJg),lfi(yJg),lfi(zJg),lfi(AJg),lfi(BJg),lfi(CJg),lfi(DJg),lfi(FJg),lfi(aKg),lfi(bKg),lfi(cKg),lfi(dKg),lfi(eKg),lfi(fKg),lfi(gKg),lfi(hKg),lfi(iKg),lfi(kKg),lfi(lKg),lfi(mKg),lfi(nKg),lfi(oKg),lfi(pKg),lfi(qKg),lfi(rKg),lfi(sKg),lfi(tKg),lfi(vKg),lfi(wKg),lfi(xKg),lfi(yKg),lfi(zKg),lfi(AKg),lfi(BKg),lfi(CKg),lfi(DKg),lfi(EKg),lfi(aLg),lfi(bLg),lfi(cLg),lfi(dLg),lfi(eLg),lfi(fLg),lfi(gLg),lfi(hLg),lfi(iLg),lfi(jLg),lfi(lLg),lfi(mLg),lfi(nLg),lfi(oLg),lfi(pLg),lfi(qLg),lfi(rLg),lfi(sLg),lfi(tLg),lfi(uLg),lfi(xLg),lfi(yLg),lfi(zLg),lfi(ALg),lfi(BLg),lfi(CLg),lfi(DLg),lfi(ELg),lfi(FLg),lfi(aMg),lfi(cMg),lfi(dMg),lfi(eMg),lfi(fMg),lfi(gMg),lfi(hMg),lfi(iMg),lfi(jMg),lfi(kMg),lfi(lMg),lfi(nMg),lfi(oMg),lfi(pMg),lfi(qMg),lfi(rMg),lfi(sMg),lfi(tMg),lfi(uMg),lfi(vMg),lfi(wMg),lfi(yMg),lfi(zMg),lfi(AMg),lfi(BMg),lfi(CMg),lfi(DMg),lfi(EMg),lfi(FMg),lfi(aNg),lfi(bNg),lfi(dNg),lfi(eNg),lfi(fNg),lfi(gNg),lfi(hNg),lfi(iNg),lfi(jNg),lfi(kNg),lfi(lNg),lfi(mNg),lfi(oNg),lfi(pNg),lfi(qNg),lfi(rNg),lfi(sNg),lfi(tNg),lfi(uNg),lfi(vNg),lfi(wNg),lfi(xNg),lfi(zNg),lfi(ANg),lfi(BNg),lfi(CNg),lfi(DNg),lfi(ENg),lfi(FNg),lfi(aOg),lfi(bOg),lfi(cOg),lfi(eOg),lfi(fOg),lfi(gOg),lfi(hOg),lfi(iOg),lfi(jOg),lfi(kOg),lfi(lOg),lfi(mOg),lfi(nOg),lfi(pOg),lfi(qOg),lfi(rOg),lfi(sOg),lfi(tOg),lfi(uOg),lfi(vOg),lfi(wOg),lfi(xOg),lfi(yOg),lfi(AOg),lfi(BOg),lfi(COg),lfi(DOg),lfi(EOg),lfi(FOg),lfi(aPg),lfi(bPg),lfi(cPg),lfi(dPg),lfi(gPg),lfi(hPg),lfi(iPg),lfi(jPg),lfi(kPg),lfi(lPg),lfi(mPg),lfi(nPg),lfi(oPg),lfi(pPg),lfi(rPg),lfi(sPg),lfi(tPg),lfi(uPg),lfi(vPg),lfi(wPg),lfi(xPg),lfi(yPg),lfi(zPg),lfi(APg),lfi(CPg),lfi(DPg),lfi(EPg),lfi(FPg),lfi(aQg),lfi(bQg),lfi(cQg),lfi(dQg),lfi(eQg),lfi(fQg),lfi(hQg),lfi(iQg),lfi(jQg),lfi(kQg),lfi(lQg),lfi(mQg),lfi(nQg),lfi(oQg),lfi(pQg),lfi(qQg),lfi(sQg),lfi(tQg),lfi(uQg),lfi(vQg),lfi(wQg),lfi(xQg),lfi(yQg),lfi(zQg),lfi(AQg),lfi(BQg),lfi(DQg),lfi(EQg),lfi(FQg),lfi(aRg),lfi(bRg),lfi(cRg),lfi(dRg),lfi(eRg),lfi(fRg),lfi(gRg),lfi(iRg),lfi(jRg),lfi(kRg),lfi(lRg),lfi(mRg),lfi(nRg),lfi(oRg),lfi(pRg),lfi(qRg),lfi(rRg),lfi(tRg),lfi(uRg),lfi(vRg),lfi(wRg),lfi(xRg),lfi(yRg),lfi(zRg),lfi(ARg),lfi(BRg),lfi(CRg),lfi(ERg),lfi(FRg),lfi(aSg),lfi(bSg),lfi(cSg),lfi(dSg),lfi(eSg),lfi(fSg),lfi(gSg),lfi(hSg),lfi(jSg),lfi(kSg),lfi(lSg),lfi(mSg),lfi(nSg),lfi(oSg),lfi(pSg),lfi(qSg),lfi(rSg),lfi(sSg),lfi(vSg),lfi(wSg),lfi(xSg),lfi(ySg),lfi(zSg),lfi(ASg),lfi(BSg),lfi(CSg),lfi(DSg),lfi(ESg),lfi(aTg),lfi(bTg),lfi(cTg),lfi(dTg),lfi(eTg),lfi(fTg),lfi(gTg),lfi(hTg),lfi(iTg),lfi(jTg),lfi(lTg),lfi(mTg),lfi(nTg),lfi(oTg),lfi(pTg),lfi(qTg),lfi(rTg),lfi(sTg),lfi(tTg),lfi(uTg),lfi(wTg),lfi(xTg),lfi(yTg),lfi(zTg),lfi(ATg),lfi(BTg),lfi(CTg),lfi(DTg),lfi(ETg),lfi(FTg),lfi(bUg),lfi(cUg),lfi(dUg),lfi(eUg),lfi(fUg),lfi(gUg),lfi(hUg),lfi(iUg),lfi(jUg),lfi(kUg),lfi(mUg),lfi(nUg),lfi(oUg),lfi(pUg),lfi(qUg),lfi(rUg),lfi(sUg),lfi(tUg),lfi(uUg),lfi(vUg),lfi(xUg),lfi(yUg),lfi(zUg),lfi(AUg),lfi(BUg),lfi(CUg),lfi(DUg),lfi(EUg),lfi(FUg),lfi(aVg),lfi(cVg),lfi(dVg),lfi(eVg),lfi(fVg),lfi(gVg),lfi(hVg),lfi(iVg),lfi(jVg),lfi(kVg),lfi(lVg),lfi(nVg),lfi(oVg),lfi(pVg),lfi(qVg),lfi(rVg),lfi(sVg),lfi(tVg),lfi(uVg),lfi(vVg),lfi(wVg),lfi(yVg),lfi(zVg),lfi(AVg),lfi(BVg),lfi(CVg),lfi(DVg),lfi(EVg),lfi(FVg),lfi(aWg),lfi(bWg),lfi(eWg),lfi(fWg),lfi(gWg),lfi(hWg),lfi(iWg),lfi(jWg),lfi(kWg),lfi(lWg),lfi(mWg),lfi(nWg),lfi(pWg),lfi(qWg),lfi(rWg),lfi(sWg),lfi(tWg),lfi(uWg),lfi(vWg),lfi(wWg),lfi(xWg),lfi(yWg),lfi(AWg),lfi(BWg),lfi(CWg),lfi(DWg),lfi(EWg),lfi(FWg),lfi(aXg),lfi(bXg),lfi(cXg),lfi(dXg),lfi(fXg),lfi(gXg),lfi(hXg),lfi(iXg),lfi(jXg),lfi(kXg),lfi(lXg),lfi(mXg),lfi(nXg),lfi(oXg),lfi(qXg),lfi(rXg),lfi(sXg),lfi(tXg),lfi(uXg),lfi(vXg),lfi(wXg),lfi(xXg),lfi(yXg),lfi(zXg),lfi(BXg),lfi(CXg),lfi(DXg),lfi(EXg),lfi(FXg),lfi(aYg),lfi(bYg),lfi(cYg),lfi(dYg),lfi(eYg),lfi(gYg),lfi(hYg),lfi(iYg),lfi(jYg),lfi(kYg),lfi(lYg),lfi(mYg),lfi(nYg),lfi(oYg),lfi(pYg),lfi(rYg),lfi(sYg),lfi(tYg),lfi(uYg),lfi(vYg),lfi(wYg),lfi(xYg),lfi(yYg),lfi(zYg),lfi(AYg),lfi(CYg),lfi(DYg),lfi(EYg),lfi(FYg),lfi(aZg),lfi(bZg),lfi(cZg),lfi(dZg),lfi(eZg),lfi(fZg),lfi(hZg),lfi(iZg),lfi(jZg),lfi(kZg),lfi(lZg),lfi(mZg),lfi(nZg),lfi(oZg),lfi(pZg),lfi(qZg),lfi(uZg),lfi(vZg),lfi(wZg),lfi(xZg),lfi(yZg),lfi(zZg),lfi(AZg),lfi(BZg),lfi(CZg),lfi(DZg),lfi(FZg),lfi(a0g),lfi(b0g),lfi(c0g),lfi(d0g),lfi(e0g),lfi(f0g),lfi(g0g),lfi(h0g),lfi(i0g),lfi(k0g),lfi(l0g),lfi(m0g),lfi(n0g),lfi(o0g),lfi(p0g),lfi(q0g),lfi(r0g),lfi(s0g),lfi(t0g),lfi(v0g),lfi(w0g),lfi(x0g),lfi(y0g),lfi(z0g),lfi(A0g),lfi(B0g),lfi(C0g),lfi(D0g),lfi(E0g),lfi(a1g),lfi(b1g),lfi(c1g),lfi(d1g),lfi(e1g),lfi(f1g),lfi(g1g),lfi(h1g),lfi(i1g),lfi(j1g),lfi(l1g),lfi(m1g),lfi(n1g),lfi(o1g),lfi(p1g),lfi(q1g),lfi(r1g),lfi(s1g),lfi(t1g),lfi(u1g),lfi(w1g),lfi(x1g),lfi(y1g),lfi(z1g),lfi(A1g),lfi(B1g),lfi(C1g),lfi(D1g),lfi(E1g),lfi(F1g),lfi(b2g),lfi(c2g),lfi(d2g),lfi(e2g),lfi(f2g),lfi(g2g),lfi(h2g),lfi(i2g),lfi(j2g),lfi(k2g),lfi(m2g),lfi(n2g),lfi(o2g),lfi(p2g),lfi(q2g),lfi(r2g),lfi(s2g),lfi(t2g),lfi(u2g),lfi(v2g),lfi(x2g),lfi(y2g),lfi(z2g),lfi(A2g),lfi(B2g),lfi(C2g),lfi(D2g),lfi(E2g),lfi(F2g),lfi(a3g),lfi(d3g),lfi(e3g),lfi(f3g),lfi(g3g),lfi(h3g),lfi(i3g),lfi(j3g),lfi(k3g),lfi(l3g),lfi(m3g),lfi(o3g),lfi(p3g),lfi(q3g),lfi(r3g),lfi(s3g),lfi(t3g),lfi(u3g),lfi(v3g),lfi(w3g),lfi(x3g),lfi(z3g),lfi(A3g),lfi(B3g),lfi(C3g),lfi(D3g),lfi(E3g),lfi(F3g),lfi(a4g),lfi(b4g),lfi(c4g),lfi(e4g),lfi(f4g),lfi(g4g),lfi(h4g),lfi(i4g),lfi(c7h),lfi(j4g),lfi(k4g),lfi(l4g),lfi(m4g),lfi(n4g),lfi(p4g),lfi(q4g),lfi(r4g),lfi(s4g),lfi(t4g),lfi(u4g),lfi(v4g),lfi(w4g),lfi(x4g),lfi(y4g),lfi(A4g),lfi(B4g),lfi(C4g),lfi(D4g),lfi(E4g),lfi(F4g),lfi(a5g),lfi(b5g),lfi(c5g),lfi(d5g),lfi(f5g),lfi(g5g),lfi(h5g),lfi(i5g),lfi(j5g),lfi(k5g),lfi(l5g),lfi(m5g),lfi(n5g),lfi(o5g),lfi(q5g),lfi(r5g),lfi(s5g),lfi(t5g),lfi(u5g),lfi(v5g),lfi(w5g),lfi(x5g),lfi(y5g),lfi(z5g),lfi(B5g),lfi(C5g),lfi(D5g),lfi(E5g),lfi(F5g),lfi(a6g),lfi(b6g),lfi(c6g),lfi(d6g),lfi(e6g),lfi(g6g),lfi(h6g),lfi(i6g),lfi(j6g),lfi(k6g),lfi(l6g),lfi(m6g),lfi(n6g),lfi(o6g),lfi(p6g),lfi(s6g),lfi(t6g),lfi(u6g),lfi(v6g),lfi(w6g),lfi(x6g),lfi(y6g),lfi(z6g),lfi(A6g),lfi(B6g),lfi(D6g),lfi(E6g),lfi(F6g),lfi(a7g),lfi(b7g),lfi(c7g),lfi(d7g),lfi(e7g),lfi(f7g),lfi(g7g),lfi(i7g),lfi(j7g),lfi(k7g),lfi(l7g),lfi(m7g),lfi(n7g),lfi(o7g),lfi(p7g),lfi(q7g),lfi(r7g),lfi(t7g),lfi(u7g),lfi(v7g),lfi(w7g),lfi(x7g),lfi(y7g),lfi(z7g),lfi(A7g),lfi(B7g),lfi(C7g),lfi(E7g),lfi(F7g),lfi(a8g),lfi(b8g),lfi(c8g),lfi(d8g),lfi(e8g),lfi(f8g),lfi(g8g),lfi(h8g),lfi(j8g),lfi(k8g),lfi(l8g),lfi(m8g),lfi(n8g),lfi(o8g),lfi(p8g),lfi(q8g),lfi(r8g),lfi(s8g),lfi(u8g),lfi(v8g),lfi(w8g),lfi(x8g),lfi(y8g),lfi(z8g),lfi(A8g),lfi(B8g),lfi(C8g),lfi(D8g),lfi(F8g),lfi(a9g),lfi(b9g),lfi(c9g),lfi(d9g),lfi(e9g),lfi(f9g),lfi(g9g),lfi(h9g),lfi(i9g),lfi(k9g),lfi(l9g),lfi(m9g),lfi(n9g),lfi(o9g),lfi(p9g),lfi(q9g),lfi(r9g),lfi(s9g),lfi(t9g),lfi(v9g),lfi(w9g),lfi(x9g),lfi(y9g),lfi(z9g),lfi(A9g),lfi(B9g),lfi(C9g),lfi(D9g),lfi(E9g),lfi(b$g),lfi(c$g),lfi(d$g),lfi(e$g),lfi(f$g),lfi(g$g),lfi(h$g),lfi(i$g),lfi(j$g),lfi(k$g),lfi(m$g),lfi(n$g),lfi(o$g),lfi(p$g),lfi(q$g),lfi(r$g),lfi(s$g),lfi(j2h),lfi(t$g),lfi(u$g),lfi(v$g),lfi(x$g),lfi(y$g),lfi(z$g),lfi(A$g),lfi(B$g),lfi(C$g),lfi(D$g),lfi(E$g),lfi(F$g),lfi(a_g),lfi(c_g),lfi(d_g),lfi(e_g),lfi(f_g),lfi(g_g),lfi(h_g),lfi(i_g),lfi(j_g),lfi(k_g),lfi(l_g),lfi(n_g),lfi(o_g),lfi(p_g),lfi(q_g),lfi(r_g),lfi(s_g),lfi(t_g),lfi(u_g),lfi(v_g),lfi(w_g),lfi(y_g),lfi(z_g),lfi(A_g),lfi(B_g),lfi(C_g),lfi(D_g),lfi(E_g),lfi(F_g),lfi(aah),lfi(bah),lfi(dah),lfi(eah),lfi(fah),lfi(gah),lfi(hah),lfi(iah),lfi(jah),lfi(kah),lfi(lah),lfi(mah),lfi(oah),lfi(pah),lfi(qah),lfi(rah),lfi(sah),lfi(tah),lfi(uah),lfi(vah),lfi(wah),lfi(xah),lfi(zah),lfi(Aah),lfi(Bah),lfi(Cah),lfi(Dah),lfi(Eah),lfi(Fah),lfi(abh),lfi(bbh),lfi(cbh),lfi(ebh),lfi(fbh),lfi(gbh),lfi(hbh),lfi(ibh),lfi(jbh),lfi(kbh),lfi(lbh),lfi(mbh),lfi(nbh),lfi(qbh),lfi(rbh),lfi(sbh),lfi(tbh),lfi(ubh),lfi(vbh),lfi(wbh),lfi(xbh),lfi(ybh),lfi(zbh),lfi(Bbh),lfi(Cbh),lfi(Dbh),lfi(Ebh),lfi(Fbh),lfi(ach),lfi(bch),lfi(cch),lfi(dch),lfi(ech),lfi(gch),lfi(hch),lfi(ich),lfi(jch),lfi(kch),lfi(lch),lfi(mch),lfi(nch),lfi(och),lfi(pch),lfi(rch),lfi(sch),lfi(tch),lfi(uch),lfi(vch),lfi(wch),lfi(xch),lfi(ych),lfi(zch),lfi(Ach),lfi(Cch),lfi(Dch),lfi(Ech),lfi(Fch),lfi(adh),lfi(bdh),lfi(cdh),lfi(ddh),lfi(edh),lfi(fdh),lfi(hdh),lfi(idh),lfi(jdh),lfi(kdh),lfi(ldh),lfi(mdh),lfi(ndh),lfi(odh),lfi(pdh),lfi(qdh),lfi(sdh),lfi(tdh),lfi(udh),lfi(vdh),lfi(wdh),lfi(xdh),lfi(ydh),lfi(zdh),lfi(Adh),lfi(Bdh),lfi(Ddh),lfi(Edh),lfi(Fdh),lfi(aeh),lfi(beh),lfi(ceh),lfi(deh),lfi(eeh),lfi(feh),lfi(geh),lfi(ieh),lfi(jeh),lfi(keh),lfi(leh),lfi(meh),lfi(neh),lfi(oeh),lfi(peh),lfi(qeh),lfi(reh),lfi(teh),lfi(ueh),lfi(veh),lfi(weh),lfi(xeh),lfi(yeh),lfi(zeh),lfi(Aeh),lfi(Beh),lfi(Ceh),lfi(Feh),lfi(afh),lfi(bfh),lfi(cfh),lfi(dfh),lfi(efh),lfi(ffh),lfi(gfh),lfi(hfh),lfi(ifh),lfi(kfh),lfi(lfh),lfi(mfh),lfi(nfh),lfi(ofh),lfi(pfh),lfi(qfh),lfi(rfh),lfi(sfh),lfi(tfh),lfi(vfh),lfi(wfh),lfi(xfh),lfi(yfh),lfi(zfh),lfi(Afh),lfi(Bfh),lfi(Cfh),lfi(Dfh),lfi(Efh),lfi(agh),lfi(bgh),lfi(cgh),lfi(dgh),lfi(egh),lfi(fgh),lfi(ggh),lfi(hgh),lfi(igh),lfi(jgh),lfi(lgh),lfi(mgh),lfi(ngh),lfi(ogh),lfi(pgh),lfi(qgh),lfi(rgh),lfi(sgh),lfi(tgh),lfi(ugh),lfi(wgh),lfi(xgh),lfi(ygh),lfi(zgh),lfi(Agh),lfi(Bgh),lfi(Cgh),lfi(Dgh),lfi(Egh),lfi(Fgh),lfi(bhh),lfi(chh),lfi(dhh),lfi(ehh),lfi(fhh),lfi(ghh),lfi(hhh),lfi(o2h),lfi(ihh),lfi(jhh),lfi(khh),lfi(mhh),lfi(nhh),lfi(ohh),lfi(phh),lfi(qhh),lfi(rhh),lfi(shh),lfi(thh),lfi(uhh),lfi(vhh),lfi(xhh),lfi(yhh),lfi(zhh),lfi(Ahh),lfi(Bhh),lfi(Chh),lfi(Dhh),lfi(Ehh),lfi(Fhh),lfi(aih),lfi(cih),lfi(dih),lfi(eih),lfi(fih),lfi(gih),lfi(hih),lfi(iih),lfi(jih),lfi(kih),lfi(lih),lfi(oih),lfi(pih),lfi(qih),lfi(rih),lfi(sih),lfi(tih),lfi(uih),lfi(vih),lfi(wih),lfi(xih),lfi(zih),lfi(Aih),lfi(Bih),lfi(Cih),lfi(Dih),lfi(Eih),lfi(Fih),lfi(ajh),lfi(bjh),lfi(cjh),lfi(ejh),lfi(fjh),lfi(gjh),lfi(hjh),lfi(ijh),lfi(jjh),lfi(kjh),lfi(ljh),lfi(mjh),lfi(njh),lfi(pjh),lfi(qjh),lfi(rjh),lfi(sjh),lfi(tjh),lfi(ujh),lfi(vjh),lfi(wjh),lfi(xjh),lfi(yjh),lfi(Ajh),lfi(Bjh),lfi(Cjh),lfi(Djh),lfi(Ejh),lfi(Fjh),lfi(akh),lfi(bkh),lfi(ckh),lfi(dkh),lfi(fkh),lfi(gkh),lfi(hkh),lfi(ikh),lfi(jkh),lfi(kkh),lfi(lkh),lfi(mkh),lfi(nkh),lfi(okh),lfi(qkh),lfi(rkh),lfi(skh),lfi(tkh),lfi(ukh),lfi(vkh),lfi(wkh),lfi(xkh),lfi(ykh),lfi(zkh),lfi(Bkh),lfi(Ckh),lfi(Dkh),lfi(Ekh),lfi(Fkh),lfi(alh),lfi(blh),lfi(clh),lfi(dlh),lfi(elh),lfi(v3h),lfi(glh),lfi(hlh),lfi(ilh),lfi(jlh),lfi(klh),lfi(llh),lfi(mlh),lfi(nlh),lfi(olh),lfi(plh),lfi(rlh),lfi(slh),lfi(tlh),lfi(ulh),lfi(vlh),lfi(wlh),lfi(xlh),lfi(ylh),lfi(zlh),lfi(Alh),lfi(Dlh),lfi(Elh),lfi(Flh),lfi(amh),lfi(bmh),lfi(cmh),lfi(dmh),lfi(emh),lfi(fmh),lfi(gmh),lfi(imh),lfi(jmh),lfi(kmh),lfi(lmh),lfi(mmh),lfi(nmh),lfi(omh),lfi(pmh),lfi(qmh),lfi(rmh),lfi(tmh),lfi(umh),lfi(vmh),lfi(wmh),lfi(xmh),lfi(ymh),lfi(zmh),lfi(Amh),lfi(Bmh),lfi(Cmh),lfi(Emh),lfi(Fmh),lfi(anh),lfi(bnh),lfi(cnh),lfi(dnh),lfi(enh),lfi(fnh),lfi(gnh),lfi(hnh),lfi(jnh),lfi(knh),lfi(lnh),lfi(mnh),lfi(nnh),lfi(onh),lfi(pnh),lfi(qnh),lfi(rnh),lfi(snh),lfi(unh),lfi(vnh),lfi(wnh),lfi(xnh),lfi(ynh),lfi(znh),lfi(Anh),lfi(Bnh),lfi(Cnh),lfi(Dnh),lfi(Fnh),lfi(aoh),lfi(boh),lfi(coh),lfi(doh),lfi(eoh),lfi(foh),lfi(goh),lfi(hoh),lfi(ioh),lfi(koh),lfi(loh),lfi(moh),lfi(noh),lfi(ooh),lfi(poh),lfi(qoh),lfi(roh),lfi(soh),lfi(toh),lfi(voh),lfi(woh),lfi(xoh),lfi(yoh),lfi(zoh),lfi(Aoh),lfi(Boh),lfi(Coh),lfi(Doh),lfi(Eoh),lfi(aph),lfi(bph),lfi(cph),lfi(dph),lfi(eph),lfi(fph),lfi(gph),lfi(hph),lfi(iph),lfi(jph),lfi(mph),lfi(nph),lfi(oph),lfi(pph),lfi(qph),lfi(rph),lfi(sph),lfi(tph),lfi(uph),lfi(vph),lfi(xph),lfi(yph),lfi(zph),lfi(Aph),lfi(Bph),lfi(Cph),lfi(Dph),lfi(Eph),lfi(Fph),lfi(aqh),lfi(cqh),lfi(dqh),lfi(eqh),lfi(fqh),lfi(gqh),lfi(hqh),lfi(iqh),lfi(jqh),lfi(kqh),lfi(lqh),lfi(nqh),lfi(oqh),lfi(pqh),lfi(qqh),lfi(rqh),lfi(sqh),lfi(tqh),lfi(uqh),lfi(vqh),lfi(wqh),lfi(yqh),lfi(zqh),lfi(Aqh),lfi(Bqh),lfi(Cqh),lfi(Dqh),lfi(Eqh),lfi(Fqh),lfi(arh),lfi(brh),lfi(drh),lfi(erh),lfi(frh),lfi(grh),lfi(hrh),lfi(irh),lfi(jrh),lfi(krh),lfi(lrh),lfi(mrh),lfi(orh),lfi(prh),lfi(qrh),lfi(rrh),lfi(srh),lfi(trh),lfi(urh),lfi(vrh),lfi(wrh),lfi(xrh),lfi(zrh),lfi(Arh),lfi(Brh),lfi(Crh),lfi(Drh),lfi(Erh),lfi(Frh),lfi(ash),lfi(bsh),lfi(csh),lfi(esh),lfi(fsh),lfi(gsh),lfi(hsh),lfi(ish),lfi(jsh),lfi(ksh),lfi(lsh),lfi(msh),lfi(nsh),lfi(psh),lfi(qsh),lfi(rsh),lfi(ssh),lfi(tsh),lfi(ush),lfi(vsh),lfi(wsh),lfi(xsh),lfi(ysh),lfi(Bsh),lfi(Csh),lfi(Dsh),lfi(Esh),lfi(Fsh),lfi(ath),lfi(bth),lfi(cth),lfi(dth),lfi(eth),lfi(gth),lfi(hth),lfi(ith),lfi(jth),lfi(kth),lfi(lth),lfi(mth),lfi(nth),lfi(oth),lfi(pth),lfi(rth),lfi(sth),lfi(tth),lfi(uth),lfi(vth),lfi(wth),lfi(xth),lfi(yth),lfi(zth),lfi(Ath),lfi(Cth),lfi(Dth),lfi(Eth),lfi(Fth),lfi(auh),lfi(buh),lfi(cuh),lfi(duh),lfi(euh),lfi(fuh),lfi(huh),lfi(iuh),lfi(juh),lfi(kuh),lfi(luh),lfi(muh),lfi(nuh),lfi(ouh),lfi(puh),lfi(quh),lfi(suh),lfi(tuh),lfi(uuh),lfi(vuh),lfi(wuh),lfi(xuh),lfi(yuh),lfi(zuh),lfi(Auh),lfi(Buh),lfi(Duh),lfi(Euh),lfi(Fuh),lfi(avh),lfi(bvh),lfi(cvh),lfi(dvh),lfi(evh),lfi(fvh),lfi(gvh),lfi(ivh),lfi(jvh),lfi(kvh),lfi(lvh),lfi(mvh),lfi(nvh),lfi(ovh),lfi(pvh),lfi(qvh),lfi(rvh),lfi(tvh),lfi(uvh),lfi(vvh),lfi(wvh),lfi(xvh),lfi(yvh),lfi(zvh),lfi(Avh),lfi(Bvh),lfi(Cvh),lfi(Evh),lfi(Fvh),lfi(awh),lfi(bwh),lfi(cwh),lfi(dwh),lfi(ewh),lfi(fwh),lfi(gwh),lfi(hwh),lfi(lwh),lfi(mwh),lfi(nwh),lfi(owh),lfi(pwh),lfi(qwh),lfi(rwh),lfi(swh),lfi(twh),lfi(uwh),lfi(wwh),lfi(xwh),lfi(ywh),lfi(zwh),lfi(Awh),lfi(Bwh),lfi(Cwh),lfi(Dwh),lfi(Ewh),lfi(Fwh),lfi(bxh),lfi(cxh),lfi(dxh),lfi(exh),lfi(fxh),lfi(gxh),lfi(hxh),lfi(ixh),lfi(jxh),lfi(kxh),lfi(mxh),lfi(nxh),lfi(oxh),lfi(pxh),lfi(qxh),lfi(rxh),lfi(sxh),lfi(txh),lfi(uxh),lfi(vxh),lfi(xxh),lfi(yxh),lfi(zxh),lfi(Axh),lfi(Bxh),lfi(Cxh),lfi(Dxh),lfi(Exh),lfi(Fxh),lfi(ayh),lfi(cyh),lfi(dyh),lfi(eyh),lfi(fyh),lfi(gyh),lfi(hyh),lfi(iyh),lfi(jyh),lfi(kyh),lfi(lyh),lfi(nyh),lfi(oyh),lfi(pyh),lfi(qyh),lfi(ryh),lfi(syh),lfi(tyh),lfi(uyh),lfi(vyh),lfi(wyh),lfi(yyh),lfi(zyh),lfi(Ayh),lfi(Byh),lfi(Cyh),lfi(Dyh),lfi(Eyh),lfi(Fyh),lfi(azh),lfi(bzh),lfi(dzh),lfi(ezh),lfi(fzh),lfi(gzh),lfi(hzh),lfi(izh),lfi(jzh),lfi(kzh),lfi(lzh),lfi(mzh),lfi(ozh),lfi(pzh),lfi(qzh),lfi(rzh),lfi(szh),lfi(tzh),lfi(uzh),lfi(vzh),lfi(wzh),lfi(xzh),lfi(Azh),lfi(Bzh),lfi(Czh),lfi(Dzh),lfi(Ezh),lfi(Fzh),lfi(aAh),lfi(bAh),lfi(cAh),lfi(dAh),lfi(fAh),lfi(gAh),lfi(hAh),lfi(iAh),lfi(jAh),lfi(kAh),lfi(lAh),lfi(mAh),lfi(nAh),lfi(oAh),lfi(qAh),lfi(rAh),lfi(sAh),lfi(tAh),lfi(uAh),lfi(vAh),lfi(wAh),lfi(xAh),lfi(yAh),lfi(zAh),lfi(BAh),lfi(CAh),lfi(DAh),lfi(EAh),lfi(FAh),lfi(aBh),lfi(bBh),lfi(cBh),lfi(dBh),lfi(eBh),lfi(gBh),lfi(hBh),lfi(iBh),lfi(jBh),lfi(kBh),lfi(lBh),lfi(mBh),lfi(nBh),lfi(oBh),lfi(pBh),lfi(rBh),lfi(sBh),lfi(tBh),lfi(uBh),lfi(vBh),lfi(wBh),lfi(xBh),lfi(yBh),lfi(zBh),lfi(ABh),lfi(CBh),lfi(DBh),lfi(EBh),lfi(r6h),lfi(FBh),lfi(aCh),lfi(bCh),lfi(cCh),lfi(dCh),lfi(eCh),lfi(fCh),lfi(hCh),lfi(iCh),lfi(jCh),lfi(kCh),lfi(lCh),lfi(mCh),lfi(nCh),lfi(oCh),lfi(pCh),lfi(qCh),lfi(sCh),lfi(tCh),lfi(uCh),lfi(vCh),lfi(wCh),lfi(xCh),lfi(yCh),lfi(zCh),lfi(ACh),lfi(BCh),lfi(DCh),lfi(ECh),lfi(FCh),lfi(aDh),lfi(bDh),lfi(cDh),lfi(dDh),lfi(eDh),lfi(fDh),lfi(gDh),lfi(jDh),lfi(kDh),lfi(lDh),lfi(mDh),lfi(nDh),lfi(oDh),lfi(pDh),lfi(qDh),lfi(rDh),lfi(sDh),lfi(uDh),lfi(vDh),lfi(wDh),lfi(xDh),lfi(yDh),lfi(zDh),lfi(ADh),lfi(BDh),lfi(CDh),lfi(DDh),lfi(FDh),lfi(aEh),lfi(bEh),lfi(cEh),lfi(dEh),lfi(eEh),lfi(fEh),lfi(gEh),lfi(hEh),lfi(iEh),lfi(kEh),lfi(lEh),lfi(mEh),lfi(nEh),lfi(oEh),lfi(pEh),lfi(qEh),lfi(rEh),lfi(sEh),lfi(tEh),lfi(vEh),lfi(wEh),lfi(xEh),lfi(yEh),lfi(zEh),lfi(AEh),lfi(BEh),lfi(CEh),lfi(DEh),lfi(EEh),lfi(aFh),lfi(bFh),lfi(cFh),lfi(dFh),lfi(eFh),lfi(fFh),lfi(gFh),lfi(hFh),lfi(iFh),lfi(jFh),lfi(lFh),lfi(mFh),lfi(nFh),lfi(oFh),lfi(pFh),lfi(qFh),lfi(rFh),lfi(sFh),lfi(tFh),lfi(uFh),lfi(wFh),lfi(xFh),lfi(yFh),lfi(zFh),lfi(AFh),lfi(BFh),lfi(CFh),lfi(DFh),lfi(EFh),lfi(FFh),lfi(bGh),lfi(cGh),lfi(dGh),lfi(eGh),lfi(fGh),lfi(gGh),lfi(hGh),lfi(iGh),lfi(jGh),lfi(kGh),lfi(mGh),lfi(nGh),lfi(oGh),lfi(pGh),lfi(qGh),lfi(rGh),lfi(sGh),lfi(tGh),lfi(uGh),lfi(vGh),lfi(yGh),lfi(zGh),lfi(AGh),lfi(BGh),lfi(CGh),lfi(DGh),lfi(EGh),lfi(FGh),lfi(aHh),lfi(bHh),lfi(dHh),lfi(eHh),lfi(fHh),lfi(gHh),lfi(hHh),lfi(iHh),lfi(jHh),lfi(kHh),lfi(lHh),lfi(mHh),lfi(oHh),lfi(pHh),lfi(qHh),lfi(rHh),lfi(sHh),lfi(tHh),lfi(uHh),lfi(vHh),lfi(wHh),lfi(xHh),lfi(zHh),lfi(AHh),lfi(BHh),lfi(CHh),lfi(DHh),lfi(EHh),lfi(FHh),lfi(aIh),lfi(bIh),lfi(cIh),lfi(eIh),lfi(fIh),lfi(gIh),lfi(hIh)]);tVi=f9h(cai,52,12,[f9h(A_h,42,-1,[198]),f9h(A_h,42,-1,[198]),f9h(A_h,42,-1,[38]),f9h(A_h,42,-1,[38]),f9h(A_h,42,-1,[193]),f9h(A_h,42,-1,[193]),f9h(A_h,42,-1,[258]),f9h(A_h,42,-1,[194]),f9h(A_h,42,-1,[194]),f9h(A_h,42,-1,[1040]),f9h(A_h,42,-1,[55349,56580]),f9h(A_h,42,-1,[192]),f9h(A_h,42,-1,[192]),f9h(A_h,42,-1,[913]),f9h(A_h,42,-1,[256]),f9h(A_h,42,-1,[10835]),f9h(A_h,42,-1,[260]),f9h(A_h,42,-1,[55349,56632]),f9h(A_h,42,-1,[8289]),f9h(A_h,42,-1,[197]),f9h(A_h,42,-1,[197]),f9h(A_h,42,-1,[55349,56476]),f9h(A_h,42,-1,[8788]),f9h(A_h,42,-1,[195]),f9h(A_h,42,-1,[195]),f9h(A_h,42,-1,[196]),f9h(A_h,42,-1,[196]),f9h(A_h,42,-1,[8726]),f9h(A_h,42,-1,[10983]),f9h(A_h,42,-1,[8966]),f9h(A_h,42,-1,[1041]),f9h(A_h,42,-1,[8757]),f9h(A_h,42,-1,[8492]),f9h(A_h,42,-1,[914]),f9h(A_h,42,-1,[55349,56581]),f9h(A_h,42,-1,[55349,56633]),f9h(A_h,42,-1,[728]),f9h(A_h,42,-1,[8492]),f9h(A_h,42,-1,[8782]),f9h(A_h,42,-1,[1063]),f9h(A_h,42,-1,[169]),f9h(A_h,42,-1,[169]),f9h(A_h,42,-1,[262]),f9h(A_h,42,-1,[8914]),f9h(A_h,42,-1,[8517]),f9h(A_h,42,-1,[8493]),f9h(A_h,42,-1,[268]),f9h(A_h,42,-1,[199]),f9h(A_h,42,-1,[199]),f9h(A_h,42,-1,[264]),f9h(A_h,42,-1,[8752]),f9h(A_h,42,-1,[266]),f9h(A_h,42,-1,[184]),f9h(A_h,42,-1,[183]),f9h(A_h,42,-1,[8493]),f9h(A_h,42,-1,[935]),f9h(A_h,42,-1,[8857]),f9h(A_h,42,-1,[8854]),f9h(A_h,42,-1,[8853]),f9h(A_h,42,-1,[8855]),f9h(A_h,42,-1,[8754]),f9h(A_h,42,-1,[8221]),f9h(A_h,42,-1,[8217]),f9h(A_h,42,-1,[8759]),f9h(A_h,42,-1,[10868]),f9h(A_h,42,-1,[8801]),f9h(A_h,42,-1,[8751]),f9h(A_h,42,-1,[8750]),f9h(A_h,42,-1,[8450]),f9h(A_h,42,-1,[8720]),f9h(A_h,42,-1,[8755]),f9h(A_h,42,-1,[10799]),f9h(A_h,42,-1,[55349,56478]),f9h(A_h,42,-1,[8915]),f9h(A_h,42,-1,[8781]),f9h(A_h,42,-1,[8517]),f9h(A_h,42,-1,[10513]),f9h(A_h,42,-1,[1026]),f9h(A_h,42,-1,[1029]),f9h(A_h,42,-1,[1039]),f9h(A_h,42,-1,[8225]),f9h(A_h,42,-1,[8609]),f9h(A_h,42,-1,[10980]),f9h(A_h,42,-1,[270]),f9h(A_h,42,-1,[1044]),f9h(A_h,42,-1,[8711]),f9h(A_h,42,-1,[916]),f9h(A_h,42,-1,[55349,56583]),f9h(A_h,42,-1,[180]),f9h(A_h,42,-1,[729]),f9h(A_h,42,-1,[733]),f9h(A_h,42,-1,[96]),f9h(A_h,42,-1,[732]),f9h(A_h,42,-1,[8900]),f9h(A_h,42,-1,[8518]),f9h(A_h,42,-1,[55349,56635]),f9h(A_h,42,-1,[168]),f9h(A_h,42,-1,[8412]),f9h(A_h,42,-1,[8784]),f9h(A_h,42,-1,[8751]),f9h(A_h,42,-1,[168]),f9h(A_h,42,-1,[8659]),f9h(A_h,42,-1,[8656]),f9h(A_h,42,-1,[8660]),f9h(A_h,42,-1,[10980]),f9h(A_h,42,-1,[10232]),f9h(A_h,42,-1,[10234]),f9h(A_h,42,-1,[10233]),f9h(A_h,42,-1,[8658]),f9h(A_h,42,-1,[8872]),f9h(A_h,42,-1,[8657]),f9h(A_h,42,-1,[8661]),f9h(A_h,42,-1,[8741]),f9h(A_h,42,-1,[8595]),f9h(A_h,42,-1,[10515]),f9h(A_h,42,-1,[8693]),f9h(A_h,42,-1,[785]),f9h(A_h,42,-1,[10576]),f9h(A_h,42,-1,[10590]),f9h(A_h,42,-1,[8637]),f9h(A_h,42,-1,[10582]),f9h(A_h,42,-1,[10591]),f9h(A_h,42,-1,[8641]),f9h(A_h,42,-1,[10583]),f9h(A_h,42,-1,[8868]),f9h(A_h,42,-1,[8615]),f9h(A_h,42,-1,[8659]),f9h(A_h,42,-1,[55349,56479]),f9h(A_h,42,-1,[272]),f9h(A_h,42,-1,[330]),f9h(A_h,42,-1,[208]),f9h(A_h,42,-1,[208]),f9h(A_h,42,-1,[201]),f9h(A_h,42,-1,[201]),f9h(A_h,42,-1,[282]),f9h(A_h,42,-1,[202]),f9h(A_h,42,-1,[202]),f9h(A_h,42,-1,[1069]),f9h(A_h,42,-1,[278]),f9h(A_h,42,-1,[55349,56584]),f9h(A_h,42,-1,[200]),f9h(A_h,42,-1,[200]),f9h(A_h,42,-1,[8712]),f9h(A_h,42,-1,[274]),f9h(A_h,42,-1,[9723]),f9h(A_h,42,-1,[9643]),f9h(A_h,42,-1,[280]),f9h(A_h,42,-1,[55349,56636]),f9h(A_h,42,-1,[917]),f9h(A_h,42,-1,[10869]),f9h(A_h,42,-1,[8770]),f9h(A_h,42,-1,[8652]),f9h(A_h,42,-1,[8496]),f9h(A_h,42,-1,[10867]),f9h(A_h,42,-1,[919]),f9h(A_h,42,-1,[203]),f9h(A_h,42,-1,[203]),f9h(A_h,42,-1,[8707]),f9h(A_h,42,-1,[8519]),f9h(A_h,42,-1,[1060]),f9h(A_h,42,-1,[55349,56585]),f9h(A_h,42,-1,[9724]),f9h(A_h,42,-1,[9642]),f9h(A_h,42,-1,[55349,56637]),f9h(A_h,42,-1,[8704]),f9h(A_h,42,-1,[8497]),f9h(A_h,42,-1,[8497]),f9h(A_h,42,-1,[1027]),f9h(A_h,42,-1,[62]),f9h(A_h,42,-1,[62]),f9h(A_h,42,-1,[915]),f9h(A_h,42,-1,[988]),f9h(A_h,42,-1,[286]),f9h(A_h,42,-1,[290]),f9h(A_h,42,-1,[284]),f9h(A_h,42,-1,[1043]),f9h(A_h,42,-1,[288]),f9h(A_h,42,-1,[55349,56586]),f9h(A_h,42,-1,[8921]),f9h(A_h,42,-1,[55349,56638]),f9h(A_h,42,-1,[8805]),f9h(A_h,42,-1,[8923]),f9h(A_h,42,-1,[8807]),f9h(A_h,42,-1,[10914]),f9h(A_h,42,-1,[8823]),f9h(A_h,42,-1,[10878]),f9h(A_h,42,-1,[8819]),f9h(A_h,42,-1,[55349,56482]),f9h(A_h,42,-1,[8811]),f9h(A_h,42,-1,[1066]),f9h(A_h,42,-1,[711]),f9h(A_h,42,-1,[94]),f9h(A_h,42,-1,[292]),f9h(A_h,42,-1,[8460]),f9h(A_h,42,-1,[8459]),f9h(A_h,42,-1,[8461]),f9h(A_h,42,-1,[9472]),f9h(A_h,42,-1,[8459]),f9h(A_h,42,-1,[294]),f9h(A_h,42,-1,[8782]),f9h(A_h,42,-1,[8783]),f9h(A_h,42,-1,[1045]),f9h(A_h,42,-1,[306]),f9h(A_h,42,-1,[1025]),f9h(A_h,42,-1,[205]),f9h(A_h,42,-1,[205]),f9h(A_h,42,-1,[206]),f9h(A_h,42,-1,[206]),f9h(A_h,42,-1,[1048]),f9h(A_h,42,-1,[304]),f9h(A_h,42,-1,[8465]),f9h(A_h,42,-1,[204]),f9h(A_h,42,-1,[204]),f9h(A_h,42,-1,[8465]),f9h(A_h,42,-1,[298]),f9h(A_h,42,-1,[8520]),f9h(A_h,42,-1,[8658]),f9h(A_h,42,-1,[8748]),f9h(A_h,42,-1,[8747]),f9h(A_h,42,-1,[8898]),f9h(A_h,42,-1,[8291]),f9h(A_h,42,-1,[8290]),f9h(A_h,42,-1,[302]),f9h(A_h,42,-1,[55349,56640]),f9h(A_h,42,-1,[921]),f9h(A_h,42,-1,[8464]),f9h(A_h,42,-1,[296]),f9h(A_h,42,-1,[1030]),f9h(A_h,42,-1,[207]),f9h(A_h,42,-1,[207]),f9h(A_h,42,-1,[308]),f9h(A_h,42,-1,[1049]),f9h(A_h,42,-1,[55349,56589]),f9h(A_h,42,-1,[55349,56641]),f9h(A_h,42,-1,[55349,56485]),f9h(A_h,42,-1,[1032]),f9h(A_h,42,-1,[1028]),f9h(A_h,42,-1,[1061]),f9h(A_h,42,-1,[1036]),f9h(A_h,42,-1,[922]),f9h(A_h,42,-1,[310]),f9h(A_h,42,-1,[1050]),f9h(A_h,42,-1,[55349,56590]),f9h(A_h,42,-1,[55349,56642]),f9h(A_h,42,-1,[55349,56486]),f9h(A_h,42,-1,[1033]),f9h(A_h,42,-1,[60]),f9h(A_h,42,-1,[60]),f9h(A_h,42,-1,[313]),f9h(A_h,42,-1,[923]),f9h(A_h,42,-1,[10218]),f9h(A_h,42,-1,[8466]),f9h(A_h,42,-1,[8606]),f9h(A_h,42,-1,[317]),f9h(A_h,42,-1,[315]),f9h(A_h,42,-1,[1051]),f9h(A_h,42,-1,[10216]),f9h(A_h,42,-1,[8592]),f9h(A_h,42,-1,[8676]),f9h(A_h,42,-1,[8646]),f9h(A_h,42,-1,[8968]),f9h(A_h,42,-1,[10214]),f9h(A_h,42,-1,[10593]),f9h(A_h,42,-1,[8643]),f9h(A_h,42,-1,[10585]),f9h(A_h,42,-1,[8970]),f9h(A_h,42,-1,[8596]),f9h(A_h,42,-1,[10574]),f9h(A_h,42,-1,[8867]),f9h(A_h,42,-1,[8612]),f9h(A_h,42,-1,[10586]),f9h(A_h,42,-1,[8882]),f9h(A_h,42,-1,[10703]),f9h(A_h,42,-1,[8884]),f9h(A_h,42,-1,[10577]),f9h(A_h,42,-1,[10592]),f9h(A_h,42,-1,[8639]),f9h(A_h,42,-1,[10584]),f9h(A_h,42,-1,[8636]),f9h(A_h,42,-1,[10578]),f9h(A_h,42,-1,[8656]),f9h(A_h,42,-1,[8660]),f9h(A_h,42,-1,[8922]),f9h(A_h,42,-1,[8806]),f9h(A_h,42,-1,[8822]),f9h(A_h,42,-1,[10913]),f9h(A_h,42,-1,[10877]),f9h(A_h,42,-1,[8818]),f9h(A_h,42,-1,[55349,56591]),f9h(A_h,42,-1,[8920]),f9h(A_h,42,-1,[8666]),f9h(A_h,42,-1,[319]),f9h(A_h,42,-1,[10229]),f9h(A_h,42,-1,[10231]),f9h(A_h,42,-1,[10230]),f9h(A_h,42,-1,[10232]),f9h(A_h,42,-1,[10234]),f9h(A_h,42,-1,[10233]),f9h(A_h,42,-1,[55349,56643]),f9h(A_h,42,-1,[8601]),f9h(A_h,42,-1,[8600]),f9h(A_h,42,-1,[8466]),f9h(A_h,42,-1,[8624]),f9h(A_h,42,-1,[321]),f9h(A_h,42,-1,[8810]),f9h(A_h,42,-1,[10501]),f9h(A_h,42,-1,[1052]),f9h(A_h,42,-1,[8287]),f9h(A_h,42,-1,[8499]),f9h(A_h,42,-1,[55349,56592]),f9h(A_h,42,-1,[8723]),f9h(A_h,42,-1,[55349,56644]),f9h(A_h,42,-1,[8499]),f9h(A_h,42,-1,[924]),f9h(A_h,42,-1,[1034]),f9h(A_h,42,-1,[323]),f9h(A_h,42,-1,[327]),f9h(A_h,42,-1,[325]),f9h(A_h,42,-1,[1053]),f9h(A_h,42,-1,[8203]),f9h(A_h,42,-1,[8203]),f9h(A_h,42,-1,[8203]),f9h(A_h,42,-1,[8203]),f9h(A_h,42,-1,[8811]),f9h(A_h,42,-1,[8810]),f9h(A_h,42,-1,[10]),f9h(A_h,42,-1,[55349,56593]),f9h(A_h,42,-1,[8288]),f9h(A_h,42,-1,[160]),f9h(A_h,42,-1,[8469]),f9h(A_h,42,-1,[10988]),f9h(A_h,42,-1,[8802]),f9h(A_h,42,-1,[8813]),f9h(A_h,42,-1,[8742]),f9h(A_h,42,-1,[8713]),f9h(A_h,42,-1,[8800]),f9h(A_h,42,-1,[8708]),f9h(A_h,42,-1,[8815]),f9h(A_h,42,-1,[8817]),f9h(A_h,42,-1,[8825]),f9h(A_h,42,-1,[8821]),f9h(A_h,42,-1,[8938]),f9h(A_h,42,-1,[8940]),f9h(A_h,42,-1,[8814]),f9h(A_h,42,-1,[8816]),f9h(A_h,42,-1,[8824]),f9h(A_h,42,-1,[8820]),f9h(A_h,42,-1,[8832]),f9h(A_h,42,-1,[8928]),f9h(A_h,42,-1,[8716]),f9h(A_h,42,-1,[8939]),f9h(A_h,42,-1,[8941]),f9h(A_h,42,-1,[8930]),f9h(A_h,42,-1,[8931]),f9h(A_h,42,-1,[8840]),f9h(A_h,42,-1,[8833]),f9h(A_h,42,-1,[8929]),f9h(A_h,42,-1,[8841]),f9h(A_h,42,-1,[8769]),f9h(A_h,42,-1,[8772]),f9h(A_h,42,-1,[8775]),f9h(A_h,42,-1,[8777]),f9h(A_h,42,-1,[8740]),f9h(A_h,42,-1,[55349,56489]),f9h(A_h,42,-1,[209]),f9h(A_h,42,-1,[209]),f9h(A_h,42,-1,[925]),f9h(A_h,42,-1,[338]),f9h(A_h,42,-1,[211]),f9h(A_h,42,-1,[211]),f9h(A_h,42,-1,[212]),f9h(A_h,42,-1,[212]),f9h(A_h,42,-1,[1054]),f9h(A_h,42,-1,[336]),f9h(A_h,42,-1,[55349,56594]),f9h(A_h,42,-1,[210]),f9h(A_h,42,-1,[210]),f9h(A_h,42,-1,[332]),f9h(A_h,42,-1,[937]),f9h(A_h,42,-1,[927]),f9h(A_h,42,-1,[55349,56646]),f9h(A_h,42,-1,[8220]),f9h(A_h,42,-1,[8216]),f9h(A_h,42,-1,[10836]),f9h(A_h,42,-1,[55349,56490]),f9h(A_h,42,-1,[216]),f9h(A_h,42,-1,[216]),f9h(A_h,42,-1,[213]),f9h(A_h,42,-1,[213]),f9h(A_h,42,-1,[10807]),f9h(A_h,42,-1,[214]),f9h(A_h,42,-1,[214]),f9h(A_h,42,-1,[175]),f9h(A_h,42,-1,[9182]),f9h(A_h,42,-1,[9140]),f9h(A_h,42,-1,[9180]),f9h(A_h,42,-1,[8706]),f9h(A_h,42,-1,[1055]),f9h(A_h,42,-1,[55349,56595]),f9h(A_h,42,-1,[934]),f9h(A_h,42,-1,[928]),f9h(A_h,42,-1,[177]),f9h(A_h,42,-1,[8460]),f9h(A_h,42,-1,[8473]),f9h(A_h,42,-1,[10939]),f9h(A_h,42,-1,[8826]),f9h(A_h,42,-1,[10927]),f9h(A_h,42,-1,[8828]),f9h(A_h,42,-1,[8830]),f9h(A_h,42,-1,[8243]),f9h(A_h,42,-1,[8719]),f9h(A_h,42,-1,[8759]),f9h(A_h,42,-1,[8733]),f9h(A_h,42,-1,[55349,56491]),f9h(A_h,42,-1,[936]),f9h(A_h,42,-1,[34]),f9h(A_h,42,-1,[34]),f9h(A_h,42,-1,[55349,56596]),f9h(A_h,42,-1,[8474]),f9h(A_h,42,-1,[55349,56492]),f9h(A_h,42,-1,[10512]),f9h(A_h,42,-1,[174]),f9h(A_h,42,-1,[174]),f9h(A_h,42,-1,[340]),f9h(A_h,42,-1,[10219]),f9h(A_h,42,-1,[8608]),f9h(A_h,42,-1,[10518]),f9h(A_h,42,-1,[344]),f9h(A_h,42,-1,[342]),f9h(A_h,42,-1,[1056]),f9h(A_h,42,-1,[8476]),f9h(A_h,42,-1,[8715]),f9h(A_h,42,-1,[8651]),f9h(A_h,42,-1,[10607]),f9h(A_h,42,-1,[8476]),f9h(A_h,42,-1,[929]),f9h(A_h,42,-1,[10217]),f9h(A_h,42,-1,[8594]),f9h(A_h,42,-1,[8677]),f9h(A_h,42,-1,[8644]),f9h(A_h,42,-1,[8969]),f9h(A_h,42,-1,[10215]),f9h(A_h,42,-1,[10589]),f9h(A_h,42,-1,[8642]),f9h(A_h,42,-1,[10581]),f9h(A_h,42,-1,[8971]),f9h(A_h,42,-1,[8866]),f9h(A_h,42,-1,[8614]),f9h(A_h,42,-1,[10587]),f9h(A_h,42,-1,[8883]),f9h(A_h,42,-1,[10704]),f9h(A_h,42,-1,[8885]),f9h(A_h,42,-1,[10575]),f9h(A_h,42,-1,[10588]),f9h(A_h,42,-1,[8638]),f9h(A_h,42,-1,[10580]),f9h(A_h,42,-1,[8640]),f9h(A_h,42,-1,[10579]),f9h(A_h,42,-1,[8658]),f9h(A_h,42,-1,[8477]),f9h(A_h,42,-1,[10608]),f9h(A_h,42,-1,[8667]),f9h(A_h,42,-1,[8475]),f9h(A_h,42,-1,[8625]),f9h(A_h,42,-1,[10740]),f9h(A_h,42,-1,[1065]),f9h(A_h,42,-1,[1064]),f9h(A_h,42,-1,[1068]),f9h(A_h,42,-1,[346]),f9h(A_h,42,-1,[10940]),f9h(A_h,42,-1,[352]),f9h(A_h,42,-1,[350]),f9h(A_h,42,-1,[348]),f9h(A_h,42,-1,[1057]),f9h(A_h,42,-1,[55349,56598]),f9h(A_h,42,-1,[8595]),f9h(A_h,42,-1,[8592]),f9h(A_h,42,-1,[8594]),f9h(A_h,42,-1,[8593]),f9h(A_h,42,-1,[931]),f9h(A_h,42,-1,[8728]),f9h(A_h,42,-1,[55349,56650]),f9h(A_h,42,-1,[8730]),f9h(A_h,42,-1,[9633]),f9h(A_h,42,-1,[8851]),f9h(A_h,42,-1,[8847]),f9h(A_h,42,-1,[8849]),f9h(A_h,42,-1,[8848]),f9h(A_h,42,-1,[8850]),f9h(A_h,42,-1,[8852]),f9h(A_h,42,-1,[55349,56494]),f9h(A_h,42,-1,[8902]),f9h(A_h,42,-1,[8912]),f9h(A_h,42,-1,[8912]),f9h(A_h,42,-1,[8838]),f9h(A_h,42,-1,[8827]),f9h(A_h,42,-1,[10928]),f9h(A_h,42,-1,[8829]),f9h(A_h,42,-1,[8831]),f9h(A_h,42,-1,[8715]),f9h(A_h,42,-1,[8721]),f9h(A_h,42,-1,[8913]),f9h(A_h,42,-1,[8835]),f9h(A_h,42,-1,[8839]),f9h(A_h,42,-1,[8913]),f9h(A_h,42,-1,[222]),f9h(A_h,42,-1,[222]),f9h(A_h,42,-1,[8482]),f9h(A_h,42,-1,[1035]),f9h(A_h,42,-1,[1062]),f9h(A_h,42,-1,[9]),f9h(A_h,42,-1,[932]),f9h(A_h,42,-1,[356]),f9h(A_h,42,-1,[354]),f9h(A_h,42,-1,[1058]),f9h(A_h,42,-1,[55349,56599]),f9h(A_h,42,-1,[8756]),f9h(A_h,42,-1,[920]),f9h(A_h,42,-1,[8201]),f9h(A_h,42,-1,[8764]),f9h(A_h,42,-1,[8771]),f9h(A_h,42,-1,[8773]),f9h(A_h,42,-1,[8776]),f9h(A_h,42,-1,[55349,56651]),f9h(A_h,42,-1,[8411]),f9h(A_h,42,-1,[55349,56495]),f9h(A_h,42,-1,[358]),f9h(A_h,42,-1,[218]),f9h(A_h,42,-1,[218]),f9h(A_h,42,-1,[8607]),f9h(A_h,42,-1,[10569]),f9h(A_h,42,-1,[1038]),f9h(A_h,42,-1,[364]),f9h(A_h,42,-1,[219]),f9h(A_h,42,-1,[219]),f9h(A_h,42,-1,[1059]),f9h(A_h,42,-1,[368]),f9h(A_h,42,-1,[55349,56600]),f9h(A_h,42,-1,[217]),f9h(A_h,42,-1,[217]),f9h(A_h,42,-1,[362]),f9h(A_h,42,-1,[818]),f9h(A_h,42,-1,[9183]),f9h(A_h,42,-1,[9141]),f9h(A_h,42,-1,[9181]),f9h(A_h,42,-1,[8899]),f9h(A_h,42,-1,[8846]),f9h(A_h,42,-1,[370]),f9h(A_h,42,-1,[55349,56652]),f9h(A_h,42,-1,[8593]),f9h(A_h,42,-1,[10514]),f9h(A_h,42,-1,[8645]),f9h(A_h,42,-1,[8597]),f9h(A_h,42,-1,[10606]),f9h(A_h,42,-1,[8869]),f9h(A_h,42,-1,[8613]),f9h(A_h,42,-1,[8657]),f9h(A_h,42,-1,[8661]),f9h(A_h,42,-1,[8598]),f9h(A_h,42,-1,[8599]),f9h(A_h,42,-1,[978]),f9h(A_h,42,-1,[933]),f9h(A_h,42,-1,[366]),f9h(A_h,42,-1,[55349,56496]),f9h(A_h,42,-1,[360]),f9h(A_h,42,-1,[220]),f9h(A_h,42,-1,[220]),f9h(A_h,42,-1,[8875]),f9h(A_h,42,-1,[10987]),f9h(A_h,42,-1,[1042]),f9h(A_h,42,-1,[8873]),f9h(A_h,42,-1,[10982]),f9h(A_h,42,-1,[8897]),f9h(A_h,42,-1,[8214]),f9h(A_h,42,-1,[8214]),f9h(A_h,42,-1,[8739]),f9h(A_h,42,-1,[124]),f9h(A_h,42,-1,[10072]),f9h(A_h,42,-1,[8768]),f9h(A_h,42,-1,[8202]),f9h(A_h,42,-1,[55349,56601]),f9h(A_h,42,-1,[55349,56653]),f9h(A_h,42,-1,[55349,56497]),f9h(A_h,42,-1,[8874]),f9h(A_h,42,-1,[372]),f9h(A_h,42,-1,[8896]),f9h(A_h,42,-1,[55349,56602]),f9h(A_h,42,-1,[55349,56654]),f9h(A_h,42,-1,[55349,56498]),f9h(A_h,42,-1,[55349,56603]),f9h(A_h,42,-1,[926]),f9h(A_h,42,-1,[55349,56655]),f9h(A_h,42,-1,[55349,56499]),f9h(A_h,42,-1,[1071]),f9h(A_h,42,-1,[1031]),f9h(A_h,42,-1,[1070]),f9h(A_h,42,-1,[221]),f9h(A_h,42,-1,[221]),f9h(A_h,42,-1,[374]),f9h(A_h,42,-1,[1067]),f9h(A_h,42,-1,[55349,56604]),f9h(A_h,42,-1,[55349,56656]),f9h(A_h,42,-1,[55349,56500]),f9h(A_h,42,-1,[376]),f9h(A_h,42,-1,[1046]),f9h(A_h,42,-1,[377]),f9h(A_h,42,-1,[381]),f9h(A_h,42,-1,[1047]),f9h(A_h,42,-1,[379]),f9h(A_h,42,-1,[8203]),f9h(A_h,42,-1,[918]),f9h(A_h,42,-1,[8488]),f9h(A_h,42,-1,[8484]),f9h(A_h,42,-1,[55349,56501]),f9h(A_h,42,-1,[225]),f9h(A_h,42,-1,[225]),f9h(A_h,42,-1,[259]),f9h(A_h,42,-1,[8766]),f9h(A_h,42,-1,[8767]),f9h(A_h,42,-1,[226]),f9h(A_h,42,-1,[226]),f9h(A_h,42,-1,[180]),f9h(A_h,42,-1,[180]),f9h(A_h,42,-1,[1072]),f9h(A_h,42,-1,[230]),f9h(A_h,42,-1,[230]),f9h(A_h,42,-1,[8289]),f9h(A_h,42,-1,[55349,56606]),f9h(A_h,42,-1,[224]),f9h(A_h,42,-1,[224]),f9h(A_h,42,-1,[8501]),f9h(A_h,42,-1,[8501]),f9h(A_h,42,-1,[945]),f9h(A_h,42,-1,[257]),f9h(A_h,42,-1,[10815]),f9h(A_h,42,-1,[38]),f9h(A_h,42,-1,[38]),f9h(A_h,42,-1,[8743]),f9h(A_h,42,-1,[10837]),f9h(A_h,42,-1,[10844]),f9h(A_h,42,-1,[10840]),f9h(A_h,42,-1,[10842]),f9h(A_h,42,-1,[8736]),f9h(A_h,42,-1,[10660]),f9h(A_h,42,-1,[8736]),f9h(A_h,42,-1,[8737]),f9h(A_h,42,-1,[10664]),f9h(A_h,42,-1,[10665]),f9h(A_h,42,-1,[10666]),f9h(A_h,42,-1,[10667]),f9h(A_h,42,-1,[10668]),f9h(A_h,42,-1,[10669]),f9h(A_h,42,-1,[10670]),f9h(A_h,42,-1,[10671]),f9h(A_h,42,-1,[8735]),f9h(A_h,42,-1,[8894]),f9h(A_h,42,-1,[10653]),f9h(A_h,42,-1,[8738]),f9h(A_h,42,-1,[8491]),f9h(A_h,42,-1,[9084]),f9h(A_h,42,-1,[261]),f9h(A_h,42,-1,[55349,56658]),f9h(A_h,42,-1,[8776]),f9h(A_h,42,-1,[10864]),f9h(A_h,42,-1,[10863]),f9h(A_h,42,-1,[8778]),f9h(A_h,42,-1,[8779]),f9h(A_h,42,-1,[39]),f9h(A_h,42,-1,[8776]),f9h(A_h,42,-1,[8778]),f9h(A_h,42,-1,[229]),f9h(A_h,42,-1,[229]),f9h(A_h,42,-1,[55349,56502]),f9h(A_h,42,-1,[42]),f9h(A_h,42,-1,[8776]),f9h(A_h,42,-1,[8781]),f9h(A_h,42,-1,[227]),f9h(A_h,42,-1,[227]),f9h(A_h,42,-1,[228]),f9h(A_h,42,-1,[228]),f9h(A_h,42,-1,[8755]),f9h(A_h,42,-1,[10769]),f9h(A_h,42,-1,[10989]),f9h(A_h,42,-1,[8780]),f9h(A_h,42,-1,[1014]),f9h(A_h,42,-1,[8245]),f9h(A_h,42,-1,[8765]),f9h(A_h,42,-1,[8909]),f9h(A_h,42,-1,[8893]),f9h(A_h,42,-1,[8965]),f9h(A_h,42,-1,[8965]),f9h(A_h,42,-1,[9141]),f9h(A_h,42,-1,[9142]),f9h(A_h,42,-1,[8780]),f9h(A_h,42,-1,[1073]),f9h(A_h,42,-1,[8222]),f9h(A_h,42,-1,[8757]),f9h(A_h,42,-1,[8757]),f9h(A_h,42,-1,[10672]),f9h(A_h,42,-1,[1014]),f9h(A_h,42,-1,[8492]),f9h(A_h,42,-1,[946]),f9h(A_h,42,-1,[8502]),f9h(A_h,42,-1,[8812]),f9h(A_h,42,-1,[55349,56607]),f9h(A_h,42,-1,[8898]),f9h(A_h,42,-1,[9711]),f9h(A_h,42,-1,[8899]),f9h(A_h,42,-1,[10752]),f9h(A_h,42,-1,[10753]),f9h(A_h,42,-1,[10754]),f9h(A_h,42,-1,[10758]),f9h(A_h,42,-1,[9733]),f9h(A_h,42,-1,[9661]),f9h(A_h,42,-1,[9651]),f9h(A_h,42,-1,[10756]),f9h(A_h,42,-1,[8897]),f9h(A_h,42,-1,[8896]),f9h(A_h,42,-1,[10509]),f9h(A_h,42,-1,[10731]),f9h(A_h,42,-1,[9642]),f9h(A_h,42,-1,[9652]),f9h(A_h,42,-1,[9662]),f9h(A_h,42,-1,[9666]),f9h(A_h,42,-1,[9656]),f9h(A_h,42,-1,[9251]),f9h(A_h,42,-1,[9618]),f9h(A_h,42,-1,[9617]),f9h(A_h,42,-1,[9619]),f9h(A_h,42,-1,[9608]),f9h(A_h,42,-1,[8976]),f9h(A_h,42,-1,[55349,56659]),f9h(A_h,42,-1,[8869]),f9h(A_h,42,-1,[8869]),f9h(A_h,42,-1,[8904]),f9h(A_h,42,-1,[9559]),f9h(A_h,42,-1,[9556]),f9h(A_h,42,-1,[9558]),f9h(A_h,42,-1,[9555]),f9h(A_h,42,-1,[9552]),f9h(A_h,42,-1,[9574]),f9h(A_h,42,-1,[9577]),f9h(A_h,42,-1,[9572]),f9h(A_h,42,-1,[9575]),f9h(A_h,42,-1,[9565]),f9h(A_h,42,-1,[9562]),f9h(A_h,42,-1,[9564]),f9h(A_h,42,-1,[9561]),f9h(A_h,42,-1,[9553]),f9h(A_h,42,-1,[9580]),f9h(A_h,42,-1,[9571]),f9h(A_h,42,-1,[9568]),f9h(A_h,42,-1,[9579]),f9h(A_h,42,-1,[9570]),f9h(A_h,42,-1,[9567]),f9h(A_h,42,-1,[10697]),f9h(A_h,42,-1,[9557]),f9h(A_h,42,-1,[9554]),f9h(A_h,42,-1,[9488]),f9h(A_h,42,-1,[9484]),f9h(A_h,42,-1,[9472]),f9h(A_h,42,-1,[9573]),f9h(A_h,42,-1,[9576]),f9h(A_h,42,-1,[9516]),f9h(A_h,42,-1,[9524]),f9h(A_h,42,-1,[8863]),f9h(A_h,42,-1,[8862]),f9h(A_h,42,-1,[8864]),f9h(A_h,42,-1,[9563]),f9h(A_h,42,-1,[9560]),f9h(A_h,42,-1,[9496]),f9h(A_h,42,-1,[9492]),f9h(A_h,42,-1,[9474]),f9h(A_h,42,-1,[9578]),f9h(A_h,42,-1,[9569]),f9h(A_h,42,-1,[9566]),f9h(A_h,42,-1,[9532]),f9h(A_h,42,-1,[9508]),f9h(A_h,42,-1,[9500]),f9h(A_h,42,-1,[8245]),f9h(A_h,42,-1,[728]),f9h(A_h,42,-1,[166]),f9h(A_h,42,-1,[166]),f9h(A_h,42,-1,[55349,56503]),f9h(A_h,42,-1,[8271]),f9h(A_h,42,-1,[8765]),f9h(A_h,42,-1,[8909]),f9h(A_h,42,-1,[92]),f9h(A_h,42,-1,[10693]),f9h(A_h,42,-1,[8226]),f9h(A_h,42,-1,[8226]),f9h(A_h,42,-1,[8782]),f9h(A_h,42,-1,[10926]),f9h(A_h,42,-1,[8783]),f9h(A_h,42,-1,[8783]),f9h(A_h,42,-1,[263]),f9h(A_h,42,-1,[8745]),f9h(A_h,42,-1,[10820]),f9h(A_h,42,-1,[10825]),f9h(A_h,42,-1,[10827]),f9h(A_h,42,-1,[10823]),f9h(A_h,42,-1,[10816]),f9h(A_h,42,-1,[8257]),f9h(A_h,42,-1,[711]),f9h(A_h,42,-1,[10829]),f9h(A_h,42,-1,[269]),f9h(A_h,42,-1,[231]),f9h(A_h,42,-1,[231]),f9h(A_h,42,-1,[265]),f9h(A_h,42,-1,[10828]),f9h(A_h,42,-1,[10832]),f9h(A_h,42,-1,[267]),f9h(A_h,42,-1,[184]),f9h(A_h,42,-1,[184]),f9h(A_h,42,-1,[10674]),f9h(A_h,42,-1,[162]),f9h(A_h,42,-1,[162]),f9h(A_h,42,-1,[183]),f9h(A_h,42,-1,[55349,56608]),f9h(A_h,42,-1,[1095]),f9h(A_h,42,-1,[10003]),f9h(A_h,42,-1,[10003]),f9h(A_h,42,-1,[967]),f9h(A_h,42,-1,[9675]),f9h(A_h,42,-1,[10691]),f9h(A_h,42,-1,[710]),f9h(A_h,42,-1,[8791]),f9h(A_h,42,-1,[8634]),f9h(A_h,42,-1,[8635]),f9h(A_h,42,-1,[174]),f9h(A_h,42,-1,[9416]),f9h(A_h,42,-1,[8859]),f9h(A_h,42,-1,[8858]),f9h(A_h,42,-1,[8861]),f9h(A_h,42,-1,[8791]),f9h(A_h,42,-1,[10768]),f9h(A_h,42,-1,[10991]),f9h(A_h,42,-1,[10690]),f9h(A_h,42,-1,[9827]),f9h(A_h,42,-1,[9827]),f9h(A_h,42,-1,[58]),f9h(A_h,42,-1,[8788]),f9h(A_h,42,-1,[8788]),f9h(A_h,42,-1,[44]),f9h(A_h,42,-1,[64]),f9h(A_h,42,-1,[8705]),f9h(A_h,42,-1,[8728]),f9h(A_h,42,-1,[8705]),f9h(A_h,42,-1,[8450]),f9h(A_h,42,-1,[8773]),f9h(A_h,42,-1,[10861]),f9h(A_h,42,-1,[8750]),f9h(A_h,42,-1,[55349,56660]),f9h(A_h,42,-1,[8720]),f9h(A_h,42,-1,[169]),f9h(A_h,42,-1,[169]),f9h(A_h,42,-1,[8471]),f9h(A_h,42,-1,[8629]),f9h(A_h,42,-1,[10007]),f9h(A_h,42,-1,[55349,56504]),f9h(A_h,42,-1,[10959]),f9h(A_h,42,-1,[10961]),f9h(A_h,42,-1,[10960]),f9h(A_h,42,-1,[10962]),f9h(A_h,42,-1,[8943]),f9h(A_h,42,-1,[10552]),f9h(A_h,42,-1,[10549]),f9h(A_h,42,-1,[8926]),f9h(A_h,42,-1,[8927]),f9h(A_h,42,-1,[8630]),f9h(A_h,42,-1,[10557]),f9h(A_h,42,-1,[8746]),f9h(A_h,42,-1,[10824]),f9h(A_h,42,-1,[10822]),f9h(A_h,42,-1,[10826]),f9h(A_h,42,-1,[8845]),f9h(A_h,42,-1,[10821]),f9h(A_h,42,-1,[8631]),f9h(A_h,42,-1,[10556]),f9h(A_h,42,-1,[8926]),f9h(A_h,42,-1,[8927]),f9h(A_h,42,-1,[8910]),f9h(A_h,42,-1,[8911]),f9h(A_h,42,-1,[164]),f9h(A_h,42,-1,[164]),f9h(A_h,42,-1,[8630]),f9h(A_h,42,-1,[8631]),f9h(A_h,42,-1,[8910]),f9h(A_h,42,-1,[8911]),f9h(A_h,42,-1,[8754]),f9h(A_h,42,-1,[8753]),f9h(A_h,42,-1,[9005]),f9h(A_h,42,-1,[8659]),f9h(A_h,42,-1,[10597]),f9h(A_h,42,-1,[8224]),f9h(A_h,42,-1,[8504]),f9h(A_h,42,-1,[8595]),f9h(A_h,42,-1,[8208]),f9h(A_h,42,-1,[8867]),f9h(A_h,42,-1,[10511]),f9h(A_h,42,-1,[733]),f9h(A_h,42,-1,[271]),f9h(A_h,42,-1,[1076]),f9h(A_h,42,-1,[8518]),f9h(A_h,42,-1,[8225]),f9h(A_h,42,-1,[8650]),f9h(A_h,42,-1,[10871]),f9h(A_h,42,-1,[176]),f9h(A_h,42,-1,[176]),f9h(A_h,42,-1,[948]),f9h(A_h,42,-1,[10673]),f9h(A_h,42,-1,[10623]),f9h(A_h,42,-1,[55349,56609]),f9h(A_h,42,-1,[8643]),f9h(A_h,42,-1,[8642]),f9h(A_h,42,-1,[8900]),f9h(A_h,42,-1,[8900]),f9h(A_h,42,-1,[9830]),f9h(A_h,42,-1,[9830]),f9h(A_h,42,-1,[168]),f9h(A_h,42,-1,[989]),f9h(A_h,42,-1,[8946]),f9h(A_h,42,-1,[247]),f9h(A_h,42,-1,[247]),f9h(A_h,42,-1,[247]),f9h(A_h,42,-1,[8903]),f9h(A_h,42,-1,[8903]),f9h(A_h,42,-1,[1106]),f9h(A_h,42,-1,[8990]),f9h(A_h,42,-1,[8973]),f9h(A_h,42,-1,[36]),f9h(A_h,42,-1,[55349,56661]),f9h(A_h,42,-1,[729]),f9h(A_h,42,-1,[8784]),f9h(A_h,42,-1,[8785]),f9h(A_h,42,-1,[8760]),f9h(A_h,42,-1,[8724]),f9h(A_h,42,-1,[8865]),f9h(A_h,42,-1,[8966]),f9h(A_h,42,-1,[8595]),f9h(A_h,42,-1,[8650]),f9h(A_h,42,-1,[8643]),f9h(A_h,42,-1,[8642]),f9h(A_h,42,-1,[10512]),f9h(A_h,42,-1,[8991]),f9h(A_h,42,-1,[8972]),f9h(A_h,42,-1,[55349,56505]),f9h(A_h,42,-1,[1109]),f9h(A_h,42,-1,[10742]),f9h(A_h,42,-1,[273]),f9h(A_h,42,-1,[8945]),f9h(A_h,42,-1,[9663]),f9h(A_h,42,-1,[9662]),f9h(A_h,42,-1,[8693]),f9h(A_h,42,-1,[10607]),f9h(A_h,42,-1,[10662]),f9h(A_h,42,-1,[1119]),f9h(A_h,42,-1,[10239]),f9h(A_h,42,-1,[10871]),f9h(A_h,42,-1,[8785]),f9h(A_h,42,-1,[233]),f9h(A_h,42,-1,[233]),f9h(A_h,42,-1,[10862]),f9h(A_h,42,-1,[283]),f9h(A_h,42,-1,[8790]),f9h(A_h,42,-1,[234]),f9h(A_h,42,-1,[234]),f9h(A_h,42,-1,[8789]),f9h(A_h,42,-1,[1101]),f9h(A_h,42,-1,[279]),f9h(A_h,42,-1,[8519]),f9h(A_h,42,-1,[8786]),f9h(A_h,42,-1,[55349,56610]),f9h(A_h,42,-1,[10906]),f9h(A_h,42,-1,[232]),f9h(A_h,42,-1,[232]),f9h(A_h,42,-1,[10902]),f9h(A_h,42,-1,[10904]),f9h(A_h,42,-1,[10905]),f9h(A_h,42,-1,[9191]),f9h(A_h,42,-1,[8467]),f9h(A_h,42,-1,[10901]),f9h(A_h,42,-1,[10903]),f9h(A_h,42,-1,[275]),f9h(A_h,42,-1,[8709]),f9h(A_h,42,-1,[8709]),f9h(A_h,42,-1,[8709]),f9h(A_h,42,-1,[8196]),f9h(A_h,42,-1,[8197]),f9h(A_h,42,-1,[8195]),f9h(A_h,42,-1,[331]),f9h(A_h,42,-1,[8194]),f9h(A_h,42,-1,[281]),f9h(A_h,42,-1,[55349,56662]),f9h(A_h,42,-1,[8917]),f9h(A_h,42,-1,[10723]),f9h(A_h,42,-1,[10865]),f9h(A_h,42,-1,[1013]),f9h(A_h,42,-1,[949]),f9h(A_h,42,-1,[949]),f9h(A_h,42,-1,[8790]),f9h(A_h,42,-1,[8789]),f9h(A_h,42,-1,[8770]),f9h(A_h,42,-1,[10902]),f9h(A_h,42,-1,[10901]),f9h(A_h,42,-1,[61]),f9h(A_h,42,-1,[8799]),f9h(A_h,42,-1,[8801]),f9h(A_h,42,-1,[10872]),f9h(A_h,42,-1,[10725]),f9h(A_h,42,-1,[8787]),f9h(A_h,42,-1,[10609]),f9h(A_h,42,-1,[8495]),f9h(A_h,42,-1,[8784]),f9h(A_h,42,-1,[8770]),f9h(A_h,42,-1,[951]),f9h(A_h,42,-1,[240]),f9h(A_h,42,-1,[240]),f9h(A_h,42,-1,[235]),f9h(A_h,42,-1,[235]),f9h(A_h,42,-1,[8364]),f9h(A_h,42,-1,[33]),f9h(A_h,42,-1,[8707]),f9h(A_h,42,-1,[8496]),f9h(A_h,42,-1,[8519]),f9h(A_h,42,-1,[8786]),f9h(A_h,42,-1,[1092]),f9h(A_h,42,-1,[9792]),f9h(A_h,42,-1,[64259]),f9h(A_h,42,-1,[64256]),f9h(A_h,42,-1,[64260]),f9h(A_h,42,-1,[55349,56611]),f9h(A_h,42,-1,[64257]),f9h(A_h,42,-1,[9837]),f9h(A_h,42,-1,[64258]),f9h(A_h,42,-1,[9649]),f9h(A_h,42,-1,[402]),f9h(A_h,42,-1,[55349,56663]),f9h(A_h,42,-1,[8704]),f9h(A_h,42,-1,[8916]),f9h(A_h,42,-1,[10969]),f9h(A_h,42,-1,[10765]),f9h(A_h,42,-1,[189]),f9h(A_h,42,-1,[189]),f9h(A_h,42,-1,[8531]),f9h(A_h,42,-1,[188]),f9h(A_h,42,-1,[188]),f9h(A_h,42,-1,[8533]),f9h(A_h,42,-1,[8537]),f9h(A_h,42,-1,[8539]),f9h(A_h,42,-1,[8532]),f9h(A_h,42,-1,[8534]),f9h(A_h,42,-1,[190]),f9h(A_h,42,-1,[190]),f9h(A_h,42,-1,[8535]),f9h(A_h,42,-1,[8540]),f9h(A_h,42,-1,[8536]),f9h(A_h,42,-1,[8538]),f9h(A_h,42,-1,[8541]),f9h(A_h,42,-1,[8542]),f9h(A_h,42,-1,[8260]),f9h(A_h,42,-1,[8994]),f9h(A_h,42,-1,[55349,56507]),f9h(A_h,42,-1,[8807]),f9h(A_h,42,-1,[10892]),f9h(A_h,42,-1,[501]),f9h(A_h,42,-1,[947]),f9h(A_h,42,-1,[989]),f9h(A_h,42,-1,[10886]),f9h(A_h,42,-1,[287]),f9h(A_h,42,-1,[285]),f9h(A_h,42,-1,[1075]),f9h(A_h,42,-1,[289]),f9h(A_h,42,-1,[8805]),f9h(A_h,42,-1,[8923]),f9h(A_h,42,-1,[8805]),f9h(A_h,42,-1,[8807]),f9h(A_h,42,-1,[10878]),f9h(A_h,42,-1,[10878]),f9h(A_h,42,-1,[10921]),f9h(A_h,42,-1,[10880]),f9h(A_h,42,-1,[10882]),f9h(A_h,42,-1,[10884]),f9h(A_h,42,-1,[10900]),f9h(A_h,42,-1,[55349,56612]),f9h(A_h,42,-1,[8811]),f9h(A_h,42,-1,[8921]),f9h(A_h,42,-1,[8503]),f9h(A_h,42,-1,[1107]),f9h(A_h,42,-1,[8823]),f9h(A_h,42,-1,[10898]),f9h(A_h,42,-1,[10917]),f9h(A_h,42,-1,[10916]),f9h(A_h,42,-1,[8809]),f9h(A_h,42,-1,[10890]),f9h(A_h,42,-1,[10890]),f9h(A_h,42,-1,[10888]),f9h(A_h,42,-1,[10888]),f9h(A_h,42,-1,[8809]),f9h(A_h,42,-1,[8935]),f9h(A_h,42,-1,[55349,56664]),f9h(A_h,42,-1,[96]),f9h(A_h,42,-1,[8458]),f9h(A_h,42,-1,[8819]),f9h(A_h,42,-1,[10894]),f9h(A_h,42,-1,[10896]),f9h(A_h,42,-1,[62]),f9h(A_h,42,-1,[62]),f9h(A_h,42,-1,[10919]),f9h(A_h,42,-1,[10874]),f9h(A_h,42,-1,[8919]),f9h(A_h,42,-1,[10645]),f9h(A_h,42,-1,[10876]),f9h(A_h,42,-1,[10886]),f9h(A_h,42,-1,[10616]),f9h(A_h,42,-1,[8919]),f9h(A_h,42,-1,[8923]),f9h(A_h,42,-1,[10892]),f9h(A_h,42,-1,[8823]),f9h(A_h,42,-1,[8819]),f9h(A_h,42,-1,[8660]),f9h(A_h,42,-1,[8202]),f9h(A_h,42,-1,[189]),f9h(A_h,42,-1,[8459]),f9h(A_h,42,-1,[1098]),f9h(A_h,42,-1,[8596]),f9h(A_h,42,-1,[10568]),f9h(A_h,42,-1,[8621]),f9h(A_h,42,-1,[8463]),f9h(A_h,42,-1,[293]),f9h(A_h,42,-1,[9829]),f9h(A_h,42,-1,[9829]),f9h(A_h,42,-1,[8230]),f9h(A_h,42,-1,[8889]),f9h(A_h,42,-1,[55349,56613]),f9h(A_h,42,-1,[10533]),f9h(A_h,42,-1,[10534]),f9h(A_h,42,-1,[8703]),f9h(A_h,42,-1,[8763]),f9h(A_h,42,-1,[8617]),f9h(A_h,42,-1,[8618]),f9h(A_h,42,-1,[55349,56665]),f9h(A_h,42,-1,[8213]),f9h(A_h,42,-1,[55349,56509]),f9h(A_h,42,-1,[8463]),f9h(A_h,42,-1,[295]),f9h(A_h,42,-1,[8259]),f9h(A_h,42,-1,[8208]),f9h(A_h,42,-1,[237]),f9h(A_h,42,-1,[237]),f9h(A_h,42,-1,[8291]),f9h(A_h,42,-1,[238]),f9h(A_h,42,-1,[238]),f9h(A_h,42,-1,[1080]),f9h(A_h,42,-1,[1077]),f9h(A_h,42,-1,[161]),f9h(A_h,42,-1,[161]),f9h(A_h,42,-1,[8660]),f9h(A_h,42,-1,[55349,56614]),f9h(A_h,42,-1,[236]),f9h(A_h,42,-1,[236]),f9h(A_h,42,-1,[8520]),f9h(A_h,42,-1,[10764]),f9h(A_h,42,-1,[8749]),f9h(A_h,42,-1,[10716]),f9h(A_h,42,-1,[8489]),f9h(A_h,42,-1,[307]),f9h(A_h,42,-1,[299]),f9h(A_h,42,-1,[8465]),f9h(A_h,42,-1,[8464]),f9h(A_h,42,-1,[8465]),f9h(A_h,42,-1,[305]),f9h(A_h,42,-1,[8887]),f9h(A_h,42,-1,[437]),f9h(A_h,42,-1,[8712]),f9h(A_h,42,-1,[8453]),f9h(A_h,42,-1,[8734]),f9h(A_h,42,-1,[10717]),f9h(A_h,42,-1,[305]),f9h(A_h,42,-1,[8747]),f9h(A_h,42,-1,[8890]),f9h(A_h,42,-1,[8484]),f9h(A_h,42,-1,[8890]),f9h(A_h,42,-1,[10775]),f9h(A_h,42,-1,[10812]),f9h(A_h,42,-1,[1105]),f9h(A_h,42,-1,[303]),f9h(A_h,42,-1,[55349,56666]),f9h(A_h,42,-1,[953]),f9h(A_h,42,-1,[10812]),f9h(A_h,42,-1,[191]),f9h(A_h,42,-1,[191]),f9h(A_h,42,-1,[55349,56510]),f9h(A_h,42,-1,[8712]),f9h(A_h,42,-1,[8953]),f9h(A_h,42,-1,[8949]),f9h(A_h,42,-1,[8948]),f9h(A_h,42,-1,[8947]),f9h(A_h,42,-1,[8712]),f9h(A_h,42,-1,[8290]),f9h(A_h,42,-1,[297]),f9h(A_h,42,-1,[1110]),f9h(A_h,42,-1,[239]),f9h(A_h,42,-1,[239]),f9h(A_h,42,-1,[309]),f9h(A_h,42,-1,[1081]),f9h(A_h,42,-1,[55349,56615]),f9h(A_h,42,-1,[567]),f9h(A_h,42,-1,[55349,56667]),f9h(A_h,42,-1,[55349,56511]),f9h(A_h,42,-1,[1112]),f9h(A_h,42,-1,[1108]),f9h(A_h,42,-1,[954]),f9h(A_h,42,-1,[1008]),f9h(A_h,42,-1,[311]),f9h(A_h,42,-1,[1082]),f9h(A_h,42,-1,[55349,56616]),f9h(A_h,42,-1,[312]),f9h(A_h,42,-1,[1093]),f9h(A_h,42,-1,[1116]),f9h(A_h,42,-1,[55349,56668]),f9h(A_h,42,-1,[55349,56512]),f9h(A_h,42,-1,[8666]),f9h(A_h,42,-1,[8656]),f9h(A_h,42,-1,[10523]),f9h(A_h,42,-1,[10510]),f9h(A_h,42,-1,[8806]),f9h(A_h,42,-1,[10891]),f9h(A_h,42,-1,[10594]),f9h(A_h,42,-1,[314]),f9h(A_h,42,-1,[10676]),f9h(A_h,42,-1,[8466]),f9h(A_h,42,-1,[955]),f9h(A_h,42,-1,[10216]),f9h(A_h,42,-1,[10641]),f9h(A_h,42,-1,[10216]),f9h(A_h,42,-1,[10885]),f9h(A_h,42,-1,[171]),f9h(A_h,42,-1,[171]),f9h(A_h,42,-1,[8592]),f9h(A_h,42,-1,[8676]),f9h(A_h,42,-1,[10527]),f9h(A_h,42,-1,[10525]),f9h(A_h,42,-1,[8617]),f9h(A_h,42,-1,[8619]),f9h(A_h,42,-1,[10553]),f9h(A_h,42,-1,[10611]),f9h(A_h,42,-1,[8610]),f9h(A_h,42,-1,[10923]),f9h(A_h,42,-1,[10521]),f9h(A_h,42,-1,[10925]),f9h(A_h,42,-1,[10508]),f9h(A_h,42,-1,[10098]),f9h(A_h,42,-1,[123]),f9h(A_h,42,-1,[91]),f9h(A_h,42,-1,[10635]),f9h(A_h,42,-1,[10639]),f9h(A_h,42,-1,[10637]),f9h(A_h,42,-1,[318]),f9h(A_h,42,-1,[316]),f9h(A_h,42,-1,[8968]),f9h(A_h,42,-1,[123]),f9h(A_h,42,-1,[1083]),f9h(A_h,42,-1,[10550]),f9h(A_h,42,-1,[8220]),f9h(A_h,42,-1,[8222]),f9h(A_h,42,-1,[10599]),f9h(A_h,42,-1,[10571]),f9h(A_h,42,-1,[8626]),f9h(A_h,42,-1,[8804]),f9h(A_h,42,-1,[8592]),f9h(A_h,42,-1,[8610]),f9h(A_h,42,-1,[8637]),f9h(A_h,42,-1,[8636]),f9h(A_h,42,-1,[8647]),f9h(A_h,42,-1,[8596]),f9h(A_h,42,-1,[8646]),f9h(A_h,42,-1,[8651]),f9h(A_h,42,-1,[8621]),f9h(A_h,42,-1,[8907]),f9h(A_h,42,-1,[8922]),f9h(A_h,42,-1,[8804]),f9h(A_h,42,-1,[8806]),f9h(A_h,42,-1,[10877]),f9h(A_h,42,-1,[10877]),f9h(A_h,42,-1,[10920]),f9h(A_h,42,-1,[10879]),f9h(A_h,42,-1,[10881]),f9h(A_h,42,-1,[10883]),f9h(A_h,42,-1,[10899]),f9h(A_h,42,-1,[10885]),f9h(A_h,42,-1,[8918]),f9h(A_h,42,-1,[8922]),f9h(A_h,42,-1,[10891]),f9h(A_h,42,-1,[8822]),f9h(A_h,42,-1,[8818]),f9h(A_h,42,-1,[10620]),f9h(A_h,42,-1,[8970]),f9h(A_h,42,-1,[55349,56617]),f9h(A_h,42,-1,[8822]),f9h(A_h,42,-1,[10897]),f9h(A_h,42,-1,[8637]),f9h(A_h,42,-1,[8636]),f9h(A_h,42,-1,[10602]),f9h(A_h,42,-1,[9604]),f9h(A_h,42,-1,[1113]),f9h(A_h,42,-1,[8810]),f9h(A_h,42,-1,[8647]),f9h(A_h,42,-1,[8990]),f9h(A_h,42,-1,[10603]),f9h(A_h,42,-1,[9722]),f9h(A_h,42,-1,[320]),f9h(A_h,42,-1,[9136]),f9h(A_h,42,-1,[9136]),f9h(A_h,42,-1,[8808]),f9h(A_h,42,-1,[10889]),f9h(A_h,42,-1,[10889]),f9h(A_h,42,-1,[10887]),f9h(A_h,42,-1,[10887]),f9h(A_h,42,-1,[8808]),f9h(A_h,42,-1,[8934]),f9h(A_h,42,-1,[10220]),f9h(A_h,42,-1,[8701]),f9h(A_h,42,-1,[10214]),f9h(A_h,42,-1,[10229]),f9h(A_h,42,-1,[10231]),f9h(A_h,42,-1,[10236]),f9h(A_h,42,-1,[10230]),f9h(A_h,42,-1,[8619]),f9h(A_h,42,-1,[8620]),f9h(A_h,42,-1,[10629]),f9h(A_h,42,-1,[55349,56669]),f9h(A_h,42,-1,[10797]),f9h(A_h,42,-1,[10804]),f9h(A_h,42,-1,[8727]),f9h(A_h,42,-1,[95]),f9h(A_h,42,-1,[9674]),f9h(A_h,42,-1,[9674]),f9h(A_h,42,-1,[10731]),f9h(A_h,42,-1,[40]),f9h(A_h,42,-1,[10643]),f9h(A_h,42,-1,[8646]),f9h(A_h,42,-1,[8991]),f9h(A_h,42,-1,[8651]),f9h(A_h,42,-1,[10605]),f9h(A_h,42,-1,[8206]),f9h(A_h,42,-1,[8895]),f9h(A_h,42,-1,[8249]),f9h(A_h,42,-1,[55349,56513]),f9h(A_h,42,-1,[8624]),f9h(A_h,42,-1,[8818]),f9h(A_h,42,-1,[10893]),f9h(A_h,42,-1,[10895]),f9h(A_h,42,-1,[91]),f9h(A_h,42,-1,[8216]),f9h(A_h,42,-1,[8218]),f9h(A_h,42,-1,[322]),f9h(A_h,42,-1,[60]),f9h(A_h,42,-1,[60]),f9h(A_h,42,-1,[10918]),f9h(A_h,42,-1,[10873]),f9h(A_h,42,-1,[8918]),f9h(A_h,42,-1,[8907]),f9h(A_h,42,-1,[8905]),f9h(A_h,42,-1,[10614]),f9h(A_h,42,-1,[10875]),f9h(A_h,42,-1,[10646]),f9h(A_h,42,-1,[9667]),f9h(A_h,42,-1,[8884]),f9h(A_h,42,-1,[9666]),f9h(A_h,42,-1,[10570]),f9h(A_h,42,-1,[10598]),f9h(A_h,42,-1,[8762]),f9h(A_h,42,-1,[175]),f9h(A_h,42,-1,[175]),f9h(A_h,42,-1,[9794]),f9h(A_h,42,-1,[10016]),f9h(A_h,42,-1,[10016]),f9h(A_h,42,-1,[8614]),f9h(A_h,42,-1,[8614]),f9h(A_h,42,-1,[8615]),f9h(A_h,42,-1,[8612]),f9h(A_h,42,-1,[8613]),f9h(A_h,42,-1,[9646]),f9h(A_h,42,-1,[10793]),f9h(A_h,42,-1,[1084]),f9h(A_h,42,-1,[8212]),f9h(A_h,42,-1,[8737]),f9h(A_h,42,-1,[55349,56618]),f9h(A_h,42,-1,[8487]),f9h(A_h,42,-1,[181]),f9h(A_h,42,-1,[181]),f9h(A_h,42,-1,[8739]),f9h(A_h,42,-1,[42]),f9h(A_h,42,-1,[10992]),f9h(A_h,42,-1,[183]),f9h(A_h,42,-1,[183]),f9h(A_h,42,-1,[8722]),f9h(A_h,42,-1,[8863]),f9h(A_h,42,-1,[8760]),f9h(A_h,42,-1,[10794]),f9h(A_h,42,-1,[10971]),f9h(A_h,42,-1,[8230]),f9h(A_h,42,-1,[8723]),f9h(A_h,42,-1,[8871]),f9h(A_h,42,-1,[55349,56670]),f9h(A_h,42,-1,[8723]),f9h(A_h,42,-1,[55349,56514]),f9h(A_h,42,-1,[8766]),f9h(A_h,42,-1,[956]),f9h(A_h,42,-1,[8888]),f9h(A_h,42,-1,[8888]),f9h(A_h,42,-1,[8653]),f9h(A_h,42,-1,[8654]),f9h(A_h,42,-1,[8655]),f9h(A_h,42,-1,[8879]),f9h(A_h,42,-1,[8878]),f9h(A_h,42,-1,[8711]),f9h(A_h,42,-1,[324]),f9h(A_h,42,-1,[8777]),f9h(A_h,42,-1,[329]),f9h(A_h,42,-1,[8777]),f9h(A_h,42,-1,[9838]),f9h(A_h,42,-1,[9838]),f9h(A_h,42,-1,[8469]),f9h(A_h,42,-1,[160]),f9h(A_h,42,-1,[160]),f9h(A_h,42,-1,[10819]),f9h(A_h,42,-1,[328]),f9h(A_h,42,-1,[326]),f9h(A_h,42,-1,[8775]),f9h(A_h,42,-1,[10818]),f9h(A_h,42,-1,[1085]),f9h(A_h,42,-1,[8211]),f9h(A_h,42,-1,[8800]),f9h(A_h,42,-1,[8663]),f9h(A_h,42,-1,[10532]),f9h(A_h,42,-1,[8599]),f9h(A_h,42,-1,[8599]),f9h(A_h,42,-1,[8802]),f9h(A_h,42,-1,[10536]),f9h(A_h,42,-1,[8708]),f9h(A_h,42,-1,[8708]),f9h(A_h,42,-1,[55349,56619]),f9h(A_h,42,-1,[8817]),f9h(A_h,42,-1,[8817]),f9h(A_h,42,-1,[8821]),f9h(A_h,42,-1,[8815]),f9h(A_h,42,-1,[8815]),f9h(A_h,42,-1,[8654]),f9h(A_h,42,-1,[8622]),f9h(A_h,42,-1,[10994]),f9h(A_h,42,-1,[8715]),f9h(A_h,42,-1,[8956]),f9h(A_h,42,-1,[8954]),f9h(A_h,42,-1,[8715]),f9h(A_h,42,-1,[1114]),f9h(A_h,42,-1,[8653]),f9h(A_h,42,-1,[8602]),f9h(A_h,42,-1,[8229]),f9h(A_h,42,-1,[8816]),f9h(A_h,42,-1,[8602]),f9h(A_h,42,-1,[8622]),f9h(A_h,42,-1,[8816]),f9h(A_h,42,-1,[8814]),f9h(A_h,42,-1,[8820]),f9h(A_h,42,-1,[8814]),f9h(A_h,42,-1,[8938]),f9h(A_h,42,-1,[8940]),f9h(A_h,42,-1,[8740]),f9h(A_h,42,-1,[55349,56671]),f9h(A_h,42,-1,[172]),f9h(A_h,42,-1,[172]),f9h(A_h,42,-1,[8713]),f9h(A_h,42,-1,[8713]),f9h(A_h,42,-1,[8951]),f9h(A_h,42,-1,[8950]),f9h(A_h,42,-1,[8716]),f9h(A_h,42,-1,[8716]),f9h(A_h,42,-1,[8958]),f9h(A_h,42,-1,[8957]),f9h(A_h,42,-1,[8742]),f9h(A_h,42,-1,[8742]),f9h(A_h,42,-1,[10772]),f9h(A_h,42,-1,[8832]),f9h(A_h,42,-1,[8928]),f9h(A_h,42,-1,[8832]),f9h(A_h,42,-1,[8655]),f9h(A_h,42,-1,[8603]),f9h(A_h,42,-1,[8603]),f9h(A_h,42,-1,[8939]),f9h(A_h,42,-1,[8941]),f9h(A_h,42,-1,[8833]),f9h(A_h,42,-1,[8929]),f9h(A_h,42,-1,[55349,56515]),f9h(A_h,42,-1,[8740]),f9h(A_h,42,-1,[8742]),f9h(A_h,42,-1,[8769]),f9h(A_h,42,-1,[8772]),f9h(A_h,42,-1,[8772]),f9h(A_h,42,-1,[8740]),f9h(A_h,42,-1,[8742]),f9h(A_h,42,-1,[8930]),f9h(A_h,42,-1,[8931]),f9h(A_h,42,-1,[8836]),f9h(A_h,42,-1,[8840]),f9h(A_h,42,-1,[8840]),f9h(A_h,42,-1,[8833]),f9h(A_h,42,-1,[8837]),f9h(A_h,42,-1,[8841]),f9h(A_h,42,-1,[8841]),f9h(A_h,42,-1,[8825]),f9h(A_h,42,-1,[241]),f9h(A_h,42,-1,[241]),f9h(A_h,42,-1,[8824]),f9h(A_h,42,-1,[8938]),f9h(A_h,42,-1,[8940]),f9h(A_h,42,-1,[8939]),f9h(A_h,42,-1,[8941]),f9h(A_h,42,-1,[957]),f9h(A_h,42,-1,[35]),f9h(A_h,42,-1,[8470]),f9h(A_h,42,-1,[8199]),f9h(A_h,42,-1,[8877]),f9h(A_h,42,-1,[10500]),f9h(A_h,42,-1,[8876]),f9h(A_h,42,-1,[10718]),f9h(A_h,42,-1,[10498]),f9h(A_h,42,-1,[10499]),f9h(A_h,42,-1,[8662]),f9h(A_h,42,-1,[10531]),f9h(A_h,42,-1,[8598]),f9h(A_h,42,-1,[8598]),f9h(A_h,42,-1,[10535]),f9h(A_h,42,-1,[9416]),f9h(A_h,42,-1,[243]),f9h(A_h,42,-1,[243]),f9h(A_h,42,-1,[8859]),f9h(A_h,42,-1,[8858]),f9h(A_h,42,-1,[244]),f9h(A_h,42,-1,[244]),f9h(A_h,42,-1,[1086]),f9h(A_h,42,-1,[8861]),f9h(A_h,42,-1,[337]),f9h(A_h,42,-1,[10808]),f9h(A_h,42,-1,[8857]),f9h(A_h,42,-1,[10684]),f9h(A_h,42,-1,[339]),f9h(A_h,42,-1,[10687]),f9h(A_h,42,-1,[55349,56620]),f9h(A_h,42,-1,[731]),f9h(A_h,42,-1,[242]),f9h(A_h,42,-1,[242]),f9h(A_h,42,-1,[10689]),f9h(A_h,42,-1,[10677]),f9h(A_h,42,-1,[8486]),f9h(A_h,42,-1,[8750]),f9h(A_h,42,-1,[8634]),f9h(A_h,42,-1,[10686]),f9h(A_h,42,-1,[10683]),f9h(A_h,42,-1,[8254]),f9h(A_h,42,-1,[10688]),f9h(A_h,42,-1,[333]),f9h(A_h,42,-1,[969]),f9h(A_h,42,-1,[959]),f9h(A_h,42,-1,[10678]),f9h(A_h,42,-1,[8854]),f9h(A_h,42,-1,[55349,56672]),f9h(A_h,42,-1,[10679]),f9h(A_h,42,-1,[10681]),f9h(A_h,42,-1,[8853]),f9h(A_h,42,-1,[8744]),f9h(A_h,42,-1,[8635]),f9h(A_h,42,-1,[10845]),f9h(A_h,42,-1,[8500]),f9h(A_h,42,-1,[8500]),f9h(A_h,42,-1,[170]),f9h(A_h,42,-1,[170]),f9h(A_h,42,-1,[186]),f9h(A_h,42,-1,[186]),f9h(A_h,42,-1,[8886]),f9h(A_h,42,-1,[10838]),f9h(A_h,42,-1,[10839]),f9h(A_h,42,-1,[10843]),f9h(A_h,42,-1,[8500]),f9h(A_h,42,-1,[248]),f9h(A_h,42,-1,[248]),f9h(A_h,42,-1,[8856]),f9h(A_h,42,-1,[245]),f9h(A_h,42,-1,[245]),f9h(A_h,42,-1,[8855]),f9h(A_h,42,-1,[10806]),f9h(A_h,42,-1,[246]),f9h(A_h,42,-1,[246]),f9h(A_h,42,-1,[9021]),f9h(A_h,42,-1,[8741]),f9h(A_h,42,-1,[182]),f9h(A_h,42,-1,[182]),f9h(A_h,42,-1,[8741]),f9h(A_h,42,-1,[10995]),f9h(A_h,42,-1,[11005]),f9h(A_h,42,-1,[8706]),f9h(A_h,42,-1,[1087]),f9h(A_h,42,-1,[37]),f9h(A_h,42,-1,[46]),f9h(A_h,42,-1,[8240]),f9h(A_h,42,-1,[8869]),f9h(A_h,42,-1,[8241]),f9h(A_h,42,-1,[55349,56621]),f9h(A_h,42,-1,[966]),f9h(A_h,42,-1,[966]),f9h(A_h,42,-1,[8499]),f9h(A_h,42,-1,[9742]),f9h(A_h,42,-1,[960]),f9h(A_h,42,-1,[8916]),f9h(A_h,42,-1,[982]),f9h(A_h,42,-1,[8463]),f9h(A_h,42,-1,[8462]),f9h(A_h,42,-1,[8463]),f9h(A_h,42,-1,[43]),f9h(A_h,42,-1,[10787]),f9h(A_h,42,-1,[8862]),f9h(A_h,42,-1,[10786]),f9h(A_h,42,-1,[8724]),f9h(A_h,42,-1,[10789]),f9h(A_h,42,-1,[10866]),f9h(A_h,42,-1,[177]),f9h(A_h,42,-1,[177]),f9h(A_h,42,-1,[10790]),f9h(A_h,42,-1,[10791]),f9h(A_h,42,-1,[177]),f9h(A_h,42,-1,[10773]),f9h(A_h,42,-1,[55349,56673]),f9h(A_h,42,-1,[163]),f9h(A_h,42,-1,[163]),f9h(A_h,42,-1,[8826]),f9h(A_h,42,-1,[10931]),f9h(A_h,42,-1,[10935]),f9h(A_h,42,-1,[8828]),f9h(A_h,42,-1,[10927]),f9h(A_h,42,-1,[8826]),f9h(A_h,42,-1,[10935]),f9h(A_h,42,-1,[8828]),f9h(A_h,42,-1,[10927]),f9h(A_h,42,-1,[10937]),f9h(A_h,42,-1,[10933]),f9h(A_h,42,-1,[8936]),f9h(A_h,42,-1,[8830]),f9h(A_h,42,-1,[8242]),f9h(A_h,42,-1,[8473]),f9h(A_h,42,-1,[10933]),f9h(A_h,42,-1,[10937]),f9h(A_h,42,-1,[8936]),f9h(A_h,42,-1,[8719]),f9h(A_h,42,-1,[9006]),f9h(A_h,42,-1,[8978]),f9h(A_h,42,-1,[8979]),f9h(A_h,42,-1,[8733]),f9h(A_h,42,-1,[8733]),f9h(A_h,42,-1,[8830]),f9h(A_h,42,-1,[8880]),f9h(A_h,42,-1,[55349,56517]),f9h(A_h,42,-1,[968]),f9h(A_h,42,-1,[8200]),f9h(A_h,42,-1,[55349,56622]),f9h(A_h,42,-1,[10764]),f9h(A_h,42,-1,[55349,56674]),f9h(A_h,42,-1,[8279]),f9h(A_h,42,-1,[55349,56518]),f9h(A_h,42,-1,[8461]),f9h(A_h,42,-1,[10774]),f9h(A_h,42,-1,[63]),f9h(A_h,42,-1,[8799]),f9h(A_h,42,-1,[34]),f9h(A_h,42,-1,[34]),f9h(A_h,42,-1,[8667]),f9h(A_h,42,-1,[8658]),f9h(A_h,42,-1,[10524]),f9h(A_h,42,-1,[10511]),f9h(A_h,42,-1,[10596]),f9h(A_h,42,-1,[10714]),f9h(A_h,42,-1,[341]),f9h(A_h,42,-1,[8730]),f9h(A_h,42,-1,[10675]),f9h(A_h,42,-1,[10217]),f9h(A_h,42,-1,[10642]),f9h(A_h,42,-1,[10661]),f9h(A_h,42,-1,[10217]),f9h(A_h,42,-1,[187]),f9h(A_h,42,-1,[187]),f9h(A_h,42,-1,[8594]),f9h(A_h,42,-1,[10613]),f9h(A_h,42,-1,[8677]),f9h(A_h,42,-1,[10528]),f9h(A_h,42,-1,[10547]),f9h(A_h,42,-1,[10526]),f9h(A_h,42,-1,[8618]),f9h(A_h,42,-1,[8620]),f9h(A_h,42,-1,[10565]),f9h(A_h,42,-1,[10612]),f9h(A_h,42,-1,[8611]),f9h(A_h,42,-1,[8605]),f9h(A_h,42,-1,[10522]),f9h(A_h,42,-1,[8758]),f9h(A_h,42,-1,[8474]),f9h(A_h,42,-1,[10509]),f9h(A_h,42,-1,[10099]),f9h(A_h,42,-1,[125]),f9h(A_h,42,-1,[93]),f9h(A_h,42,-1,[10636]),f9h(A_h,42,-1,[10638]),f9h(A_h,42,-1,[10640]),f9h(A_h,42,-1,[345]),f9h(A_h,42,-1,[343]),f9h(A_h,42,-1,[8969]),f9h(A_h,42,-1,[125]),f9h(A_h,42,-1,[1088]),f9h(A_h,42,-1,[10551]),f9h(A_h,42,-1,[10601]),f9h(A_h,42,-1,[8221]),f9h(A_h,42,-1,[8221]),f9h(A_h,42,-1,[8627]),f9h(A_h,42,-1,[8476]),f9h(A_h,42,-1,[8475]),f9h(A_h,42,-1,[8476]),f9h(A_h,42,-1,[8477]),f9h(A_h,42,-1,[9645]),f9h(A_h,42,-1,[174]),f9h(A_h,42,-1,[174]),f9h(A_h,42,-1,[10621]),f9h(A_h,42,-1,[8971]),f9h(A_h,42,-1,[55349,56623]),f9h(A_h,42,-1,[8641]),f9h(A_h,42,-1,[8640]),f9h(A_h,42,-1,[10604]),f9h(A_h,42,-1,[961]),f9h(A_h,42,-1,[1009]),f9h(A_h,42,-1,[8594]),f9h(A_h,42,-1,[8611]),f9h(A_h,42,-1,[8641]),f9h(A_h,42,-1,[8640]),f9h(A_h,42,-1,[8644]),f9h(A_h,42,-1,[8652]),f9h(A_h,42,-1,[8649]),f9h(A_h,42,-1,[8605]),f9h(A_h,42,-1,[8908]),f9h(A_h,42,-1,[730]),f9h(A_h,42,-1,[8787]),f9h(A_h,42,-1,[8644]),f9h(A_h,42,-1,[8652]),f9h(A_h,42,-1,[8207]),f9h(A_h,42,-1,[9137]),f9h(A_h,42,-1,[9137]),f9h(A_h,42,-1,[10990]),f9h(A_h,42,-1,[10221]),f9h(A_h,42,-1,[8702]),f9h(A_h,42,-1,[10215]),f9h(A_h,42,-1,[10630]),f9h(A_h,42,-1,[55349,56675]),f9h(A_h,42,-1,[10798]),f9h(A_h,42,-1,[10805]),f9h(A_h,42,-1,[41]),f9h(A_h,42,-1,[10644]),f9h(A_h,42,-1,[10770]),f9h(A_h,42,-1,[8649]),f9h(A_h,42,-1,[8250]),f9h(A_h,42,-1,[55349,56519]),f9h(A_h,42,-1,[8625]),f9h(A_h,42,-1,[93]),f9h(A_h,42,-1,[8217]),f9h(A_h,42,-1,[8217]),f9h(A_h,42,-1,[8908]),f9h(A_h,42,-1,[8906]),f9h(A_h,42,-1,[9657]),f9h(A_h,42,-1,[8885]),f9h(A_h,42,-1,[9656]),f9h(A_h,42,-1,[10702]),f9h(A_h,42,-1,[10600]),f9h(A_h,42,-1,[8478]),f9h(A_h,42,-1,[347]),f9h(A_h,42,-1,[8218]),f9h(A_h,42,-1,[8827]),f9h(A_h,42,-1,[10932]),f9h(A_h,42,-1,[10936]),f9h(A_h,42,-1,[353]),f9h(A_h,42,-1,[8829]),f9h(A_h,42,-1,[10928]),f9h(A_h,42,-1,[351]),f9h(A_h,42,-1,[349]),f9h(A_h,42,-1,[10934]),f9h(A_h,42,-1,[10938]),f9h(A_h,42,-1,[8937]),f9h(A_h,42,-1,[10771]),f9h(A_h,42,-1,[8831]),f9h(A_h,42,-1,[1089]),f9h(A_h,42,-1,[8901]),f9h(A_h,42,-1,[8865]),f9h(A_h,42,-1,[10854]),f9h(A_h,42,-1,[8664]),f9h(A_h,42,-1,[10533]),f9h(A_h,42,-1,[8600]),f9h(A_h,42,-1,[8600]),f9h(A_h,42,-1,[167]),f9h(A_h,42,-1,[167]),f9h(A_h,42,-1,[59]),f9h(A_h,42,-1,[10537]),f9h(A_h,42,-1,[8726]),f9h(A_h,42,-1,[8726]),f9h(A_h,42,-1,[10038]),f9h(A_h,42,-1,[55349,56624]),f9h(A_h,42,-1,[8994]),f9h(A_h,42,-1,[9839]),f9h(A_h,42,-1,[1097]),f9h(A_h,42,-1,[1096]),f9h(A_h,42,-1,[8739]),f9h(A_h,42,-1,[8741]),f9h(A_h,42,-1,[173]),f9h(A_h,42,-1,[173]),f9h(A_h,42,-1,[963]),f9h(A_h,42,-1,[962]),f9h(A_h,42,-1,[962]),f9h(A_h,42,-1,[8764]),f9h(A_h,42,-1,[10858]),f9h(A_h,42,-1,[8771]),f9h(A_h,42,-1,[8771]),f9h(A_h,42,-1,[10910]),f9h(A_h,42,-1,[10912]),f9h(A_h,42,-1,[10909]),f9h(A_h,42,-1,[10911]),f9h(A_h,42,-1,[8774]),f9h(A_h,42,-1,[10788]),f9h(A_h,42,-1,[10610]),f9h(A_h,42,-1,[8592]),f9h(A_h,42,-1,[8726]),f9h(A_h,42,-1,[10803]),f9h(A_h,42,-1,[10724]),f9h(A_h,42,-1,[8739]),f9h(A_h,42,-1,[8995]),f9h(A_h,42,-1,[10922]),f9h(A_h,42,-1,[10924]),f9h(A_h,42,-1,[1100]),f9h(A_h,42,-1,[47]),f9h(A_h,42,-1,[10692]),f9h(A_h,42,-1,[9023]),f9h(A_h,42,-1,[55349,56676]),f9h(A_h,42,-1,[9824]),f9h(A_h,42,-1,[9824]),f9h(A_h,42,-1,[8741]),f9h(A_h,42,-1,[8851]),f9h(A_h,42,-1,[8852]),f9h(A_h,42,-1,[8847]),f9h(A_h,42,-1,[8849]),f9h(A_h,42,-1,[8847]),f9h(A_h,42,-1,[8849]),f9h(A_h,42,-1,[8848]),f9h(A_h,42,-1,[8850]),f9h(A_h,42,-1,[8848]),f9h(A_h,42,-1,[8850]),f9h(A_h,42,-1,[9633]),f9h(A_h,42,-1,[9633]),f9h(A_h,42,-1,[9642]),f9h(A_h,42,-1,[9642]),f9h(A_h,42,-1,[8594]),f9h(A_h,42,-1,[55349,56520]),f9h(A_h,42,-1,[8726]),f9h(A_h,42,-1,[8995]),f9h(A_h,42,-1,[8902]),f9h(A_h,42,-1,[9734]),f9h(A_h,42,-1,[9733]),f9h(A_h,42,-1,[1013]),f9h(A_h,42,-1,[981]),f9h(A_h,42,-1,[175]),f9h(A_h,42,-1,[8834]),f9h(A_h,42,-1,[10949]),f9h(A_h,42,-1,[10941]),f9h(A_h,42,-1,[8838]),f9h(A_h,42,-1,[10947]),f9h(A_h,42,-1,[10945]),f9h(A_h,42,-1,[10955]),f9h(A_h,42,-1,[8842]),f9h(A_h,42,-1,[10943]),f9h(A_h,42,-1,[10617]),f9h(A_h,42,-1,[8834]),f9h(A_h,42,-1,[8838]),f9h(A_h,42,-1,[10949]),f9h(A_h,42,-1,[8842]),f9h(A_h,42,-1,[10955]),f9h(A_h,42,-1,[10951]),f9h(A_h,42,-1,[10965]),f9h(A_h,42,-1,[10963]),f9h(A_h,42,-1,[8827]),f9h(A_h,42,-1,[10936]),f9h(A_h,42,-1,[8829]),f9h(A_h,42,-1,[10928]),f9h(A_h,42,-1,[10938]),f9h(A_h,42,-1,[10934]),f9h(A_h,42,-1,[8937]),f9h(A_h,42,-1,[8831]),f9h(A_h,42,-1,[8721]),f9h(A_h,42,-1,[9834]),f9h(A_h,42,-1,[185]),f9h(A_h,42,-1,[185]),f9h(A_h,42,-1,[178]),f9h(A_h,42,-1,[178]),f9h(A_h,42,-1,[179]),f9h(A_h,42,-1,[179]),f9h(A_h,42,-1,[8835]),f9h(A_h,42,-1,[10950]),f9h(A_h,42,-1,[10942]),f9h(A_h,42,-1,[10968]),f9h(A_h,42,-1,[8839]),f9h(A_h,42,-1,[10948]),f9h(A_h,42,-1,[10967]),f9h(A_h,42,-1,[10619]),f9h(A_h,42,-1,[10946]),f9h(A_h,42,-1,[10956]),f9h(A_h,42,-1,[8843]),f9h(A_h,42,-1,[10944]),f9h(A_h,42,-1,[8835]),f9h(A_h,42,-1,[8839]),f9h(A_h,42,-1,[10950]),f9h(A_h,42,-1,[8843]),f9h(A_h,42,-1,[10956]),f9h(A_h,42,-1,[10952]),f9h(A_h,42,-1,[10964]),f9h(A_h,42,-1,[10966]),f9h(A_h,42,-1,[8665]),f9h(A_h,42,-1,[10534]),f9h(A_h,42,-1,[8601]),f9h(A_h,42,-1,[8601]),f9h(A_h,42,-1,[10538]),f9h(A_h,42,-1,[223]),f9h(A_h,42,-1,[223]),f9h(A_h,42,-1,[8982]),f9h(A_h,42,-1,[964]),f9h(A_h,42,-1,[9140]),f9h(A_h,42,-1,[357]),f9h(A_h,42,-1,[355]),f9h(A_h,42,-1,[1090]),f9h(A_h,42,-1,[8411]),f9h(A_h,42,-1,[8981]),f9h(A_h,42,-1,[55349,56625]),f9h(A_h,42,-1,[8756]),f9h(A_h,42,-1,[8756]),f9h(A_h,42,-1,[952]),f9h(A_h,42,-1,[977]),f9h(A_h,42,-1,[977]),f9h(A_h,42,-1,[8776]),f9h(A_h,42,-1,[8764]),f9h(A_h,42,-1,[8201]),f9h(A_h,42,-1,[8776]),f9h(A_h,42,-1,[8764]),f9h(A_h,42,-1,[254]),f9h(A_h,42,-1,[254]),f9h(A_h,42,-1,[732]),f9h(A_h,42,-1,[215]),f9h(A_h,42,-1,[215]),f9h(A_h,42,-1,[8864]),f9h(A_h,42,-1,[10801]),f9h(A_h,42,-1,[10800]),f9h(A_h,42,-1,[8749]),f9h(A_h,42,-1,[10536]),f9h(A_h,42,-1,[8868]),f9h(A_h,42,-1,[9014]),f9h(A_h,42,-1,[10993]),f9h(A_h,42,-1,[55349,56677]),f9h(A_h,42,-1,[10970]),f9h(A_h,42,-1,[10537]),f9h(A_h,42,-1,[8244]),f9h(A_h,42,-1,[8482]),f9h(A_h,42,-1,[9653]),f9h(A_h,42,-1,[9663]),f9h(A_h,42,-1,[9667]),f9h(A_h,42,-1,[8884]),f9h(A_h,42,-1,[8796]),f9h(A_h,42,-1,[9657]),f9h(A_h,42,-1,[8885]),f9h(A_h,42,-1,[9708]),f9h(A_h,42,-1,[8796]),f9h(A_h,42,-1,[10810]),f9h(A_h,42,-1,[10809]),f9h(A_h,42,-1,[10701]),f9h(A_h,42,-1,[10811]),f9h(A_h,42,-1,[9186]),f9h(A_h,42,-1,[55349,56521]),f9h(A_h,42,-1,[1094]),f9h(A_h,42,-1,[1115]),f9h(A_h,42,-1,[359]),f9h(A_h,42,-1,[8812]),f9h(A_h,42,-1,[8606]),f9h(A_h,42,-1,[8608]),f9h(A_h,42,-1,[8657]),f9h(A_h,42,-1,[10595]),f9h(A_h,42,-1,[250]),f9h(A_h,42,-1,[250]),f9h(A_h,42,-1,[8593]),f9h(A_h,42,-1,[1118]),f9h(A_h,42,-1,[365]),f9h(A_h,42,-1,[251]),f9h(A_h,42,-1,[251]),f9h(A_h,42,-1,[1091]),f9h(A_h,42,-1,[8645]),f9h(A_h,42,-1,[369]),f9h(A_h,42,-1,[10606]),f9h(A_h,42,-1,[10622]),f9h(A_h,42,-1,[55349,56626]),f9h(A_h,42,-1,[249]),f9h(A_h,42,-1,[249]),f9h(A_h,42,-1,[8639]),f9h(A_h,42,-1,[8638]),f9h(A_h,42,-1,[9600]),f9h(A_h,42,-1,[8988]),f9h(A_h,42,-1,[8988]),f9h(A_h,42,-1,[8975]),f9h(A_h,42,-1,[9720]),f9h(A_h,42,-1,[363]),f9h(A_h,42,-1,[168]),f9h(A_h,42,-1,[168]),f9h(A_h,42,-1,[371]),f9h(A_h,42,-1,[55349,56678]),f9h(A_h,42,-1,[8593]),f9h(A_h,42,-1,[8597]),f9h(A_h,42,-1,[8639]),f9h(A_h,42,-1,[8638]),f9h(A_h,42,-1,[8846]),f9h(A_h,42,-1,[965]),f9h(A_h,42,-1,[978]),f9h(A_h,42,-1,[965]),f9h(A_h,42,-1,[8648]),f9h(A_h,42,-1,[8989]),f9h(A_h,42,-1,[8989]),f9h(A_h,42,-1,[8974]),f9h(A_h,42,-1,[367]),f9h(A_h,42,-1,[9721]),f9h(A_h,42,-1,[55349,56522]),f9h(A_h,42,-1,[8944]),f9h(A_h,42,-1,[361]),f9h(A_h,42,-1,[9653]),f9h(A_h,42,-1,[9652]),f9h(A_h,42,-1,[8648]),f9h(A_h,42,-1,[252]),f9h(A_h,42,-1,[252]),f9h(A_h,42,-1,[10663]),f9h(A_h,42,-1,[8661]),f9h(A_h,42,-1,[10984]),f9h(A_h,42,-1,[10985]),f9h(A_h,42,-1,[8872]),f9h(A_h,42,-1,[10652]),f9h(A_h,42,-1,[949]),f9h(A_h,42,-1,[1008]),f9h(A_h,42,-1,[8709]),f9h(A_h,42,-1,[966]),f9h(A_h,42,-1,[982]),f9h(A_h,42,-1,[8733]),f9h(A_h,42,-1,[8597]),f9h(A_h,42,-1,[1009]),f9h(A_h,42,-1,[962]),f9h(A_h,42,-1,[977]),f9h(A_h,42,-1,[8882]),f9h(A_h,42,-1,[8883]),f9h(A_h,42,-1,[1074]),f9h(A_h,42,-1,[8866]),f9h(A_h,42,-1,[8744]),f9h(A_h,42,-1,[8891]),f9h(A_h,42,-1,[8794]),f9h(A_h,42,-1,[8942]),f9h(A_h,42,-1,[124]),f9h(A_h,42,-1,[124]),f9h(A_h,42,-1,[55349,56627]),f9h(A_h,42,-1,[8882]),f9h(A_h,42,-1,[55349,56679]),f9h(A_h,42,-1,[8733]),f9h(A_h,42,-1,[8883]),f9h(A_h,42,-1,[55349,56523]),f9h(A_h,42,-1,[10650]),f9h(A_h,42,-1,[373]),f9h(A_h,42,-1,[10847]),f9h(A_h,42,-1,[8743]),f9h(A_h,42,-1,[8793]),f9h(A_h,42,-1,[8472]),f9h(A_h,42,-1,[55349,56628]),f9h(A_h,42,-1,[55349,56680]),f9h(A_h,42,-1,[8472]),f9h(A_h,42,-1,[8768]),f9h(A_h,42,-1,[8768]),f9h(A_h,42,-1,[55349,56524]),f9h(A_h,42,-1,[8898]),f9h(A_h,42,-1,[9711]),f9h(A_h,42,-1,[8899]),f9h(A_h,42,-1,[9661]),f9h(A_h,42,-1,[55349,56629]),f9h(A_h,42,-1,[10234]),f9h(A_h,42,-1,[10231]),f9h(A_h,42,-1,[958]),f9h(A_h,42,-1,[10232]),f9h(A_h,42,-1,[10229]),f9h(A_h,42,-1,[10236]),f9h(A_h,42,-1,[8955]),f9h(A_h,42,-1,[10752]),f9h(A_h,42,-1,[55349,56681]),f9h(A_h,42,-1,[10753]),f9h(A_h,42,-1,[10754]),f9h(A_h,42,-1,[10233]),f9h(A_h,42,-1,[10230]),f9h(A_h,42,-1,[55349,56525]),f9h(A_h,42,-1,[10758]),f9h(A_h,42,-1,[10756]),f9h(A_h,42,-1,[9651]),f9h(A_h,42,-1,[8897]),f9h(A_h,42,-1,[8896]),f9h(A_h,42,-1,[253]),f9h(A_h,42,-1,[253]),f9h(A_h,42,-1,[1103]),f9h(A_h,42,-1,[375]),f9h(A_h,42,-1,[1099]),f9h(A_h,42,-1,[165]),f9h(A_h,42,-1,[165]),f9h(A_h,42,-1,[55349,56630]),f9h(A_h,42,-1,[1111]),f9h(A_h,42,-1,[55349,56682]),f9h(A_h,42,-1,[55349,56526]),f9h(A_h,42,-1,[1102]),f9h(A_h,42,-1,[255]),f9h(A_h,42,-1,[255]),f9h(A_h,42,-1,[378]),f9h(A_h,42,-1,[382]),f9h(A_h,42,-1,[1079]),f9h(A_h,42,-1,[380]),f9h(A_h,42,-1,[8488]),f9h(A_h,42,-1,[950]),f9h(A_h,42,-1,[55349,56631]),f9h(A_h,42,-1,[1078]),f9h(A_h,42,-1,[8669]),f9h(A_h,42,-1,[55349,56683]),f9h(A_h,42,-1,[55349,56527]),f9h(A_h,42,-1,[8205]),f9h(A_h,42,-1,[8204])]);uVi=f9h(cai,52,12,[f9h(A_h,42,-1,[8364]),f9h(A_h,42,-1,[65533]),f9h(A_h,42,-1,[8218]),f9h(A_h,42,-1,[402]),f9h(A_h,42,-1,[8222]),f9h(A_h,42,-1,[8230]),f9h(A_h,42,-1,[8224]),f9h(A_h,42,-1,[8225]),f9h(A_h,42,-1,[710]),f9h(A_h,42,-1,[8240]),f9h(A_h,42,-1,[352]),f9h(A_h,42,-1,[8249]),f9h(A_h,42,-1,[338]),f9h(A_h,42,-1,[65533]),f9h(A_h,42,-1,[381]),f9h(A_h,42,-1,[65533]),f9h(A_h,42,-1,[65533]),f9h(A_h,42,-1,[8216]),f9h(A_h,42,-1,[8217]),f9h(A_h,42,-1,[8220]),f9h(A_h,42,-1,[8221]),f9h(A_h,42,-1,[8226]),f9h(A_h,42,-1,[8211]),f9h(A_h,42,-1,[8212]),f9h(A_h,42,-1,[732]),f9h(A_h,42,-1,[8482]),f9h(A_h,42,-1,[353]),f9h(A_h,42,-1,[8250]),f9h(A_h,42,-1,[339]),f9h(A_h,42,-1,[65533]),f9h(A_h,42,-1,[382]),f9h(A_h,42,-1,[376])])}
var sVi,tVi,uVi;function xVi(d,a,e,c){var b;if(d.length!=c){return false}for(b=0;b<c;++b){if(d.charCodeAt(b)!=a[e+b]){return false}}return true}
function yVi(d,e){var a,b,c;if(e==null){return false}if(d.length!=e.length){return false}for(c=0;c<d.length;++c){a=d.charCodeAt(c);b=e.charCodeAt(c);if(b>=65&&b<=90){b+=32}if(a!=b){return false}}return true}
function zVi(d,e){var a,b,c;if(e==null){return false}if(d.length>e.length){return false}for(c=0;c<d.length;++c){a=d.charCodeAt(c);b=e.charCodeAt(c);if(b>=65&&b<=90){b+=32}if(a!=b){return false}}return true}
function CVi(j,c,f,d,e,h,i,b,g,a){j.c=c;j.d=d;j.g=g;j.f=f;j.e=e;j.i=h;j.j=i;j.b=b;j.a=a;j.h=1;return j}
function DVi(d,c,a,b){d.c=a.d;d.d=a.e;d.g=a.e;d.f=c;d.e=b;d.i=a.f;d.j=a.g;d.b=a.c;d.a=null;d.h=1;return d}
function aWi(e,d,b,c,a){e.c=b.d;e.d=b.e;e.g=b.e;e.f=d;e.e=c;e.i=b.f;e.j=b.g;e.b=b.c;e.a=a;e.h=1;return e}
function EVi(e,c,a,b,d){e.c=a.d;e.d=a.e;e.g=d;e.f=c;e.e=b;e.i=a.f;e.j=a.g;e.b=a.c;e.a=null;e.h=1;return e}
function FVi(f,c,a,b,d,e){f.c=a.d;f.d=a.e;f.g=d;f.f=c;f.e=b;f.i=e;f.j=false;f.b=false;f.a=null;f.h=1;return f}
function cWi(){return u_h}
function dWi(){return this.d}
function AVi(){}
_=AVi.prototype=new xdi();_.gC=cWi;_.tS=dWi;_.tI=38;_.a=null;_.b=false;_.c=0;_.d=null;_.e=null;_.f=null;_.g=null;_.h=1;_.i=false;_.j=false;function q0i(d,a,c,b){d.a=a;d.c=c;d.b=b;return d}
function r0i(b,a){if(a&&b.a[b.c]==10){++b.c}}
function u0i(){return x_h}
function p0i(){}
_=p0i.prototype=new xdi();_.gC=u0i;_.tI=39;_.a=null;_.b=0;_.c=0;function z0i(b,a){b.b=a;b.a=null;return b}
function B0i(b){var a;a=b.b;if(a==null&&!!b.a){return b.a.b}else{return a}}
function C0i(){return y_h}
function D0i(){return B0i(this)}
function E0i(){if(this.a){return agi(this.a)}else{return agi(this)}}
function y0i(){}
_=y0i.prototype=new Aci();_.gC=C0i;_.Bb=D0i;_.tS=E0i;_.tI=40;_.a=null;function a1i(c,b,a){c.b=b;c.a=null;if(a){lUi(a);kUi(a)}else{}return c}
function b1i(d,c,b,a){d.b=c;d.a=a;if(b){lUi(b);kUi(b)}else{}return d}
function d1i(){return z_h}
function F0i(){}
_=F0i.prototype=new y0i();_.gC=d1i;_.tI=41;function Cbi(){!!$stats&&$stats({moduleName:$moduleName,subSystem:iIh,evtGroup:jIh,millis:(new Date()).getTime(),type:kIh,className:lIh});Envjs.parseHtmlDocument=xni}
__defineParser__=function gwtOnLoad(b,d,c){$moduleName=d;$moduleBase=c;if(b)try{Cbi()}catch(a){b(d)}else{Cbi()}}
function v0i(){}
var k$h=jci(mIh,nIh),b$h=jci(pIh,qIh),q$h=jci(mIh,rIh),g$h=jci(mIh,sIh),l$h=jci(mIh,tIh),E9h=jci(uIh,vIh),F9h=jci(uIh,wIh),D_h=ici(xIh,yIh),f$h=jci(mIh,AIh),dai=ici(cNh,BIh),s$h=jci(CIh,DIh),A$h=jci(CIh,EIh),F$h=jci(CIh,FIh),a$h=jci(pIh,aJh),i$h=jci(mIh,bJh),c$h=jci(mIh,cJh),A_h=ici(cNh,dJh),e$h=jci(mIh,fJh),d$h=jci(mIh,gJh),h$h=jci(mIh,hJh),B_h=ici(cNh,iJh),j$h=jci(mIh,jJh),p$h=jci(mIh,aUh),m$h=jci(mIh,kJh),n$h=jci(mIh,lJh),o$h=jci(mIh,mJh),r$h=jci(mIh,nJh),C_h=ici(xIh,oJh),C$h=jci(CIh,qJh),x$h=jci(CIh,rJh),E$h=jci(CIh,sJh),u$h=jci(CIh,tJh),t$h=jci(CIh,uJh),B$h=jci(CIh,vJh),v$h=jci(CIh,wJh),w$h=jci(CIh,xJh),y$h=jci(CIh,yJh),z$h=jci(CIh,zJh),D$h=jci(CIh,BJh),a_h=jci(CIh,CJh),b_h=jci(CIh,DJh),e_h=jci(CIh,EJh),c_h=jci(CIh,FJh),d_h=jci(CIh,aKh),f_h=jci(CIh,bKh),g_h=kci(cKh,dKh),h_h=kci(cKh,eKh),i_h=kci(cKh,hKh),w_h=jci(iKh,jKh),p_h=jci(iKh,kKh),k_h=jci(lKh,mKh),j_h=jci(lKh,nKh),m_h=jci(lKh,oKh),l_h=jci(lKh,pKh),n_h=jci(lKh,qKh),bai=ici(cNh,sKh),E_h=ici(tKh,uKh),o_h=jci(iKh,vKh),F_h=ici(tKh,wKh),q_h=jci(iKh,xKh),v_h=jci(iKh,yKh),r_h=jci(iKh,zKh),s_h=jci(iKh,AKh),t_h=jci(iKh,BKh),cai=ici(cNh,DKh),u_h=jci(iKh,EKh),aai=ici(tKh,FKh),x_h=jci(iKh,aLh),y_h=jci(bLh,cLh),z_h=jci(bLh,dLh);if (true) { var __gwt_initHandlers = function(){}; }})();
/**
* DOMParser
*/
__defineParser__(function(e){
console.log('Error loading html 5 parser implementation');
}, 'nu_validator_htmlparser_HtmlParser', '');
/*DOMParser = function(principle, documentURI, baseURI){};
__extend__(DOMParser.prototype,{
parseFromString: function(xmlstring, mimetype){
//console.log('DOMParser.parseFromString %s', mimetype);
var xmldoc = new Document(new DOMImplementation());
return XMLParser.parseDocument(xmlstring, xmldoc, mimetype);
}
});*/
XMLParser.parseDocument = function(xmlstring, xmldoc, mimetype){
//console.log('XMLParser.parseDocument');
var tmpdoc = new Document(new DOMImplementation()),
parent,
importedNode,
tmpNode;
if(mimetype && mimetype == 'text/xml'){
//console.log('mimetype: text/xml');
tmpdoc.baseURI = 'http://envjs.com/xml';
xmlstring = '<html><head></head><body>'+
'<envjs_1234567890 xmlns="envjs_1234567890">'
+xmlstring+
'</envjs_1234567890>'+
'</body></html>';
Envjs.parseHtmlDocument(xmlstring, tmpdoc, false, null, null);
parent = tmpdoc.getElementsByTagName('envjs_1234567890')[0];
}else{
Envjs.parseHtmlDocument(xmlstring, tmpdoc, false, null, null);
parent = tmpdoc.documentElement;
}
while(xmldoc.firstChild != null){
xmldoc.removeChild( xmldoc.firstChild );
}
while(parent.firstChild != null){
tmpNode = parent.removeChild( parent.firstChild );
importedNode = xmldoc.importNode( tmpNode, true);
xmldoc.appendChild( importedNode );
}
return xmldoc;
};
var __fragmentCache__ = {length:0},
__cachable__ = 255;
HTMLParser.parseDocument = function(htmlstring, htmldoc){
//console.log('HTMLParser.parseDocument %s', htmldoc.async);
htmldoc.parsing = true;
Envjs.parseHtmlDocument(htmlstring, htmldoc, htmldoc.async, null, null);
//Envjs.wait(-1);
return htmldoc;
};
HTMLParser.parseFragment = function(htmlstring, element){
//console.log('HTMLParser.parseFragment')
// fragment is allowed to be an element as well
var tmpdoc,
parent,
importedNode,
tmpNode,
length,
i,
docstring;
//console.log('parsing fragment: %s', htmlstring);
//console.log('__fragmentCache__.length %s', __fragmentCache__.length)
if( htmlstring.length > __cachable__ && htmlstring in __fragmentCache__){
tmpdoc = __fragmentCache__[htmlstring];
}else{
//console.log('parsing html fragment \n%s', htmlstring);
tmpdoc = new HTMLDocument(new DOMImplementation());
// Need some indicator that this document isn't THE document
// to fire off img.src change events and other items.
// Otherwise, what happens is the tmpdoc fires and img.src
// event, then when it's all imported to the original document
// it happens again.
tmpdoc.fragment = true;
//preserves leading white space
docstring = '<html><head></head><body>'+
'<envjs_1234567890 xmlns="envjs_1234567890">'
+htmlstring+
'</envjs_1234567890>'+
'</body></html>';
Envjs.parseHtmlDocument(docstring,tmpdoc, false, null,null);
if(htmlstring.length > __cachable__ ){
tmpdoc.normalizeDocument();
__fragmentCache__[htmlstring] = tmpdoc;
__fragmentCache__.length += htmlstring.length;
tmpdoc.cached = true;
}else{
tmpdoc.cached = false;
}
}
//parent is envjs_1234567890 element
parent = tmpdoc.body.childNodes[0];
while(element.firstChild != null){
//zap the elements children so we can import
element.removeChild( element.firstChild );
}
if(tmpdoc.cached){
length = parent.childNodes.length;
for(i=0;i<length;i++){
importedNode = element.importNode( parent.childNodes[i], true );
element.appendChild( importedNode );
}
}else{
while(parent.firstChild != null){
tmpNode = parent.removeChild( parent.firstChild );
importedNode = element.importNode( tmpNode, true);
element.appendChild( importedNode );
}
}
// console.log('finished fragment: %s', element.outerHTML);
return element;
};
var __clearFragmentCache__ = function(){
__fragmentCache__ = {};
}
/**
* @name Document
* @w3c:domlevel 2
* @uri http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html
*/
__extend__(Document.prototype, {
loadXML : function(xmlString) {
//console.log('Parser::Document.loadXML');
// create Document
if(this === document){
//$debug("Setting internal window.document");
document = this;
}
// populate Document
try {
// make sure this document object is empty before we try to load ...
this.attributes = new NamedNodeMap(this, this);
this._namespaces = new NamespaceNodeMap(this, this);
this._readonly = false;
XMLParser.parseDocument(xmlString, this);
Envjs.wait(-1);
} catch (e) {
//$error(e);
}
return this;
}
});
__extend__(HTMLDocument.prototype, {
open : function() {
//console.log('opening doc for write.');
if (! this._writebuffer) {
this._writebuffer = [];
}
},
close : function() {
//console.log('closing doc.');
if (this._writebuffer) {
HTMLParser.parseDocument(this._writebuffer.join(''), this);
this._writebuffer = null;
//console.log('finished writing doc.');
}
},
/**
* http://dev.w3.org/html5/spec/Overview.html#document.write
*/
write: function(htmlstring) {
//console.log('writing doc.');
this.open();
this._writebuffer.push(htmlstring);
},
/**
* http://dev.w3.org/html5/spec/Overview.html#dom-document-writeln
*/
writeln: function(htmlstring) {
this.open();
this._writebuffer.push(htmlstring + '\n');
}
});
/**
* elementPopped is called by the parser in two cases
*
* - an 'tag' is * complete (all children process and end tag, real or
* implied is * processed)
* - a replaceElement happens (this happens by making placeholder
* nodes and then the real one is swapped in.
*
*/
var __elementPopped__ = function(ns, name, node){
//console.log('popped html element %s %s %s', ns, name, node);
var doc = node.ownerDocument,
okay,
event;
switch(doc.parsing){
case false:
//innerHTML so dont do loading patterns for parsing
//console.log('element popped (implies innerHTML) not in parsing mode %s', node.nodeName);
break;
case true:
switch(doc+''){
case '[object XMLDocument]':
break;
case '[object HTMLDocument]':
switch(node.namespaceURI){
case "http://n.validator.nu/placeholder/":
//console.log('got script during parsing %s', node.textContent);
break;
case null:
case "":
case "http://www.w3.org/1999/xhtml":
switch(name.toLowerCase()){
case 'script':
try{
okay = Envjs.loadLocalScript(node, null);
// console.log('loaded script? %s %s', node.uuid, okay);
// only fire event if we actually had something to load
if (node.src && node.src.length > 0){
event = doc.createEvent('HTMLEvents');
event.initEvent( okay ? "load" : "error", false, false );
node.dispatchEvent( event, false );
}
}catch(e){
console.log('error loading html element %s %s %s %e', ns, name, node, e.toString());
}
break;
case 'frame':
case 'iframe':
node.contentWindow = { };
node.contentDocument = new HTMLDocument(new DOMImplementation(), node.contentWindow);
node.contentWindow.document = node.contentDocument;
try{
Window;
}catch(e){
node.contentDocument.addEventListener('DOMContentLoaded', function(){
event = node.contentDocument.createEvent('HTMLEvents');
event.initEvent("load", false, false);
node.dispatchEvent( event, false );
});
}
try{
if (node.src && node.src.length > 0){
//console.log("getting content document for (i)frame from %s", node.src);
Envjs.loadFrame(node, Envjs.uri(node.src));
event = node.contentDocument.createEvent('HTMLEvents');
event.initEvent("load", false, false);
node.dispatchEvent( event, false );
}else{
//I dont like this being here:
//TODO: better mix-in strategy so the try/catch isnt required
try{
if(Window){
Envjs.loadFrame(node);
//console.log('src/html/document.js: triggering frame load');
event = node.contentDocument.createEvent('HTMLEvents');
event.initEvent("load", false, false);
node.dispatchEvent( event, false );
}
}catch(e){}
}
}catch(e){
console.log('error loading html element %s %e', node, e.toString());
}
/*try{
if (node.src && node.src.length > 0){
//console.log("getting content document for (i)frame from %s", node.src);
Envjs.loadFrame(node, Envjs.uri(node.src));
event = node.ownerDocument.createEvent('HTMLEvents');
event.initEvent("load", false, false);
node.dispatchEvent( event, false );
}else{
//console.log('src/parser/htmldocument: triggering frame load (no src)');
}
}catch(e){
console.log('error loading html element %s %s %s %e', ns, name, node, e.toString());
}*/
break;
case 'link':
if (node.href) {
__loadLink__(node, node.href);
}
break;
case 'option':
node._updateoptions();
break;
case 'img':
if (node.src){
__loadImage__(node, node.src);
}
break;
case 'html':
//console.log('html popped');
doc.parsing = false;
//DOMContentLoaded event
try{
if(doc.createEvent){
event = doc.createEvent('Events');
event.initEvent("DOMContentLoaded", false, false);
doc.dispatchEvent( event, false );
}
}catch(e){
console.log('%s', e);
}
try{
if(doc.createEvent){
event = doc.createEvent('HTMLEvents');
event.initEvent("load", false, false);
doc.dispatchEvent( event, false );
}
}catch(e){
console.log('%s', e);
}
try{
if(doc.parentWindow){
event = doc.createEvent('HTMLEvents');
event.initEvent("load", false, false);
doc.parentWindow.dispatchEvent( event, false );
}
}catch(e){
console.log('%s', e);
}
try{
if(doc === window.document){
//console.log('triggering window.load')
event = doc.createEvent('HTMLEvents');
event.initEvent("load", false, false);
try{
window.dispatchEvent( event, false );
}catch(e){
console.log('%s', e);
}
}
}catch(e){
//console.log('%s', e);
//swallow
}
default:
if(node.getAttribute('onload')){
//console.log('%s onload', node);
node.onload();
}
break;
}//switch on name
default:
break;
}//switch on ns
break;
default:
console.log('element popped: %s %s', ns, name, node.ownerDocument+'');
}//switch on doc type
default:
break;
}//switch on parsing
};
__extend__(HTMLElement.prototype,{
set innerHTML(html){
HTMLParser.parseFragment(html, this);
}
});
/**
* @author john resig & the envjs team
* @uri http://www.envjs.com/
* @copyright 2008-2010
* @license MIT
*/
//CLOSURE_END
}());
/*
* Envjs xhr.1.2.13
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*
* Parts of the implementation originally written by Yehuda Katz.
*
* This file simply provides the global definitions we need to
* be able to correctly implement to core browser (XML)HTTPRequest
* interfaces.
*/
var Location,
XMLHttpRequest;
/*
* Envjs xhr.1.2.13
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*/
//CLOSURE_START
(function(){
/**
* @author john resig
*/
// Helper method for extending one object with another.
function __extend__(a,b) {
for ( var i in b ) {
var g = b.__lookupGetter__(i), s = b.__lookupSetter__(i);
if ( g || s ) {
if ( g ) { a.__defineGetter__(i, g); }
if ( s ) { a.__defineSetter__(i, s); }
} else {
a[i] = b[i];
}
} return a;
}
/**
* @author john resig
*/
//from jQuery
function __setArray__( target, array ) {
// Resetting the length to 0, then using the native Array push
// is a super-fast way to populate an object with array-like properties
target.length = 0;
Array.prototype.push.apply( target, array );
}
/**
* @author ariel flesler
* http://flesler.blogspot.com/2008/11/fast-trim-function-for-javascript.html
* @param {Object} str
*/
function __trim__( str ){
return (str || "").replace( /^\s+|\s+$/g, "" );
}
/**
* @todo: document
*/
__extend__(Document.prototype,{
load: function(url){
if(this.documentURI == 'about:html'){
this.location.assign(url);
}else if(this.documentURI == url){
this.location.reload(false);
}else{
this.location.replace(url);
}
},
get location(){
return new Location(this.documentURI, this);
},
set location(url){
//very important or you will go into an infinite
//loop when creating a xml document
if(url) {
this.location.replace(url);
}
}
});
HTMLFormElement.prototype.submit = function(){
var event = __submit__(this),
serialized,
xhr,
method,
action;
if(!event.cancelled){
serialized = __formSerialize__(this);
xhr = new XMLHttpRequest();
method = this.method !== ""?this.method:"GET";
action = this.action !== ""?this.action:this.ownerDocument.baseURI;
xhr.open(method, action, false);
xhr.send(data, false);
if(xhr.readyState === 4){
__exchangeHTMLDocument__(this.ownerDocument, xhr.responseText, url);
}
}
};
/**
* Form Submissions
*
* This code is borrow largely from jquery.params and jquery.form.js
*
* formToArray() gathers form element data into an array of objects that can
* be passed to any of the following ajax functions: $.get, $.post, or load.
* Each object in the array has both a 'name' and 'value' property. An example of
* an array for a simple login form might be:
*
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
*
* It is this array that is passed to pre-submit callback functions provided to the
* ajaxSubmit() and ajaxForm() methods.
*
* The semantic argument can be used to force form serialization in semantic order.
* This is normally true anyway, unless the form contains input elements of type='image'.
* If your form must be submitted with name/value pairs in semantic order and your form
* contains an input of type='image" then pass true for this arg, otherwise pass false
* (or nothing) to avoid the overhead for this logic.
*
*
* @name formToArray
* @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
* @type Array<Object>
*/
var __formToArray__ = function(form, semantic) {
var array = [],
elements = semantic ? form.getElementsByTagName('*') : form.elements,
element,
i,j,imax, jmax,
name,
value;
if (!elements) {
return array;
}
imax = elements.length;
for(i=0; i < imax; i++) {
element = elements[i];
name = element.name;
if (!name) {
continue;
}
if (semantic && form.clk && element.type === "image") {
// handle image inputs on the fly when semantic == true
if(!element.disabled && form.clk == element) {
array.push({
name: name+'.x',
value: form.clk_x
},{
name: name+'.y',
value: form.clk_y
});
}
continue;
}
value = __fieldValue__(element, true);
if (value && value.constructor == Array) {
jmax = value.length;
for(j=0; j < jmax; j++){
array.push({name: name, value: value[j]});
}
} else if (value !== null && typeof value != 'undefined'){
array.push({name: name, value: value});
}
}
if (!semantic && form.clk) {
// input type=='image' are not found in elements array! handle them here
elements = form.getElementsByTagName("input");
imax = imax=elements.length;
for(i=0; i < imax; i++) {
element = elements[i];
name = element.name;
if(name && !element.disabled && element.type == "image" && form.clk == input) {
array.push(
{name: name+'.x', value: form.clk_x},
{name: name+'.y', value: form.clk_y});
}
}
}
return array;
};
/**
* Serializes form data into a 'submittable' string. This method will return a string
* in the format: name1=value1&name2=value2
*
* The semantic argument can be used to force form serialization in semantic order.
* If your form must be submitted with name/value pairs in semantic order then pass
* true for this arg, otherwise pass false (or nothing) to avoid the overhead for
* this logic (which can be significant for very large forms).
*
*
* @name formSerialize
* @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
* @type String
*/
var __formSerialize__ = function(form, semantic) {
//hand off to param for proper encoding
return __param__(__formToArray__(form, semantic));
};
/**
* Serializes all field elements inputs Array into a query string.
* This method will return a string in the format: name1=value1&name2=value2
*
* The successful argument controls whether or not serialization is limited to
* 'successful' controls (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
* The default value of the successful argument is true.
*
*
* @name fieldSerialize
* @param successful true if only successful controls should be serialized (default is true)
* @type String
*/
var __fieldSerialize__ = function(inputs, successful) {
var array = [],
input,
name,
value,
i,j, imax, jmax;
imax = inputs.length;
for(i=0; i<imax; i++){
input = inputs[i];
name = input.name;
if (!name) {
return '';
}
value = __fieldValue__(input, successful);
if (value && value.constructor == Array) {
jmax = value.length;
for (j=0; j < jmax; j++){
array.push({
name: name,
value: value[j]
});
}
}else if (value !== null && typeof value != 'undefined'){
array.push({
name: input.name,
value: value
});
}
}
//hand off for proper encoding
return __param__(array);
};
/**
* Returns the value(s) of the element in the matched set. For example, consider the following form:
*
*
* The successful argument controls whether or not the field element must be 'successful'
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
* The default value of the successful argument is true. If this value is false the value(s)
* for each element is returned.
*
* Note: This method *always* returns an array. If no valid value can be determined the
* array will be empty, otherwise it will contain one or more values.
*
*
* @name fieldValue
* @param Boolean successful true if only the values for successful controls
* should be returned (default is true)
* @type Array<String>
*/
var __fieldValues__ = function(inputs, successful) {
var i,
imax = inputs.length,
element,
values = [],
value;
for (i=0; i < imax; i++) {
element = inputs[i];
value = __fieldValue__(element, successful);
if (value === null || typeof value == 'undefined' ||
(value.constructor == Array && !value.length)) {
continue;
}
if (value.constructor == Array) {
Array.prototype.push(values, value);
} else {
values.push(value);
}
}
return values;
};
/**
* Returns the value of the field element.
*
* The successful argument controls whether or not the field element must be 'successful'
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
* The default value of the successful argument is true. If the given element is not
* successful and the successful arg is not false then the returned value will be null.
*
* Note: If the successful flag is true (default) but the element is not successful, the return will be null
* Note: The value returned for a successful select-multiple element will always be an array.
* Note: If the element has no value the return value will be undefined.
*
* @name fieldValue
* @param Element el The DOM element for which the value will be returned
* @param Boolean successful true if value returned must be for a successful controls (default is true)
* @type String or Array<String> or null or undefined
*/
var __fieldValue__ = function(element, successful) {
var name = element.name,
type = element.type,
tag = element.tagName.toLowerCase(),
index,
array,
options,
option,
one,
i, imax,
value;
if (typeof successful == 'undefined') {
successful = true;
}
if (successful && (!name || element.disabled || type == 'reset' || type == 'button' ||
(type == 'checkbox' || type == 'radio') && !element.checked ||
(type == 'submit' || type == 'image') &&
element.form && element.form.clk != element || tag === 'select' &&
element.selectedIndex === -1)) {
return null;
}
if (tag === 'select') {
index = element.selectedIndex;
if (index < 0) {
return null;
}
array = [];
options = element.options;
one = (type == 'select-one');
imax = (one ? index+1 : options.length);
i = (one ? index : 0);
for( i; i < imax; i++) {
option = options[i];
if (option.selected) {
value = option.value;
if (one) {
return value;
}
array.push(value);
}
}
return array;
}
return element.value;
};
/**
* Clears the form data. Takes the following actions on the form's input fields:
* - input text fields will have their 'value' property set to the empty string
* - select elements will have their 'selectedIndex' property set to -1
* - checkbox and radio inputs will have their 'checked' property set to false
* - inputs of type submit, button, reset, and hidden will *not* be effected
* - button elements will *not* be effected
*
*
* @name clearForm
*/
var __clearForm__ = function(form) {
var i,
j, jmax,
elements,
resetable = ['input','select','textarea'];
for(i=0; i<resetable.length; i++){
elements = form.getElementsByTagName(resetable[i]);
jmax = elements.length;
for(j=0;j<jmax;j++){
__clearField__(elements[j]);
}
}
};
/**
* Clears the selected form element. Takes the following actions on the element:
* - input text fields will have their 'value' property set to the empty string
* - select elements will have their 'selectedIndex' property set to -1
* - checkbox and radio inputs will have their 'checked' property set to false
* - inputs of type submit, button, reset, and hidden will *not* be effected
* - button elements will *not* be effected
*
* @name clearFields
*/
var __clearField__ = function(element) {
var type = element.type,
tag = element.tagName.toLowerCase();
if (type == 'text' || type == 'password' || tag === 'textarea') {
element.value = '';
} else if (type == 'checkbox' || type == 'radio') {
element.checked = false;
} else if (tag === 'select') {
element.selectedIndex = -1;
}
};
// Serialize an array of key/values into a query string
var __param__= function( array ) {
var i, serialized = [];
// Serialize the key/values
for(i=0; i<array.length; i++){
serialized[ serialized.length ] =
encodeURIComponent(array[i].name) + '=' +
encodeURIComponent(array[i].value);
}
// Return the resulting serialization
return serialized.join("&").replace(/%20/g, "+");
};
/**
* Location
*
* Mozilla MDC:
* https://developer.mozilla.org/En/DOM/Window.location
* https://developer.mozilla.org/en/DOM/document.location
*
* HTML5: 6.10.4 The Location interface
* http://dev.w3.org/html5/spec/Overview.html#location
*
* HTML5: 2.5.3 Interfaces for URL manipulation
* http://dev.w3.org/html5/spec/Overview.html#url-decomposition-idl-attributes
* All of section 2.5 is worth reading, but 2.5.3 contains very
* detailed information on how getters/setter should work
*
* NOT IMPLEMENTED:
* HTML5: Section 6.10.4.1 Security -- prevents scripts from another domain
* from accessing most of the 'Location'
* Not sure if anyone implements this in HTML4
*/
Location = function(url, doc, history) {
//console.log('Location url %s', url);
var $url = url,
$document = doc ? doc : null,
$history = history ? history : null;
var parts = Envjs.urlsplit($url);
return {
get hash() {
return parts.fragment ? '#' + parts.fragment : parts.fragment;
},
set hash(s) {
if (s[0] === '#') {
parts.fragment = s.substr(1);
} else {
parts.fragment = s;
}
$url = Envjs.urlunsplit(parts);
if ($history) {
$history.add($url, 'hash');
}
},
get host() {
return parts.netloc;
},
set host(s) {
if (!s || s === '') {
return;
}
parts.netloc = s;
$url = Envjs.urlunsplit(parts);
// this regenerates hostname & port
parts = Envjs.urlsplit($url);
if ($history) {
$history.add( $url, 'host');
}
this.assign($url);
},
get hostname() {
return parts.hostname;
},
set hostname(s) {
if (!s || s === '') {
return;
}
parts.netloc = s;
if (parts.port != '') {
parts.netloc += ':' + parts.port;
}
parts.hostname = s;
$url = Envjs.urlunsplit(parts);
if ($history) {
$history.add( $url, 'hostname');
}
this.assign($url);
},
get href() {
return $url;
},
set href(url) {
$url = url;
if ($history) {
$history.add($url, 'href');
}
this.assign($url);
},
get pathname() {
return parts.path;
},
set pathname(s) {
if (s[0] === '/') {
parts.path = s;
} else {
parts.path = '/' + s;
}
$url = Envjs.urlunsplit(parts);
if ($history) {
$history.add($url, 'pathname');
}
this.assign($url);
},
get port() {
// make sure it's a string
return '' + parts.port;
},
set port(p) {
// make a string
var s = '' + p;
parts.port = s;
parts.netloc = parts.hostname + ':' + parts.port;
$url = Envjs.urlunsplit(parts);
if ($history) {
$history.add( $url, 'port');
}
this.assign($url);
},
get protocol() {
return parts.scheme + ':';
},
set protocol(s) {
var i = s.indexOf(':');
if (i != -1) {
s = s.substr(0,i);
}
parts.scheme = s;
$url = Envjs.urlunsplit(parts);
if ($history) {
$history.add($url, 'protocol');
}
this.assign($url);
},
get search() {
return (parts.query) ? '?' + parts.query : parts.query;
},
set search(s) {
if (s[0] == '?') {
s = s.substr(1);
}
parts.query = s;
$url = Envjs.urlunsplit(parts);
if ($history) {
$history.add($url, 'search');
}
this.assign($url);
},
toString: function() {
return $url;
},
assign: function(url) {
var _this = this,
xhr,
event,
cookie;
//console.log('assigning %s',url);
// update closure upvars
$url = url;
parts = Envjs.urlsplit($url);
//we can only assign if this Location is associated with a document
if ($document) {
//console.log('fetching %s (async? %s)', url, $document.async);
xhr = new XMLHttpRequest();
// TODO: make async flag a Envjs paramter
xhr.open('GET', url, false);//$document.async);
// TODO: is there a better way to test if a node is an HTMLDocument?
if ($document.toString() === '[object HTMLDocument]') {
//tell the xhr to not parse the document as XML
//console.log('loading html document');
xhr.onreadystatechange = function() {
//console.log('readyState %s', xhr.readyState);
if (xhr.readyState === 4) {
$document.baseURI = new Location(url, $document);
//console.log('new document baseURI %s', $document.baseURI);
__exchangeHTMLDocument__($document, xhr.responseText, url);
}
};
xhr.send(null, false);
} else {
//Treat as an XMLDocument
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
$document = xhr.responseXML;
$document.baseURI = $url;
if ($document.createEvent) {
event = $document.createEvent('Event');
event.initEvent('DOMContentLoaded');
$document.dispatchEvent( event, false );
}
}
};
xhr.send();
}
};
},
reload: function(forceget) {
//for now we have no caching so just proxy to assign
//console.log('reloading %s',$url);
this.assign($url);
},
replace: function(url) {
this.assign(url);
}
};
};
var __exchangeHTMLDocument__ = function(doc, text, url) {
var html, head, title, body, event, e;
try {
doc.baseURI = url;
HTMLParser.parseDocument(text, doc);
Envjs.wait();
} catch (e) {
console.log('parsererror %s', e);
try {
console.log('document \n %s', doc.documentElement.outerHTML);
} catch (e) {
// swallow
}
doc = new HTMLDocument(new DOMImplementation(), doc.ownerWindow);
html = doc.createElement('html');
head = doc.createElement('head');
title = doc.createElement('title');
body = doc.createElement('body');
title.appendChild(doc.createTextNode('Error'));
body.appendChild(doc.createTextNode('' + e));
head.appendChild(title);
html.appendChild(head);
html.appendChild(body);
doc.appendChild(html);
//console.log('default error document \n %s', doc.documentElement.outerHTML);
//DOMContentLoaded event
if (doc.createEvent) {
event = doc.createEvent('Event');
event.initEvent('DOMContentLoaded', false, false);
doc.dispatchEvent( event, false );
event = doc.createEvent('HTMLEvents');
event.initEvent('load', false, false);
doc.dispatchEvent( event, false );
}
//finally fire the window.onload event
//TODO: this belongs in window.js which is a event
// event handler for DOMContentLoaded on document
try {
if (doc === window.document) {
console.log('triggering window.load');
event = doc.createEvent('HTMLEvents');
event.initEvent('load', false, false);
window.dispatchEvent( event, false );
}
} catch (e) {
//console.log('window load event failed %s', e);
//swallow
}
}; /* closes return {... */
};
/**
*
* @class XMLHttpRequest
* @author Originally implemented by Yehuda Katz
*
*/
// this implementation can be used without requiring a DOMParser
// assuming you dont try to use it to get xml/html documents
var domparser;
XMLHttpRequest = function(){
this.headers = {};
this.responseHeaders = {};
this.aborted = false;//non-standard
};
// defined by the standard: http://www.w3.org/TR/XMLHttpRequest/#xmlhttprequest
// but not provided by Firefox. Safari and others do define it.
XMLHttpRequest.UNSENT = 0;
XMLHttpRequest.OPEN = 1;
XMLHttpRequest.HEADERS_RECEIVED = 2;
XMLHttpRequest.LOADING = 3;
XMLHttpRequest.DONE = 4;
XMLHttpRequest.prototype = {
open: function(method, url, async, user, password){
//console.log('openning xhr %s %s %s', method, url, async);
this.readyState = 1;
this.async = (async === false)?false:true;
this.method = method || "GET";
this.url = Envjs.uri(url);
this.onreadystatechange();
},
setRequestHeader: function(header, value){
this.headers[header] = value;
},
send: function(data, parsedoc/*non-standard*/){
var _this = this;
parsedoc = (parsedoc === undefined)?true:!!parsedoc;
function makeRequest(){
var cookie = Envjs.getCookies(_this.url);
if(cookie){
_this.setRequestHeader('COOKIE', cookie);
}
Envjs.connection(_this, function(){
if (!_this.aborted){
var doc = null,
domparser,
cookie;
// try to parse the document if we havent explicitly set a
// flag saying not to and if we can assure the text at least
// starts with valid xml
if ( parsedoc && _this.responseText.match(/^\s*</) ) {
domparser = domparser||new DOMParser();
try {
//console.log("parsing response text into xml document");
doc = domparser.parseFromString(_this.responseText+"", 'text/xml');
} catch(e) {
//Envjs.error('response XML does not appear to be well formed xml', e);
console.warn('parseerror \n%s', e);
doc = document.implementation.createDocument('','error',null);
doc.appendChild(doc.createTextNode(e+''));
}
}else{
//Envjs.warn('response XML does not appear to be xml');
}
try{
cookie = _this.getResponseHeader('SET-COOKIE');
if(cookie){
Envjs.setCookie(_this.url, cookie);
}
}catch(e){
console.warn("Failed to set cookie");
}
_this.__defineGetter__("responseXML", function(){
return doc;
});
}
}, data);
if (!_this.aborted){
_this.onreadystatechange();
}
}
if (this.async){
//TODO: what we really need to do here is rejoin the
// current thread and call onreadystatechange via
// setTimeout so the callback is essentially applied
// at the end of the current callstack
//console.log('requesting async: %s', this.url);
Envjs.runAsync(makeRequest);
}else{
//console.log('requesting sync: %s', this.url);
makeRequest();
}
},
abort: function(){
this.aborted = true;
},
onreadystatechange: function(){
//Instance specific
},
getResponseHeader: function(header){
//$debug('GETTING RESPONSE HEADER '+header);
var rHeader, returnedHeaders;
if (this.readyState < 3){
throw new Error("INVALID_STATE_ERR");
} else {
returnedHeaders = [];
for (rHeader in this.responseHeaders) {
if (rHeader.match(new RegExp(header, "i"))) {
returnedHeaders.push(this.responseHeaders[rHeader]);
}
}
if (returnedHeaders.length){
//$debug('GOT RESPONSE HEADER '+returnedHeaders.join(", "));
return returnedHeaders.join(", ");
}
}
return null;
},
getAllResponseHeaders: function(){
var header, returnedHeaders = [];
if (this.readyState < 3){
throw new Error("INVALID_STATE_ERR");
} else {
for (header in this.responseHeaders) {
returnedHeaders.push( header + ": " + this.responseHeaders[header] );
}
}
return returnedHeaders.join("\r\n");
},
async: true,
readyState: 0,
responseText: "",
status: 0,
statusText: ""
};
/**
* @author john resig & the envjs team
* @uri http://www.envjs.com/
* @copyright 2008-2010
* @license MIT
*/
//CLOSURE_END
}());
/**
* @todo: document
*/
var Window,
Screen,
History,
Navigator;
/*
* Envjs window.1.2.13
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*/
//CLOSURE_START
(function(){
/**
* @author john resig
*/
// Helper method for extending one object with another.
function __extend__(a,b) {
for ( var i in b ) {
var g = b.__lookupGetter__(i), s = b.__lookupSetter__(i);
if ( g || s ) {
if ( g ) { a.__defineGetter__(i, g); }
if ( s ) { a.__defineSetter__(i, s); }
} else {
a[i] = b[i];
}
} return a;
}
/**
* @todo: document
*/
__extend__(HTMLFrameElement.prototype,{
get contentDocument(){
return this.contentWindow?
this.contentWindow.document:
null;
},
set src(value){
var event;
this.setAttribute('src', value);
if (this.parentNode && value && value.length > 0){
//console.log('loading frame %s', value);
Envjs.loadFrame(this, Envjs.uri(value));
//console.log('event frame load %s', value);
event = this.ownerDocument.createEvent('HTMLEvents');
event.initEvent("load", false, false);
this.dispatchEvent( event, false );
}
}
});
/*
* history.js
*
*/
History = function(owner) {
var $current = 0,
$history = [null],
$owner = owner;
return {
go : function(target) {
if (typeof target === "number") {
target = $current + target;
if (target > -1 && target < $history.length){
if ($history[target].type === "hash") {
if ($owner.location) {
$owner.location.hash = $history[target].value;
}
} else {
if ($owner.location) {
$owner.location = $history[target].value;
}
}
$current = target;
}
} else {
//TODO: walk through the history and find the 'best match'?
}
},
get length() {
return $history.length;
},
back : function(count) {
if (count) {
this.go(-count);
} else {
this.go(-1);
}
},
get current() {
return this.item($current);
},
get previous() {
return this.item($current-1);
},
forward : function(count) {
if (count) {
this.go(count);
} else {
this.go(1);
}
},
item: function(idx) {
if (idx >= 0 && idx < $history.length) {
return $history[idx];
} else {
return null;
}
},
add: function(newLocation, type) {
//not a standard interface, we expose it to simplify
//history state modifications
if (newLocation !== $history[$current]) {
$history.slice(0, $current);
$history.push({
type: type || 'href',
value: newLocation
});
}
}
}; /* closes 'return {' */
};
/*
* navigator.js
* Browser Navigator
*/
Navigator = function(){
return {
get appCodeName(){
return Envjs.appCodeName;
},
get appName(){
return Envjs.appName;
},
get appVersion(){
return Envjs.version +" ("+
this.platform +"; "+
"U; "+//?
Envjs.os_name+" "+Envjs.os_arch+" "+Envjs.os_version+"; "+
(Envjs.lang?Envjs.lang:"en-US")+"; "+
"rv:"+Envjs.revision+
")";
},
get cookieEnabled(){
return true;
},
get mimeTypes(){
return [];
},
get platform(){
return Envjs.platform;
},
get plugins(){
return [];
},
get userAgent(){
return this.appCodeName + "/" + this.appVersion + " " + this.appName;
},
javaEnabled : function(){
return Envjs.javaEnabled;
}
};
};
/**
* Screen
* @param {Object} __window__
*/
Screen = function(__window__){
var $availHeight = 600,
$availWidth = 800,
$colorDepth = 16,
$pixelDepth = 24,
$height = 600,
$width = 800,
$top = 0,
$left = 0,
$availTop = 0,
$availLeft = 0;
__extend__( __window__, {
moveBy : function(dx,dy){
//TODO - modify $locals to reflect change
},
moveTo : function(x,y) {
//TODO - modify $locals to reflect change
},
/*print : function(){
//TODO - good global to modify to ensure print is not misused
};*/
resizeBy : function(dw, dh){
__window__resizeTo($width + dw, $height + dh);
},
resizeTo : function(width, height){
$width = (width <= $availWidth) ? width : $availWidth;
$height = (height <= $availHeight) ? height : $availHeight;
},
scroll : function(x,y){
//TODO - modify $locals to reflect change
},
scrollBy : function(dx, dy){
//TODO - modify $locals to reflect change
},
scrollTo : function(x,y){
//TODO - modify $locals to reflect change
}
});
return {
get top(){
return $top;
},
get left(){
return $left;
},
get availTop(){
return $availTop;
},
get availLeft(){
return $availLeft;
},
get availHeight(){
return $availHeight;
},
get availWidth(){
return $availWidth;
},
get colorDepth(){
return $colorDepth;
},
get pixelDepth(){
return $pixelDepth;
},
get height(){
return $height;
},
get width(){
return $width;
}
};
};
/*
* Copyright (c) 2010 Nick Galbreath
* http://code.google.com/p/stringencoders/source/browse/#svn/trunk/javascript
*
* 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.
*/
/* base64 encode/decode compatible with window.btoa/atob
*
* window.atob/btoa is a Firefox extension to convert binary data (the "b")
* to base64 (ascii, the "a").
*
* It is also found in Safari and Chrome. It is not available in IE.
*
* if (!window.btoa) window.btoa = base64.encode
* if (!window.atob) window.atob = base64.decode
*
* The original spec's for atob/btoa are a bit lacking
* https://developer.mozilla.org/en/DOM/window.atob
* https://developer.mozilla.org/en/DOM/window.btoa
*
* window.btoa and base64.encode takes a string where charCodeAt is [0,255]
* If any character is not [0,255], then an DOMException(5) is thrown.
*
* window.atob and base64.decode take a base64-encoded string
* If the input length is not a multiple of 4, or contains invalid characters
* then an DOMException(5) is thrown.
*/
var base64 = {};
base64.PADCHAR = '=';
base64.ALPHA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
base64.makeDOMException = function() {
// sadly in FF,Safari,Chrome you can't make a DOMException
var e, tmp;
try {
return new DOMException(DOMException.INVALID_CHARACTER_ERR);
} catch (tmp) {
// not available, just passback a duck-typed equiv
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Error
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Error/prototype
var ex = new Error("DOM Exception 5");
// ex.number and ex.description is IE-specific.
ex.code = ex.number = 5;
ex.name = ex.description = "INVALID_CHARACTER_ERR";
// Safari/Chrome output format
ex.toString = function() { return 'Error: ' + ex.name + ': ' + ex.message; };
return ex;
}
};
base64.getbyte64 = function(s,i) {
// This is oddly fast, except on Chrome/V8.
// Minimal or no improvement in performance by using a
// object with properties mapping chars to value (eg. 'A': 0)
var idx = base64.ALPHA.indexOf(s.charAt(i));
if (idx === -1) {
throw base64.makeDOMException();
}
return idx;
};
base64.decode = function(s) {
// convert to string
s = '' + s;
var getbyte64 = base64.getbyte64;
var pads, i, b10;
var imax = s.length;
if (imax === 0) {
return s;
}
if (imax % 4 !== 0) {
throw base64.makeDOMException();
}
pads = 0;
if (s.charAt(imax - 1) === base64.PADCHAR) {
pads = 1;
if (s.charAt(imax - 2) === base64.PADCHAR) {
pads = 2;
}
// either way, we want to ignore this last block
imax -= 4;
}
var x = [];
for (i = 0; i < imax; i += 4) {
b10 = (getbyte64(s,i) << 18) | (getbyte64(s,i+1) << 12) |
(getbyte64(s,i+2) << 6) | getbyte64(s,i+3);
x.push(String.fromCharCode(b10 >> 16, (b10 >> 8) & 0xff, b10 & 0xff));
}
switch (pads) {
case 1:
b10 = (getbyte64(s,i) << 18) | (getbyte64(s,i+1) << 12) | (getbyte64(s,i+2) << 6);
x.push(String.fromCharCode(b10 >> 16, (b10 >> 8) & 0xff));
break;
case 2:
b10 = (getbyte64(s,i) << 18) | (getbyte64(s,i+1) << 12);
x.push(String.fromCharCode(b10 >> 16));
break;
}
return x.join('');
};
base64.getbyte = function(s,i) {
var x = s.charCodeAt(i);
if (x > 255) {
throw base64.makeDOMException();
}
return x;
};
base64.encode = function(s) {
if (arguments.length !== 1) {
throw new SyntaxError("Not enough arguments");
}
var padchar = base64.PADCHAR;
var alpha = base64.ALPHA;
var getbyte = base64.getbyte;
var i, b10;
var x = [];
// convert to string
s = '' + s;
var imax = s.length - s.length % 3;
if (s.length === 0) {
return s;
}
for (i = 0; i < imax; i += 3) {
b10 = (getbyte(s,i) << 16) | (getbyte(s,i+1) << 8) | getbyte(s,i+2);
x.push(alpha.charAt(b10 >> 18));
x.push(alpha.charAt((b10 >> 12) & 0x3F));
x.push(alpha.charAt((b10 >> 6) & 0x3f));
x.push(alpha.charAt(b10 & 0x3f));
}
switch (s.length - imax) {
case 1:
b10 = getbyte(s,i) << 16;
x.push(alpha.charAt(b10 >> 18) + alpha.charAt((b10 >> 12) & 0x3F) +
padchar + padchar);
break;
case 2:
b10 = (getbyte(s,i) << 16) | (getbyte(s,i+1) << 8);
x.push(alpha.charAt(b10 >> 18) + alpha.charAt((b10 >> 12) & 0x3F) +
alpha.charAt((b10 >> 6) & 0x3f) + padchar);
break;
}
return x.join('');
};
//These descriptions of window properties are taken loosely David Flanagan's
//'JavaScript - The Definitive Guide' (O'Reilly)
var __windows__ = {};
var __top__ = function(_scope){
var _parent = _scope.parent;
while (_scope && _parent && _scope !== _parent) {
if (_parent === _parent.parent) {
break;
}
_parent = _parent.parent;
//console.log('scope %s _parent %s', scope, _parent);
}
return _parent || null;
};
/**
* Window
* @param {Object} scope
* @param {Object} parent
* @param {Object} opener
*/
Window = function(scope, parent, opener){
// the window property is identical to the self property and to this obj
//var proxy = new Envjs.proxy(scope, parent);
//scope.__proxy__ = proxy;
scope.__defineGetter__('window', function(){
return scope;
});
var $uuid = new Date().getTime()+'-'+Math.floor(Math.random()*1000000000000000);
__windows__[$uuid] = scope;
//console.log('opening window %s', $uuid);
// every window has one-and-only-one .document property which is always
// an [object HTMLDocument]. also, only window.document objects are
// html documents, all other documents created by the window.document are
// [object XMLDocument]
var $htmlImplementation = new DOMImplementation();
$htmlImplementation.namespaceAware = true;
$htmlImplementation.errorChecking = false;
// read only reference to the Document object
var $document = new HTMLDocument($htmlImplementation, scope);
// A read-only reference to the Window object that contains this window
// or frame. If the window is a top-level window, parent refers to
// the window itself. If this window is a frame, this property refers
// to the window or frame that contains it.
var $parent = parent;
/**> $cookies - see cookie.js <*/
// read only boolean specifies whether the window has been closed
var $closed = false;
// a read/write string that specifies the default message that
// appears in the status line
var $defaultStatus = "Done";
// IE only, refers to the most recent event object - this maybe be
// removed after review
var $event = null;
// a read-only reference to the History object
var $history = new History();
// a read-only reference to the Location object. the location object does
// expose read/write properties
var $location = new Location('about:blank', $document, $history);
// The name of window/frame. Set directly, when using open(), or in frameset.
// May be used when specifying the target attribute of links
var $name = null;
// a read-only reference to the Navigator object
var $navigator = new Navigator();
// a read/write reference to the Window object that contained the script
// that called open() to open this browser window. This property is valid
// only for top-level window objects.
var $opener = opener?opener:null;
// read-only properties that specify the height and width, in pixels
var $innerHeight = 600, $innerWidth = 800;
// Read-only properties that specify the total height and width, in pixels,
// of the browser window. These dimensions include the height and width of
// the menu bar, toolbars, scrollbars, window borders and so on. These
// properties are not supported by IE and IE offers no alternative
// properties;
var $outerHeight = $innerHeight,
$outerWidth = $innerWidth;
// Read-only properties that specify the number of pixels that the current
// document has been scrolled to the right and down. These are not
// supported by IE.
var $pageXOffset = 0, $pageYOffset = 0;
// a read-only reference to the Screen object that specifies information
// about the screen: the number of available pixels and the number of
// available colors.
var $screen = new Screen(scope);
// read only properties that specify the coordinates of the upper-left
// corner of the screen.
var $screenX = 1,
$screenY = 1;
var $screenLeft = $screenX,
$screenTop = $screenY;
// a read/write string that specifies the current status line.
var $status = '';
__extend__(scope, EventTarget.prototype);
return __extend__( scope, {
get closed(){
return $closed;
},
get defaultStatus(){
return $defaultStatus;
},
set defaultStatus(defaultStatus){
$defaultStatus = defaultStatus;
},
get document(){
return $document;
},
set document(doc){
$document = doc;
},
/*
deprecated ie specific property probably not good to support
get event(){
return $event;
},
*/
get frames(){
return new HTMLCollection($document.getElementsByTagName('frame'));
},
get length(){
// should be frames.length,
return this.frames.length;
},
get history(){
return $history;
},
get innerHeight(){
return $innerHeight;
},
get innerWidth(){
return $innerWidth;
},
get clientHeight(){
return $innerHeight;
},
get clientWidth(){
return $innerWidth;
},
get location(){
return $location;
},
set location(uri){
uri = Envjs.uri(uri);
//new Window(this, this.parent, this.opener);
if($location.href == uri){
$location.reload();
}else if($location.href == 'about:blank'){
$location.assign(uri);
}else{
$location.replace(uri);
}
},
get name(){
return $name;
},
set name(newName){
$name = newName;
},
get navigator(){
return $navigator;
},
get opener(){
return $opener;
},
get outerHeight(){
return $outerHeight;
},
get outerWidth(){
return $outerWidth;
},
get pageXOffest(){
return $pageXOffset;
},
get pageYOffset(){
return $pageYOffset;
},
get parent(){
return $parent;
},
get screen(){
return $screen;
},
get screenLeft(){
return $screenLeft;
},
get screenTop(){
return $screenTop;
},
get screenX(){
return $screenX;
},
get screenY(){
return $screenY;
},
get self(){
return scope;
},
get status(){
return $status;
},
set status(status){
$status = status;
},
// a read-only reference to the top-level window that contains this window.
// If this window is a top-level window it is simply a reference to itself.
// If this window is a frame, the top property refers to the top-level
// window that contains the frame.
get top(){
return __top__(scope);
},
get window(){
return this;
},
toString : function(){
return '[Window]';
},
/**
* getComputedStyle
*
* Firefox 3.6:
* - Requires both elements to be present else an
* exception is thrown.
* - Returns a 'ComputedCSSStyleDeclaration' object.
* while a raw element.style returns a 'CSSStyleDeclaration' object.
* - Bogus input also throws exception
*
* Safari 4:
* - Requires one argument (second can be MIA)
* - Returns a CSSStyleDeclaration object
* - if bad imput, returns null
*
* getComputedStyle should really be an "add on" from the css
* modules. Unfortunately, 'window' comes way after the 'css'
* so css can't add it.
*/
getComputedStyle: function(element, pseudoElement) {
return element.style;
},
open: function(url, name, features, replace){
if (features) {
console.log("'features argument not yet implemented");
}
var _window = Envjs.proxy({}),
open;
if(replace && name){
for(open in __windows__){
if(open.name === name) {
_window = open;
}
}
}
new Window(_window, _window, this);
if(name) {
_window.name = name;
}
_window.document.async = false;
_window.location.assign(Envjs.uri(url));
return _window;
},
close: function(){
//console.log('closing window %s', __windows__[$uuid]);
try{
delete __windows__[$uuid];
}catch(e){
console.log('%s',e);
}
},
alert : function(message){
Envjs.alert(message);
},
confirm : function(question){
Envjs.confirm(question);
},
prompt : function(message, defaultMsg){
Envjs.prompt(message, defaultMsg);
},
btoa: function(binary){
return base64.encode(binary);
},
atob: function(ascii){
return base64.decode(ascii);
},
onload: function(){},
onunload: function(){},
get guid(){
return $uuid;
}
});
};
//finally pre-supply the window with the window-like environment
//console.log('Default Window');
new Window(__this__, __this__);
console.log('[ %s ]',window.navigator.userAgent);
/**
*
* @param {Object} event
*/
__extend__(Envjs.defaultEventBehaviors,{
'submit': function(event) {
var target = event.target;
while (target && target.nodeName !== 'FORM') {
target = target.parentNode;
}
if (target && target.nodeName === 'FORM') {
target.submit();
}
},
'click': function(event) {
// console.log('handling event target default behavior for click');
}
});
/**
* @author john resig & the envjs team
* @uri http://www.envjs.com/
* @copyright 2008-2010
* @license MIT
*/
//CLOSURE_END
}());
|
app/components/ToggleOption/index.js
|
shaggyshelar/CLA
|
/**
*
* ToggleOption
*
*/
import React from 'react';
import { injectIntl, intlShape } from 'react-intl';
const ToggleOption = ({ value, message, intl }) => (
<option value={value}>
{message ? intl.formatMessage(message) : value}
</option>
);
ToggleOption.propTypes = {
value: React.PropTypes.string.isRequired,
message: React.PropTypes.object,
intl: intlShape.isRequired,
};
export default injectIntl(ToggleOption);
|
src/Form/RegisterOwnerForm.js
|
blockchain-IoT/blockchain-IoT-core
|
/* eslint-disable react/prop-types */
import React from 'react';
const registerOwnerForm = props => (
<div className="uk-card uk-card-default uk-card-body uk-width-1-2@m">
<h3 className="uk-card-title">Register new Owner</h3>
<p>Lorem ipsum <a href="#">dolor</a> sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<form>
<fieldset className="uk-fieldset">
<div className="uk-margin">
<button className="uk-button uk-button-default"
disabled={props.state._disabled} onClick={props.onSubmit}>Register</button>
</div>
</fieldset>
</form>
</div>
);
export default registerOwnerForm;
|
docs/components/common/version/version.js
|
t1m0n/air-datepicker
|
import React from 'react';
import {version} from 'components/airDatepicker';
import PropTypes from 'prop-types';
import cn from 'classnames';
import css from './version.module.scss';
function Version({className} = {}) {
return (
<div className={cn(css.el, className)}>
v{version}
</div>
);
}
Version.propTypes = {
className: PropTypes.string
};
export default Version;
|
app/js/components/tabletop-deck.js
|
kristenmills/pokemon-deck-builder
|
import React, { Component } from 'react';
import { Surface, Image } from 'react-canvas';
import Button from 'react-bootstrap/lib/Button';
import { imageURL, expandCards } from '../util';
const HEIGHT = 480;
const WIDTH = 350;
const ROWS = 6;
const COLS = 10;
export default class TabletopDeck extends Component {
constructor() {
super();
this.imageStyle = this.imageStyle.bind(this);
this.dataURI = this.dataURI.bind(this);
}
dataURI() {
return window.open(document.getElementsByTagName('canvas')[0].toDataURL('image/png'));
}
imageStyle(index) {
const row = Math.floor(index / COLS);
const col = index % COLS;
return {
top: row * HEIGHT,
left: col * WIDTH,
width: WIDTH,
height: HEIGHT,
};
}
render() {
return (
<div>
<div style={{ display: 'none' }}>
<Surface ref='canvas' width={WIDTH * COLS} height={HEIGHT * ROWS} left={0} top={0}>
{expandCards(this.props.deck.cards).map((card, index) => {
return (
<Image key={`${card.id}-${index}`} style={this.imageStyle(index)} src={imageURL(card)} />
);
})}
</Surface>
</div>
<Button onClick={this.dataURI} block>Download Tabletop Simulator Deck</Button>
</div>
);
}
}
|
JotunheimenPlaces/node_modules/react-native/local-cli/templates/HelloWorld/__tests__/index.android.js
|
designrad/Jotunheimen-tracking
|
import 'react-native';
import React from 'react';
import Index from '../index.android.js';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
it('renders correctly', () => {
const tree = renderer.create(
<Index />
);
});
|
misc/tabledrag.js
|
alinem/squaretheme
|
(function ($) {
/**
* Drag and drop table rows with field manipulation.
*
* Using the drupal_add_tabledrag() function, any table with weights or parent
* relationships may be made into draggable tables. Columns containing a field
* may optionally be hidden, providing a better user experience.
*
* Created tableDrag instances may be modified with custom behaviors by
* overriding the .onDrag, .onDrop, .row.onSwap, and .row.onIndent methods.
* See blocks.js for an example of adding additional functionality to tableDrag.
*/
Drupal.behaviors.tableDrag = {
attach: function (context, settings) {
for (var base in settings.tableDrag) {
$('#' + base, context).once('tabledrag', function () {
// Create the new tableDrag instance. Save in the Drupal variable
// to allow other scripts access to the object.
Drupal.tableDrag[base] = new Drupal.tableDrag(this, settings.tableDrag[base]);
});
}
}
};
/**
* Constructor for the tableDrag object. Provides table and field manipulation.
*
* @param table
* DOM object for the table to be made draggable.
* @param tableSettings
* Settings for the table added via drupal_add_dragtable().
*/
Drupal.tableDrag = function (table, tableSettings) {
var self = this;
// Required object variables.
this.table = table;
this.tableSettings = tableSettings;
this.dragObject = null; // Used to hold information about a current drag operation.
this.rowObject = null; // Provides operations for row manipulation.
this.oldRowElement = null; // Remember the previous element.
this.oldY = 0; // Used to determine up or down direction from last mouse move.
this.changed = false; // Whether anything in the entire table has changed.
this.maxDepth = 0; // Maximum amount of allowed parenting.
this.rtl = $(this.table).css('direction') == 'rtl' ? -1 : 1; // Direction of the table.
// Configure the scroll settings.
this.scrollSettings = { amount: 4, interval: 50, trigger: 70 };
this.scrollInterval = null;
this.scrollY = 0;
this.windowHeight = 0;
// Check this table's settings to see if there are parent relationships in
// this table. For efficiency, large sections of code can be skipped if we
// don't need to track horizontal movement and indentations.
this.indentEnabled = false;
for (var group in tableSettings) {
for (var n in tableSettings[group]) {
if (tableSettings[group][n].relationship == 'parent') {
this.indentEnabled = true;
}
if (tableSettings[group][n].limit > 0) {
this.maxDepth = tableSettings[group][n].limit;
}
}
}
if (this.indentEnabled) {
this.indentCount = 1; // Total width of indents, set in makeDraggable.
// Find the width of indentations to measure mouse movements against.
// Because the table doesn't need to start with any indentations, we
// manually append 2 indentations in the first draggable row, measure
// the offset, then remove.
var indent = Drupal.theme('tableDragIndentation');
var testRow = $('<tr/>').addClass('draggable').appendTo(table);
var testCell = $('<td/>').appendTo(testRow).prepend(indent).prepend(indent);
this.indentAmount = $('.indentation', testCell).get(1).offsetLeft - $('.indentation', testCell).get(0).offsetLeft;
testRow.remove();
}
// Make each applicable row draggable.
// Match immediate children of the parent element to allow nesting.
$('> tr.draggable, > tbody > tr.draggable', table).each(function () { self.makeDraggable(this); });
// Add a link before the table for users to show or hide weight columns.
$(table).before($('<a href="#" class="tabledrag-toggle-weight"></a>')
.attr('title', Drupal.t('Re-order rows by numerical weight instead of dragging.'))
.click(function () {
if ($.cookie('Drupal.tableDrag.showWeight') == 1) {
self.hideColumns();
}
else {
self.showColumns();
}
return false;
})
.wrap('<div class="tabledrag-toggle-weight-wrapper"></div>')
.parent()
);
// Initialize the specified columns (for example, weight or parent columns)
// to show or hide according to user preference. This aids accessibility
// so that, e.g., screen reader users can choose to enter weight values and
// manipulate form elements directly, rather than using drag-and-drop..
self.initColumns();
// Add mouse bindings to the document. The self variable is passed along
// as event handlers do not have direct access to the tableDrag object.
$(document).bind('mousemove', function (event) { return self.dragRow(event, self); });
$(document).bind('mouseup', function (event) { return self.dropRow(event, self); });
};
/**
* Initialize columns containing form elements to be hidden by default,
* according to the settings for this tableDrag instance.
*
* Identify and mark each cell with a CSS class so we can easily toggle
* show/hide it. Finally, hide columns if user does not have a
* 'Drupal.tableDrag.showWeight' cookie.
*/
Drupal.tableDrag.prototype.initColumns = function () {
for (var group in this.tableSettings) {
// Find the first field in this group.
for (var d in this.tableSettings[group]) {
var field = $('.' + this.tableSettings[group][d].target + ':first', this.table);
if (field.length && this.tableSettings[group][d].hidden) {
var hidden = this.tableSettings[group][d].hidden;
var cell = field.closest('td');
break;
}
}
// Mark the column containing this field so it can be hidden.
if (hidden && cell[0]) {
// Add 1 to our indexes. The nth-child selector is 1 based, not 0 based.
// Match immediate children of the parent element to allow nesting.
var columnIndex = $('> td', cell.parent()).index(cell.get(0)) + 1;
$('> thead > tr, > tbody > tr, > tr', this.table).each(function () {
// Get the columnIndex and adjust for any colspans in this row.
var index = columnIndex;
var cells = $(this).children();
cells.each(function (n) {
if (n < index && this.colSpan && this.colSpan > 1) {
index -= this.colSpan - 1;
}
});
if (index > 0) {
cell = cells.filter(':nth-child(' + index + ')');
if (cell[0].colSpan && cell[0].colSpan > 1) {
// If this cell has a colspan, mark it so we can reduce the colspan.
cell.addClass('tabledrag-has-colspan');
}
else {
// Mark this cell so we can hide it.
cell.addClass('tabledrag-hide');
}
}
});
}
}
// Now hide cells and reduce colspans unless cookie indicates previous choice.
// Set a cookie if it is not already present.
if ($.cookie('Drupal.tableDrag.showWeight') === null) {
$.cookie('Drupal.tableDrag.showWeight', 0, {
path: Drupal.settings.basePath,
// The cookie expires in one year.
expires: 365
});
this.hideColumns();
}
// Check cookie value and show/hide weight columns accordingly.
else {
if ($.cookie('Drupal.tableDrag.showWeight') == 1) {
this.showColumns();
}
else {
this.hideColumns();
}
}
};
/**
* Hide the columns containing weight/parent form elements.
* Undo showColumns().
*/
Drupal.tableDrag.prototype.hideColumns = function () {
// Hide weight/parent cells and headers.
$('.tabledrag-hide', 'table.tabledrag-processed').css('display', 'none');
// Show TableDrag handles.
$('.tabledrag-handle', 'table.tabledrag-processed').css('display', '');
// Reduce the colspan of any effected multi-span columns.
$('.tabledrag-has-colspan', 'table.tabledrag-processed').each(function () {
this.colSpan = this.colSpan - 1;
});
// Change link text.
$('.tabledrag-toggle-weight').text(Drupal.t('Show row weights'));
// Change cookie.
$.cookie('Drupal.tableDrag.showWeight', 0, {
path: Drupal.settings.basePath,
// The cookie expires in one year.
expires: 365
});
// Trigger an event to allow other scripts to react to this display change.
$('table.tabledrag-processed').trigger('columnschange', 'hide');
};
/**
* Show the columns containing weight/parent form elements
* Undo hideColumns().
*/
Drupal.tableDrag.prototype.showColumns = function () {
// Show weight/parent cells and headers.
$('.tabledrag-hide', 'table.tabledrag-processed').css('display', '');
// Hide TableDrag handles.
$('.tabledrag-handle', 'table.tabledrag-processed').css('display', 'none');
// Increase the colspan for any columns where it was previously reduced.
$('.tabledrag-has-colspan', 'table.tabledrag-processed').each(function () {
this.colSpan = this.colSpan + 1;
});
// Change link text.
$('.tabledrag-toggle-weight').text(Drupal.t('Hide row weights'));
// Change cookie.
$.cookie('Drupal.tableDrag.showWeight', 1, {
path: Drupal.settings.basePath,
// The cookie expires in one year.
expires: 365
});
// Trigger an event to allow other scripts to react to this display change.
$('table.tabledrag-processed').trigger('columnschange', 'show');
};
/**
* Find the target used within a particular row and group.
*/
Drupal.tableDrag.prototype.rowSettings = function (group, row) {
var field = $('.' + group, row);
for (var delta in this.tableSettings[group]) {
var targetClass = this.tableSettings[group][delta].target;
if (field.is('.' + targetClass)) {
// Return a copy of the row settings.
var rowSettings = {};
for (var n in this.tableSettings[group][delta]) {
rowSettings[n] = this.tableSettings[group][delta][n];
}
return rowSettings;
}
}
};
/**
* Take an item and add event handlers to make it become draggable.
*/
Drupal.tableDrag.prototype.makeDraggable = function (item) {
var self = this;
// Create the handle.
var handle = $('<a href="#" class="tabledrag-handle"><div class="handle"> </div></a>').attr('title', Drupal.t('Drag to re-order'));
// Insert the handle after indentations (if any).
if ($('td:first .indentation:last', item).length) {
$('td:first .indentation:last', item).after(handle);
// Update the total width of indentation in this entire table.
self.indentCount = Math.max($('.indentation', item).length, self.indentCount);
}
else {
$('td:first', item).prepend(handle);
}
// Add hover action for the handle.
handle.hover(function () {
self.dragObject == null ? $(this).addClass('tabledrag-handle-hover') : null;
}, function () {
self.dragObject == null ? $(this).removeClass('tabledrag-handle-hover') : null;
});
// Add the mousedown action for the handle.
handle.mousedown(function (event) {
// Create a new dragObject recording the event information.
self.dragObject = {};
self.dragObject.initMouseOffset = self.getMouseOffset(item, event);
self.dragObject.initMouseCoords = self.mouseCoords(event);
if (self.indentEnabled) {
self.dragObject.indentMousePos = self.dragObject.initMouseCoords;
}
// If there's a lingering row object from the keyboard, remove its focus.
if (self.rowObject) {
$('a.tabledrag-handle', self.rowObject.element).blur();
}
// Create a new rowObject for manipulation of this row.
self.rowObject = new self.row(item, 'mouse', self.indentEnabled, self.maxDepth, true);
// Save the position of the table.
self.table.topY = $(self.table).offset().top;
self.table.bottomY = self.table.topY + self.table.offsetHeight;
// Add classes to the handle and row.
$(this).addClass('tabledrag-handle-hover');
$(item).addClass('drag');
// Set the document to use the move cursor during drag.
$('body').addClass('drag');
if (self.oldRowElement) {
$(self.oldRowElement).removeClass('drag-previous');
}
// Hack for IE6 that flickers uncontrollably if select lists are moved.
if (navigator.userAgent.indexOf('MSIE 6.') != -1) {
$('select', this.table).css('display', 'none');
}
// Hack for Konqueror, prevent the blur handler from firing.
// Konqueror always gives links focus, even after returning false on mousedown.
self.safeBlur = false;
// Call optional placeholder function.
self.onDrag();
return false;
});
// Prevent the anchor tag from jumping us to the top of the page.
handle.click(function () {
return false;
});
// Similar to the hover event, add a class when the handle is focused.
handle.focus(function () {
$(this).addClass('tabledrag-handle-hover');
self.safeBlur = true;
});
// Remove the handle class on blur and fire the same function as a mouseup.
handle.blur(function (event) {
$(this).removeClass('tabledrag-handle-hover');
if (self.rowObject && self.safeBlur) {
self.dropRow(event, self);
}
});
// Add arrow-key support to the handle.
handle.keydown(function (event) {
// If a rowObject doesn't yet exist and this isn't the tab key.
if (event.keyCode != 9 && !self.rowObject) {
self.rowObject = new self.row(item, 'keyboard', self.indentEnabled, self.maxDepth, true);
}
var keyChange = false;
switch (event.keyCode) {
case 37: // Left arrow.
case 63234: // Safari left arrow.
keyChange = true;
self.rowObject.indent(-1 * self.rtl);
break;
case 38: // Up arrow.
case 63232: // Safari up arrow.
var previousRow = $(self.rowObject.element).prev('tr').get(0);
while (previousRow && $(previousRow).is(':hidden')) {
previousRow = $(previousRow).prev('tr').get(0);
}
if (previousRow) {
self.safeBlur = false; // Do not allow the onBlur cleanup.
self.rowObject.direction = 'up';
keyChange = true;
if ($(item).is('.tabledrag-root')) {
// Swap with the previous top-level row.
var groupHeight = 0;
while (previousRow && $('.indentation', previousRow).length) {
previousRow = $(previousRow).prev('tr').get(0);
groupHeight += $(previousRow).is(':hidden') ? 0 : previousRow.offsetHeight;
}
if (previousRow) {
self.rowObject.swap('before', previousRow);
// No need to check for indentation, 0 is the only valid one.
window.scrollBy(0, -groupHeight);
}
}
else if (self.table.tBodies[0].rows[0] != previousRow || $(previousRow).is('.draggable')) {
// Swap with the previous row (unless previous row is the first one
// and undraggable).
self.rowObject.swap('before', previousRow);
self.rowObject.interval = null;
self.rowObject.indent(0);
window.scrollBy(0, -parseInt(item.offsetHeight, 10));
}
handle.get(0).focus(); // Regain focus after the DOM manipulation.
}
break;
case 39: // Right arrow.
case 63235: // Safari right arrow.
keyChange = true;
self.rowObject.indent(1 * self.rtl);
break;
case 40: // Down arrow.
case 63233: // Safari down arrow.
var nextRow = $(self.rowObject.group).filter(':last').next('tr').get(0);
while (nextRow && $(nextRow).is(':hidden')) {
nextRow = $(nextRow).next('tr').get(0);
}
if (nextRow) {
self.safeBlur = false; // Do not allow the onBlur cleanup.
self.rowObject.direction = 'down';
keyChange = true;
if ($(item).is('.tabledrag-root')) {
// Swap with the next group (necessarily a top-level one).
var groupHeight = 0;
var nextGroup = new self.row(nextRow, 'keyboard', self.indentEnabled, self.maxDepth, false);
if (nextGroup) {
$(nextGroup.group).each(function () {
groupHeight += $(this).is(':hidden') ? 0 : this.offsetHeight;
});
var nextGroupRow = $(nextGroup.group).filter(':last').get(0);
self.rowObject.swap('after', nextGroupRow);
// No need to check for indentation, 0 is the only valid one.
window.scrollBy(0, parseInt(groupHeight, 10));
}
}
else {
// Swap with the next row.
self.rowObject.swap('after', nextRow);
self.rowObject.interval = null;
self.rowObject.indent(0);
window.scrollBy(0, parseInt(item.offsetHeight, 10));
}
handle.get(0).focus(); // Regain focus after the DOM manipulation.
}
break;
}
if (self.rowObject && self.rowObject.changed == true) {
$(item).addClass('drag');
if (self.oldRowElement) {
$(self.oldRowElement).removeClass('drag-previous');
}
self.oldRowElement = item;
self.restripeTable();
self.onDrag();
}
// Returning false if we have an arrow key to prevent scrolling.
if (keyChange) {
return false;
}
});
// Compatibility addition, return false on keypress to prevent unwanted scrolling.
// IE and Safari will suppress scrolling on keydown, but all other browsers
// need to return false on keypress. http://www.quirksmode.org/js/keys.html
handle.keypress(function (event) {
switch (event.keyCode) {
case 37: // Left arrow.
case 38: // Up arrow.
case 39: // Right arrow.
case 40: // Down arrow.
return false;
}
});
};
/**
* Mousemove event handler, bound to document.
*/
Drupal.tableDrag.prototype.dragRow = function (event, self) {
if (self.dragObject) {
self.currentMouseCoords = self.mouseCoords(event);
var y = self.currentMouseCoords.y - self.dragObject.initMouseOffset.y;
var x = self.currentMouseCoords.x - self.dragObject.initMouseOffset.x;
// Check for row swapping and vertical scrolling.
if (y != self.oldY) {
self.rowObject.direction = y > self.oldY ? 'down' : 'up';
self.oldY = y; // Update the old value.
// Check if the window should be scrolled (and how fast).
var scrollAmount = self.checkScroll(self.currentMouseCoords.y);
// Stop any current scrolling.
clearInterval(self.scrollInterval);
// Continue scrolling if the mouse has moved in the scroll direction.
if (scrollAmount > 0 && self.rowObject.direction == 'down' || scrollAmount < 0 && self.rowObject.direction == 'up') {
self.setScroll(scrollAmount);
}
// If we have a valid target, perform the swap and restripe the table.
var currentRow = self.findDropTargetRow(x, y);
if (currentRow) {
if (self.rowObject.direction == 'down') {
self.rowObject.swap('after', currentRow, self);
}
else {
self.rowObject.swap('before', currentRow, self);
}
self.restripeTable();
}
}
// Similar to row swapping, handle indentations.
if (self.indentEnabled) {
var xDiff = self.currentMouseCoords.x - self.dragObject.indentMousePos.x;
// Set the number of indentations the mouse has been moved left or right.
var indentDiff = Math.round(xDiff / self.indentAmount * self.rtl);
// Indent the row with our estimated diff, which may be further
// restricted according to the rows around this row.
var indentChange = self.rowObject.indent(indentDiff);
// Update table and mouse indentations.
self.dragObject.indentMousePos.x += self.indentAmount * indentChange * self.rtl;
self.indentCount = Math.max(self.indentCount, self.rowObject.indents);
}
return false;
}
};
/**
* Mouseup event handler, bound to document.
* Blur event handler, bound to drag handle for keyboard support.
*/
Drupal.tableDrag.prototype.dropRow = function (event, self) {
// Drop row functionality shared between mouseup and blur events.
if (self.rowObject != null) {
var droppedRow = self.rowObject.element;
// The row is already in the right place so we just release it.
if (self.rowObject.changed == true) {
// Update the fields in the dropped row.
self.updateFields(droppedRow);
// If a setting exists for affecting the entire group, update all the
// fields in the entire dragged group.
for (var group in self.tableSettings) {
var rowSettings = self.rowSettings(group, droppedRow);
if (rowSettings.relationship == 'group') {
for (var n in self.rowObject.children) {
self.updateField(self.rowObject.children[n], group);
}
}
}
self.rowObject.markChanged();
if (self.changed == false) {
$(Drupal.theme('tableDragChangedWarning')).insertBefore(self.table).hide().fadeIn('slow');
self.changed = true;
}
}
if (self.indentEnabled) {
self.rowObject.removeIndentClasses();
}
if (self.oldRowElement) {
$(self.oldRowElement).removeClass('drag-previous');
}
$(droppedRow).removeClass('drag').addClass('drag-previous');
self.oldRowElement = droppedRow;
self.onDrop();
self.rowObject = null;
}
// Functionality specific only to mouseup event.
if (self.dragObject != null) {
$('.tabledrag-handle', droppedRow).removeClass('tabledrag-handle-hover');
self.dragObject = null;
$('body').removeClass('drag');
clearInterval(self.scrollInterval);
// Hack for IE6 that flickers uncontrollably if select lists are moved.
if (navigator.userAgent.indexOf('MSIE 6.') != -1) {
$('select', this.table).css('display', 'block');
}
}
};
/**
* Get the mouse coordinates from the event (allowing for browser differences).
*/
Drupal.tableDrag.prototype.mouseCoords = function (event) {
if (event.pageX || event.pageY) {
return { x: event.pageX, y: event.pageY };
}
return {
x: event.clientX + document.body.scrollLeft - document.body.clientLeft,
y: event.clientY + document.body.scrollTop - document.body.clientTop
};
};
/**
* Given a target element and a mouse event, get the mouse offset from that
* element. To do this we need the element's position and the mouse position.
*/
Drupal.tableDrag.prototype.getMouseOffset = function (target, event) {
var docPos = $(target).offset();
var mousePos = this.mouseCoords(event);
return { x: mousePos.x - docPos.left, y: mousePos.y - docPos.top };
};
/**
* Find the row the mouse is currently over. This row is then taken and swapped
* with the one being dragged.
*
* @param x
* The x coordinate of the mouse on the page (not the screen).
* @param y
* The y coordinate of the mouse on the page (not the screen).
*/
Drupal.tableDrag.prototype.findDropTargetRow = function (x, y) {
var rows = $(this.table.tBodies[0].rows).not(':hidden');
for (var n = 0; n < rows.length; n++) {
var row = rows[n];
var indentDiff = 0;
var rowY = $(row).offset().top;
// Because Safari does not report offsetHeight on table rows, but does on
// table cells, grab the firstChild of the row and use that instead.
// http://jacob.peargrove.com/blog/2006/technical/table-row-offsettop-bug-in-safari.
if (row.offsetHeight == 0) {
var rowHeight = parseInt(row.firstChild.offsetHeight, 10) / 2;
}
// Other browsers.
else {
var rowHeight = parseInt(row.offsetHeight, 10) / 2;
}
// Because we always insert before, we need to offset the height a bit.
if ((y > (rowY - rowHeight)) && (y < (rowY + rowHeight))) {
if (this.indentEnabled) {
// Check that this row is not a child of the row being dragged.
for (var n in this.rowObject.group) {
if (this.rowObject.group[n] == row) {
return null;
}
}
}
else {
// Do not allow a row to be swapped with itself.
if (row == this.rowObject.element) {
return null;
}
}
// Check that swapping with this row is allowed.
if (!this.rowObject.isValidSwap(row)) {
return null;
}
// We may have found the row the mouse just passed over, but it doesn't
// take into account hidden rows. Skip backwards until we find a draggable
// row.
while ($(row).is(':hidden') && $(row).prev('tr').is(':hidden')) {
row = $(row).prev('tr').get(0);
}
return row;
}
}
return null;
};
/**
* After the row is dropped, update the table fields according to the settings
* set for this table.
*
* @param changedRow
* DOM object for the row that was just dropped.
*/
Drupal.tableDrag.prototype.updateFields = function (changedRow) {
for (var group in this.tableSettings) {
// Each group may have a different setting for relationship, so we find
// the source rows for each separately.
this.updateField(changedRow, group);
}
};
/**
* After the row is dropped, update a single table field according to specific
* settings.
*
* @param changedRow
* DOM object for the row that was just dropped.
* @param group
* The settings group on which field updates will occur.
*/
Drupal.tableDrag.prototype.updateField = function (changedRow, group) {
var rowSettings = this.rowSettings(group, changedRow);
// Set the row as its own target.
if (rowSettings.relationship == 'self' || rowSettings.relationship == 'group') {
var sourceRow = changedRow;
}
// Siblings are easy, check previous and next rows.
else if (rowSettings.relationship == 'sibling') {
var previousRow = $(changedRow).prev('tr').get(0);
var nextRow = $(changedRow).next('tr').get(0);
var sourceRow = changedRow;
if ($(previousRow).is('.draggable') && $('.' + group, previousRow).length) {
if (this.indentEnabled) {
if ($('.indentations', previousRow).length == $('.indentations', changedRow)) {
sourceRow = previousRow;
}
}
else {
sourceRow = previousRow;
}
}
else if ($(nextRow).is('.draggable') && $('.' + group, nextRow).length) {
if (this.indentEnabled) {
if ($('.indentations', nextRow).length == $('.indentations', changedRow)) {
sourceRow = nextRow;
}
}
else {
sourceRow = nextRow;
}
}
}
// Parents, look up the tree until we find a field not in this group.
// Go up as many parents as indentations in the changed row.
else if (rowSettings.relationship == 'parent') {
var previousRow = $(changedRow).prev('tr');
while (previousRow.length && $('.indentation', previousRow).length >= this.rowObject.indents) {
previousRow = previousRow.prev('tr');
}
// If we found a row.
if (previousRow.length) {
sourceRow = previousRow[0];
}
// Otherwise we went all the way to the left of the table without finding
// a parent, meaning this item has been placed at the root level.
else {
// Use the first row in the table as source, because it's guaranteed to
// be at the root level. Find the first item, then compare this row
// against it as a sibling.
sourceRow = $(this.table).find('tr.draggable:first').get(0);
if (sourceRow == this.rowObject.element) {
sourceRow = $(this.rowObject.group[this.rowObject.group.length - 1]).next('tr.draggable').get(0);
}
var useSibling = true;
}
}
// Because we may have moved the row from one category to another,
// take a look at our sibling and borrow its sources and targets.
this.copyDragClasses(sourceRow, changedRow, group);
rowSettings = this.rowSettings(group, changedRow);
// In the case that we're looking for a parent, but the row is at the top
// of the tree, copy our sibling's values.
if (useSibling) {
rowSettings.relationship = 'sibling';
rowSettings.source = rowSettings.target;
}
var targetClass = '.' + rowSettings.target;
var targetElement = $(targetClass, changedRow).get(0);
// Check if a target element exists in this row.
if (targetElement) {
var sourceClass = '.' + rowSettings.source;
var sourceElement = $(sourceClass, sourceRow).get(0);
switch (rowSettings.action) {
case 'depth':
// Get the depth of the target row.
targetElement.value = $('.indentation', $(sourceElement).closest('tr')).length;
break;
case 'match':
// Update the value.
targetElement.value = sourceElement.value;
break;
case 'order':
var siblings = this.rowObject.findSiblings(rowSettings);
if ($(targetElement).is('select')) {
// Get a list of acceptable values.
var values = [];
$('option', targetElement).each(function () {
values.push(this.value);
});
var maxVal = values[values.length - 1];
// Populate the values in the siblings.
$(targetClass, siblings).each(function () {
// If there are more items than possible values, assign the maximum value to the row.
if (values.length > 0) {
this.value = values.shift();
}
else {
this.value = maxVal;
}
});
}
else {
// Assume a numeric input field.
var weight = parseInt($(targetClass, siblings[0]).val(), 10) || 0;
$(targetClass, siblings).each(function () {
this.value = weight;
weight++;
});
}
break;
}
}
};
/**
* Copy all special tableDrag classes from one row's form elements to a
* different one, removing any special classes that the destination row
* may have had.
*/
Drupal.tableDrag.prototype.copyDragClasses = function (sourceRow, targetRow, group) {
var sourceElement = $('.' + group, sourceRow);
var targetElement = $('.' + group, targetRow);
if (sourceElement.length && targetElement.length) {
targetElement[0].className = sourceElement[0].className;
}
};
Drupal.tableDrag.prototype.checkScroll = function (cursorY) {
var de = document.documentElement;
var b = document.body;
var windowHeight = this.windowHeight = window.innerHeight || (de.clientHeight && de.clientWidth != 0 ? de.clientHeight : b.offsetHeight);
var scrollY = this.scrollY = (document.all ? (!de.scrollTop ? b.scrollTop : de.scrollTop) : (window.pageYOffset ? window.pageYOffset : window.scrollY));
var trigger = this.scrollSettings.trigger;
var delta = 0;
// Return a scroll speed relative to the edge of the screen.
if (cursorY - scrollY > windowHeight - trigger) {
delta = trigger / (windowHeight + scrollY - cursorY);
delta = (delta > 0 && delta < trigger) ? delta : trigger;
return delta * this.scrollSettings.amount;
}
else if (cursorY - scrollY < trigger) {
delta = trigger / (cursorY - scrollY);
delta = (delta > 0 && delta < trigger) ? delta : trigger;
return -delta * this.scrollSettings.amount;
}
};
Drupal.tableDrag.prototype.setScroll = function (scrollAmount) {
var self = this;
this.scrollInterval = setInterval(function () {
// Update the scroll values stored in the object.
self.checkScroll(self.currentMouseCoords.y);
var aboveTable = self.scrollY > self.table.topY;
var belowTable = self.scrollY + self.windowHeight < self.table.bottomY;
if (scrollAmount > 0 && belowTable || scrollAmount < 0 && aboveTable) {
window.scrollBy(0, scrollAmount);
}
}, this.scrollSettings.interval);
};
Drupal.tableDrag.prototype.restripeTable = function () {
// :even and :odd are reversed because jQuery counts from 0 and
// we count from 1, so we're out of sync.
// Match immediate children of the parent element to allow nesting.
$('> tbody > tr.draggable:visible, > tr.draggable:visible', this.table)
.removeClass('odd even')
.filter(':odd').addClass('even').end()
.filter(':even').addClass('odd');
};
/**
* Stub function. Allows a custom handler when a row begins dragging.
*/
Drupal.tableDrag.prototype.onDrag = function () {
return null;
};
/**
* Stub function. Allows a custom handler when a row is dropped.
*/
Drupal.tableDrag.prototype.onDrop = function () {
return null;
};
/**
* Constructor to make a new object to manipulate a table row.
*
* @param tableRow
* The DOM element for the table row we will be manipulating.
* @param method
* The method in which this row is being moved. Either 'keyboard' or 'mouse'.
* @param indentEnabled
* Whether the containing table uses indentations. Used for optimizations.
* @param maxDepth
* The maximum amount of indentations this row may contain.
* @param addClasses
* Whether we want to add classes to this row to indicate child relationships.
*/
Drupal.tableDrag.prototype.row = function (tableRow, method, indentEnabled, maxDepth, addClasses) {
this.element = tableRow;
this.method = method;
this.group = [tableRow];
this.groupDepth = $('.indentation', tableRow).length;
this.changed = false;
this.table = $(tableRow).closest('table').get(0);
this.indentEnabled = indentEnabled;
this.maxDepth = maxDepth;
this.direction = ''; // Direction the row is being moved.
if (this.indentEnabled) {
this.indents = $('.indentation', tableRow).length;
this.children = this.findChildren(addClasses);
this.group = $.merge(this.group, this.children);
// Find the depth of this entire group.
for (var n = 0; n < this.group.length; n++) {
this.groupDepth = Math.max($('.indentation', this.group[n]).length, this.groupDepth);
}
}
};
/**
* Find all children of rowObject by indentation.
*
* @param addClasses
* Whether we want to add classes to this row to indicate child relationships.
*/
Drupal.tableDrag.prototype.row.prototype.findChildren = function (addClasses) {
var parentIndentation = this.indents;
var currentRow = $(this.element, this.table).next('tr.draggable');
var rows = [];
var child = 0;
while (currentRow.length) {
var rowIndentation = $('.indentation', currentRow).length;
// A greater indentation indicates this is a child.
if (rowIndentation > parentIndentation) {
child++;
rows.push(currentRow[0]);
if (addClasses) {
$('.indentation', currentRow).each(function (indentNum) {
if (child == 1 && (indentNum == parentIndentation)) {
$(this).addClass('tree-child-first');
}
if (indentNum == parentIndentation) {
$(this).addClass('tree-child');
}
else if (indentNum > parentIndentation) {
$(this).addClass('tree-child-horizontal');
}
});
}
}
else {
break;
}
currentRow = currentRow.next('tr.draggable');
}
if (addClasses && rows.length) {
$('.indentation:nth-child(' + (parentIndentation + 1) + ')', rows[rows.length - 1]).addClass('tree-child-last');
}
return rows;
};
/**
* Ensure that two rows are allowed to be swapped.
*
* @param row
* DOM object for the row being considered for swapping.
*/
Drupal.tableDrag.prototype.row.prototype.isValidSwap = function (row) {
if (this.indentEnabled) {
var prevRow, nextRow;
if (this.direction == 'down') {
prevRow = row;
nextRow = $(row).next('tr').get(0);
}
else {
prevRow = $(row).prev('tr').get(0);
nextRow = row;
}
this.interval = this.validIndentInterval(prevRow, nextRow);
// We have an invalid swap if the valid indentations interval is empty.
if (this.interval.min > this.interval.max) {
return false;
}
}
// Do not let an un-draggable first row have anything put before it.
if (this.table.tBodies[0].rows[0] == row && $(row).is(':not(.draggable)')) {
return false;
}
return true;
};
/**
* Perform the swap between two rows.
*
* @param position
* Whether the swap will occur 'before' or 'after' the given row.
* @param row
* DOM element what will be swapped with the row group.
*/
Drupal.tableDrag.prototype.row.prototype.swap = function (position, row) {
Drupal.detachBehaviors(this.group, Drupal.settings, 'move');
$(row)[position](this.group);
Drupal.attachBehaviors(this.group, Drupal.settings);
this.changed = true;
this.onSwap(row);
};
/**
* Determine the valid indentations interval for the row at a given position
* in the table.
*
* @param prevRow
* DOM object for the row before the tested position
* (or null for first position in the table).
* @param nextRow
* DOM object for the row after the tested position
* (or null for last position in the table).
*/
Drupal.tableDrag.prototype.row.prototype.validIndentInterval = function (prevRow, nextRow) {
var minIndent, maxIndent;
// Minimum indentation:
// Do not orphan the next row.
minIndent = nextRow ? $('.indentation', nextRow).length : 0;
// Maximum indentation:
if (!prevRow || $(prevRow).is(':not(.draggable)') || $(this.element).is('.tabledrag-root')) {
// Do not indent:
// - the first row in the table,
// - rows dragged below a non-draggable row,
// - 'root' rows.
maxIndent = 0;
}
else {
// Do not go deeper than as a child of the previous row.
maxIndent = $('.indentation', prevRow).length + ($(prevRow).is('.tabledrag-leaf') ? 0 : 1);
// Limit by the maximum allowed depth for the table.
if (this.maxDepth) {
maxIndent = Math.min(maxIndent, this.maxDepth - (this.groupDepth - this.indents));
}
}
return { 'min': minIndent, 'max': maxIndent };
};
/**
* Indent a row within the legal bounds of the table.
*
* @param indentDiff
* The number of additional indentations proposed for the row (can be
* positive or negative). This number will be adjusted to nearest valid
* indentation level for the row.
*/
Drupal.tableDrag.prototype.row.prototype.indent = function (indentDiff) {
// Determine the valid indentations interval if not available yet.
if (!this.interval) {
var prevRow = $(this.element).prev('tr').get(0);
var nextRow = $(this.group).filter(':last').next('tr').get(0);
this.interval = this.validIndentInterval(prevRow, nextRow);
}
// Adjust to the nearest valid indentation.
var indent = this.indents + indentDiff;
indent = Math.max(indent, this.interval.min);
indent = Math.min(indent, this.interval.max);
indentDiff = indent - this.indents;
for (var n = 1; n <= Math.abs(indentDiff); n++) {
// Add or remove indentations.
if (indentDiff < 0) {
$('.indentation:first', this.group).remove();
this.indents--;
}
else {
$('td:first', this.group).prepend(Drupal.theme('tableDragIndentation'));
this.indents++;
}
}
if (indentDiff) {
// Update indentation for this row.
this.changed = true;
this.groupDepth += indentDiff;
this.onIndent();
}
return indentDiff;
};
/**
* Find all siblings for a row, either according to its subgroup or indentation.
* Note that the passed-in row is included in the list of siblings.
*
* @param settings
* The field settings we're using to identify what constitutes a sibling.
*/
Drupal.tableDrag.prototype.row.prototype.findSiblings = function (rowSettings) {
var siblings = [];
var directions = ['prev', 'next'];
var rowIndentation = this.indents;
for (var d = 0; d < directions.length; d++) {
var checkRow = $(this.element)[directions[d]]();
while (checkRow.length) {
// Check that the sibling contains a similar target field.
if ($('.' + rowSettings.target, checkRow)) {
// Either add immediately if this is a flat table, or check to ensure
// that this row has the same level of indentation.
if (this.indentEnabled) {
var checkRowIndentation = $('.indentation', checkRow).length;
}
if (!(this.indentEnabled) || (checkRowIndentation == rowIndentation)) {
siblings.push(checkRow[0]);
}
else if (checkRowIndentation < rowIndentation) {
// No need to keep looking for siblings when we get to a parent.
break;
}
}
else {
break;
}
checkRow = $(checkRow)[directions[d]]();
}
// Since siblings are added in reverse order for previous, reverse the
// completed list of previous siblings. Add the current row and continue.
if (directions[d] == 'prev') {
siblings.reverse();
siblings.push(this.element);
}
}
return siblings;
};
/**
* Remove indentation helper classes from the current row group.
*/
Drupal.tableDrag.prototype.row.prototype.removeIndentClasses = function () {
for (var n in this.children) {
$('.indentation', this.children[n])
.removeClass('tree-child')
.removeClass('tree-child-first')
.removeClass('tree-child-last')
.removeClass('tree-child-horizontal');
}
};
/**
* Add an asterisk or other marker to the changed row.
*/
Drupal.tableDrag.prototype.row.prototype.markChanged = function () {
var marker = Drupal.theme('tableDragChangedMarker');
var cell = $('td:first', this.element);
if ($('span.tabledrag-changed', cell).length == 0) {
cell.append(marker);
}
};
/**
* Stub function. Allows a custom handler when a row is indented.
*/
Drupal.tableDrag.prototype.row.prototype.onIndent = function () {
return null;
};
/**
* Stub function. Allows a custom handler when a row is swapped.
*/
Drupal.tableDrag.prototype.row.prototype.onSwap = function (swappedRow) {
return null;
};
Drupal.theme.prototype.tableDragChangedMarker = function () {
return '<span class="warning tabledrag-changed">*</span>';
};
Drupal.theme.prototype.tableDragIndentation = function () {
return '<div class="indentation"> </div>';
};
Drupal.theme.prototype.tableDragChangedWarning = function () {
return '<div class="tabledrag-changed-warning messages warning">' + Drupal.theme('tableDragChangedMarker') + ' ' + Drupal.t('Changes made in this table will not be saved until the form is submitted.') + '</div>';
};
})(jQuery);
|
assets/plugins/tinymce/plugins/legacyoutput/plugin.js
|
fandiahm/sipag-cms
|
/**
* plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*
* This plugin will force TinyMCE to produce deprecated legacy output such as font elements, u elements, align
* attributes and so forth. There are a few cases where these old items might be needed for example in email applications or with Flash
*
* However you should NOT use this plugin if you are building some system that produces web contents such as a CMS. All these elements are
* not apart of the newer specifications for HTML and XHTML.
*/
/*global tinymce:true */
(function(tinymce) {
// Override inline_styles setting to force TinyMCE to produce deprecated contents
tinymce.on('AddEditor', function(e) {
e.editor.settings.inline_styles = false;
});
tinymce.PluginManager.add('legacyoutput', function(editor, url, $) {
editor.on('init', function() {
var alignElements = 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img',
fontSizes = tinymce.explode(editor.settings.font_size_style_values),
schema = editor.schema;
// Override some internal formats to produce legacy elements and attributes
editor.formatter.register({
// Change alignment formats to use the deprecated align attribute
alignleft: {selector: alignElements, attributes: {align: 'left'}},
aligncenter: {selector: alignElements, attributes: {align: 'center'}},
alignright: {selector: alignElements, attributes: {align: 'right'}},
alignjustify: {selector: alignElements, attributes: {align: 'justify'}},
// Change the basic formatting elements to use deprecated element types
bold: [
{inline: 'b', remove: 'all'},
{inline: 'strong', remove: 'all'},
{inline: 'span', styles: {fontWeight: 'bold'}}
],
italic: [
{inline: 'i', remove: 'all'},
{inline: 'em', remove: 'all'},
{inline: 'span', styles: {fontStyle: 'italic'}}
],
underline: [
{inline: 'u', remove: 'all'},
{inline: 'span', styles: {textDecoration: 'underline'}, exact: true}
],
strikethrough: [
{inline: 'strike', remove: 'all'},
{inline: 'span', styles: {textDecoration: 'line-through'}, exact: true}
],
// Change font size and font family to use the deprecated font element
fontname: {inline: 'font', attributes: {face: '%value'}},
fontsize: {
inline: 'font',
attributes: {
size: function(vars) {
return tinymce.inArray(fontSizes, vars.value) + 1;
}
}
},
// Setup font elements for colors as well
forecolor: {inline: 'font', attributes: {color: '%value'}},
hilitecolor: {inline: 'font', styles: {backgroundColor: '%value'}}
});
// Check that deprecated elements are allowed if not add them
tinymce.each('b,i,u,strike'.split(','), function(name) {
schema.addValidElements(name + '[*]');
});
// Add font element if it's missing
if (!schema.getElementRule("font")) {
schema.addValidElements("font[face|size|color|style]");
}
// Add the missing and depreacted align attribute for the serialization engine
tinymce.each(alignElements.split(','), function(name) {
var rule = schema.getElementRule(name);
if (rule) {
if (!rule.attributes.align) {
rule.attributes.align = {};
rule.attributesOrder.push('align');
}
}
});
});
editor.addButton('fontsizeselect', function() {
var items = [], defaultFontsizeFormats = '8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7';
var fontsize_formats = editor.settings.fontsize_formats || defaultFontsizeFormats;
editor.$.each(fontsize_formats.split(' '), function(i, item) {
var text = item, value = item;
var values = item.split('=');
if (values.length > 1) {
text = values[0];
value = values[1];
}
items.push({text: text, value: value});
});
return {
type: 'listbox',
text: 'Font Sizes',
tooltip: 'Font Sizes',
values: items,
fixedWidth: true,
onPostRender: function() {
var self = this;
editor.on('NodeChange', function() {
var fontElm;
fontElm = editor.dom.getParent(editor.selection.getNode(), 'font');
if (fontElm) {
self.value(fontElm.size);
} else {
self.value('');
}
});
},
onclick: function(e) {
if (e.control.settings.value) {
editor.execCommand('FontSize', false, e.control.settings.value);
}
}
};
});
editor.addButton('fontselect', function() {
function createFormats(formats) {
formats = formats.replace(/;$/, '').split(';');
var i = formats.length;
while (i--) {
formats[i] = formats[i].split('=');
}
return formats;
}
var defaultFontsFormats =
'Andale Mono=andale mono,monospace;' +
'Arial=arial,helvetica,sans-serif;' +
'Arial Black=arial black,sans-serif;' +
'Book Antiqua=book antiqua,palatino,serif;' +
'Comic Sans MS=comic sans ms,sans-serif;' +
'Courier New=courier new,courier,monospace;' +
'Georgia=georgia,palatino,serif;' +
'Helvetica=helvetica,arial,sans-serif;' +
'Impact=impact,sans-serif;' +
'Symbol=symbol;' +
'Tahoma=tahoma,arial,helvetica,sans-serif;' +
'Terminal=terminal,monaco,monospace;' +
'Times New Roman=times new roman,times,serif;' +
'Trebuchet MS=trebuchet ms,geneva,sans-serif;' +
'Verdana=verdana,geneva,sans-serif;' +
'Webdings=webdings;' +
'Wingdings=wingdings,zapf dingbats';
var items = [], fonts = createFormats(editor.settings.font_formats || defaultFontsFormats);
$.each(fonts, function(i, font) {
items.push({
text: {raw: font[0]},
value: font[1],
textStyle: font[1].indexOf('dings') == -1 ? 'font-family:' + font[1] : ''
});
});
return {
type: 'listbox',
text: 'Font Family',
tooltip: 'Font Family',
values: items,
fixedWidth: true,
onPostRender: function() {
var self = this;
editor.on('NodeChange', function() {
var fontElm;
fontElm = editor.dom.getParent(editor.selection.getNode(), 'font');
if (fontElm) {
self.value(fontElm.face);
} else {
self.value('');
}
});
},
onselect: function(e) {
if (e.control.settings.value) {
editor.execCommand('FontName', false, e.control.settings.value);
}
}
};
});
});
})(tinymce);
|
ajax/libs/babel-core/4.5.4/browser.min.js
|
yinghunglai/cdnjs
|
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self),n.babel=e()}}(function(){var e,n,l;return function t(e,n,l){function r(o,u){if(!n[o]){if(!e[o]){var s="function"==typeof require&&require;if(!u&&s)return s(o,!0);if(a)return a(o,!0);var i=new Error("Cannot find module '"+o+"'");throw i.code="MODULE_NOT_FOUND",i}var c=n[o]={exports:{}};e[o][0].call(c.exports,function(n){var l=e[o][1][n];return r(l?l:n)},c,c.exports,t,e,n,l)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o<l.length;o++)r(l[o]);return r}({1:[function(e,n){(function(l){"use strict";var t=n.exports=e("../transformation");t.version=e("../../../package").version,t.transform=t,t.run=function(e,n){return n||(n={}),n.sourceMap="inline",new Function(t(e,n).code)()},t.load=function(e,n,r,a){r||(r={});var o=r;o.filename||(o.filename=e);var u=l.ActiveXObject?new l.ActiveXObject("Microsoft.XMLHTTP"):new l.XMLHttpRequest;u.open("GET",e,!0),"overrideMimeType"in u&&u.overrideMimeType("text/plain"),u.onreadystatechange=function(){if(4===u.readyState){var l=u.status;if(0!==l&&200!==l)throw new Error("Could not load "+e);var o=[u.responseText,r];a||t.run.apply(t,o),n&&n(o)}},u.send(null)};var r=function(){for(var e=[],n=["text/ecmascript-6","text/6to5","text/babel","module"],r=0,a=function(e){var n=function(){return e.apply(this,arguments)};return n.toString=function(){return e.toString()},n}(function(){var n=e[r];n instanceof Array&&(t.run.apply(t,n),r++,a())}),o=function(n,l){var r={};n.src?t.load(n.src,function(n){e[l]=n,a()},r,!0):(r.filename="embedded",e[l]=[n.innerHTML,r])},u=l.document.getElementsByTagName("script"),s=0;s<u.length;++s){var i=u[s];n.indexOf(i.type)>=0&&e.push(i)}for(s in e)o(e[s],s);a()};l.addEventListener?l.addEventListener("DOMContentLoaded",r,!1):l.attachEvent&&l.attachEvent("onload",r)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../../package":338,"../transformation":42}],2:[function(e,n){"use strict";function l(e,n){this.position=e,this._indent=n.indent.base,this.format=n,this.buf=""}n.exports=l;var t=e("repeating"),r=e("trim-right"),a=e("lodash/lang/isBoolean"),o=e("lodash/collection/includes"),u=e("lodash/lang/isNumber");l.prototype.get=function(){return r(this.buf)},l.prototype.getIndent=function(){return this.format.compact||this.format.concise?"":t(this.format.indent.style,this._indent)},l.prototype.indentSize=function(){return this.getIndent().length},l.prototype.indent=function(){this._indent++},l.prototype.dedent=function(){this._indent--},l.prototype.semicolon=function(){this.push(";")},l.prototype.ensureSemicolon=function(){this.isLast(";")||this.semicolon()},l.prototype.rightBrace=function(){this.newline(!0),this.push("}")},l.prototype.keyword=function(e){this.push(e),this.space()},l.prototype.space=function(){this.format.compact||!this.buf||this.isLast(" ")||this.isLast("\n")||this.push(" ")},l.prototype.removeLast=function(e){this.format.compact||this.isLast(e)&&(this.buf=this.buf.substr(0,this.buf.length-1),this.position.unshift(e))},l.prototype.newline=function(e,n){if(!this.format.compact){if(this.format.concise)return void this.space();if(n||(n=!1),u(e)){if(e=Math.min(2,e),(this.endsWith("{\n")||this.endsWith(":\n"))&&e--,0>=e)return;for(;e>0;)this._newline(n),e--}else a(e)&&(n=e),this._newline(n)}},l.prototype._newline=function(e){this.endsWith("\n\n")||(e&&this.isLast("\n")&&this.removeLast("\n"),this.removeLast(" "),this._removeSpacesAfterLastNewline(),this._push("\n"))},l.prototype._removeSpacesAfterLastNewline=function(){var e=this.buf.lastIndexOf("\n");if(-1!==e){for(var n=this.buf.length-1;n>e&&" "===this.buf[n];)n--;n===e&&(this.buf=this.buf.substring(0,n+1))}},l.prototype.push=function(e,n){if(!this.format.compact&&this._indent&&!n&&"\n"!==e){var l=this.getIndent();e=e.replace(/\n/g,"\n"+l),this.isLast("\n")&&this._push(l)}this._push(e)},l.prototype._push=function(e){this.position.push(e),this.buf+=e},l.prototype.endsWith=function(e){return this.buf.slice(-e.length)===e},l.prototype.isLast=function(e){if(this.format.compact)return!1;var n=this.buf,l=n[n.length-1];return Array.isArray(e)?o(e,l):e===l}},{"lodash/collection/includes":201,"lodash/lang/isBoolean":284,"lodash/lang/isNumber":288,repeating:321,"trim-right":337}],3:[function(e,n,l){"use strict";l.File=function(e,n){n(e.program)},l.Program=function(e,n){n.sequence(e.body)},l.BlockStatement=function(e,n){0===e.body.length?this.push("{}"):(this.push("{"),this.newline(),n.sequence(e.body,{indent:!0}),this.removeLast("\n"),this.rightBrace())}},{}],4:[function(e,n,l){"use strict";l.ClassExpression=l.ClassDeclaration=function(e,n){this.push("class"),e.id&&(this.space(),n(e.id)),e.superClass&&(this.push(" extends "),n(e.superClass)),this.space(),n(e.body)},l.ClassBody=function(e,n){0===e.body.length?this.push("{}"):(this.push("{"),this.newline(),this.indent(),n.sequence(e.body),this.dedent(),this.rightBrace())},l.MethodDefinition=function(e,n){e["static"]&&this.push("static "),this._method(e,n)}},{}],5:[function(e,n,l){"use strict";l.ComprehensionBlock=function(e,n){this.keyword("for"),this.push("("),n(e.left),this.push(" of "),n(e.right),this.push(")")},l.ComprehensionExpression=function(e,n){this.push(e.generator?"(":"["),n.join(e.blocks,{separator:" "}),this.space(),e.filter&&(this.keyword("if"),this.push("("),n(e.filter),this.push(")"),this.space()),n(e.body),this.push(e.generator?")":"]")}},{}],6:[function(e,n,l){"use strict";var t=e("is-integer"),r=e("lodash/lang/isNumber"),a=e("../../types");l.UnaryExpression=function(e,n){var l=/[a-z]$/.test(e.operator),t=e.argument;(a.isUpdateExpression(t)||a.isUnaryExpression(t))&&(l=!0),a.isUnaryExpression(t)&&"!"===t.operator&&(l=!1),this.push(e.operator),l&&this.push(" "),n(e.argument)},l.UpdateExpression=function(e,n){e.prefix?(this.push(e.operator),n(e.argument)):(n(e.argument),this.push(e.operator))},l.ConditionalExpression=function(e,n){n(e.test),this.space(),this.push("?"),this.space(),n(e.consequent),this.space(),this.push(":"),this.space(),n(e.alternate)},l.NewExpression=function(e,n){this.push("new "),n(e.callee),this.push("("),n.list(e.arguments),this.push(")")},l.SequenceExpression=function(e,n){n.list(e.expressions)},l.ThisExpression=function(){this.push("this")},l.CallExpression=function(e,n){n(e.callee),this.push("(");var l=",";e._prettyCall?(l+="\n",this.newline(),this.indent()):l+=" ",n.list(e.arguments,{separator:l}),e._prettyCall&&(this.newline(),this.dedent()),this.push(")")};var o=function(e){return function(n,l){this.push(e),(n.delegate||n.all)&&this.push("*"),n.argument&&(this.space(),l(n.argument))}};l.YieldExpression=o("yield"),l.AwaitExpression=o("await"),l.EmptyStatement=function(){this.semicolon()},l.ExpressionStatement=function(e,n){n(e.expression),this.semicolon()},l.BinaryExpression=l.LogicalExpression=l.AssignmentPattern=l.AssignmentExpression=function(e,n){n(e.left),this.push(" "),this.push(e.operator),this.push(" "),n(e.right)};var u=/e/i;l.MemberExpression=function(e,n){var l=e.object;if(n(l),!e.computed&&a.isMemberExpression(e.property))throw new TypeError("Got a MemberExpression for MemberExpression property");var o=e.computed;a.isLiteral(e.property)&&r(e.property.value)&&(o=!0),o?(this.push("["),n(e.property),this.push("]")):(a.isLiteral(l)&&t(l.value)&&!u.test(l.value.toString())&&this.push("."),this.push("."),n(e.property))}},{"../../types":120,"is-integer":185,"lodash/lang/isNumber":288}],7:[function(e,n,l){"use strict";l.AnyTypeAnnotation=l.ArrayTypeAnnotation=l.BooleanTypeAnnotation=l.ClassProperty=l.DeclareClass=l.DeclareFunction=l.DeclareModule=l.DeclareVariable=l.FunctionTypeAnnotation=l.FunctionTypeParam=l.GenericTypeAnnotation=l.InterfaceExtends=l.InterfaceDeclaration=l.IntersectionTypeAnnotation=l.NullableTypeAnnotation=l.NumberTypeAnnotation=l.StringLiteralTypeAnnotation=l.StringTypeAnnotation=l.TupleTypeAnnotation=l.TypeofTypeAnnotation=l.TypeAlias=l.TypeAnnotation=l.TypeParameterDeclaration=l.TypeParameterInstantiation=l.ObjectTypeAnnotation=l.ObjectTypeCallProperty=l.ObjectTypeIndexer=l.ObjectTypeProperty=l.QualifiedTypeIdentifier=l.UnionTypeAnnotation=l.TypeCastExpression=l.VoidTypeAnnotation=function(){}},{}],8:[function(e,n,l){"use strict";var t=e("../../types"),r=e("lodash/collection/each");l.JSXAttribute=function(e,n){n(e.name),e.value&&(this.push("="),n(e.value))},l.JSXIdentifier=function(e){this.push(e.name)},l.JSXNamespacedName=function(e,n){n(e.namespace),this.push(":"),n(e.name)},l.JSXMemberExpression=function(e,n){n(e.object),this.push("."),n(e.property)},l.JSXSpreadAttribute=function(e,n){this.push("{..."),n(e.argument),this.push("}")},l.JSXExpressionContainer=function(e,n){this.push("{"),n(e.expression),this.push("}")},l.JSXElement=function(e,n){var l=this,a=e.openingElement;n(a),a.selfClosing||(this.indent(),r(e.children,function(e){t.isLiteral(e)?l.push(e.value):n(e)}),this.dedent(),n(e.closingElement))},l.JSXOpeningElement=function(e,n){this.push("<"),n(e.name),e.attributes.length>0&&(this.push(" "),n.join(e.attributes,{separator:" "})),this.push(e.selfClosing?" />":">")},l.JSXClosingElement=function(e,n){this.push("</"),n(e.name),this.push(">")},l.JSXEmptyExpression=function(){}},{"../../types":120,"lodash/collection/each":198}],9:[function(e,n,l){"use strict";var t=e("../../types");l._params=function(e,n){this.push("("),n.list(e.params),this.push(")")},l._method=function(e,n){var l=e.value,t=e.kind,r=e.key;t&&"init"!==t?this.push(t+" "):l.generator&&this.push("*"),l.async&&this.push("async "),e.computed?(this.push("["),n(r),this.push("]")):n(r),this._params(l,n),this.push(" "),n(l.body)},l.FunctionDeclaration=l.FunctionExpression=function(e,n){e.async&&this.push("async "),this.push("function"),e.generator&&this.push("*"),e.id?(this.push(" "),n(e.id)):this.space(),this._params(e,n),this.space(),n(e.body)},l.ArrowFunctionExpression=function(e,n){e.async&&this.push("async "),1===e.params.length&&t.isIdentifier(e.params[0])?n(e.params[0]):this._params(e,n),this.push(" => "),n(e.body)}},{"../../types":120}],10:[function(e,n,l){"use strict";var t=e("../../types"),r=e("lodash/collection/each");l.ImportSpecifier=function(e,n){return t.isSpecifierDefault(e)?void n(t.getSpecifierName(e)):l.ExportSpecifier.apply(this,arguments)},l.ExportSpecifier=function(e,n){n(e.id),e.name&&(this.push(" as "),n(e.name))},l.ExportBatchSpecifier=function(){this.push("*")},l.ExportDeclaration=function(e,n){this.push("export ");var l=e.specifiers;if(e["default"]&&this.push("default "),e.declaration){if(n(e.declaration),t.isStatement(e.declaration))return}else 1===l.length&&t.isExportBatchSpecifier(l[0])?n(l[0]):(this.push("{"),l.length&&(this.space(),n.join(l,{separator:", "}),this.space()),this.push("}")),e.source&&(this.push(" from "),n(e.source));this.ensureSemicolon()},l.ImportDeclaration=function(e,n){var l=this;this.push("import "),e.isType&&this.push("type ");var a=e.specifiers;if(a&&a.length){var o=!1;r(e.specifiers,function(e,r){+r>0&&l.push(", ");var a=t.isSpecifierDefault(e);a||"ImportBatchSpecifier"===e.type||o||(o=!0,l.push("{ ")),n(e)}),o&&this.push(" }"),this.push(" from ")}n(e.source),this.semicolon()},l.ImportBatchSpecifier=function(e,n){this.push("* as "),n(e.name)}},{"../../types":120,"lodash/collection/each":198}],11:[function(e,n,l){"use strict";var t=e("lodash/collection/each");t(["BindMemberExpression","BindFunctionExpression"],function(e){l[e]=function(){throw new ReferenceError("Trying to render non-standard playground node "+JSON.stringify(e))}})},{"lodash/collection/each":198}],12:[function(e,n,l){"use strict";var t=e("repeating"),r=e("../../types");l.WithStatement=function(e,n){this.keyword("with"),this.push("("),n(e.object),this.push(")"),n.block(e.body)},l.IfStatement=function(e,n){this.keyword("if"),this.push("("),n(e.test),this.push(")"),this.space(),n.indentOnComments(e.consequent),e.alternate&&(this.isLast("}")&&this.space(),this.push("else "),n.indentOnComments(e.alternate))},l.ForStatement=function(e,n){this.keyword("for"),this.push("("),n(e.init),this.push(";"),e.test&&(this.push(" "),n(e.test)),this.push(";"),e.update&&(this.push(" "),n(e.update)),this.push(")"),n.block(e.body)},l.WhileStatement=function(e,n){this.keyword("while"),this.push("("),n(e.test),this.push(")"),n.block(e.body)};var a=function(e){return function(n,l){this.keyword("for"),this.push("("),l(n.left),this.push(" "+e+" "),l(n.right),this.push(")"),l.block(n.body)}};l.ForInStatement=a("in"),l.ForOfStatement=a("of"),l.DoWhileStatement=function(e,n){this.keyword("do"),n(e.body),this.space(),this.keyword("while"),this.push("("),n(e.test),this.push(");")};var o=function(e,n){return function(l,t){this.push(e);var r=l[n||"label"];r&&(this.push(" "),t(r)),this.semicolon()}};l.ContinueStatement=o("continue"),l.ReturnStatement=o("return","argument"),l.BreakStatement=o("break"),l.LabeledStatement=function(e,n){n(e.label),this.push(": "),n(e.body)},l.TryStatement=function(e,n){this.keyword("try"),n(e.block),this.space(),n(e.handlers?e.handlers[0]:e.handler),e.finalizer&&(this.space(),this.push("finally "),n(e.finalizer))},l.CatchClause=function(e,n){this.keyword("catch"),this.push("("),n(e.param),this.push(") "),n(e.body)},l.ThrowStatement=function(e,n){this.push("throw "),n(e.argument),this.semicolon()},l.SwitchStatement=function(e,n){this.keyword("switch"),this.push("("),n(e.discriminant),this.push(")"),this.space(),this.push("{"),n.sequence(e.cases,{indent:!0,addNewlines:function(n,l){return n||e.cases[e.cases.length-1]!==l?void 0:-1}}),this.push("}")},l.SwitchCase=function(e,n){e.test?(this.push("case "),n(e.test),this.push(":")):this.push("default:"),e.consequent.length&&(this.newline(),n.sequence(e.consequent,{indent:!0}))},l.DebuggerStatement=function(){this.push("debugger;")},l.VariableDeclaration=function(e,n,l){this.push(e.kind+" ");var a=!1;if(!r.isFor(l))for(var o=0;o<e.declarations.length;o++)e.declarations[o].init&&(a=!0);var u=",";u+=!this.format.compact&&a?"\n"+t(" ",e.kind.length+1):" ",n.list(e.declarations,{separator:u}),r.isFor(l)||this.semicolon()},l.PrivateDeclaration=function(e,n){this.push("private "),n.join(e.declarations,{separator:", "}),this.semicolon()},l.VariableDeclarator=function(e,n){e.init?(n(e.id),this.space(),this.push("="),this.space(),n(e.init)):n(e.id)}},{"../../types":120,repeating:321}],13:[function(e,n,l){"use strict";var t=e("lodash/collection/each");l.TaggedTemplateExpression=function(e,n){n(e.tag),n(e.quasi)},l.TemplateElement=function(e){this._push(e.value.raw)},l.TemplateLiteral=function(e,n){var l=this;this.push("`");var r=e.quasis,a=r.length;t(r,function(t,r){n(t),a>r+1&&(l.push("${ "),n(e.expressions[r]),l.push(" }"))}),this._push("`")}},{"lodash/collection/each":198}],14:[function(e,n,l){"use strict";var t=e("lodash/collection/each");l.Identifier=function(e){this.push(e.name)},l.RestElement=l.SpreadElement=l.SpreadProperty=function(e,n){this.push("..."),n(e.argument)},l.VirtualPropertyExpression=function(e,n){n(e.object),this.push("::"),n(e.property)},l.ObjectExpression=l.ObjectPattern=function(e,n){var l=e.properties;l.length?(this.push("{"),this.space(),n.list(l,{indent:!0}),this.space(),this.push("}")):this.push("{}")},l.Property=function(e,n){if(e.method||"get"===e.kind||"set"===e.kind)this._method(e,n);else{if(e.computed)this.push("["),n(e.key),this.push("]");else if(n(e.key),e.shorthand)return;this.push(":"),this.space(),n(e.value)}},l.ArrayExpression=l.ArrayPattern=function(e,n){var l=this,r=e.elements,a=r.length;this.push("["),t(r,function(e,t){e?(t>0&&l.push(" "),n(e),a-1>t&&l.push(",")):l.push(",")}),this.push("]")},l.Literal=function(e){var n=e.value,l=typeof n;"string"===l?(n=JSON.stringify(n),n=n.replace(/[\u000A\u000D\u2028\u2029]/g,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}),this.push(n)):"number"===l?this.push(n+""):"boolean"===l?this.push(n?"true":"false"):e.regex?this.push("/"+e.regex.pattern+"/"+e.regex.flags):null===n&&this.push("null")}},{"lodash/collection/each":198}],15:[function(e,n){"use strict";function l(e,n,t){n||(n={}),this.comments=e.comments||[],this.tokens=e.tokens||[],this.format=l.normalizeOptions(t,n),this.opts=n,this.ast=e,this.whitespace=new r(this.tokens,this.comments,this.format),this.position=new u,this.map=new o(this.position,n,t),this.buffer=new i(this.position,this.format)}n.exports=function(e,n,t){var r=new l(e,n,t);return r.generate()},n.exports.CodeGenerator=l;var t=e("detect-indent"),r=e("./whitespace"),a=e("repeating"),o=e("./source-map"),u=e("./position"),s=e("../messages"),i=e("./buffer"),c=e("lodash/object/extend"),d=e("lodash/collection/each"),p=e("./node"),f=e("../types");d(i.prototype,function(e,n){l.prototype[n]=function(){return e.apply(this.buffer,arguments)}}),l.normalizeOptions=function(e,n){var l=" ";if(e){var r=t(e).indent;r&&" "!==r&&(l=r)}var a={comments:null==n.comments||n.comments,compact:n.compact,indent:{adjustMultilineComment:!0,style:l,base:0}};return"auto"===a.compact&&(a.compact=e.length>1e5,a.compact&&console.error(s.get("codeGeneratorDeopt",n.filename,"100KB"))),a},l.generators={templateLiterals:e("./generators/template-literals"),comprehensions:e("./generators/comprehensions"),expressions:e("./generators/expressions"),statements:e("./generators/statements"),playground:e("./generators/playground"),classes:e("./generators/classes"),methods:e("./generators/methods"),modules:e("./generators/modules"),types:e("./generators/types"),flow:e("./generators/flow"),base:e("./generators/base"),jsx:e("./generators/jsx")},d(l.generators,function(e){c(l.prototype,e)}),l.prototype.generate=function(){var e=this.ast;this.print(e);var n=[];return d(e.comments,function(e){e._displayed||n.push(e)}),this._printComments(n),{map:this.map.get(),code:this.buffer.get()}},l.prototype.buildPrint=function(e){var n=this,l=function(l,t){return n.print(l,e,t)};return l.sequence=function(e,t){return t||(t={}),t.statement=!0,n.printJoin(l,e,t)},l.join=function(e,t){return n.printJoin(l,e,t)},l.list=function(e,n){n||(n={});var t=n;t.separator||(t.separator=", "),l.join(e,n)},l.block=function(e){return n.printBlock(l,e)},l.indentOnComments=function(e){return n.printAndIndentOnComments(l,e)},l},l.prototype.print=function(e,n,l){var t=this;if(!e)return"";n&&n._compact&&(e._compact=!0);var r=this.format.concise;e._compact&&(this.format.concise=!0),l||(l={});var a=function(r){if(l.statement||p.isUserWhitespacable(e,n)){var a=0;if(null==e.start||e._ignoreUserWhitespace){r||a++,l.addNewlines&&(a+=l.addNewlines(r,e)||0);var o=p.needsWhitespaceAfter;r&&(o=p.needsWhitespaceBefore),o(e,n)&&a++,t.buffer.buf||(a=0)}else a=r?t.whitespace.getNewlinesBefore(e):t.whitespace.getNewlinesAfter(e);t.newline(a)}};if(!this[e.type])throw new ReferenceError("unknown node of type "+JSON.stringify(e.type)+" with constructor "+JSON.stringify(e&&e.constructor.name));var o=p.needsParensNoLineTerminator(e,n),u=o||p.needsParens(e,n);u&&this.push("("),o&&this.indent(),this.printLeadingComments(e,n),a(!0),l.before&&l.before(),this.map.mark(e,"start"),this[e.type](e,this.buildPrint(e),n),o&&(this.newline(),this.dedent()),u&&this.push(")"),this.map.mark(e,"end"),l.after&&l.after(),a(!1),this.printTrailingComments(e,n),this.format.concise=r},l.prototype.printJoin=function(e,n,l){var t=this;if(n&&n.length){l||(l={});var r=n.length;l.indent&&this.indent(),d(n,function(n,a){e(n,{statement:l.statement,addNewlines:l.addNewlines,after:function(){l.iterator&&l.iterator(n,a),l.separator&&r-1>a&&t.push(l.separator)}})}),l.indent&&this.dedent()}},l.prototype.printAndIndentOnComments=function(e,n){var l=!!n.leadingComments;l&&this.indent(),e(n),l&&this.dedent()},l.prototype.printBlock=function(e,n){f.isEmptyStatement(n)?this.semicolon():(this.push(" "),e(n))},l.prototype.generateComment=function(e){var n=e.value;return n="Line"===e.type?"//"+n:"/*"+n+"*/"},l.prototype.printTrailingComments=function(e,n){this._printComments(this.getComments("trailingComments",e,n))},l.prototype.printLeadingComments=function(e,n){this._printComments(this.getComments("leadingComments",e,n))},l.prototype.getComments=function(e,n,l){var t=this;if(f.isExpressionStatement(l))return[];var r=[],a=[n];return f.isExpressionStatement(n)&&a.push(n.argument),d(a,function(n){r=r.concat(t._getComments(e,n))}),r},l.prototype._getComments=function(e,n){return n&&n[e]||[]},l.prototype._printComments=function(e){var n=this;this.format.compact||this.format.comments&&e&&e.length&&d(e,function(e){var l=!1;if(d(n.ast.comments,function(n){return n.start===e.start?(n._displayed&&(l=!0),n._displayed=!0,!1):void 0}),!l){n.newline(n.whitespace.getNewlinesBefore(e));var t=n.position.column,r=n.generateComment(e);if(t&&!n.isLast(["\n"," ","[","{"])&&(n._push(" "),t++),"Block"===e.type&&n.format.indent.adjustMultilineComment){var o=e.loc.start.column;if(o){var u=new RegExp("\\n\\s{1,"+o+"}","g");r=r.replace(u,"\n")}var s=Math.max(n.indentSize(),t);r=r.replace(/\n/g,"\n"+a(" ",s))}0===t&&(r=n.getIndent()+r),n._push(r),n.newline(n.whitespace.getNewlinesAfter(e))}})}},{"../messages":27,"../types":120,"./buffer":2,"./generators/base":3,"./generators/classes":4,"./generators/comprehensions":5,"./generators/expressions":6,"./generators/flow":7,"./generators/jsx":8,"./generators/methods":9,"./generators/modules":10,"./generators/playground":11,"./generators/statements":12,"./generators/template-literals":13,"./generators/types":14,"./node":16,"./position":19,"./source-map":20,"./whitespace":21,"detect-indent":177,"lodash/collection/each":198,"lodash/object/extend":295,repeating:321}],16:[function(e,n){"use strict";function l(e,n){this.parent=n,this.node=e}n.exports=l;var t=e("./whitespace"),r=e("./parentheses"),a=e("lodash/collection/each"),o=e("lodash/collection/some"),u=e("../../types"),s=function(e,n,l){if(e){for(var t,r=Object.keys(e),a=0;a<r.length;a++){var o=r[a];if(u.is(o,n)){var s=e[o];if(t=s(n,l),null!=t)break}}return t}};l.isUserWhitespacable=function(e){return u.isUserWhitespacable(e)},l.needsWhitespace=function(e,n,r){if(!e)return 0;u.isExpressionStatement(e)&&(e=e.expression);var a=s(t.nodes,e,n);if(!a){var o=s(t.list,e,n);if(o)for(var i=0;i<o.length&&!(a=l.needsWhitespace(o[i],e,r));i++);}return a&&a[r]||0},l.needsWhitespaceBefore=function(e,n){return l.needsWhitespace(e,n,"before")},l.needsWhitespaceAfter=function(e,n){return l.needsWhitespace(e,n,"after")},l.needsParens=function(e,n){if(!n)return!1;if(u.isNewExpression(n)&&n.callee===e){if(u.isCallExpression(e))return!0;var l=o(e,function(e){return u.isCallExpression(e)});if(l)return!0}return s(r,e,n)},l.needsParensNoLineTerminator=function(e,n){return n&&e.leadingComments&&e.leadingComments.length?u.isYieldExpression(n)||u.isAwaitExpression(n)?!0:u.isContinueStatement(n)||u.isBreakStatement(n)||u.isReturnStatement(n)||u.isThrowStatement(n)?!0:!1:!1},a(l,function(e,n){l.prototype[n]=function(){var e=new Array(arguments.length+2);e[0]=this.node,e[1]=this.parent;for(var t=0;t<e.length;t++)e[t+2]=arguments[t];return l[n].apply(null,e)}})},{"../../types":120,"./parentheses":17,"./whitespace":18,"lodash/collection/each":198,"lodash/collection/some":204}],17:[function(e,n,l){"use strict";var t=e("../../types"),r=e("lodash/collection/each"),a={};r([["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"],["**"]],function(e,n){r(e,function(e){a[e]=n})}),l.UpdateExpression=function(e,n){return t.isMemberExpression(n)&&n.object===e?!0:void 0},l.ObjectExpression=function(e,n){return t.isExpressionStatement(n)?!0:t.isMemberExpression(n)&&n.object===e?!0:!1},l.Binary=function(e,n){if((t.isCallExpression(n)||t.isNewExpression(n))&&n.callee===e)return!0;if(t.isUnaryLike(n))return!0;if(t.isMemberExpression(n)&&n.object===e)return!0;if(t.isBinary(n)){var l=n.operator,r=a[l],o=e.operator,u=a[o];if(r>u)return!0;if(r===u&&n.right===e)return!0}},l.BinaryExpression=function(e,n){if("in"===e.operator){if(t.isVariableDeclarator(n))return!0;if(t.isFor(n))return!0}},l.SequenceExpression=function(e,n){return t.isForStatement(n)?!1:t.isExpressionStatement(n)&&n.expression===e?!1:!0},l.YieldExpression=function(e,n){return t.isBinary(n)||t.isUnaryLike(n)||t.isCallExpression(n)||t.isMemberExpression(n)||t.isNewExpression(n)||t.isConditionalExpression(n)||t.isYieldExpression(n)},l.ClassExpression=function(e,n){return t.isExpressionStatement(n)},l.UnaryLike=function(e,n){return t.isMemberExpression(n)&&n.object===e},l.FunctionExpression=function(e,n){return t.isExpressionStatement(n)?!0:t.isMemberExpression(n)&&n.object===e?!0:t.isCallExpression(n)&&n.callee===e?!0:void 0},l.AssignmentExpression=l.ConditionalExpression=function(e,n){return t.isUnaryLike(n)?!0:t.isBinary(n)?!0:(t.isCallExpression(n)||t.isNewExpression(n))&&n.callee===e?!0:t.isConditionalExpression(n)&&n.test===e?!0:t.isMemberExpression(n)&&n.object===e?!0:!1}},{"../../types":120,"lodash/collection/each":198}],18:[function(e,n,l){"use strict";var t=e("lodash/lang/isBoolean"),r=e("lodash/collection/each"),a=e("lodash/collection/map"),o=e("../../types"),u=function(e){var n=function(){return e.apply(this,arguments)};return n.toString=function(){return e.toString()},n}(function(e,n){if(n||(n={}),o.isMemberExpression(e))u(e.object,n),e.computed&&u(e.property,n);else if(o.isBinary(e)||o.isAssignmentExpression(e))u(e.left,n),u(e.right,n);else if(o.isCallExpression(e))n.hasCall=!0,u(e.callee,n);else if(o.isFunction(e))n.hasFunction=!0;else if(o.isIdentifier(e)){var l=n;l.hasHelper||(l.hasHelper=s(e.callee))}return n}),s=function(e){var n=function(){return e.apply(this,arguments)};return n.toString=function(){return e.toString()},n}(function(e){return o.isMemberExpression(e)?s(e.object)||s(e.property):o.isIdentifier(e)?"require"===e.name||"_"===e.name[0]:o.isCallExpression(e)?s(e.callee):o.isBinary(e)||o.isAssignmentExpression(e)?o.isIdentifier(e.left)&&s(e.left)||s(e.right):!1}),i=function(e){return o.isLiteral(e)||o.isObjectExpression(e)||o.isArrayExpression(e)||o.isIdentifier(e)||o.isMemberExpression(e)};l.nodes={AssignmentExpression:function(e){var n=u(e.right);return n.hasCall&&n.hasHelper||n.hasFunction?{before:n.hasFunction,after:!0}:void 0},SwitchCase:function(e,n){return{before:e.consequent.length||n.cases[0]===e}},LogicalExpression:function(e){return o.isFunction(e.left)||o.isFunction(e.right)?{after:!0}:void 0},Literal:function(e){return"use strict"===e.value?{after:!0}:void 0},CallExpression:function(e){return o.isFunction(e.callee)||s(e)?{before:!0,after:!0}:void 0},VariableDeclaration:function(e){for(var n=0;n<e.declarations.length;n++){var l=e.declarations[n],t=s(l.id)&&!i(l.init);if(!t){var r=u(l.init);t=s(l.init)&&r.hasCall||r.hasFunction}if(t)return{before:!0,after:!0}}},IfStatement:function(e){return o.isBlockStatement(e.consequent)?{before:!0,after:!0}:void 0}},l.nodes.Property=l.nodes.SpreadProperty=function(e,n){return n.properties[0]===e?{before:!0}:void 0},l.list={VariableDeclaration:function(e){return a(e.declarations,"init")},ArrayExpression:function(e){return e.elements},ObjectExpression:function(e){return e.properties}},r({Function:!0,Class:!0,Loop:!0,LabeledStatement:!0,SwitchStatement:!0,TryStatement:!0},function(e,n){t(e)&&(e={after:e,before:e}),r([n].concat(o.FLIPPED_ALIAS_KEYS[n]||[]),function(n){l.nodes[n]=function(){return e}})})},{"../../types":120,"lodash/collection/each":198,"lodash/collection/map":202,"lodash/lang/isBoolean":284}],19:[function(e,n){"use strict";function l(){this.line=1,this.column=0}n.exports=l,l.prototype.push=function(e){for(var n=0;n<e.length;n++)"\n"===e[n]?(this.line++,this.column=0):this.column++},l.prototype.unshift=function(e){for(var n=0;n<e.length;n++)"\n"===e[n]?this.line--:this.column--}},{}],20:[function(e,n){"use strict";function l(e,n,l){this.position=e,this.opts=n,n.sourceMap?(this.map=new t.SourceMapGenerator({file:n.sourceMapName,sourceRoot:n.sourceRoot}),this.map.setSourceContent(n.sourceFileName,l)):this.map=null}n.exports=l;var t=e("source-map"),r=e("../types");l.prototype.get=function(){var e=this.map;return e?e.toJSON():e},l.prototype.mark=function(e,n){var l=e.loc;if(l){var t=this.map;if(t&&!r.isProgram(e)&&!r.isFile(e)){var a=this.position,o={line:a.line,column:a.column},u=l[n];t.addMapping({source:this.opts.sourceFileName,generated:o,original:u})}}}},{"../types":120,"source-map":326}],21:[function(e,n){"use strict";function l(e,n,l){return e+=n,e>=l&&(e-=l),e}function t(e,n){this.tokens=r(e.concat(n),"start"),this.used={},this._lastFoundIndex=0}n.exports=t;var r=e("lodash/collection/sortBy");t.prototype.getNewlinesBefore=function(e){for(var n,t,r,a=this.tokens,o=0;o<a.length;o++){var u=l(o,this._lastFoundIndex,this.tokens.length);if(r=a[u],e.start===r.start){n=a[u-1],t=r,this._lastFoundIndex=u;break}}return this.getNewlinesBetween(n,t)},t.prototype.getNewlinesAfter=function(e){for(var n,t,r,a=this.tokens,o=0;o<a.length;o++){var u=l(o,this._lastFoundIndex,this.tokens.length);if(r=a[u],e.end===r.end){n=r,t=a[u+1],this._lastFoundIndex=u;break}}if(t&&"eof"===t.type.type)return 1;var s=this.getNewlinesBetween(n,t);return"Line"!==e.type||s?s:1},t.prototype.getNewlinesBetween=function(e,n){if(!n||!n.loc)return 0;for(var l=e?e.loc.end.line:1,t=n.loc.start.line,r=0,a=l;t>a;a++)"undefined"==typeof this.used[a]&&(this.used[a]=!0,r++);return r}},{"lodash/collection/sortBy":205}],22:[function(e,n){"use strict";var l=e("line-numbers"),t=e("repeating"),r=e("js-tokens"),a=e("esutils"),o=e("chalk"),u=e("lodash/function/ary"),s={string:o.red,punctuation:o.white.bold,operator:o.white.bold,curly:o.green,parens:o.blue.bold,square:o.yellow,name:o.white,keyword:o.cyan,number:o.magenta,regex:o.magenta,comment:o.grey,invalid:o.inverse},i=/\r\n|[\n\r\u2028\u2029]/,c=function(e){var n=function(e){var n=r.matchToToken(e);if("name"===n.type&&a.keyword.isKeywordES6(n.value))return"keyword";if("punctuation"===n.type)switch(n.value){case"{":case"}":return"curly";case"(":case")":return"parens";case"[":case"]":return"square"}return n.type};return e.replace(r,function(e){var l=n(arguments);if(l in s){var t=u(s[l],1);return e.split(i).map(t).join("\n")}return e})};n.exports=function(e,n,r){r=Math.max(r,0),o.supportsColor&&(e=c(e)),e=e.split(i);var a=Math.max(n-3,0),u=Math.min(e.length,n+3);return n||r||(a=0,u=e.length),"\n"+l(e.slice(a,u),{start:a+1,before:" ",after:" | ",transform:function(e){e.number===n&&(r&&(e.line+="\n"+e.before+t(" ",e.width)+e.after+t(" ",r-1)+"^"),e.before=e.before.replace(/^./,">"))}}).join("\n")}},{chalk:165,esutils:182,"js-tokens":188,"line-numbers":190,"lodash/function/ary":207,repeating:321}],23:[function(e,n){"use strict";var l=e("../types");n.exports=function(e,n,t){if(e&&"Program"===e.type)return l.file(e,n||[],t||[]);throw new Error("Not a valid ast?")}},{"../types":120}],24:[function(e,n){"use strict";n.exports=function(){return Object.create(null)}},{}],25:[function(e,n){"use strict";var l=e("./normalize-ast"),t=e("estraverse"),r=e("./code-frame"),a=e("acorn-babel");n.exports=function(e,n,o){try{var u=[],s=[],i=a.parse(n,{allowImportExportEverywhere:e.allowImportExportEverywhere,allowReturnOutsideFunction:!e._anal,ecmaVersion:e.experimental?7:6,playground:e.playground,strictMode:e.strictMode,onComment:u,locations:!0,onToken:s,ranges:!0});return t.attachComments(i,u,s),i=l(i,u,s),o?o(i):i}catch(c){if(!c._babel){c._babel=!0;var d=e.filename+": "+c.message,p=c.loc;if(p){var f=r(n,p.line,p.column+1);d+=f}c.stack&&(c.stack=c.stack.replace(c.message,d)),c.message=d}throw c}}},{"./code-frame":22,"./normalize-ast":23,"acorn-babel":123,estraverse:178}],26:[function(e,n,l){"use strict";n.exports=function t(e){function n(){}return n.prototype=e,n}},{}],27:[function(e,n,l){"use strict";var t=e("util");l.messages={tailCallReassignmentDeopt:"Function reference has been reassigned so it's probably be dereferenced so we can't optimise this with confidence",JSXNamespacedTags:"Namespace tags are not supported. ReactJSX is not XML.",classesIllegalBareSuper:"Illegal use of bare super",classesIllegalSuperCall:"Direct super call is illegal in non-constructor, use super.$1() instead",classesIllegalConstructorKind:"Illegal kind for constructor method",scopeDuplicateDeclaration:"Duplicate declaration $1",undeclaredVariable:"Reference to undeclared variable $1",undeclaredVariableSuggestion:"Reference to undeclared variable $1 - did you mean $2?",settersInvalidParamLength:"Setters must have exactly one parameter",noAssignmentsInForHead:"No assignments allowed in for-in/of head",expectedMemberExpressionOrIdentifier:"Expected type MemeberExpression or Identifier",invalidParentForThisNode:"We don't know how to handle this node within the current parent - please open an issue",readOnly:"$1 is read-only",modulesIllegalExportName:"Illegal export $1",unknownForHead:"Unknown node type $1 in ForStatement",didYouMean:"Did you mean $1?",evalInStrictMode:"eval is not allowed in strict mode",codeGeneratorDeopt:"Note: The code generator has deoptimised the styling of $1 as it exceeds the max of $2."},l.get=function(e){var n=l.messages[e];
if(!n)throw new ReferenceError("Unknown message `"+e+"`");for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);return t=l.parseArgs(t),n.replace(/\$(\d+)/g,function(e,n){return t[--n]})},l.parseArgs=function(e){return e.map(function(e){if(null!=e&&e.inspect)return e.inspect();try{return JSON.stringify(e)||e+""}catch(n){return t.inspect(e)}})}},{util:164}],28:[function(e){"use strict";var n=e("lodash/object/extend"),l=e("./types"),t=e("estraverse");n(t.VisitorKeys,l.VISITOR_KEYS);var r=e("ast-types"),a=r.Type.def,o=r.Type.or;a("File").bases("Node").build("program").field("program",a("Program")),a("AssignmentPattern").bases("Pattern").build("left","right").field("left",a("Pattern")).field("right",a("Expression")),a("ImportBatchSpecifier").bases("Specifier").build("name").field("name",a("Identifier")),a("RestElement").bases("Pattern").build("argument").field("argument",a("expression")),a("VirtualPropertyExpression").bases("Expression").build("object","property").field("object",a("Expression")).field("property",o(a("Identifier"),a("Expression"))),a("PrivateDeclaration").bases("Declaration").build("declarations").field("declarations",[a("Identifier")]),a("BindMemberExpression").bases("Expression").build("object","property","arguments").field("object",a("Expression")).field("property",o(a("Identifier"),a("Expression"))).field("arguments",[a("Expression")]),a("BindFunctionExpression").bases("Expression").build("callee","arguments").field("callee",a("Expression")).field("arguments",[a("Expression")]),r.finalize()},{"./types":120,"ast-types":137,estraverse:178,"lodash/object/extend":295}],29:[function(e,n){"use strict";function l(e){this.dynamicImportedNoDefault=[],this.dynamicImportIds={},this.dynamicImported=[],this.dynamicImports=[],this.usedHelpers={},this.dynamicData={},this.data={},this.lastStatements=[],this.opts=this.normalizeOptions(e),this.ast={},this.buildTransformers()}n.exports=l;var t=e("source-map-to-comment"),r=e("shebang-regex"),a=e("lodash/lang/isFunction"),o=e("./index"),u=e("../generation"),s=e("lodash/object/defaults"),i=e("lodash/collection/includes"),c=e("lodash/object/assign"),d=e("../helpers/parse"),p=e("../traversal/scope"),f=e("slash"),g=e("../util"),h=e("path"),m=e("lodash/collection/each"),y=e("../types");l.helpers=["inherits","defaults","prototype-properties","apply-constructor","tagged-template-literal","tagged-template-literal-loose","interop-require","to-array","to-consumable-array","sliced-to-array","object-without-properties","has-own","slice","bind","define-property","async-to-generator","interop-require-wildcard","typeof","extends","get","set","class-call-check","object-destructuring-empty","temporal-undefined","temporal-assert-defined","self-global"],l.validOptions=["filename","filenameRelative","blacklist","whitelist","loose","optional","modules","sourceMap","sourceMapName","sourceFileName","sourceRoot","moduleRoot","moduleIds","comments","reactCompat","keepModuleIdExtensions","code","ast","playground","experimental","externalHelpers","auxiliaryComment","compact","returnUsedHelpers","resolveModuleSource","moduleId","format","ignore","only","extensions","accept"],l.prototype.normalizeOptions=function(e){e=c({},e);for(var n in e)if("_"!==n[0]&&l.validOptions.indexOf(n)<0)throw new ReferenceError("Unknown option: "+n);s(e,{keepModuleIdExtensions:!1,resolveModuleSource:null,returnUsedHelpers:!1,externalHelpers:!1,auxilaryComment:"",experimental:!1,reactCompat:!1,playground:!1,moduleIds:!1,blacklist:[],whitelist:[],sourceMap:!1,optional:[],comments:!0,filename:"unknown",modules:"common",compact:"auto",loose:[],code:!0,ast:!0}),e.filename=f(e.filename),e.sourceRoot&&(e.sourceRoot=f(e.sourceRoot)),e.moduleId&&(e.moduleIds=!0),e.basename=h.basename(e.filename,h.extname(e.filename)),e.blacklist=g.arrayify(e.blacklist),e.whitelist=g.arrayify(e.whitelist),e.optional=g.arrayify(e.optional),e.compact=g.booleanify(e.compact),e.loose=g.arrayify(e.loose),(i(e.loose,"all")||i(e.loose,!0))&&(e.loose=Object.keys(o.transformers)),s(e,{moduleRoot:e.sourceRoot}),s(e,{sourceRoot:e.moduleRoot}),s(e,{filenameRelative:e.filename}),s(e,{sourceFileName:e.filenameRelative,sourceMapName:e.filenameRelative}),e.playground&&(e.experimental=!0),e.externalHelpers&&this.set("helpersNamespace",y.identifier("babelHelpers")),e.blacklist=o._ensureTransformerNames("blacklist",e.blacklist),e.whitelist=o._ensureTransformerNames("whitelist",e.whitelist),e.optional=o._ensureTransformerNames("optional",e.optional),e.loose=o._ensureTransformerNames("loose",e.loose),e.reactCompat&&(e.optional.push("reactCompat"),console.error("The reactCompat option has been moved into the optional transformer `reactCompat`"));var t=function(n){var l=o.transformerNamespaces[n];"es7"===l&&(e.experimental=!0),"playground"===l&&(e.playground=!0)};return m(e.whitelist,t),m(e.optional,t),e},l.prototype.isLoose=function(e){return i(this.opts.loose,e)},l.prototype.buildTransformers=function(){var e=this,n={},l=[],t=[];m(o.transformers,function(r,a){var o=n[a]=r.buildPass(e);o.canRun(e)&&(t.push(o),r.secondPass&&l.push(o),r.manipulateOptions&&r.manipulateOptions(e.opts,e))}),this.transformerStack=t.concat(l),this.transformers=n},l.prototype.debug=function(e){var n=this.opts.filename;e&&(n+=": "+e),g.debug(n)},l.prototype.getModuleFormatter=function(n){var l=a(n)?n:o.moduleFormatters[n];if(!l){var t=g.resolve(n);t&&(l=e(t))}if(!l)throw new ReferenceError("Unknown module formatter type "+JSON.stringify(n));return new l(this)},l.prototype.parseShebang=function(e){var n=r.exec(e);return n&&(this.shebang=n[0],e=e.replace(r,"")),e},l.prototype.set=function(e,n){return this.data[e]=n},l.prototype.setDynamic=function(e,n){this.dynamicData[e]=n},l.prototype.get=function(e){var n=this.data[e];if(n)return n;var l=this.dynamicData[e];return l?this.set(e,l()):void 0},l.prototype.addImport=function(e,n,l){n||(n=e);var t=this.dynamicImportIds[n];if(!t){t=this.dynamicImportIds[n]=this.scope.generateUidIdentifier(n);var r=[y.importSpecifier(y.identifier("default"),t)],a=y.importDeclaration(r,y.literal(e));a._blockHoist=3,this.dynamicImported.push(a),l&&this.dynamicImportedNoDefault.push(a),this.moduleFormatter.importSpecifier(r[0],a,this.dynamicImports)}return t},l.prototype.isConsequenceExpressionStatement=function(e){return y.isExpressionStatement(e)&&this.lastStatements.indexOf(e)>=0},l.prototype.attachAuxiliaryComment=function(e){var n=this.opts.auxiliaryComment;if(n){var l=e;l.leadingComments||(l.leadingComments=[]),e.leadingComments.push({type:"Line",value:" "+n})}return e},l.prototype.addHelper=function(e){if(!i(l.helpers,e))throw new ReferenceError("Unknown helper "+e);var n=this.ast.program,t=n._declarations&&n._declarations[e];if(t)return t.id;this.usedHelpers[e]=!0;var r=this.get("helpersNamespace");if(r)return e=y.identifier(y.toIdentifier(e)),y.memberExpression(r,e);var a=g.template(e);a._compact=!0;var o=this.scope.generateUidIdentifier(e);return this.scope.push({key:e,id:o,init:a}),o},l.prototype.logDeopt=function(){},l.prototype.errorWithNode=function(e,n,l){l||(l=SyntaxError);var t=e.loc.start,r=new l("Line "+t.line+": "+n);return r.loc=t,r},l.prototype.addCode=function(e){return e=(e||"")+"",this.code=e,this.parseShebang(e)},l.prototype.parse=function(e){var n=this;e=this.addCode(e);var l=this.opts;return l.allowImportExportEverywhere=this.isLoose("es6.modules"),l.strictMode=this.transformers.useStrict.canRun(),d(l,e,function(e){return n.transform(e),n.generate()})},l.prototype.transform=function(e){this.debug(),this.ast=e,this.lastStatements=y.getLastStatements(e.program),this.scope=new p(e.program,e,null,this);var n=this.moduleFormatter=this.getModuleFormatter(this.opts.modules);n.init&&this.transformers["es6.modules"].canRun()&&n.init(),this.checkNode(e),this.call("pre"),m(this.transformerStack,function(e){e.transform()}),this.call("post")},l.prototype.call=function(e){for(var n=this.transformerStack,l=0;l<n.length;l++){var t=n[l].transformer;t[e]&&t[e](this)}};var x={enter:function(e,n,l,t){b(t.stack,e,l)}},b=function(e,n,l){m(e,function(e){e.shouldRun||e.checkNode(n,l)})};l.prototype.checkNode=function(e,n){var l=this.transformerStack;n||(n=this.scope),b(l,e,n),n.traverse(e,x,{stack:l})},l.prototype.generate=function(){var e=this.opts,n=this.ast,l={code:"",map:null,ast:null};if(this.opts.returnUsedHelpers&&(l.usedHelpers=Object.keys(this.usedHelpers)),e.ast&&(l.ast=n),!e.code)return l;var r=u(n,e,this.code);return l.code=r.code,l.map=r.map,this.shebang&&(l.code=this.shebang+"\n"+l.code),"inline"===e.sourceMap&&(l.code+="\n"+t(l.map),l.map=null),l}},{"../generation":15,"../helpers/parse":25,"../traversal/scope":117,"../types":120,"../util":122,"./index":42,"lodash/collection/each":198,"lodash/collection/includes":201,"lodash/lang/isFunction":286,"lodash/object/assign":293,"lodash/object/defaults":294,path:147,"shebang-regex":323,slash:324,"source-map-to-comment":325}],30:[function(e,n){"use strict";var l=e("./explode-assignable-expression"),t=e("../../types");n.exports=function(e,n){var r=function(e){return e.operator===n.operator+"="},a=function(e,n){return t.assignmentExpression("=",e,n)};e.ExpressionStatement=function(e,o,u,s){if(!s.isConsequenceExpressionStatement(e)){var i=e.expression;if(r(i)){var c=[],d=l(i.left,c,s,u,!0);return c.push(t.expressionStatement(a(d.ref,n.build(d.uid,i.right)))),c}}},e.AssignmentExpression=function(e,o,u,s){if(r(e)){var i=[],c=l(e.left,i,s,u);return i.push(a(c.ref,n.build(c.uid,e.right))),t.toSequenceExpression(i,u)}},e.BinaryExpression=function(e){return e.operator===n.operator?n.build(e.left,e.right):void 0}}},{"../../types":120,"./explode-assignable-expression":35}],31:[function(e,n){"use strict";var l=e("../../types");n.exports=function t(e,n){var r=e.blocks.shift();if(r){var a=t(e,n);return a||(a=n(),e.filter&&(a=l.ifStatement(e.filter,l.blockStatement([a])))),l.forOfStatement(l.variableDeclaration("let",[l.variableDeclarator(r.left)]),r.right,l.blockStatement([a]))}}},{"../../types":120}],32:[function(e,n){"use strict";var l=e("./explode-assignable-expression"),t=e("../../types");n.exports=function(e,n){var r=function(e,n){return t.assignmentExpression("=",e,n)};e.ExpressionStatement=function(e,a,o,u){if(!u.isConsequenceExpressionStatement(e)){var s=e.expression;if(n.is(s,u)){var i=[],c=l(s.left,i,u,o);return i.push(t.ifStatement(n.build(c.uid,u),t.expressionStatement(r(c.ref,s.right)))),i}}},e.AssignmentExpression=function(e,a,o,u){if(n.is(e,u)){var s=[],i=l(e.left,s,u,o);return s.push(t.logicalExpression("&&",n.build(i.uid,u),r(i.ref,e.right))),s.push(i.ref),t.toSequenceExpression(s,o)}}}},{"../../types":120,"./explode-assignable-expression":35}],33:[function(e,n){"use strict";var l=e("lodash/lang/isString"),t=e("../../messages"),r=e("esutils"),a=e("./react"),o=e("../../types");n.exports=function(e,n){e.check=function(e){return o.isJSX(e)?!0:a.isCreateClass(e)?!0:!1},e.JSXIdentifier=function(e,n){return"this"===e.name&&o.isReferenced(e,n)?o.thisExpression():r.keyword.isIdentifierName(e.name)?void(e.type="Identifier"):o.literal(e.name)},e.JSXNamespacedName=function(e,n,l,r){throw r.errorWithNode(e,t.get("JSXNamespacedTags"))},e.JSXMemberExpression={exit:function(e){e.computed=o.isLiteral(e.property),e.type="MemberExpression"}},e.JSXExpressionContainer=function(e){return e.expression},e.JSXAttribute={enter:function(e){var n=e.value;o.isLiteral(n)&&l(n.value)&&(n.value=n.value.replace(/\n\s+/g," "))},exit:function(e){var n=e.value||o.literal(!0);return o.inherits(o.property("init",e.name,n),e)}},e.JSXOpeningElement={exit:function(e,l,t,r){var a,s=e.name,i=[];o.isIdentifier(s)?a=s.name:o.isLiteral(s)&&(a=s.value);var c={tagExpr:s,tagName:a,args:i};n.pre&&n.pre(c,r);var d=e.attributes;return d=d.length?u(d,r):o.literal(null),i.push(d),n.post&&n.post(c,r),c.call||o.callExpression(c.callee,i)}};var u=function(e,n){for(var l=[],t=[],r=function(){l.length&&(t.push(o.objectExpression(l)),l=[])};e.length;){var a=e.shift();o.isJSXSpreadAttribute(a)?(r(),t.push(a.argument)):l.push(a)}return r(),1===t.length?e=t[0]:(o.isObjectExpression(t[0])||t.unshift(o.objectExpression([])),e=o.callExpression(n.addHelper("extends"),t)),e};e.JSXElement={exit:function(e){for(var n=e.openingElement,l=0;l<e.children.length;l++){var t=e.children[l];o.isLiteral(t)&&"string"==typeof t.value?c(t,n.arguments):o.isJSXEmptyExpression(t)||n.arguments.push(t)}return n.arguments=i(n.arguments),n.arguments.length>=3&&(n._prettyCall=!0),o.inherits(n,e)}};var s=function(e){return o.isLiteral(e)&&l(e.value)},i=function(e){for(var n,l=[],t=0;t<e.length;t++){var r=e[t];s(r)&&s(n)?n.value+=r.value:(n=r,l.push(r))}return l},c=function(e,n){var l,t=e.value.split(/\r\n|\n|\r/),r=0;for(l=0;l<t.length;l++)t[l].match(/[^ \t]/)&&(r=l);for(l=0;l<t.length;l++){var a=t[l],u=0===l,s=l===t.length-1,i=l===r,c=a.replace(/\t/g," ");u||(c=c.replace(/^[ ]+/,"")),s||(c=c.replace(/[ ]+$/,"")),c&&(i||(c+=" "),n.push(o.literal(c)))}},d=function(e,n){for(var l=n.arguments[0].properties,t=!0,r=0;r<l.length;r++){var a=l[r];if(o.isIdentifier(a.key,{name:"displayName"})){t=!1;break}}t&&l.unshift(o.property("init",o.identifier("displayName"),o.literal(e)))};e.ExportDeclaration=function(e,n,l,t){e["default"]&&a.isCreateClass(e.declaration)&&d(t.opts.basename,e.declaration)},e.AssignmentExpression=e.Property=e.VariableDeclarator=function(e){var n,l;o.isAssignmentExpression(e)?(n=e.left,l=e.right):o.isProperty(e)?(n=e.key,l=e.value):o.isVariableDeclarator(e)&&(n=e.id,l=e.init),o.isMemberExpression(n)&&(n=n.property),o.isIdentifier(n)&&a.isCreateClass(l)&&d(n.name,l)}}},{"../../messages":27,"../../types":120,"./react":38,esutils:182,"lodash/lang/isString":291}],34:[function(e,n,l){"use strict";var t=e("lodash/lang/cloneDeep"),r=e("../../traversal"),a=e("lodash/lang/clone"),o=e("lodash/collection/each"),u=e("lodash/object/has"),s=e("../../types");l.push=function(e,n,l,a,o){var i;s.isIdentifier(n)?(i=n.name,a&&(i="computed:"+i)):i=s.isLiteral(n)?String(n.value):JSON.stringify(r.removeProperties(t(n)));var c;c=u(e,i)?e[i]:{},e[i]=c,c._key=n,a&&(c._computed=!0),c[l]=o},l.build=function(e){var n=s.objectExpression([]);return o(e,function(e){var l=s.objectExpression([]),t=s.property("init",e._key,l,e._computed);e.get||e.set||(e.writable=s.literal(!0)),e.enumerable===!1?delete e.enumerable:e.enumerable=s.literal(!0),e.configurable=s.literal(!0),o(e,function(e,n){if("_"!==n[0]){e=a(e);var t=e;s.isMethodDefinition(e)&&(e=e.value);var r=s.property("init",s.identifier(n),e);s.inheritsComments(r,t),s.removeComments(t),l.properties.push(r)}}),n.properties.push(t)}),n}},{"../../traversal":115,"../../types":120,"lodash/collection/each":198,"lodash/lang/clone":280,"lodash/lang/cloneDeep":281,"lodash/object/has":296}],35:[function(e,n){"use strict";var l=e("../../types"),t=function(e,n,t,r){var a;if(l.isIdentifier(e)){if(r.hasBinding(e.name))return e;a=e}else{if(!l.isMemberExpression(e))throw new Error("We can't explode this node type "+e.type);if(a=e.object,l.isIdentifier(a)&&r.hasGlobal(a.name))return a}var o=r.generateUidBasedOnNode(a);return n.push(l.variableDeclaration("var",[l.variableDeclarator(o,a)])),o},r=function(e,n,t,r){var a=e.property,o=l.toComputedKey(e,a);if(l.isLiteral(o))return o;var u=r.generateUidBasedOnNode(a);return n.push(l.variableDeclaration("var",[l.variableDeclarator(u,a)])),u};n.exports=function(e,n,a,o,u){var s;s=l.isIdentifier(e)&&u?e:t(e,n,a,o);var i,c;if(l.isIdentifier(e))i=e,c=s;else{var d=r(e,n,a,o),p=e.computed||l.isLiteral(d);c=i=l.memberExpression(s,d,p)}return{uid:c,ref:i}}},{"../../types":120}],36:[function(e,n){"use strict";var l=e("../../types");n.exports=function(e){for(var n=0,t=0;t<e.params.length;t++)l.isAssignmentPattern(e.params[t])||(n=t+1);return n}},{"../../types":120}],37:[function(e,n,l){"use strict";var t=e("./get-function-arity"),r=e("../../util"),a=e("../../types"),o={enter:function(e,n,l,t){if(a.isReferencedIdentifier(e,n,{name:t.name})){var r=l.getBindingIdentifier(t.name);r===t.outerDeclar&&(t.selfReference=!0,this.stop())}}},u=function(e,n,l,a){if(e.selfReference){var o="property-method-assignment-wrapper";n.generator&&(o+="-generator");for(var u=r.template(o,{FUNCTION:n,FUNCTION_ID:l,FUNCTION_KEY:a.generateUidIdentifier(l.name),WRAPPER_KEY:a.generateUidIdentifier(l.name+"Wrapper")}),s=u.callee.body.body[0].declarations[0].init.params,i=0,c=t(n);c>i;i++)s.push(a.generateUidIdentifier("x"));return u}return n.id=l,n},s=function(e,n,l){var t={selfAssignment:!1,selfReference:!1,outerDeclar:l.getBindingIdentifier(n),references:[],name:n},r=null;return r?"param"===r.kind&&(t.selfReference=!0):l.traverse(e,o,t),t};l.property=function(e,n,l){var t=a.toComputedKey(e,e.key);if(!a.isLiteral(t))return e;var r=a.toIdentifier(t.value),o=a.identifier(r),i=e.value,c=s(i,r,l);e.value=u(c,i,o,l)},l.bare=function(e,n,l){if(!e.id){var t;if(a.isProperty(n)&&"init"===n.kind&&!n.computed)t=n.key;else{if(!a.isVariableDeclarator(n))return;t=n.id}if(a.isIdentifier(t)){var r=a.toIdentifier(t.name);t=a.identifier(r);var o=s(e,r,l);return u(o,e,t,l)}}}},{"../../types":120,"../../util":122,"./get-function-arity":36}],38:[function(e,n,l){"use strict";var t=e("../../types"),r=t.buildMatchMemberExpression("React.createClass");l.isCreateClass=function(e){if(!e||!t.isCallExpression(e))return!1;if(!r(e.callee))return!1;var n=e.arguments;if(1!==n.length)return!1;var l=n[0];return t.isObjectExpression(l)?!0:!1},l.isReactComponent=t.buildMatchMemberExpression("React.Component"),l.isCompatTag=function(e){return e&&/^[a-z]|\-/.test(e)}},{"../../types":120}],39:[function(e,n){"use strict";var l=e("../../types"),t={enter:function(e){l.isFunction(e)&&this.skip(),l.isAwaitExpression(e)&&(e.type="YieldExpression",e.all&&(e.all=!1,e.argument=l.callExpression(l.memberExpression(l.identifier("Promise"),l.identifier("all")),[e.argument])))}};n.exports=function(e,n,r){e.async=!1,e.generator=!0,r.traverse(e,t);var a=l.callExpression(n,[e]),o=e.id;if(delete e.id,l.isFunctionDeclaration(e)){var u=l.variableDeclaration("let",[l.variableDeclarator(o,a)]);return u._blockHoist=!0,u}return a}},{"../../types":120}],40:[function(e,n){"use strict";function l(e,n){this.topLevelThisReference=e.topLevelThisReference,this.methodNode=e.methodNode,this.className=e.className,this.superName=e.superName,this.isStatic=e.isStatic,this.hasSuper=!1,this.inClass=n,this.isLoose=e.isLoose,this.scope=e.scope,this.file=e.file}n.exports=l;var t=e("../../messages"),r=e("../../types");l.prototype.setSuperProperty=function(e,n,l,t){return r.callExpression(this.file.addHelper("set"),[r.callExpression(r.memberExpression(r.identifier("Object"),r.identifier("getPrototypeOf")),[this.isStatic?this.className:r.memberExpression(this.className,r.identifier("prototype"))]),l?e:r.literal(e.name),n,t])},l.prototype.getSuperProperty=function(e,n,l){return r.callExpression(this.file.addHelper("get"),[r.callExpression(r.memberExpression(r.identifier("Object"),r.identifier("getPrototypeOf")),[this.isStatic?this.className:r.memberExpression(this.className,r.identifier("prototype"))]),n?e:r.literal(e.name),l])},l.prototype.replace=function(){this.traverseLevel(this.methodNode.value,!0)};var a={enter:function(e,n,l,t){var a=t.topLevel,o=t.self;if(r.isFunction(e)&&!r.isArrowFunctionExpression(e))return o.traverseLevel(e,!1),this.skip();if(r.isProperty(e,{method:!0})||r.isMethodDefinition(e))return this.skip();var u=a?r.thisExpression:o.getThisReference.bind(o),s=o.specHandle;return o.isLoose&&(s=o.looseHandle),s.call(o,u,e,n)}};l.prototype.traverseLevel=function(e,n){var l={self:this,topLevel:n};this.scope.traverse(e,a,l)},l.prototype.getThisReference=function(){if(this.topLevelThisReference)return this.topLevelThisReference;var e=this.topLevelThisReference=this.scope.generateUidIdentifier("this");return this.methodNode.value.body.body.unshift(r.variableDeclaration("var",[r.variableDeclarator(this.topLevelThisReference,r.thisExpression())])),e},l.prototype.getLooseSuperProperty=function(e,n){var l=this.methodNode,t=l.key,a=this.superName||r.identifier("Function");return n.property===e?void 0:r.isCallExpression(n,{callee:e})?(n.arguments.unshift(r.thisExpression()),"constructor"===t.name?r.memberExpression(a,r.identifier("call")):(e=a,l["static"]||(e=r.memberExpression(e,r.identifier("prototype"))),e=r.memberExpression(e,t,l.computed),r.memberExpression(e,r.identifier("call")))):r.isMemberExpression(n)&&!l["static"]?r.memberExpression(a,r.identifier("prototype")):a},l.prototype.looseHandle=function(e,n,l){if(r.isIdentifier(n,{name:"super"}))return this.hasSuper=!0,this.getLooseSuperProperty(n,l);if(r.isCallExpression(n)){var t=n.callee;if(!r.isMemberExpression(t))return;if("super"!==t.object.name)return;this.hasSuper=!0,r.appendToMemberExpression(t,r.identifier("call")),n.arguments.unshift(e())}},l.prototype.specHandle=function(e,n,l){var a,s,i,c,d=this.methodNode;if(o(n,l))throw this.file.errorWithNode(n,t.get("classesIllegalBareSuper"));if(r.isCallExpression(n)){var p=n.callee;if(u(p,n)){if(a=d.key,s=d.computed,i=n.arguments,"constructor"!==d.key.name||!this.inClass){var f=d.key.name||"METHOD_NAME";throw this.file.errorWithNode(n,t.get("classesIllegalSuperCall",f))}}else r.isMemberExpression(p)&&u(p.object,p)&&(a=p.property,s=p.computed,i=n.arguments)}else if(r.isMemberExpression(n)&&u(n.object,n))a=n.property,s=n.computed;else if(r.isAssignmentExpression(n)&&u(n.left.object,n.left)&&"set"===d.kind)return this.hasSuper=!0,this.setSuperProperty(n.left.property,n.right,n.left.computed,e());if(a){this.hasSuper=!0,c=e();var g=this.getSuperProperty(a,s,c);return i?1===i.length&&r.isSpreadElement(i[0])?r.callExpression(r.memberExpression(g,r.identifier("apply")),[c,i[0].argument]):r.callExpression(r.memberExpression(g,r.identifier("call")),[c].concat(i)):g}};var o=function(e,n){return u(e,n)?r.isMemberExpression(n,{computed:!1})?!1:r.isCallExpression(n,{callee:e})?!1:!0:!1},u=function(e,n){return r.isIdentifier(e,{name:"super"})&&r.isReferenced(e,n)}},{"../../messages":27,"../../types":120}],41:[function(e,n,l){"use strict";var t=e("../../types");l.has=function(e){var n=e.body[0];return t.isExpressionStatement(n)&&t.isLiteral(n.expression,{value:"use strict"})},l.wrap=function(e,n){var t;l.has(e)&&(t=e.body.shift()),n(),t&&e.body.unshift(t)}},{"../../types":120}],42:[function(e,n){"use strict";function l(e,n){var l=new o(n);return l.parse(e)}n.exports=l;var t=e("../helpers/normalize-ast"),r=e("./transformer"),a=e("../helpers/object"),o=e("./file"),u=e("lodash/collection/each");l.fromAst=function(e,n,l){e=t(e);var r=new o(l);return r.addCode(n),r.transform(e),r.generate()},l._ensureTransformerNames=function(e,n){for(var t=[],r=0;r<n.length;r++){var a=n[r],o=l.deprecatedTransformerMap[a];if(o)console.error("The transformer "+a+" has been renamed to "+o),n.push(o);else if(l.transformers[a])t.push(a);else{if(!l.namespaces[a])throw new ReferenceError("Unknown transformer "+a+" specified in "+e);t=t.concat(l.namespaces[a])}}return t},l.transformerNamespaces=a(),l.transformers=a(),l.namespaces=a(),l.deprecatedTransformerMap=e("./transformers/deprecated"),l.moduleFormatters=e("./modules");var s=e("./transformers");u(s,function(e,n){var t=n.split(".")[0],a=l.namespaces,o=t;a[o]||(a[o]=[]),l.namespaces[t].push(n),l.transformerNamespaces[n]=t,l.transformers[n]=new r(n,e)})},{"../helpers/normalize-ast":23,"../helpers/object":24,"./file":29,"./modules":50,"./transformer":55,"./transformers":81,"./transformers/deprecated":56,"lodash/collection/each":198}],43:[function(e,n){"use strict";function l(e){this.scope=e.scope,this.file=e,this.ids=a(),this.hasNonDefaultExports=!1,this.hasLocalExports=!1,this.hasLocalImports=!1,this.localImportOccurences=a(),this.localExports=a(),this.localImports=a(),this.getLocalExports(),this.getLocalImports(),this.remapAssignments()}n.exports=l;var t=e("../../messages"),r=e("lodash/object/extend"),a=e("../../helpers/object"),o=e("../../util"),u=e("../../types");l.prototype.doDefaultExportInterop=function(e){return e["default"]&&!this.noInteropRequireExport&&!this.hasNonDefaultExports},l.prototype.bumpImportOccurences=function(e){var n=e.source.value,l=this.localImportOccurences,t=l,r=n;t[r]||(t[r]=0),l[n]+=e.specifiers.length};var s={enter:function(e,n,l,t){var a=e&&e.declaration;u.isExportDeclaration(e)&&(t.hasLocalImports=!0,a&&u.isStatement(a)&&r(t.localExports,u.getBindingIdentifiers(a)),e["default"]||(t.hasNonDefaultExports=!0),e.source&&t.bumpImportOccurences(e))}};l.prototype.getLocalExports=function(){this.file.scope.traverse(this.file.ast,s,this)};var i={enter:function(e,n,l,t){u.isImportDeclaration(e)&&(t.hasLocalImports=!0,r(t.localImports,u.getBindingIdentifiers(e)),t.bumpImportOccurences(e))}};l.prototype.getLocalImports=function(){this.file.scope.traverse(this.file.ast,i,this)};var c={enter:function(e,n,l,t){if(u.isUpdateExpression(e)&&t.isLocalReference(e.argument,l)){this.skip();var r=u.assignmentExpression(e.operator[0]+"=",e.argument,u.literal(1)),a=t.remapExportAssignment(r);if(u.isExpressionStatement(n)||e.prefix)return a;var o=[];o.push(a);var s;return s="--"===e.operator?"+":"-",o.push(u.binaryExpression(s,e.argument,u.literal(1))),u.sequenceExpression(o)}return u.isAssignmentExpression(e)&&t.isLocalReference(e.left,l)?(this.skip(),t.remapExportAssignment(e)):void 0}};l.prototype.remapAssignments=function(){this.hasLocalImports&&this.file.scope.traverse(this.file.ast,c,this)},l.prototype.isLocalReference=function(e){var n=this.localImports;return u.isIdentifier(e)&&n[e.name]&&n[e.name]!==e},l.prototype.remapExportAssignment=function(e){return u.assignmentExpression("=",e.left,u.assignmentExpression(e.operator,u.memberExpression(u.identifier("exports"),e.left),e.right))},l.prototype.isLocalReference=function(e,n){var l=this.localExports,t=e.name;return u.isIdentifier(e)&&l[t]&&l[t]===n.getBindingIdentifier(t)},l.prototype.getModuleName=function(){var e=this.file.opts;if(e.moduleId)return e.moduleId;var n=e.filenameRelative,l="";if(e.moduleRoot&&(l=e.moduleRoot+"/"),!e.filenameRelative)return l+e.filename.replace(/^\//,"");if(e.sourceRoot){var t=new RegExp("^"+e.sourceRoot+"/?");n=n.replace(t,"")}return e.keepModuleIdExtensions||(n=n.replace(/\.(\w*?)$/,"")),l+=n,l=l.replace(/\\/g,"/")},l.prototype._pushStatement=function(e,n){return(u.isClass(e)||u.isFunction(e))&&e.id&&(n.push(u.toStatement(e)),e=e.id),e},l.prototype._hoistExport=function(e,n,l){return u.isFunctionDeclaration(e)&&(n._blockHoist=l||2),n},l.prototype.getExternalReference=function(e,n){var l=this.ids,t=e.source.value;return l[t]?l[t]:this.ids[t]=this._getExternalReference(e,n)},l.prototype.checkExportIdentifier=function(e){if(u.isIdentifier(e,{name:"__esModule"}))throw this.file.errorWithNode(e,t.get("modulesIllegalExportName",e.name))},l.prototype.exportSpecifier=function(e,n,l){if(n.source){var t=this.getExternalReference(n,l);u.isExportBatchSpecifier(e)?l.push(this.buildExportsWildcard(t,n)):(t=u.isSpecifierDefault(e)&&!this.noInteropRequireExport?u.callExpression(this.file.addHelper("interop-require"),[t]):u.memberExpression(t,u.getSpecifierId(e)),l.push(this.buildExportsAssignment(u.getSpecifierName(e),t,n)))}else l.push(this.buildExportsAssignment(u.getSpecifierName(e),e.id,n))},l.prototype.buildExportsWildcard=function(e){return u.expressionStatement(u.callExpression(this.file.addHelper("defaults"),[u.identifier("exports"),u.callExpression(this.file.addHelper("interop-require-wildcard"),[e])]))},l.prototype.buildExportsAssignment=function(e,n){return this.checkExportIdentifier(e),o.template("exports-assign",{VALUE:n,KEY:e},!0)},l.prototype.exportDeclaration=function(e,n){var l=e.declaration,t=l.id;e["default"]&&(t=u.identifier("default"));var r;if(u.isVariableDeclaration(l))for(var a=0;a<l.declarations.length;a++){var o=l.declarations[a];o.init=this.buildExportsAssignment(o.id,o.init,e).expression;var s=u.variableDeclaration(l.kind,[o]);0===a&&u.inherits(s,l),n.push(s)}else{var i=l;(u.isFunctionDeclaration(l)||u.isClassDeclaration(l))&&(i=l.id,n.push(l)),r=this.buildExportsAssignment(t,i,e),n.push(r),this._hoistExport(l,r)}}},{"../../helpers/object":24,"../../messages":27,"../../types":120,"../../util":122,"lodash/object/extend":295}],44:[function(e,n){"use strict";var l=e("../../util");n.exports=function(e){var n=function(){this.noInteropRequireImport=!0,this.noInteropRequireExport=!0,e.apply(this,arguments)};return l.inherits(n,e),n}},{"../../util":122}],45:[function(e,n){"use strict";n.exports=e("./_strict")(e("./amd"))},{"./_strict":44,"./amd":46}],46:[function(e,n){"use strict";function l(){r.apply(this,arguments)}n.exports=l;var t=e("./_default"),r=e("./common"),a=e("lodash/collection/includes"),o=e("lodash/object/values"),u=e("../../util"),s=e("../../types");u.inherits(l,t),l.prototype.init=r.prototype.init,l.prototype.buildDependencyLiterals=function(){var e=[];for(var n in this.ids)e.push(s.literal(n));return e},l.prototype.transform=function(e){var n=e.body,l=[s.literal("exports")];this.passModuleArg&&l.push(s.literal("module")),l=l.concat(this.buildDependencyLiterals()),l=s.arrayExpression(l);var t=o(this.ids);this.passModuleArg&&t.unshift(s.identifier("module")),t.unshift(s.identifier("exports"));var r=s.functionExpression(null,t,s.blockStatement(n)),a=[l,r],u=this.getModuleName();u&&a.unshift(s.literal(u));var i=s.callExpression(s.identifier("define"),a);e.body=[s.expressionStatement(i)]},l.prototype.getModuleName=function(){return this.file.opts.moduleIds?t.prototype.getModuleName.apply(this,arguments):null},l.prototype._getExternalReference=function(e){return this.scope.generateUidIdentifier(e.source.value)},l.prototype.importDeclaration=function(e){this.getExternalReference(e)},l.prototype.importSpecifier=function(e,n,l){var t=s.getSpecifierName(e),r=this.getExternalReference(n);a(this.file.dynamicImportedNoDefault,n)?this.ids[n.source.value]=r:s.isImportBatchSpecifier(e)||(r=a(this.file.dynamicImported,n)||!s.isSpecifierDefault(e)||this.noInteropRequireImport?s.memberExpression(r,s.getSpecifierId(e),!1):s.callExpression(this.file.addHelper("interop-require"),[r])),l.push(s.variableDeclaration("var",[s.variableDeclarator(t,r)]))},l.prototype.exportDeclaration=function(e){this.doDefaultExportInterop(e)&&(this.passModuleArg=!0),r.prototype.exportDeclaration.apply(this,arguments)}},{"../../types":120,"../../util":122,"./_default":43,"./common":48,"lodash/collection/includes":201,"lodash/object/values":299}],47:[function(e,n){"use strict";n.exports=e("./_strict")(e("./common"))},{"./_strict":44,"./common":48}],48:[function(e,n){"use strict";function l(){t.apply(this,arguments)}n.exports=l;var t=e("./_default"),r=e("lodash/collection/includes"),a=e("../../util"),o=e("../../types");a.inherits(l,t),l.prototype.init=function(){var e=this.file,n=e.scope;if(n.rename("module"),!this.noInteropRequireImport&&this.hasNonDefaultExports){var l="exports-module-declaration";this.file.isLoose("es6.modules")&&(l+="-loose"),e.ast.program.body.push(a.template(l,!0))}},l.prototype.importSpecifier=function(e,n,l){var t=o.getSpecifierName(e),a=this.getExternalReference(n,l);o.isSpecifierDefault(e)?(r(this.file.dynamicImportedNoDefault,n)||(a=this.noInteropRequireImport||r(this.file.dynamicImported,n)?o.memberExpression(a,o.identifier("default")):o.callExpression(this.file.addHelper("interop-require"),[a])),l.push(o.variableDeclaration("var",[o.variableDeclarator(t,a)]))):"ImportBatchSpecifier"===e.type?(this.noInteropRequireImport||(a=o.callExpression(this.file.addHelper("interop-require-wildcard"),[a])),l.push(o.variableDeclaration("var",[o.variableDeclarator(t,a)]))):l.push(o.variableDeclaration("var",[o.variableDeclarator(t,o.memberExpression(a,o.getSpecifierId(e)))]))},l.prototype.importDeclaration=function(e,n){n.push(a.template("require",{MODULE_NAME:e.source},!0))},l.prototype.exportDeclaration=function(e,n){if(this.doDefaultExportInterop(e)){var l=e.declaration,r=a.template("exports-default-assign",{VALUE:this._pushStatement(l,n)},!0);return o.isFunctionDeclaration(l)&&(r._blockHoist=3),void n.push(r)}t.prototype.exportDeclaration.apply(this,arguments)
},l.prototype._getExternalReference=function(e,n){var l=e.source.value,t=o.callExpression(o.identifier("require"),[e.source]);if(this.localImportOccurences[l]>1){var r=this.scope.generateUidIdentifier(l);return n.push(o.variableDeclaration("var",[o.variableDeclarator(r,t)])),r}return t}},{"../../types":120,"../../util":122,"./_default":43,"lodash/collection/includes":201}],49:[function(e,n){"use strict";function l(){}n.exports=l;var t=e("../../types");l.prototype.exportDeclaration=function(e,n){var l=t.toStatement(e.declaration,!0);l&&n.push(t.inherits(l,e))},l.prototype.importDeclaration=l.prototype.importSpecifier=l.prototype.exportSpecifier=function(){}},{"../../types":120}],50:[function(e,n){"use strict";n.exports={commonStrict:e("./common-strict"),amdStrict:e("./amd-strict"),umdStrict:e("./umd-strict"),common:e("./common"),system:e("./system"),ignore:e("./ignore"),amd:e("./amd"),umd:e("./umd")}},{"./amd":46,"./amd-strict":45,"./common":48,"./common-strict":47,"./ignore":49,"./system":51,"./umd":53,"./umd-strict":52}],51:[function(e,n){"use strict";function l(e){this.exportIdentifier=e.scope.generateUidIdentifier("export"),this.noInteropRequireExport=!0,this.noInteropRequireImport=!0,t.apply(this,arguments)}n.exports=l;var t=e("./_default"),r=e("./amd"),a=e("../../util"),o=e("lodash/array/last"),u=e("lodash/collection/each"),s=e("lodash/collection/map"),i=e("../../types");a.inherits(l,r),l.prototype.init=function(){},l.prototype._addImportSource=function(e,n){return e._importSource=n.source&&n.source.value,e},l.prototype.buildExportsWildcard=function(e,n){var l=this.scope.generateUidIdentifier("key"),t=i.memberExpression(e,l,!0),r=i.variableDeclaration("var",[i.variableDeclarator(l)]),a=e,o=i.blockStatement([i.expressionStatement(this.buildExportCall(l,t))]);return this._addImportSource(i.forInStatement(r,a,o),n)},l.prototype.buildExportsAssignment=function(e,n,l){var t=this.buildExportCall(i.literal(e.name),n,!0);return this._addImportSource(t,l)},l.prototype.remapExportAssignment=function(e){return this.buildExportCall(i.literal(e.left.name),e)},l.prototype.buildExportCall=function(e,n,l){var t=i.callExpression(this.exportIdentifier,[e,n]);return l?i.expressionStatement(t):t},l.prototype.importSpecifier=function(e,n,l){r.prototype.importSpecifier.apply(this,arguments),this._addImportSource(o(l),n)};var c={enter:function(e,n,l,t){e._importSource===t.source&&(i.isVariableDeclaration(e)?u(e.declarations,function(e){t.hoistDeclarators.push(i.variableDeclarator(e.id)),t.nodes.push(i.expressionStatement(i.assignmentExpression("=",e.id,e.init)))}):t.nodes.push(e),this.remove())}};l.prototype.buildRunnerSetters=function(e,n){var l=this.file.scope;return i.arrayExpression(s(this.ids,function(t,r){var a={source:r,nodes:[],hoistDeclarators:n};return l.traverse(e,c,a),i.functionExpression(null,[t],i.blockStatement(a.nodes))}))};var d={enter:function(e,n,l,t){if(i.isFunction(e))return this.skip();if(i.isVariableDeclaration(e)){if("var"!==e.kind&&!i.isProgram(n))return;if(e._blockHoist)return;for(var r=[],a=0;a<e.declarations.length;a++){var o=e.declarations[a];if(t.push(i.variableDeclarator(o.id)),o.init){var u=i.expressionStatement(i.assignmentExpression("=",o.id,o.init));r.push(u)}}if(i.isFor(n)){if(n.left===e)return e.declarations[0].id;if(n.init===e)return i.toSequenceExpression(r,l)}return r}}},p={enter:function(e,n,l,t){i.isFunction(e)&&this.skip(),(i.isFunctionDeclaration(e)||e._blockHoist)&&(t.push(e),this.remove())}};l.prototype.transform=function(e){var n=[],l=this.getModuleName(),t=i.literal(l),r=i.blockStatement(e.body),o=a.template("system",{MODULE_NAME:t,MODULE_DEPENDENCIES:i.arrayExpression(this.buildDependencyLiterals()),EXPORT_IDENTIFIER:this.exportIdentifier,SETTERS:this.buildRunnerSetters(r,n),EXECUTE:i.functionExpression(null,[],r)},!0),u=o.expression.arguments[2].body.body;l||o.expression.arguments.shift();var s=u.pop();if(this.file.scope.traverse(r,d,n),n.length){var c=i.variableDeclaration("var",n);c._blockHoist=!0,u.unshift(c)}this.file.scope.traverse(r,p,u),u.push(s),e.body=[o]}},{"../../types":120,"../../util":122,"./_default":43,"./amd":46,"lodash/array/last":194,"lodash/collection/each":198,"lodash/collection/map":202}],52:[function(e,n){"use strict";n.exports=e("./_strict")(e("./umd"))},{"./_strict":44,"./umd":53}],53:[function(e,n){"use strict";function l(){t.apply(this,arguments)}n.exports=l;var t=e("./amd"),r=e("../../util"),a=e("../../types"),o=e("lodash/object/values");r.inherits(l,t),l.prototype.transform=function(e){var n=e.body,l=[];for(var t in this.ids)l.push(a.literal(t));var u=o(this.ids),s=[a.identifier("exports")];this.passModuleArg&&s.push(a.identifier("module")),s=s.concat(u);var i=a.functionExpression(null,s,a.blockStatement(n)),c=[a.literal("exports")];this.passModuleArg&&c.push(a.literal("module")),c=c.concat(l),c=[a.arrayExpression(c)];var d=r.template("test-exports"),p=r.template("test-module"),f=this.passModuleArg?a.logicalExpression("&&",d,p):d,g=[a.identifier("exports")];this.passModuleArg&&g.push(a.identifier("module")),g=g.concat(l.map(function(e){return a.callExpression(a.identifier("require"),[e])}));var h=this.getModuleName();h&&c.unshift(a.literal(h));var m=r.template("umd-runner-body",{AMD_ARGUMENTS:c,COMMON_TEST:f,COMMON_ARGUMENTS:g}),y=a.callExpression(m,[i]);e.body=[a.expressionStatement(y)]}},{"../../types":120,"../../util":122,"./amd":46,"lodash/object/values":299}],54:[function(e,n){"use strict";function l(e,n){this.transformer=n,this.shouldRun=!n.check,this.handlers=n.handlers,this.file=e}n.exports=l;var t=e("lodash/collection/includes");l.prototype.canRun=function(){var e=this.transformer,n=this.file.opts,l=e.key;if("_"===l[0])return!0;var r=n.blacklist;if(r.length&&t(r,l))return!1;var a=n.whitelist;return a.length?t(a,l):e.optional&&!t(n.optional,l)?!1:e.experimental&&!n.experimental?!1:e.playground&&!n.playground?!1:!0},l.prototype.checkNode=function(e){var n=this.transformer.check;return n?this.shouldRun=n(e):!0},l.prototype.transform=function(){if(this.shouldRun){var e=this.file;e.debug("Running transformer "+this.transformer.key),e.scope.traverse(e.ast,this.handlers,e)}}},{"lodash/collection/includes":201}],55:[function(e,n){"use strict";function l(e,n){n=u({},n);var l=function(e){var l=n[e];return delete n[e],l};this.manipulateOptions=l("manipulateOptions"),this.check=l("check"),this.post=l("post"),this.pre=l("pre"),this.experimental=!!l("experimental"),this.playground=!!l("playground"),this.secondPass=!!l("secondPass"),this.optional=!!l("optional"),this.handlers=this.normalize(n);var t=this;t.opts||(t.opts={}),this.key=e}n.exports=l;var t=e("./transformer-pass"),r=e("lodash/lang/isFunction"),a=e("../traversal"),o=e("lodash/lang/isObject"),u=e("lodash/object/assign"),s=e("lodash/collection/each");l.prototype.normalize=function(e){var n=this;return r(e)&&(e={ast:e}),a.explode(e),s(e,function(l,t){return"_"===t[0]?void(n[t]=l):void("enter"!==t&&"exit"!==t&&(r(l)&&(l={enter:l}),o(l)&&(l.enter||(l.enter=function(){}),l.exit||(l.exit=function(){}),e[t]=l)))}),e},l.prototype.buildPass=function(e){return new t(e,this)}},{"../traversal":115,"./transformer-pass":54,"lodash/collection/each":198,"lodash/lang/isFunction":286,"lodash/lang/isObject":289,"lodash/object/assign":293}],56:[function(e,n){n.exports={selfContained:"runtime"}},{}],57:[function(e,n,l){"use strict";var t=e("../../../types");l.MemberExpression=function(e){var n=e.property;e.computed&&t.isLiteral(n)&&t.isValidIdentifier(n.value)?(e.property=t.identifier(n.value),e.computed=!1):e.computed||!t.isIdentifier(n)||t.isValidIdentifier(n.name)||(e.property=t.literal(n.name),e.computed=!0)}},{"../../../types":120}],58:[function(e,n,l){"use strict";var t=e("../../../types");l.Property=function(e){var n=e.key;t.isLiteral(n)&&t.isValidIdentifier(n.value)?(e.key=t.identifier(n.value),e.computed=!1):e.computed||!t.isIdentifier(n)||t.isValidIdentifier(n.name)||(e.key=t.literal(n.name))}},{"../../../types":120}],59:[function(e,n,l){"use strict";var t=e("../../helpers/define-map"),r=e("../../../types");l.check=function(e){return r.isProperty(e)&&("get"===e.kind||"set"===e.kind)},l.ObjectExpression=function(e){var n={},l=!1;return e.properties=e.properties.filter(function(e){return"get"===e.kind||"set"===e.kind?(l=!0,t.push(n,e.key,e.kind,e.computed,e.value),!1):!0}),l?r.callExpression(r.memberExpression(r.identifier("Object"),r.identifier("defineProperties")),[e,t.build(n)]):void 0}},{"../../../types":120,"../../helpers/define-map":34}],60:[function(e,n,l){"use strict";var t=e("../../../types");l.check=t.isArrowFunctionExpression,l.ArrowFunctionExpression=function(e){return t.ensureBlock(e),e._aliasFunction="arrow",e.expression=!1,e.type="FunctionExpression",e}},{"../../../types":120}],61:[function(e,n,l){"use strict";var t=e("../../../types"),r={enter:function(e,n,l,r){if(t.isReferencedIdentifier(e,n)){var a=r.letRefs[e.name];if(a&&l.getBindingIdentifier(e.name)===a){var o=t.callExpression(r.file.addHelper("temporal-assert-defined"),[e,t.literal(e.name),r.file.addHelper("temporal-undefined")]);return this.skip(),t.isAssignmentExpression(n)||t.isUpdateExpression(n)?void(n._ignoreBlockScopingTDZ||(this.parentPath.node=t.sequenceExpression([o,n]))):t.logicalExpression("&&",o,e)}}}};l.optional=!0,l.Loop=l.Program=l.BlockStatement=function(e,n,l,t){var a=e._letReferences;if(a){var o={letRefs:a,file:t};l.traverse(e,r,o)}}},{"../../../types":120}],62:[function(e,n,l){"use strict";function t(e,n,l,t){if(i.isReferencedIdentifier(e,n)){var r=t[e.name];if(r){var a=l.getBindingIdentifier(e.name);a===r.binding?e.name=r.uid:this&&this.skip()}}}function r(e,n,l,r){t(e,n,l,r),l.traverse(e,m,r)}var a=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},o=e("../../../traversal"),u=e("../../../helpers/object"),s=e("../../../util"),i=e("../../../types"),c=e("lodash/object/values"),d=e("lodash/object/extend");l.check=function(e){return i.isVariableDeclaration(e)&&("let"===e.kind||"const"===e.kind)};var p=function(e,n){if(!i.isVariableDeclaration(e))return!1;if(e._let)return!0;if("let"!==e.kind)return!1;if(f(e,n))for(var l=0;l<e.declarations.length;l++){var t=e.declarations[l],r=t;r.init||(r.init=i.identifier("undefined"))}return e._let=!0,e.kind="var",!0},f=function(e,n){return!i.isFor(n)||!i.isFor(n,{left:e})},g=function(e,n){return i.isVariableDeclaration(e,{kind:"var"})&&!p(e,n)},h=function(e){for(var n=0;n<e.length;n++)delete e[n]._let};l.VariableDeclaration=function(e,n,l,t){if(p(e,n)&&f(e)&&t.transformers["es6.blockScopingTDZ"].canRun()){for(var r=[e],a=0;a<e.declarations.length;a++){var o=e.declarations[a];if(o.init){var u=i.assignmentExpression("=",o.id,o.init);u._ignoreBlockScopingTDZ=!0,r.push(i.expressionStatement(u))}o.init=t.addHelper("temporal-undefined")}return e._blockHoist=2,r}},l.Loop=function(e,n,l,t){var r=e.left||e.init;p(r,e)&&(i.ensureBlock(e),e.body._letDeclarators=[r]);var a=new E(e,e.body,n,l,t);a.run()},l.Program=l.BlockStatement=function(e,n,l,t){if(!i.isLoop(n)){var r=new E(!1,e,n,l,t);r.run()}};var m={enter:t},y={enter:function(e,n,l,t){return i.isFunction(e)?(l.traverse(e,x,t),this.skip()):void 0}},x={enter:function(e,n,l,t){i.isReferencedIdentifier(e,n)&&(l.hasOwnBinding(e.name)||t.letReferences[e.name]&&(t.closurify=!0))}},b={enter:function(e,n,l,t){if(i.isForStatement(e))g(e.init,e)&&(e.init=i.sequenceExpression(t.pushDeclar(e.init)));else if(i.isFor(e))g(e.left,e)&&(e.left=e.left.declarations[0].id);else{if(g(e,n))return t.pushDeclar(e).map(i.expressionStatement);if(i.isFunction(e))return this.skip()}}},_={enter:function(e,n,l,t){i.isLabeledStatement(e)&&t.innerLabels.push(e.label.name)}},v=function(e){return i.isBreakStatement(e)?"break":i.isContinueStatement(e)?"continue":void 0},I={enter:function(e,n,l,t){var r;if(i.isLoop(e)&&(t.ignoreLabeless=!0,l.traverse(e,I,t),t.ignoreLabeless=!1),i.isFunction(e)||i.isLoop(e))return this.skip();var a=v(e);if(a){if(e.label){if(t.innerLabels.indexOf(e.label.name)>=0)return;a=a+"|"+e.label.name}else{if(t.ignoreLabeless)return;if(i.isBreakStatement(e)&&i.isSwitchCase(n))return}t.hasBreakContinue=!0,t.map[a]=e,r=i.literal(a)}return i.isReturnStatement(e)&&(t.hasReturn=!0,r=i.objectExpression([i.property("init",i.identifier("v"),e.argument||i.identifier("undefined"))])),r?(r=i.returnStatement(r),i.inherits(r,e)):void 0}},E=function(){function e(n,l,t,r,o){a(this,e),this.loopParent=n,this.parent=t,this.scope=r,this.block=l,this.file=o,this.outsideLetReferences=u(),this.hasLetReferences=!1,this.letReferences=l._letReferences=u(),this.body=[]}return e.prototype.run=function(){var e=this.block;if(!e._letDone){e._letDone=!0;var n=this.getLetReferences();i.isFunction(this.parent)||i.isProgram(this.block)||this.hasLetReferences&&(n?this.wrapClosure():this.remap())}},e.prototype.remap=function(){var e=!1,n=this.letReferences,l=this.scope,t=u();for(var a in n){var o=n[a];if(l.parentHasBinding(a)||l.hasGlobal(a)){var s=l.generateUidIdentifier(o.name).name;o.name=s,e=!0,t[a]=t[s]={binding:o,uid:s}}}if(e){var i=this.loopParent;i&&(r(i.right,i,l,t),r(i.test,i,l,t),r(i.update,i,l,t)),l.traverse(this.block,m,t)}},e.prototype.wrapClosure=function(){var e=this.block,n=this.outsideLetReferences;if(this.loopParent)for(var l in n){var t=n[l];this.scope.hasGlobal(t.name)&&(delete n[t.name],delete this.letReferences[t.name],this.scope.rename(t.name),this.letReferences[t.name]=t,n[t.name]=t)}this.has=this.checkLoop(),this.hoistVarDeclarations();var r=c(n),a=i.functionExpression(null,r,i.blockStatement(e.body));a._aliasFunction=!0,e.body=this.body;var u=i.callExpression(a,r),s=this.scope.generateUidIdentifier("ret"),d=o.hasType(a.body,this.scope,"YieldExpression",i.FUNCTION_TYPES);d&&(a.generator=!0,u=i.yieldExpression(u,!0));var p=o.hasType(a.body,this.scope,"AwaitExpression",i.FUNCTION_TYPES);p&&(a.async=!0,u=i.awaitExpression(u,!0)),this.build(s,u)},e.prototype.getLetReferences=function(){for(var e,n=this.block,l=n._letDeclarators||[],t=0;t<l.length;t++)e=l[t],d(this.outsideLetReferences,i.getBindingIdentifiers(e));if(n.body)for(t=0;t<n.body.length;t++)e=n.body[t],p(e,n)&&(l=l.concat(e.declarations));for(t=0;t<l.length;t++){e=l[t];var r=i.getBindingIdentifiers(e);d(this.letReferences,r),this.hasLetReferences=!0}if(this.hasLetReferences){h(l);var a={letReferences:this.letReferences,closurify:!1};return this.scope.traverse(this.block,y,a),a.closurify}},e.prototype.checkLoop=function(){var e={hasBreakContinue:!1,ignoreLabeless:!1,innerLabels:[],hasReturn:!1,isLoop:!!this.loopParent,map:{}};return this.scope.traverse(this.block,_,e),this.scope.traverse(this.block,I,e),e},e.prototype.hoistVarDeclarations=function(){o(this.block,b,this.scope,this)},e.prototype.pushDeclar=function(e){this.body.push(i.variableDeclaration(e.kind,e.declarations.map(function(e){return i.variableDeclarator(e.id)})));for(var n=[],l=0;l<e.declarations.length;l++){var t=e.declarations[l];if(t.init){var r=i.assignmentExpression("=",t.id,t.init);n.push(i.inherits(r,t))}}return n},e.prototype.build=function(e,n){var l=this.has;l.hasReturn||l.hasBreakContinue?this.buildHas(e,n):this.body.push(i.expressionStatement(n))},e.prototype.buildHas=function(e,n){var l=this.body;l.push(i.variableDeclaration("var",[i.variableDeclarator(e,n)]));var t,r=this.loopParent,a=this.has,o=[];if(a.hasReturn&&(t=s.template("let-scoping-return",{RETURN:e})),a.hasBreakContinue){if(!r)throw new Error("Has no loop parent but we're trying to reassign breaks and continues, something is going wrong here.");for(var u in a.map)o.push(i.switchCase(i.literal(u),[a.map[u]]));if(a.hasReturn&&o.push(i.switchCase(null,[t])),1===o.length){var c=o[0];l.push(this.file.attachAuxiliaryComment(i.ifStatement(i.binaryExpression("===",e,c.test),c.consequent[0])))}else l.push(this.file.attachAuxiliaryComment(i.switchStatement(e,o)))}else a.hasReturn&&l.push(this.file.attachAuxiliaryComment(t))},e}()},{"../../../helpers/object":24,"../../../traversal":115,"../../../types":120,"../../../util":122,"lodash/object/extend":295,"lodash/object/values":299}],63:[function(e,n,l){"use strict";var t=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},r=e("../../helpers/replace-supers"),a=e("../../helpers/name-method"),o=e("../../helpers/define-map"),u=e("../../../messages"),s=e("../../../util"),i=e("../../../types");l.check=i.isClass,l.ClassDeclaration=function(e,n,l,t){return new c(e,t,l,!0).run()},l.ClassExpression=function(e,n,l,t){return e.id||(i.isProperty(n)&&n.value===e&&!n.computed&&i.isIdentifier(n.key)&&(e.id=n.key),i.isVariableDeclarator(n)&&i.isIdentifier(n.id)&&(e.id=n.id)),new c(e,t,l,!1).run()};var c=function(){function e(n,l,r,a){t(this,e),this.isStatement=a,this.scope=r,this.node=n,this.file=l,this.hasInstanceMutators=!1,this.hasStaticMutators=!1,this.instanceMutatorMap={},this.staticMutatorMap={},this.hasConstructor=!1,this.className=n.id||r.generateUidIdentifier("class"),this.superName=n.superClass||i.identifier("Function"),this.hasSuper=!!n.superClass,this.isLoose=l.isLoose("es6.classes")}return e.prototype.run=function(){var e,n=this.superName,l=this.className,t=this.node.body.body,r=this.file,a=this.body=[],o=i.blockStatement([i.expressionStatement(i.callExpression(r.addHelper("class-call-check"),[i.thisExpression(),l]))]);if(this.node.id)e=i.functionDeclaration(l,[],o),a.push(e);else{var u=null,s=1===t.length&&"constructor"===t[0].key.name;this.hasSuper||0!==t.length&&!s||(u=l),e=i.functionExpression(u,[],o),a.push(i.variableDeclaration("var",[i.variableDeclarator(l,e)]))}this.constructor=e;var c=[],d=[];this.hasSuper&&(d.push(n),i.isIdentifier(n)||(n=this.scope.generateUidBasedOnNode(n,this.file)),c.push(n),this.superName=n,a.push(i.expressionStatement(i.callExpression(r.addHelper("inherits"),[l,n])))),this.buildBody(),i.inheritsComments(a[0],this.node);var p;return 1===a.length?p=i.toExpression(e):(a.push(i.returnStatement(l)),p=i.callExpression(i.functionExpression(null,c,i.blockStatement(a)),d)),this.isStatement?i.variableDeclaration("let",[i.variableDeclarator(l,p)]):p},e.prototype.buildBody=function(){for(var e=this.constructor,n=this.className,l=this.superName,t=this.node.body.body,a=this.body,u=0;u<t.length;u++){var c=t[u];if(i.isMethodDefinition(c)){var d=new r({methodNode:c,className:this.className,superName:this.superName,isStatic:c["static"],isLoose:this.isLoose,scope:this.scope,file:this.file},!0);d.replace(),!c.computed&&i.isIdentifier(c.key,{name:"constructor"})||i.isLiteral(c.key,{value:"constructor"})?this.pushConstructor(c):this.pushMethod(c)}else i.isPrivateDeclaration(c)?(this.closure=!0,a.unshift(c)):i.isClassProperty(c)&&this.pushProperty(c)}if(!this.hasConstructor&&this.hasSuper&&!i.isFalsyExpression(l)){var p="class-super-constructor-call";this.isLoose&&(p+="-loose"),e.body.body.push(s.template(p,{CLASS_NAME:n,SUPER_NAME:this.superName},!0))}var f,g;if(this.hasInstanceMutators&&(f=o.build(this.instanceMutatorMap)),this.hasStaticMutators&&(g=o.build(this.staticMutatorMap)),f||g){g||(g=i.literal(null));var h=[n,g];f&&h.push(f),a.push(i.expressionStatement(i.callExpression(this.file.addHelper("prototype-properties"),h)))}},e.prototype.pushMethod=function(e){var n=e.key,l=e.kind;if(""===l){if(a.property(e,this.file,this.scope),this.isLoose){var t=this.className;e["static"]||(t=i.memberExpression(t,i.identifier("prototype"))),n=i.memberExpression(t,n,e.computed);var r=i.expressionStatement(i.assignmentExpression("=",n,e.value));return i.inheritsComments(r,e),void this.body.push(r)}l="value"}var u=this.instanceMutatorMap;e["static"]?(this.hasStaticMutators=!0,u=this.staticMutatorMap):this.hasInstanceMutators=!0,o.push(u,n,l,e.computed,e),o.push(u,n,"enumerable",e.computed,!1)},e.prototype.pushProperty=function(e){if(e.value){var n;e["static"]?(n=i.memberExpression(this.className,e.key),this.body.push(i.expressionStatement(i.assignmentExpression("=",n,e.value)))):(n=i.memberExpression(i.thisExpression(),e.key),this.constructor.body.body.unshift(i.expressionStatement(i.assignmentExpression("=",n,e.value))))}},e.prototype.pushConstructor=function(e){if(e.kind)throw this.file.errorWithNode(e,u.get("classesIllegalConstructorKind"));var n=this.constructor,l=e.value;this.hasConstructor=!0,i.inherits(n,l),i.inheritsComments(n,e),n._ignoreUserWhitespace=!0,n.params=l.params,n.body.body=n.body.body.concat(l.body.body)},e}()},{"../../../messages":27,"../../../types":120,"../../../util":122,"../../helpers/define-map":34,"../../helpers/name-method":37,"../../helpers/replace-supers":40}],64:[function(e,n,l){"use strict";var t=e("../../../messages"),r=e("../../../types");l.check=function(e){return r.isVariableDeclaration(e,{kind:"const"})};var a={enter:function(e,n,l,a){if(r.isAssignmentExpression(e)||r.isUpdateExpression(e)){var o=r.getBindingIdentifiers(e);for(var u in o){var s=o[u],i=a.constants[u];if(i){var c=i.identifier;if(s!==c&&l.bindingIdentifierEquals(u,c))throw a.file.errorWithNode(s,t.get("readOnly",u))}}}else r.isScope(e,n)&&this.skip()}};l.Scopable=function(e,n,l,t){l.traverse(e,a,{constants:l.getAllBindingsOfKind("const"),file:t})},l.VariableDeclaration=function(e){"const"===e.kind&&(e.kind="let")}},{"../../../messages":27,"../../../types":120}],65:[function(e,n,l){"use strict";var t=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},r=e("../../../messages"),a=e("../../../types");l.check=a.isPattern,l.ForInStatement=l.ForOfStatement=function(e,n,l,t){var r=e.left;if(a.isPattern(r)){var o=l.generateUidIdentifier("ref");return e.left=a.variableDeclaration("var",[a.variableDeclarator(o)]),a.ensureBlock(e),void e.body.body.unshift(a.variableDeclaration("var",[a.variableDeclarator(r,o)]))}if(a.isVariableDeclaration(r)){var u=r.declarations[0].id;if(a.isPattern(u)){var i=l.generateUidIdentifier("ref");e.left=a.variableDeclaration(r.kind,[a.variableDeclarator(i,null)]);var c=[],d=new s({kind:r.kind,file:t,scope:l,nodes:c});d.init(u,i),a.ensureBlock(e);var p=e.body;p.body=c.concat(p.body)}}},l.Function=function(e,n,l,t){var r=[],o=!1;if(e.params=e.params.map(function(n,u){if(!a.isPattern(n))return n;o=!0;var i=l.generateUidIdentifier("ref"),c=new s({blockHoist:e.params.length-u,nodes:r,scope:l,file:t,kind:"var"});return c.init(n,i),i}),o){a.ensureBlock(e);var u=e.body;u.body=r.concat(u.body)}},l.CatchClause=function(e,n,l,t){var r=e.param;if(a.isPattern(r)){var o=l.generateUidIdentifier("ref");e.param=o;var u=[],i=new s({kind:"let",file:t,scope:l,nodes:u});return i.init(r,o),e.body.body=u.concat(e.body.body),e}},l.ExpressionStatement=function(e,n,l,t){var r=e.expression;if("AssignmentExpression"===r.type&&a.isPattern(r.left)&&!t.isConsequenceExpressionStatement(e)){var o=[],u=l.generateUidIdentifier("ref");o.push(a.variableDeclaration("var",[a.variableDeclarator(u,r.right)]));var i=new s({operator:r.operator,file:t,scope:l,nodes:o});return i.init(r.left,u),o}},l.AssignmentExpression=function(e,n,l,t){if(a.isPattern(e.left)){var r=l.generateUidIdentifier("temp");l.push({key:r.name,id:r});var o=[];o.push(a.assignmentExpression("=",r,e.right));var u=new s({operator:e.operator,file:t,scope:l,nodes:o});return u.init(e.left,r),o.push(r),a.toSequenceExpression(o,l)}};var o=function(e){for(var n=0;n<e.declarations.length;n++)if(a.isPattern(e.declarations[n].id))return!0;return!1};l.VariableDeclaration=function(e,n,l,t){if(!a.isForInStatement(n)&&!a.isForOfStatement(n)&&o(e)){for(var u,i=[],c=0;c<e.declarations.length;c++){u=e.declarations[c];var d=u.init,p=u.id,f=new s({nodes:i,scope:l,kind:e.kind,file:t});a.isPattern(p)&&d?(f.init(p,d),+c!==e.declarations.length-1&&a.inherits(i[i.length-1],u)):i.push(a.inherits(f.buildVariableAssignment(u.id,u.init),u))}if(!a.isProgram(n)&&!a.isBlockStatement(n)){for(u=null,c=0;c<i.length;c++){if(e=i[c],u||(u=a.variableDeclaration(e.kind,[])),!a.isVariableDeclaration(e)&&u.kind!==e.kind)throw t.errorWithNode(e,r.get("invalidParentForThisNode"));u.declarations=u.declarations.concat(e.declarations)}return u}return i}};var u=function(e){for(var n=0;n<e.elements.length;n++)if(a.isRestElement(e.elements[n]))return!0;return!1},s=function(){function e(n){t(this,e),this.blockHoist=n.blockHoist,this.operator=n.operator,this.nodes=n.nodes,this.scope=n.scope,this.file=n.file,this.kind=n.kind}return e.prototype.buildVariableAssignment=function(e,n){var l=this.operator;a.isMemberExpression(e)&&(l="=");var t;return t=l?a.expressionStatement(a.assignmentExpression(l,e,n)):a.variableDeclaration(this.kind,[a.variableDeclarator(e,n)]),t._blockHoist=this.blockHoist,t},e.prototype.buildVariableDeclaration=function(e,n){var l=a.variableDeclaration("var",[a.variableDeclarator(e,n)]);return l._blockHoist=this.blockHoist,l},e.prototype.push=function(e,n){a.isObjectPattern(e)?this.pushObjectPattern(e,n):a.isArrayPattern(e)?this.pushArrayPattern(e,n):a.isAssignmentPattern(e)?this.pushAssignmentPattern(e,n):this.nodes.push(this.buildVariableAssignment(e,n))},e.prototype.pushAssignmentPattern=function(e,n){var l=this.scope.generateUidBasedOnNode(n),t=a.variableDeclaration("var",[a.variableDeclarator(l,n)]);t._blockHoist=this.blockHoist,this.nodes.push(t),this.nodes.push(this.buildVariableAssignment(e.left,a.conditionalExpression(a.binaryExpression("===",l,a.identifier("undefined")),e.right,l)))},e.prototype.pushObjectSpread=function(e,n,l,t){for(var r=[],o=0;o<e.properties.length;o++){var u=e.properties[o];if(o>=t)break;if(!a.isSpreadProperty(u)){var s=u.key;a.isIdentifier(s)&&(s=a.literal(u.key.name)),r.push(s)}}r=a.arrayExpression(r);var i=a.callExpression(this.file.addHelper("object-without-properties"),[n,r]);this.nodes.push(this.buildVariableAssignment(l.argument,i))},e.prototype.pushObjectProperty=function(e,n){a.isLiteral(e.key)&&(e.computed=!0);var l=e.value,t=a.memberExpression(n,e.key,e.computed);a.isPattern(l)?this.push(l,t):this.nodes.push(this.buildVariableAssignment(l,t))},e.prototype.pushObjectPattern=function(e,n){if(e.properties.length||this.nodes.push(a.expressionStatement(a.callExpression(this.file.addHelper("object-destructuring-empty"),[n]))),e.properties.length>1&&a.isMemberExpression(n)){var l=this.scope.generateUidBasedOnNode(n,this.file);this.nodes.push(this.buildVariableDeclaration(l,n)),n=l}for(var t=0;t<e.properties.length;t++){var r=e.properties[t];a.isSpreadProperty(r)?this.pushObjectSpread(e,n,r,t):this.pushObjectProperty(r,n)}},e.prototype.canUnpackArrayPattern=function(e,n){if(!a.isArrayExpression(n))return!1;if(!(e.elements.length>n.elements.length)){if(e.elements.length<n.elements.length&&!u(e))return!1;for(var l=0;l<e.elements.length;l++)if(!e.elements[l])return!1;return!0}},e.prototype.pushUnpackedArrayPattern=function(e,n){for(var l=0;l<e.elements.length;l++){var t=e.elements[l];a.isRestElement(t)?this.push(t.argument,a.arrayExpression(n.elements.slice(l))):this.push(t,n.elements[l])}},e.prototype.pushArrayPattern=function(e,n){if(e.elements){if(this.canUnpackArrayPattern(e,n))return this.pushUnpackedArrayPattern(e,n);var l=!u(e)&&e.elements.length,t=this.scope.toArray(n,l);a.isIdentifier(t)?n=t:(n=this.scope.generateUidBasedOnNode(n),this.nodes.push(this.buildVariableDeclaration(n,t)),this.scope.assignTypeGeneric(n.name,"Array"));for(var r=0;r<e.elements.length;r++){var o=e.elements[r];if(o){var s;a.isRestElement(o)?(s=this.scope.toArray(n),r>0&&(s=a.callExpression(a.memberExpression(s,a.identifier("slice")),[a.literal(r)])),o=o.argument):s=a.memberExpression(n,a.literal(r),!0),this.push(o,s)}}}},e.prototype.init=function(e,n){if(!a.isArrayExpression(n)&&!a.isMemberExpression(n)&&!a.isIdentifier(n)){var l=this.scope.generateUidBasedOnNode(n);this.nodes.push(this.buildVariableDeclaration(l,n)),n=l}this.push(e,n)},e}()},{"../../../messages":27,"../../../types":120}],66:[function(e,n,l){"use strict";var t=e("../../../messages"),r=e("../../../util"),a=e("../../../types");l.check=a.isForOfStatement,l.ForOfStatement=function(e,n,l,t){var r=s;t.isLoose("es6.forOf")&&(r=u);var o=r(e,n,l,t),i=o.declar,c=o.loop,d=c.body;return a.inheritsComments(c,e),a.ensureBlock(e),i&&d.body.push(i),d.body=d.body.concat(e.body.body),a.inherits(c,e),c._scopeInfo=e._scopeInfo,c};var o={enter:function(e,n,l,t){if(a.isLoop(e))return t.ignoreLabeless=!0,l.traverse(e,o,t),t.ignoreLabeless=!1,this.skip();if(a.isBreakStatement(e)){if(!e.label&&t.ignoreLabeless)return;if(e.label&&e.label.name!==t.label)return;var r=a.expressionStatement(a.callExpression(a.memberExpression(t.iteratorKey,a.identifier("return")),[]));return r=t.wrapReturn(r),this.skip(),[r,e]}}},u=function(e,n,l,u){var s,i,c=e.left;if(a.isIdentifier(c)||a.isPattern(c)||a.isMemberExpression(c))i=c;else{if(!a.isVariableDeclaration(c))throw u.errorWithNode(c,t.get("unknownForHead",c.type));i=l.generateUidIdentifier("ref"),s=a.variableDeclaration(c.kind,[a.variableDeclarator(c.declarations[0].id,i)])}var d=l.generateUidIdentifier("iterator"),p=l.generateUidIdentifier("isArray"),f=r.template("for-of-loose",{LOOP_OBJECT:d,IS_ARRAY:p,OBJECT:e.right,INDEX:l.generateUidIdentifier("i"),ID:i});return s||f.body.body.shift(),l.traverse(e,o,{iteratorKey:d,wrapReturn:function(e){return a.ifStatement(a.logicalExpression("&&",a.unaryExpression("!",p,!0),a.memberExpression(d,a.identifier("return"))),e)},label:a.isLabeledStatement(n)&&n.label.name}),{declar:s,loop:f}},s=function(e,n,l,u){var s,i=e.left,c=l.generateUidIdentifier("step"),d=a.memberExpression(c,a.identifier("value"));if(a.isIdentifier(i)||a.isPattern(i)||a.isMemberExpression(i))s=a.expressionStatement(a.assignmentExpression("=",i,d));else{if(!a.isVariableDeclaration(i))throw u.errorWithNode(i,t.get("unknownForHead",i.type));s=a.variableDeclaration(i.kind,[a.variableDeclarator(i.declarations[0].id,d)])}var p=l.generateUidIdentifier("iterator"),f=r.template("for-of",{ITERATOR_KEY:p,STEP_KEY:c,OBJECT:e.right});return l.traverse(e,o,{iteratorKey:p,wrapReturn:function(e){return a.ifStatement(a.memberExpression(p,a.identifier("return")),e)},label:a.isLabeledStatement(n)&&n.label.name}),{declar:s,loop:f}}},{"../../../messages":27,"../../../types":120,"../../../util":122}],67:[function(e,n,l){"use strict";var t=e("../../../types");l.check=e("../internal/modules").check,l.ImportDeclaration=function(e,n,l,t){if(!e.isType){var r=[];if(e.specifiers.length)for(var a=0;a<e.specifiers.length;a++)t.moduleFormatter.importSpecifier(e.specifiers[a],e,r,n);else t.moduleFormatter.importDeclaration(e,r,n);return 1===r.length&&(r[0]._blockHoist=e._blockHoist),r}},l.ExportDeclaration=function(e,n,l,r){if(!t.isTypeAlias(e.declaration)){var a,o=[];if(e.declaration){if(t.isVariableDeclaration(e.declaration)){var u=e.declaration.declarations[0];u.init=u.init||t.identifier("undefined")}r.moduleFormatter.exportDeclaration(e,o,n)}else if(e.specifiers)for(a=0;a<e.specifiers.length;a++)r.moduleFormatter.exportSpecifier(e.specifiers[a],e,o,n);if(e._blockHoist)for(a=0;a<o.length;a++)o[a]._blockHoist=e._blockHoist;return o}}},{"../../../types":120,"../internal/modules":87}],68:[function(e,n,l){"use strict";var t=e("../../helpers/replace-supers"),r=e("../../../types");l.check=function(e){return r.isIdentifier(e,{name:"super"})},l.Property=function(e,n,l,a){if(e.method){var o=e.value,u=l.generateUidIdentifier("this"),s=new t({topLevelThisReference:u,methodNode:e,className:u,isStatic:!0,scope:l,file:a});s.replace(),s.hasSuper&&o.body.body.unshift(r.variableDeclaration("var",[r.variableDeclarator(u,r.thisExpression())]))}}},{"../../../types":120,"../../helpers/replace-supers":40}],69:[function(e,n,l){"use strict";var t=e("../../../util"),r=e("../../../types");l.check=function(e){return r.isFunction(e)&&a(e)};var a=function(e){for(var n=0;n<e.params.length;n++)if(!r.isIdentifier(e.params[n]))return!0;return!1},o={enter:function(e,n,l,t){r.isReferencedIdentifier(e,n)&&t.scope.hasOwnBinding(e.name)&&(t.scope.bindingIdentifierEquals(e.name,e)||(t.iife=!0,this.stop()))}};l.Function=function(e,n,l,u){if(a(e)){r.ensureBlock(e);var s=[],i=r.identifier("arguments");i._ignoreAliasFunctions=!0;for(var c=0,d={iife:!1,scope:l},p=function(n,l,a){var o=t.template("default-parameter",{VARIABLE_NAME:n,DEFAULT_VALUE:l,ARGUMENT_KEY:r.literal(a),ARGUMENTS:i},!0);
u.checkNode(o),o._blockHoist=e.params.length-a,s.push(o)},f=0;f<e.params.length;f++){var g=e.params[f];if(r.isAssignmentPattern(g)){var h=g.left,m=g.right,y=l.generateUidIdentifier("x");y._isDefaultPlaceholder=!0,e.params[f]=y,d.iife||(r.isIdentifier(m)&&l.hasOwnBinding(m.name)?d.iife=!0:l.traverse(m,o,d)),p(h,m,f)}else r.isRestElement(g)||(c=f+1),r.isIdentifier(g)||l.traverse(g,o,d),u.transformers["es6.blockScopingTDZ"].canRun()&&p(g,r.identifier("undefined"),f)}if(e.params=e.params.slice(0,c),d.iife){var x=r.functionExpression(null,[],e.body,e.generator);x._aliasFunction=!0,s.push(r.returnStatement(r.callExpression(x,[]))),e.body=r.blockStatement(s)}else e.body.body=s.concat(e.body.body)}}},{"../../../types":120,"../../../util":122}],70:[function(e,n,l){"use strict";var t=e("../../../util"),r=e("../../../types");l.check=r.isRestElement;var a=function(e){return r.isRestElement(e.params[e.params.length-1])};l.Function=function(e,n,l){if(a(e)){var o=e.params.pop().argument,u=r.identifier("arguments");u._ignoreAliasFunctions=!0;var s=r.literal(e.params.length),i=l.generateUidIdentifier("key"),c=l.generateUidIdentifier("len"),d=i,p=c;if(e.params.length&&(d=r.binaryExpression("-",i,s),p=r.conditionalExpression(r.binaryExpression(">",c,s),r.binaryExpression("-",c,s),r.literal(0))),r.isPattern(o)){var f=o;o=l.generateUidIdentifier("ref");var g=r.variableDeclaration("var",[r.variableDeclarator(f,o)]);g._blockHoist=e.params.length+1,e.body.body.unshift(g)}l.assignTypeGeneric(o.name,"Array");var h=t.template("rest",{ARGUMENTS:u,ARRAY_KEY:d,ARRAY_LEN:p,START:s,ARRAY:o,KEY:i,LEN:c});h._blockHoist=e.params.length+1,e.body.body.unshift(h)}}},{"../../../types":120,"../../../util":122}],71:[function(e,n,l){"use strict";var t=e("../../../types");l.check=function(e){return t.isProperty(e)&&e.computed},l.ObjectExpression=function(e,n,l,o){for(var u=!1,s=0;s<e.properties.length&&!(u=t.isProperty(e.properties[s],{computed:!0,kind:"init"}));s++);if(u){var i=[],c=l.generateUidBasedOnNode(n),d=[],p=t.functionExpression(null,[],t.blockStatement(d));p._aliasFunction=!0;var f=a;o.isLoose("es6.properties.computed")&&(f=r);var g=f(e,d,c,i,o);return g?g:(d.unshift(t.variableDeclaration("var",[t.variableDeclarator(c,t.objectExpression(i))])),d.push(t.returnStatement(c)),t.callExpression(p,[]))}};var r=function(e,n,l){for(var r=0;r<e.properties.length;r++){var a=e.properties[r];n.push(t.expressionStatement(t.assignmentExpression("=",t.memberExpression(l,a.key,a.computed||t.isLiteral(a.key)),a.value)))}},a=function(e,n,l,r,a){for(var o,u,s=e.properties,i=0;i<s.length;i++)o=s[i],"init"===o.kind&&(u=o.key,!o.computed&&t.isIdentifier(u)&&(o.key=t.literal(u.name)));var c=!1;for(i=0;i<s.length;i++)o=s[i],o.computed&&(c=!0),("init"!==o.kind||!c||t.isLiteral(t.toComputedKey(o,o.key),{value:"__proto__"}))&&(r.push(o),s[i]=null);for(i=0;i<s.length;i++)if(o=s[i]){u=o.key;var d;d=o.computed&&t.isMemberExpression(u)&&t.isIdentifier(u.object,{name:"Symbol"})?t.assignmentExpression("=",t.memberExpression(l,u,!0),o.value):t.callExpression(a.addHelper("define-property"),[l,u,o.value]),n.push(t.expressionStatement(d))}if(1===n.length){var p=n[0].expression;if(t.isCallExpression(p))return p.arguments[0]=t.objectExpression(r),p}}},{"../../../types":120}],72:[function(e,n,l){"use strict";var t=e("lodash/lang/clone"),r=e("../../../types");l.check=function(e){return r.isProperty(e)&&(e.method||e.shorthand)},l.Property=function(e){e.method&&(e.method=!1),e.shorthand&&(e.shorthand=!1,e.key=r.removeComments(t(e.key)))}},{"../../../types":120,"lodash/lang/clone":280}],73:[function(e,n,l){"use strict";var t=e("lodash/collection/includes"),r=e("../../../types");l.check=r.isSpreadElement;var a=function(e,n){return n.toArray(e.argument,!0)},o=function(e){for(var n=0;n<e.length;n++)if(r.isSpreadElement(e[n]))return!0;return!1},u=function(e,n){for(var l=[],t=[],o=function(){t.length&&(l.push(r.arrayExpression(t)),t=[])},u=0;u<e.length;u++){var s=e[u];r.isSpreadElement(s)?(o(),l.push(a(s,n))):t.push(s)}return o(),l};l.ArrayExpression=function(e,n,l){var t=e.elements;if(o(t)){var a=u(t,l),s=a.shift();return r.isArrayExpression(s)||(a.unshift(s),s=r.arrayExpression([])),r.callExpression(r.memberExpression(s,r.identifier("concat")),a)}},l.CallExpression=function(e,n,l){var t=e.arguments;if(o(t)){var a=r.identifier("undefined");e.arguments=[];var s;s=1===t.length&&"arguments"===t[0].argument.name?[t[0].argument]:u(t,l);var i=s.shift();e.arguments.push(s.length?r.callExpression(r.memberExpression(i,r.identifier("concat")),s):i);var c=e.callee;if(r.isMemberExpression(c)){var d=l.generateTempBasedOnNode(c.object);d?(c.object=r.assignmentExpression("=",d,c.object),a=d):a=c.object,r.appendToMemberExpression(c,r.identifier("apply"))}else e.callee=r.memberExpression(e.callee,r.identifier("apply"));e.arguments.unshift(a)}},l.NewExpression=function(e,n,l,a){var s=e.arguments;if(o(s)){var i=r.isIdentifier(e.callee)&&t(r.NATIVE_TYPE_NAMES,e.callee.name),c=u(s,l);i&&c.unshift(r.arrayExpression([r.literal(null)]));var d=c.shift();return s=c.length?r.callExpression(r.memberExpression(d,r.identifier("concat")),c):d,i?r.newExpression(r.callExpression(r.memberExpression(a.addHelper("bind"),r.identifier("apply")),[e.callee,s]),[]):r.callExpression(a.addHelper("apply-constructor"),[e.callee,s])}}},{"../../../types":120,"lodash/collection/includes":201}],74:[function(e,n,l){"use strict";function t(e){return c.blockStatement([c.returnStatement(e)])}var r=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},a=e("lodash/collection/reduceRight"),o=e("../../../messages"),u=e("lodash/array/flatten"),s=e("../../../util"),i=e("lodash/collection/map"),c=e("../../../types");l.Function=function(e,n,l,t){var r=new g(e,l,t);r.run()};var d={enter:function(e,n,l,t){if(c.isIfStatement(e))c.isReturnStatement(e.alternate)&&c.ensureBlock(e,"alternate"),c.isReturnStatement(e.consequent)&&c.ensureBlock(e,"consequent");else{if(c.isReturnStatement(e))return this.skip(),t.subTransform(e.argument);c.isTryStatement(n)?e===n.block?this.skip():n.finalizer&&e!==n.finalizer&&this.skip():c.isFunction(e)?this.skip():c.isVariableDeclaration(e)&&(this.skip(),t.vars.push(e))}}},p={enter:function(e,n,l,t){return c.isThisExpression(e)?(t.needsThis=!0,t.getThisId()):c.isReferencedIdentifier(e,n,{name:"arguments"})?(t.needsArguments=!0,t.getArgumentsId()):c.isFunction(e)&&(this.skip(),c.isFunctionDeclaration(e))?(e=c.variableDeclaration("var",[c.variableDeclarator(e.id,c.toExpression(e))]),e._blockHoist=2,e):void 0}},f={enter:function(e,n,l,t){if(c.isExpressionStatement(e)){var r=e.expression;if(c.isAssignmentExpression(r))if(t.needsThis||r.left!==t.getThisId()){if(!t.needsArguments&&r.left===t.getArgumentsId()&&c.isArrayExpression(r.right))return i(r.right.elements,function(e){return c.expressionStatement(e)})}else this.remove()}}},g=function(){function e(n,l,t){r(this,e),this.hasTailRecursion=!1,this.needsArguments=!1,this.setsArguments=!1,this.needsThis=!1,this.ownerId=n.id,this.vars=[],this.scope=l,this.file=t,this.node=n}return e.prototype.getArgumentsId=function(){var e;return e=this,!e.argumentsId&&(e.argumentsId=this.scope.generateUidIdentifier("arguments")),e.argumentsId},e.prototype.getThisId=function(){var e;return e=this,!e.thisId&&(e.thisId=this.scope.generateUidIdentifier("this")),e.thisId},e.prototype.getLeftId=function(){var e;return e=this,!e.leftId&&(e.leftId=this.scope.generateUidIdentifier("left")),e.leftId},e.prototype.getFunctionId=function(){var e;return e=this,!e.functionId&&(e.functionId=this.scope.generateUidIdentifier("function")),e.functionId},e.prototype.getAgainId=function(){var e;return e=this,!e.againId&&(e.againId=this.scope.generateUidIdentifier("again")),e.againId},e.prototype.getParams=function(){var e=this.params;if(!e){e=this.node.params,this.paramDecls=[];for(var n=0;n<e.length;n++){var l=e[n];l._isDefaultPlaceholder||this.paramDecls.push(c.variableDeclarator(l,e[n]=this.scope.generateUidIdentifier("x")))}}return this.params=e},e.prototype.hasDeopt=function(){var e=this.scope.getBindingInfo(this.ownerId.name);return e&&e.reassigned},e.prototype.run=function(){var e=this.scope,n=this.node,l=this.ownerId;if(l&&(e.traverse(n,d,this),this.hasTailRecursion)){if(this.hasDeopt())return void this.file.logDeopt(n,o.get("tailCallReassignmentDeopt"));e.traverse(n,p,this),this.needsThis&&this.needsArguments||e.traverse(n,f,this);var t=c.ensureBlock(n).body;if(this.vars.length>0){var r=u(i(this.vars,function(e){return e.declarations},this)),g=a(r,function(e,n){return c.assignmentExpression("=",n.id,e)},c.identifier("undefined"));t.unshift(c.expressionStatement(g))}var h=this.paramDecls;h.length>0&&t.unshift(c.variableDeclaration("var",h)),t.unshift(c.expressionStatement(c.assignmentExpression("=",this.getAgainId(),c.literal(!1)))),n.body=s.template("tail-call-body",{AGAIN_ID:this.getAgainId(),THIS_ID:this.thisId,ARGUMENTS_ID:this.argumentsId,FUNCTION_ID:this.getFunctionId(),BLOCK:n.body});var m=[];if(this.needsThis&&m.push(c.variableDeclarator(this.getThisId(),c.thisExpression())),this.needsArguments||this.setsArguments){var y=c.variableDeclarator(this.getArgumentsId());this.needsArguments&&(y.init=c.identifier("arguments")),m.push(y)}var x=this.leftId;x&&m.push(c.variableDeclarator(x)),m.length>0&&n.body.body.unshift(c.variableDeclaration("var",m))}},e.prototype.subTransform=function(e){if(e){var n=this["subTransform"+e.type];return n?n.call(this,e):void 0}},e.prototype.subTransformConditionalExpression=function(e){var n=this.subTransform(e.consequent),l=this.subTransform(e.alternate);return n||l?(e.type="IfStatement",e.consequent=n?c.toBlock(n):t(e.consequent),e.alternate=l?c.isIfStatement(l)?l:c.toBlock(l):t(e.alternate),[e]):void 0},e.prototype.subTransformLogicalExpression=function(e){var n=this.subTransform(e.right);if(n){var l=this.getLeftId(),r=c.assignmentExpression("=",l,e.left);return"&&"===e.operator&&(r=c.unaryExpression("!",r)),[c.ifStatement(r,t(l))].concat(n)}},e.prototype.subTransformSequenceExpression=function(e){var n=e.expressions,l=this.subTransform(n[n.length-1]);return l?(1===--n.length&&(e=n[0]),[c.expressionStatement(e)].concat(l)):void 0},e.prototype.subTransformCallExpression=function(e){var n,l,t=e.callee;if(c.isMemberExpression(t,{computed:!1})&&c.isIdentifier(t.property)){switch(t.property.name){case"call":l=c.arrayExpression(e.arguments.slice(1));break;case"apply":l=e.arguments[1]||c.identifier("undefined");break;default:return}n=e.arguments[0],t=t.object}if(c.isIdentifier(t)&&this.scope.bindingIdentifierEquals(t.name,this.ownerId)&&(this.hasTailRecursion=!0,!this.hasDeopt())){var r=[];c.isThisExpression(n)||r.push(c.expressionStatement(c.assignmentExpression("=",this.getThisId(),n||c.identifier("undefined")))),l||(l=c.arrayExpression(e.arguments));var a=this.getArgumentsId(),o=this.getParams();r.push(c.expressionStatement(c.assignmentExpression("=",a,l)));var u,s;if(c.isArrayExpression(l)){var i=l.elements;for(u=0;u<i.length&&u<o.length;u++){s=o[u];var d=i[u]||(i[u]=c.identifier("undefined"));s._isDefaultPlaceholder||(i[u]=c.assignmentExpression("=",s,d))}}else for(this.setsArguments=!0,u=0;u<o.length;u++)s=o[u],s._isDefaultPlaceholder||r.push(c.expressionStatement(c.assignmentExpression("=",s,c.memberExpression(a,c.literal(u),!0))));return r.push(c.expressionStatement(c.assignmentExpression("=",this.getAgainId(),c.literal(!0)))),r.push(c.continueStatement(this.getFunctionId())),r}},e}()},{"../../../messages":27,"../../../types":120,"../../../util":122,"lodash/array/flatten":193,"lodash/collection/map":202,"lodash/collection/reduceRight":203}],75:[function(e,n,l){"use strict";var t=e("../../../types"),r=function(e,n){return t.binaryExpression("+",e,n)};l.check=function(e){return t.isTemplateLiteral(e)||t.isTaggedTemplateExpression(e)},l.TaggedTemplateExpression=function(e,n,l,r){for(var a=[],o=e.quasi,u=[],s=[],i=0;i<o.quasis.length;i++){var c=o.quasis[i];u.push(t.literal(c.value.cooked)),s.push(t.literal(c.value.raw))}u=t.arrayExpression(u),s=t.arrayExpression(s);var d="tagged-template-literal";return r.isLoose("es6.templateLiterals")&&(d+="-loose"),a.push(t.callExpression(r.addHelper(d),[u,s])),a=a.concat(o.expressions),t.callExpression(e.tag,a)},l.TemplateLiteral=function(e){var n,l=[];for(n=0;n<e.quasis.length;n++){var a=e.quasis[n];l.push(t.literal(a.value.cooked));var o=e.expressions.shift();o&&l.push(o)}if(l.length>1){var u=l[l.length-1];t.isLiteral(u,{value:""})&&l.pop();var s=r(l.shift(),l.shift());for(n=0;n<l.length;n++)s=r(s,l[n]);return s}return l[0]}},{"../../../types":120}],76:[function(e,n,l){"use strict";var t=e("regexpu/rewrite-pattern"),r=e("lodash/array/pull"),a=e("../../../types");l.check=function(e){return a.isLiteral(e)&&e.regex&&e.regex.flags.indexOf("u")>=0},l.Literal=function(e){var n=e.regex;if(n){var l=n.flags.split("");n.flags.indexOf("u")<0||(r(l,"u"),n.pattern=t(n.pattern,n.flags),n.flags=l.join(""))}}},{"../../../types":120,"lodash/array/pull":195,"regexpu/rewrite-pattern":320}],77:[function(e,n,l){"use strict";var t=e("../../../util"),r=e("../../../types");l.experimental=!0;var a=function(e,n,l,t){if(r.isExpressionStatement(e)&&!t.isConsequenceExpressionStatement(e))return n;var a=[];return r.isSequenceExpression(n)?a=n.expressions:a.push(n),a.push(l),r.sequenceExpression(a)};l.AssignmentExpression=function(e,n,l,o){var u=e.left;if(r.isVirtualPropertyExpression(u)){var s,i=e.right;r.isExpressionStatement(n)||(s=l.generateTempBasedOnNode(e.right),s&&(i=s)),"="!==e.operator&&(i=r.binaryExpression(e.operator[0],t.template("abstract-expression-get",{PROPERTY:e.property,OBJECT:e.object}),i));var c=t.template("abstract-expression-set",{PROPERTY:u.property,OBJECT:u.object,VALUE:i});return s&&(c=r.sequenceExpression([r.assignmentExpression("=",s,e.right),c])),a(n,c,i,o)}},l.UnaryExpression=function(e,n,l,o){var u=e.argument;if(r.isVirtualPropertyExpression(u)&&"delete"===e.operator){var s=t.template("abstract-expression-delete",{PROPERTY:u.property,OBJECT:u.object});return a(n,s,r.literal(!0),o)}},l.CallExpression=function(e,n,l){var a=e.callee;if(r.isVirtualPropertyExpression(a)){var o=l.generateTempBasedOnNode(a.object),u=t.template("abstract-expression-call",{PROPERTY:a.property,OBJECT:o||a.object});return u.arguments=u.arguments.concat(e.arguments),o?r.sequenceExpression([r.assignmentExpression("=",o,a.object),u]):u}},l.VirtualPropertyExpression=function(e){return t.template("abstract-expression-get",{PROPERTY:e.property,OBJECT:e.object})},l.PrivateDeclaration=function(e){return r.variableDeclaration("const",e.declarations.map(function(e){return r.variableDeclarator(e,r.newExpression(r.identifier("WeakMap"),[]))}))}},{"../../../types":120,"../../../util":122}],78:[function(e,n,l){"use strict";var t=e("../../helpers/build-comprehension"),r=e("../../../traversal"),a=e("../../../util"),o=e("../../../types");l.experimental=!0,l.ComprehensionExpression=function(e,n,l,t){var r=s;return e.generator&&(r=u),r(e,n,l,t)};var u=function(e){var n=[],l=o.functionExpression(null,[],o.blockStatement(n),!0);return l._aliasFunction=!0,n.push(t(e,function(){return o.expressionStatement(o.yieldExpression(e.body))})),o.callExpression(l,[])},s=function(e,n,l,u){var s=l.generateUidBasedOnNode(n,u),i=a.template("array-comprehension-container",{KEY:s});i.callee._aliasFunction=!0;var c=i.callee.body,d=c.body;r.hasType(e,l,"YieldExpression",o.FUNCTION_TYPES)&&(i.callee.generator=!0,i=o.yieldExpression(i,!0));var p=d.pop();return d.push(t(e,function(){return a.template("array-push",{STATEMENT:e.body,KEY:s},!0)})),d.push(p),i}},{"../../../traversal":115,"../../../types":120,"../../../util":122,"../../helpers/build-comprehension":31}],79:[function(e,n,l){"use strict";l.experimental=!0;var t=e("../../helpers/build-binary-assignment-operator-transformer"),r=e("../../../types"),a=r.memberExpression(r.identifier("Math"),r.identifier("pow"));t(l,{operator:"**",build:function(e,n){return r.callExpression(a,[e,n])}})},{"../../../types":120,"../../helpers/build-binary-assignment-operator-transformer":30}],80:[function(e,n,l){"use strict";var t=e("../../../types");l.experimental=!0,l.manipulateOptions=function(e){e.whitelist.length&&e.whitelist.push("es6.destructuring")};var r=function(e){for(var n=0;n<e.properties.length;n++)if(t.isSpreadProperty(e.properties[n]))return!0;return!1};l.ObjectExpression=function(e,n,l,a){if(r(e)){for(var o=[],u=[],s=function(){u.length&&(o.push(t.objectExpression(u)),u=[])},i=0;i<e.properties.length;i++){var c=e.properties[i];t.isSpreadProperty(c)?(s(),o.push(c.argument)):u.push(c)}return s(),t.isObjectExpression(o[0])||o.unshift(t.objectExpression([])),t.callExpression(a.addHelper("extends"),o)}}},{"../../../types":120}],81:[function(e,n){"use strict";n.exports={useStrict:e("./other/use-strict"),"validation.undeclaredVariableCheck":e("./validation/undeclared-variable-check"),"validation.noForInOfAssignment":e("./validation/no-for-in-of-assignment"),"validation.setters":e("./validation/setters"),"validation.react":e("./validation/react"),"spec.functionName":e("./spec/function-name"),"spec.blockScopedFunctions":e("./spec/block-scoped-functions"),"es6.arrowFunctions":e("./es6/arrow-functions"),"playground.malletOperator":e("./playground/mallet-operator"),"playground.methodBinding":e("./playground/method-binding"),"playground.memoizationOperator":e("./playground/memoization-operator"),"playground.objectGetterMemoization":e("./playground/object-getter-memoization"),reactCompat:e("./other/react-compat"),flow:e("./other/flow"),react:e("./other/react"),_modules:e("./internal/modules"),"es7.comprehensions":e("./es7/comprehensions"),"es6.classes":e("./es6/classes"),asyncToGenerator:e("./other/async-to-generator"),bluebirdCoroutines:e("./other/bluebird-coroutines"),"es6.objectSuper":e("./es6/object-super"),"es7.objectRestSpread":e("./es7/object-rest-spread"),"es7.exponentiationOperator":e("./es7/exponentiation-operator"),"es6.templateLiterals":e("./es6/template-literals"),"es5.properties.mutators":e("./es5/properties.mutators"),"es6.properties.shorthand":e("./es6/properties.shorthand"),"es6.properties.computed":e("./es6/properties.computed"),"es6.forOf":e("./es6/for-of"),"es6.unicodeRegex":e("./es6/unicode-regex"),"es7.abstractReferences":e("./es7/abstract-references"),"es6.constants":e("./es6/constants"),"es6.parameters.rest":e("./es6/parameters.rest"),"es6.spread":e("./es6/spread"),"es6.parameters.default":e("./es6/parameters.default"),"es6.destructuring":e("./es6/destructuring"),"es6.blockScoping":e("./es6/block-scoping"),"es6.blockScopingTDZ":e("./es6/block-scoping-tdz"),"es6.tailCall":e("./es6/tail-call"),regenerator:e("./other/regenerator"),runtime:e("./other/runtime"),"es6.modules":e("./es6/modules"),_blockHoist:e("./internal/block-hoist"),"spec.protoToAssign":e("./spec/proto-to-assign"),_declarations:e("./internal/declarations"),_aliasFunctions:e("./internal/alias-functions"),"spec.typeofSymbol":e("./spec/typeof-symbol"),"spec.undefinedToVoid":e("./spec/undefined-to-void"),_useStrict:e("./internal/use-strict"),_moduleFormatter:e("./internal/module-formatter"),"es3.propertyLiterals":e("./es3/property-literals"),"es3.memberExpressionLiterals":e("./es3/member-expression-literals"),"minification.removeDebugger":e("./minification/remove-debugger"),"minification.removeConsoleCalls":e("./minification/remove-console-calls"),"minification.deadCodeElimination":e("./minification/dead-code-elimination"),"minification.renameLocalVariables":e("./minification/rename-local-variables"),_cleanUp:e("./internal/cleanup")}},{"./es3/member-expression-literals":57,"./es3/property-literals":58,"./es5/properties.mutators":59,"./es6/arrow-functions":60,"./es6/block-scoping":62,"./es6/block-scoping-tdz":61,"./es6/classes":63,"./es6/constants":64,"./es6/destructuring":65,"./es6/for-of":66,"./es6/modules":67,"./es6/object-super":68,"./es6/parameters.default":69,"./es6/parameters.rest":70,"./es6/properties.computed":71,"./es6/properties.shorthand":72,"./es6/spread":73,"./es6/tail-call":74,"./es6/template-literals":75,"./es6/unicode-regex":76,"./es7/abstract-references":77,"./es7/comprehensions":78,"./es7/exponentiation-operator":79,"./es7/object-rest-spread":80,"./internal/alias-functions":82,"./internal/block-hoist":83,"./internal/cleanup":84,"./internal/declarations":85,"./internal/module-formatter":86,"./internal/modules":87,"./internal/use-strict":88,"./minification/dead-code-elimination":89,"./minification/remove-console-calls":90,"./minification/remove-debugger":91,"./minification/rename-local-variables":92,"./other/async-to-generator":93,"./other/bluebird-coroutines":94,"./other/flow":95,"./other/react":97,"./other/react-compat":96,"./other/regenerator":98,"./other/runtime":99,"./other/use-strict":100,"./playground/mallet-operator":101,"./playground/memoization-operator":102,"./playground/method-binding":103,"./playground/object-getter-memoization":104,"./spec/block-scoped-functions":105,"./spec/function-name":106,"./spec/proto-to-assign":107,"./spec/typeof-symbol":108,"./spec/undefined-to-void":109,"./validation/no-for-in-of-assignment":110,"./validation/react":111,"./validation/setters":112,"./validation/undeclared-variable-check":113}],82:[function(e,n,l){"use strict";var t=e("../../../types"),r={enter:function(e,n,l,r){if(t.isFunction(e)&&!e._aliasFunction)return this.skip();if(e._ignoreAliasFunctions)return this.skip();var a;if(t.isIdentifier(e)&&"arguments"===e.name)a=r.getArgumentsId;else{if(!t.isThisExpression(e))return;a=r.getThisId}return t.isReferenced(e,n)?a():void 0}},a={enter:function(e,n,l,a){return e._aliasFunction?(l.traverse(e,r,a),this.skip()):t.isFunction(e)?this.skip():void 0}},o=function(e,n,l){var r,o,u={getArgumentsId:function(){return!r&&(r=l.generateUidIdentifier("arguments")),r},getThisId:function(){return!o&&(o=l.generateUidIdentifier("this")),o}};l.traverse(n,a,u);var s,i=function(n,l){s||(s=e()),s.unshift(t.variableDeclaration("var",[t.variableDeclarator(n,l)]))};r&&i(r,t.identifier("arguments")),o&&i(o,t.thisExpression())};l.Program=function(e,n,l){o(function(){return e.body},e,l)},l.FunctionDeclaration=l.FunctionExpression=function(e,n,l){o(function(){return t.ensureBlock(e),e.body.body},e,l)}},{"../../../types":120}],83:[function(e,n,l){"use strict";var t=e("lodash/collection/groupBy"),r=e("lodash/array/flatten"),a=e("lodash/object/values");l.BlockStatement=l.Program={exit:function(e){for(var n=!1,l=0;l<e.body.length;l++){var o=e.body[l];o&&null!=o._blockHoist&&(n=!0)}if(n){var u=t(e.body,function(e){var n=e._blockHoist;return null==n&&(n=1),n===!0&&(n=2),n});e.body=r(a(u).reverse())}}}},{"lodash/array/flatten":193,"lodash/collection/groupBy":200,"lodash/object/values":299}],84:[function(e,n,l){"use strict";l.SequenceExpression=function(e){return 1===e.expressions.length?e.expressions[0]:void 0}},{}],85:[function(e,n,l){"use strict";var t=e("../../helpers/use-strict"),r=e("../../../types");l.secondPass=!0,l.BlockStatement=l.Program=function(e,n,l,a){e._declarations&&t.wrap(e,function(){var n,l={};for(var t in e._declarations){var o=e._declarations[t];n=o.kind||"var";var u=r.variableDeclarator(o.id,o.init);if(o.init)e.body.unshift(a.attachAuxiliaryComment(r.variableDeclaration(n,[u])));else{var s=l,i=n;s[i]||(s[i]=[]),l[n].push(u)}}for(n in l)e.body.unshift(a.attachAuxiliaryComment(r.variableDeclaration(n,l[n])));e._declarations=null})}},{"../../../types":120,"../../helpers/use-strict":41}],86:[function(e,n,l){"use strict";var t=e("../../helpers/use-strict");l.Program=function(e,n,l,r){r.transformers["es6.modules"].canRun()&&(t.wrap(e,function(){e.body=r.dynamicImports.concat(e.body)}),r.moduleFormatter.transform&&r.moduleFormatter.transform(e))}},{"../../helpers/use-strict":41}],87:[function(e,n,l){"use strict";var t=e("../../../types"),r=function(e){var n=function(){return e.apply(this,arguments)};return n.toString=function(){return e.toString()},n}(function(e,n,l,t){var r=t.opts.resolveModuleSource;e.source&&r&&(e.source.value=r(e.source.value))});l.check=function(e){return t.isImportDeclaration(e)||t.isExportDeclaration(e)},l.ImportDeclaration=r,l.ExportDeclaration=function(e,n,l){if(r.apply(null,arguments),!e.isType){var a=e.declaration;if(e["default"]){if(t.isClassDeclaration(a))return e.declaration=a.id,[a,e];if(t.isClassExpression(a)){var o=l.generateUidIdentifier("default");return a=t.variableDeclaration("var",[t.variableDeclarator(o,a)]),e.declaration=o,[a,e]}if(t.isFunctionDeclaration(a))return e._blockHoist=2,e.declaration=a.id,[a,e]}else if(t.isFunctionDeclaration(a))return e.specifiers=[t.importSpecifier(a.id,a.id)],e.declaration=null,e._blockHoist=2,[a,e]}}},{"../../../types":120}],88:[function(e,n,l){"use strict";var t=e("../../../types");l.Program=function(e,n,l,r){r.transformers.useStrict.canRun()&&e.body.unshift(t.expressionStatement(t.literal("use strict")))}},{"../../../types":120}],89:[function(e,n,l){"use strict";var t=e("../../../types");l.optional=!0,l.ExpressionStatement=function(e){var n=e.expression;(t.isLiteral(n)||t.isIdentifier(e)&&t.hasBinding(e.name))&&this.remove()},l.IfStatement={exit:function(e){var n=e.consequent,l=e.alternate,r=e.test;return t.isLiteral(r)&&r.value?n:t.isFalsyExpression(r)?l?l:this.remove():(t.isBlockStatement(l)&&!l.body.length&&(l=e.alternate=null),void(t.blockStatement(n)&&!n.body.length&&t.isBlockStatement(l)&&l.body.length&&(e.consequent=e.alternate,e.alternate=null,e.test=t.unaryExpression("!",r,!0))))}}},{"../../../types":120}],90:[function(e,n,l){"use strict";var t=e("../../../types"),r=t.buildMatchMemberExpression("console",!0);l.optional=!0,l.CallExpression=function(e,n){r(e.callee)&&(t.isExpressionStatement(n)?this.parentPath.remove():this.remove())}},{"../../../types":120}],91:[function(e,n,l){"use strict";var t=e("../../../types");l.optional=!0,l.ExpressionStatement=function(e){t.isIdentifier(e.expression,{name:"debugger"})&&this.remove()}},{"../../../types":120}],92:[function(e,n,l){"use strict";l.optional=!0,l.Scopable=function(){}},{}],93:[function(e,n,l){"use strict";var t=e("../../helpers/remap-async-to-generator"),r=e("./bluebird-coroutines");l.optional=!0,l.manipulateOptions=r.manipulateOptions,l.Function=function(e,n,l,r){return e.async&&!e.generator?t(e,r.addHelper("async-to-generator"),l):void 0}},{"../../helpers/remap-async-to-generator":39,"./bluebird-coroutines":94}],94:[function(e,n,l){"use strict";var t=e("../../helpers/remap-async-to-generator"),r=e("../../../types");l.manipulateOptions=function(e){e.experimental=!0,e.blacklist.push("regenerator")},l.optional=!0,l.Function=function(e,n,l,a){return e.async&&!e.generator?t(e,r.memberExpression(a.addImport("bluebird",null,!0),r.identifier("coroutine")),l):void 0}},{"../../../types":120,"../../helpers/remap-async-to-generator":39}],95:[function(e,n,l){"use strict";var t=e("../../../types");l.TypeCastExpression=function(e){return e.expression},l.ImportDeclaration=function(e){e.isType&&this.remove()},l.ExportDeclaration=function(e){t.isTypeAlias(e.declaration)&&this.remove()}},{"../../../types":120}],96:[function(e,n,l){"use strict";var t=e("../../helpers/react"),r=e("../../../types");l.manipulateOptions=function(e){e.blacklist.push("react")},l.optional=!0,e("../../helpers/build-react-transformer")(l,{pre:function(e){e.callee=e.tagExpr},post:function(e){t.isCompatTag(e.tagName)&&(e.call=r.callExpression(r.memberExpression(r.memberExpression(r.identifier("React"),r.identifier("DOM")),e.tagExpr,r.isLiteral(e.tagExpr)),e.args))}})},{"../../../types":120,"../../helpers/build-react-transformer":33,"../../helpers/react":38}],97:[function(e,n,l){"use strict";var t=e("../../helpers/react"),r=e("../../../types"),a=/^\*\s*@jsx\s+([^\s]+)/;l.Program=function(e,n,l,t){for(var o="React.createElement",u=0;u<t.ast.comments.length;u++){var s=t.ast.comments[u],i=a.exec(s.value);if(i){if(o=i[1],"React.DOM"===o)throw t.errorWithNode(s,"The @jsx React.DOM pragma has been deprecated as of React 0.12");break}}t.set("jsxIdentifier",o.split(".").map(r.identifier).reduce(function(e,n){return r.memberExpression(e,n)}))},e("../../helpers/build-react-transformer")(l,{pre:function(e){var n=e.tagName,l=e.args;l.push(t.isCompatTag(n)?r.literal(n):e.tagExpr)},post:function(e,n){e.callee=n.get("jsxIdentifier")}})},{"../../../types":120,"../../helpers/build-react-transformer":33,"../../helpers/react":38}],98:[function(e,n,l){"use strict";var t=e("regenerator-babel"),r=e("../../../types");l.check=function(e){return r.isFunction(e)&&(e.async||e.generator)},l.Program={enter:function(e){t.transform(e),this.stop()}}},{"../../../types":120,"regenerator-babel":312}],99:[function(e,n,l){"use strict";var t=e("lodash/collection/includes"),r=e("../../../util"),a=e("core-js/library"),o=e("lodash/object/has"),u=e("../../../types"),s=u.buildMatchMemberExpression("Symbol.iterator"),i=function(e){return"_"!==e.name&&o(a,e.name)},c=["Symbol","Promise","Map","WeakMap","Set","WeakSet"],d={enter:function(e,n,l,d){var p;if(u.isMemberExpression(e)&&u.isReferenced(e,n)){var f=e.object;if(p=e.property,!u.isReferenced(f,e))return;if(!e.computed&&i(f)&&o(a[f.name],p.name)&&!l.getBindingIdentifier(f.name))return this.skip(),u.prependToMemberExpression(e,d.get("coreIdentifier"))}else{if(u.isReferencedIdentifier(e,n)&&!u.isMemberExpression(n)&&t(c,e.name)&&!l.getBindingIdentifier(e.name))return u.memberExpression(d.get("coreIdentifier"),e);if(u.isCallExpression(e)){var g=e.callee;return e.arguments.length?!1:u.isMemberExpression(g)&&g.computed?(p=g.property,s(p)?r.template("corejs-iterator",{CORE_ID:d.get("coreIdentifier"),VALUE:g.object}):!1):!1}if(u.isBinaryExpression(e)){if("in"!==e.operator)return;var h=e.left;if(!s(h))return;return r.template("corejs-is-iterator",{CORE_ID:d.get("coreIdentifier"),VALUE:e.right})}}}};l.optional=!0,l.manipulateOptions=function(e){e.whitelist.length&&e.whitelist.push("es6.modules")},l.Program=function(e,n,l,t){l.traverse(e,d,t)},l.pre=function(e){e.setDynamic("helpersNamespace",function(){return e.addImport("babel-runtime/helpers","babelHelpers")}),e.setDynamic("coreIdentifier",function(){return e.addImport("babel-runtime/core-js","core")}),e.setDynamic("regeneratorIdentifier",function(){return e.addImport("babel-runtime/regenerator","regeneratorRuntime")})},l.Identifier=function(e,n,l,t){return u.isReferencedIdentifier(e,n,{name:"regeneratorRuntime"})?t.get("regeneratorIdentifier"):void 0}},{"../../../types":120,"../../../util":122,"core-js/library":173,"lodash/collection/includes":201,"lodash/object/has":296}],100:[function(e,n,l){"use strict";var t=e("../../../messages"),r=e("../../../types");l.Program=function(e){var n=e.body[0];r.isExpressionStatement(n)&&r.isLiteral(n.expression,{value:"use strict"})&&e.body.shift()},l.FunctionDeclaration=l.FunctionExpression=function(){this.skip()},l.ThisExpression=function(){return r.identifier("undefined")},l.CallExpression=function(e,n,l,a){if(r.isIdentifier(e.callee,{name:"eval"}))throw a.errorWithNode(e,t.get("evalInStrictMode"))}},{"../../../messages":27,"../../../types":120}],101:[function(e,n,l){"use strict";var t=e("../../../messages"),r=e("../../helpers/build-conditional-assignment-operator-transformer"),a=e("../../../types");l.playground=!0,r(l,{is:function(e){var n=function(){return e.apply(this,arguments)};return n.toString=function(){return e.toString()},n}(function(e,n){var l=a.isAssignmentExpression(e)&&"||="===e.operator;if(l){var r=e.left;if(!a.isMemberExpression(r)&&!a.isIdentifier(r))throw n.errorWithNode(r,t.get("expectedMemberExpressionOrIdentifier"));return!0}}),build:function(e){return a.unaryExpression("!",e,!0)}})},{"../../../messages":27,"../../../types":120,"../../helpers/build-conditional-assignment-operator-transformer":32}],102:[function(e,n,l){"use strict";var t=e("../../helpers/build-conditional-assignment-operator-transformer"),r=e("../../../types");l.playground=!0,t(l,{is:function(e){var n=function(){return e.apply(this,arguments)};return n.toString=function(){return e.toString()},n}(function(e){var n=r.isAssignmentExpression(e)&&"?="===e.operator;
return n&&r.assertMemberExpression(e.left),n}),build:function(e,n){return r.unaryExpression("!",r.callExpression(r.memberExpression(n.addHelper("has-own"),r.identifier("call")),[e.object,e.property]),!0)}})},{"../../../types":120,"../../helpers/build-conditional-assignment-operator-transformer":32}],103:[function(e,n,l){"use strict";var t=e("../../../types");l.playground=!0,l.BindMemberExpression=function(e,n,l){var r=e.object,a=e.property,o=l.generateTempBasedOnNode(e.object);o&&(r=o);var u=t.callExpression(t.memberExpression(t.memberExpression(r,a),t.identifier("bind")),[r].concat(e.arguments));return o?t.sequenceExpression([t.assignmentExpression("=",o,e.object),u]):u},l.BindFunctionExpression=function(e,n,l){var r=function(n){var r=l.generateUidIdentifier("val");return t.functionExpression(null,[r],t.blockStatement([t.returnStatement(t.callExpression(t.memberExpression(r,e.callee),n))]))},a=l.generateTemp("args");return t.sequenceExpression([t.assignmentExpression("=",a,t.arrayExpression(e.arguments)),r(e.arguments.map(function(e,n){return t.memberExpression(a,t.literal(n),!0)}))])}},{"../../../types":120}],104:[function(e,n,l){"use strict";var t=e("../../../types");l.playground=!0;var r={enter:function(e,n,l,r){return t.isFunction(e)?this.skip():void(t.isReturnStatement(e)&&e.argument&&(e.argument=t.memberExpression(t.callExpression(r.file.addHelper("define-property"),[t.thisExpression(),r.key,e.argument]),r.key,!0)))}};l.Property=l.MethodDefinition=function(e,n,l,a){if("memo"===e.kind){e.kind="get";var o=e.value;t.ensureBlock(o);var u=e.key;t.isIdentifier(u)&&!e.computed&&(u=t.literal(u.name));var s={key:u,file:a};return l.traverse(o,r,s),e}}},{"../../../types":120}],105:[function(e,n,l){"use strict";var t=e("../../../types");l.BlockStatement=function(e,n,l,r){if(!(t.isFunction(n)&&n.body===e||t.isExportDeclaration(n)))for(var a=0;a<e.body.length;a++){var o=e.body[a];if(t.isFunctionDeclaration(o)){var u=t.variableDeclaration("let",[t.variableDeclarator(o.id,t.toExpression(o))]);u._blockHoist=2,o.id=null,e.body[a]=u,r.checkNode(u)}}}},{"../../../types":120}],106:[function(e,n,l){"use strict";var t=e("../../helpers/name-method");l.FunctionExpression=t.bare},{"../../helpers/name-method":37}],107:[function(e,n,l){"use strict";var t=e("../../../types"),r=e("lodash/array/pull"),a=function(e){return t.isLiteral(t.toComputedKey(e,e.key),{value:"__proto__"})},o=function(e){var n=e.left;return t.isMemberExpression(n)&&t.isLiteral(t.toComputedKey(n,n.property),{value:"__proto__"})},u=function(e,n,l){return t.expressionStatement(t.callExpression(l.addHelper("defaults"),[n,e.right]))};l.optional=!0,l.secondPass=!0,l.AssignmentExpression=function(e,n,l,r){if(o(e)){var a=[],s=e.left.object,i=l.generateTempBasedOnNode(e.left.object);return a.push(t.expressionStatement(t.assignmentExpression("=",i,s))),a.push(u(e,i,r)),i&&a.push(i),t.toSequenceExpression(a)}},l.ExpressionStatement=function(e,n,l,r){var a=e.expression;if(t.isAssignmentExpression(a,{operator:"="}))return o(a)?u(a,a.left.object,r):void 0},l.ObjectExpression=function(e,n,l,o){for(var u,s=0;s<e.properties.length;s++){var i=e.properties[s];a(i)&&(u=i.value,r(e.properties,i))}if(u){var c=[t.objectExpression([]),u];return e.properties.length&&c.push(e),t.callExpression(o.addHelper("extends"),c)}}},{"../../../types":120,"lodash/array/pull":195}],108:[function(e,n,l){"use strict";var t=e("../../../types");l.optional=!0,l.UnaryExpression=function(e,n,l,r){if(this.skip(),"typeof"===e.operator){var a=t.callExpression(r.addHelper("typeof"),[e.argument]);if(t.isIdentifier(e.argument)){var o=t.literal("undefined");return t.conditionalExpression(t.binaryExpression("===",t.unaryExpression("typeof",e.argument),o),o,a)}return a}}},{"../../../types":120}],109:[function(e,n,l){"use strict";var t=e("../../../types");l.optional=!0,l.Identifier=function(e,n){return"undefined"===e.name&&t.isReferenced(e,n)?t.unaryExpression("void",t.literal(0),!0):void 0}},{"../../../types":120}],110:[function(e,n,l){"use strict";var t=e("../../../messages"),r=e("../../../types");l.check=r.isFor,l.ForInStatement=l.ForOfStatement=function(e,n,l,a){var o=e.left;if(r.isVariableDeclaration(o)){var u=o.declarations[0];if(u.init)throw a.errorWithNode(u,t.get("noAssignmentsInForHead"))}}},{"../../../messages":27,"../../../types":120}],111:[function(e,n,l){"use strict";var t=e("../../../messages"),r=e("../../../types"),a=function(e,n){if(r.isLiteral(e)){var l=e.value,a=l.toLowerCase();if("react"===a&&l!==a)throw n.errorWithNode(e,t.get("didYouMean","react"))}};l.CallExpression=function(e,n,l,t){r.isIdentifier(e.callee,{name:"require"})&&1===e.arguments.length&&a(e.arguments[0],t)},l.ImportDeclaration=l.ExportDeclaration=function(e,n,l,t){a(e.source,t)}},{"../../../messages":27,"../../../types":120}],112:[function(e,n,l){"use strict";var t=e("../../../messages");l.check=function(e){return"set"===e.kind},l.MethodDefinition=l.Property=function(e,n,l,r){if("set"===e.kind&&1!==e.value.params.length)throw r.errorWithNode(e.value,t.get("settersInvalidParamLength"))}},{"../../../messages":27}],113:[function(e,n,l){"use strict";var t=e("leven"),r=e("../../../messages"),a=e("../../../types");l.optional=!0,l.Identifier=function(e,n,l,o){if(a.isReferenced(e,n)&&!l.hasBinding(e.name)){var u,s=l.getAllBindings(),i=-1;for(var c in s){var d=t(e.name,c);0>=d||d>3||i>=d||(u=c,i=d)}var p;throw p=u?r.get("undeclaredVariableSuggestion",e.name,u):r.get("undeclaredVariable",e.name),o.errorWithNode(e,p,ReferenceError)}}},{"../../../messages":27,"../../../types":120,leven:189}],114:[function(e,n){"use strict";function l(e,n,l,t){this.shouldFlatten=!1,this.parentPath=t,this.scope=e,this.state=l,this.opts=n}n.exports=l;var t=e("./path"),r=e("lodash/array/flatten"),a=e("lodash/array/compact");l.prototype.flatten=function(){this.shouldFlatten=!0},l.prototype.visitNode=function(e,n,l){var r=new t(this,e,n,l);return r.visit()},l.prototype.visit=function(e,n){var l=e[n];if(l){if(!Array.isArray(l))return this.visitNode(e,e,n);if(0!==l.length){for(var t=0;t<l.length;t++)if(l[t]&&this.visitNode(e,l,t))return!0;this.shouldFlatten&&(e[n]=r(e[n]),"body"===n&&(e[n]=a(e[n])))}}}},{"./path":116,"lodash/array/compact":192,"lodash/array/flatten":193}],115:[function(e,n){"use strict";function l(e,n,t,r){if(e){if(!n.noScope&&!t&&"Program"!==e.type&&"File"!==e.type)throw new Error("Must pass a scope unless traversing a Program/File got a "+e.type+" node");if(n||(n={}),n.enter||(n.enter=function(){}),n.exit||(n.exit=function(){}),Array.isArray(e))for(var a=0;a<e.length;a++)l.node(e[a],n,t,r);else l.node(e,n,t,r)}}function t(e){e._declarations=null,e.extendedRange=null,e._scopeInfo=null,e.tokens=null,e.range=null,e.start=null,e.end=null,e.loc=null,e.raw=null,Array.isArray(e.trailingComments)&&r(e.trailingComments),Array.isArray(e.leadingComments)&&r(e.leadingComments)}function r(e){for(var n=0;n<e.length;n++)t(e[n])}function a(e,n,l,t){e.type===t.type&&(t.has=!0,this.skip())}n.exports=l;var o=e("./context"),u=e("lodash/collection/includes"),s=e("../types");l.node=function(e,n,l,t,r){var a=s.VISITOR_KEYS[e.type];if(a)for(var u=new o(l,n,t,r),i=0;i<a.length;i++)if(u.visit(e,a[i]))return};var i={noScope:!0,enter:t};l.removeProperties=function(e){return t(e),l(e,i),e},l.explode=function(e){for(var n in e){var l=e[n],t=s.FLIPPED_ALIAS_KEYS[n];if(t)for(var r=0;r<t.length;r++)e[t[r]]=l}return e},l.hasType=function(e,n,t,r){if(u(r,e.type))return!1;if(e.type===t)return!0;var o={has:!1,type:t};return l(e,{blacklist:r,enter:a},n,o),o.has}},{"../types":120,"./context":114,"lodash/collection/includes":201}],116:[function(e,n){"use strict";function l(e,n,l,t){this.shouldRemove=!1,this.shouldSkip=!1,this.shouldStop=!1,this.parentPath=e.parentPath,this.context=e,this.state=this.context.state,this.opts=this.context.opts,this.container=l,this.key=t,this.parent=n,this.state=e.state,this.setScope()}n.exports=l;var t=e("./index"),r=e("lodash/collection/includes"),a=e("./scope"),o=e("../types");l.getScope=function(e,n,l){var t=l;return o.isScope(e,n)&&(t=new a(e,n,l)),t},l.prototype.setScope=function(){this.scope=l.getScope(this.node,this.parent,this.context.scope)},l.prototype.remove=function(){this.shouldRemove=!0,this.shouldSkip=!0},l.prototype.skip=function(){this.shouldSkip=!0},l.prototype.stop=function(){this.shouldStop=!0,this.shouldSkip=!0},l.prototype.flatten=function(){this.context.flatten()},Object.defineProperty(l.prototype,"node",{get:function(){return this.container[this.key]},set:function(e){var n=Array.isArray(e),l=e;n&&(l=e[0]),l&&o.inheritsComments(l,this.node),this.container[this.key]=e,this.setScope();var t=this.scope&&this.scope.file;if(t)if(n)for(var a=0;a<e.length;a++)t.checkNode(e[a],this.scope);else t.checkNode(e,this.scope);n&&(r(o.STATEMENT_OR_BLOCK_KEYS,this.key)&&!o.isBlockStatement(this.container)&&o.ensureBlock(this.container,this.key),this.flatten())}}),l.prototype.call=function(e){var n=this.node;if(n){var l=this.opts,t=l[e]||l;l[n.type]&&(t=l[n.type][e]||t);var r=t.call(this,n,this.parent,this.scope,this.state);r&&(this.node=r),this.shouldRemove&&(this.container[this.key]=null,this.flatten())}},l.prototype.visit=function(){var e=this.opts,n=this.node;if(!(e.blacklist&&e.blacklist.indexOf(n.type)>-1)){if(this.call("enter"),this.shouldSkip)return this.shouldStop;if(n=this.node,Array.isArray(n))for(var l=0;l<n.length;l++)t.node(n[l],e,this.scope,this.state,this);else t.node(n,e,this.scope,this.state,this),this.call("exit");return this.shouldStop}},l.prototype.isReferencedIdentifier=function(){return o.isReferencedIdentifier(this.node)}},{"../types":120,"./index":115,"./scope":117,"lodash/collection/includes":201}],117:[function(e,n){"use strict";function l(e,n,l,t){this.parent=l,this.file=l?l.file:t,this.parentBlock=n,this.block=e,this.crawl()}n.exports=l;var t=e("lodash/collection/includes"),r=e("./index"),a=e("lodash/object/defaults"),o=e("../messages"),u=e("globals"),s=e("lodash/array/flatten"),i=e("lodash/object/extend"),c=e("../helpers/object"),d=e("lodash/collection/each"),p=e("../types");l.globals=s([u.builtin,u.browser,u.node].map(Object.keys)),l.prototype.traverse=function(e,n,l){r(e,n,this,l)},l.prototype.generateTemp=function(e){var n=this.generateUidIdentifier(e||"temp");return this.push({key:n.name,id:n}),n},l.prototype.generateUidIdentifier=function(e){var n=p.identifier(this.generateUid(e));return this.getFunctionParent().registerBinding("uid",n),n},l.prototype.generateUid=function(e){e=p.toIdentifier(e).replace(/^_+/,"");var n,l=0;do n=this._generateUid(e,l),l++;while(this.hasBinding(n)||this.hasGlobal(n));return n},l.prototype._generateUid=function(e,n){var l=e;return n>1&&(l+=n),"_"+l},l.prototype.generateUidBasedOnNode=function(e){var n=e;p.isAssignmentExpression(e)?n=e.left:p.isVariableDeclarator(e)?n=e.id:p.isProperty(n)&&(n=n.key);var l=[],t=function(e){var n=function(){return e.apply(this,arguments)};return n.toString=function(){return e.toString()},n}(function(e){p.isMemberExpression(e)?(t(e.object),t(e.property)):p.isIdentifier(e)?l.push(e.name):p.isLiteral(e)?l.push(e.value):p.isCallExpression(e)&&t(e.callee)});t(n);var r=l.join("$");return r=r.replace(/^_/,"")||"ref",this.generateUidIdentifier(r)},l.prototype.generateTempBasedOnNode=function(e){if(p.isIdentifier(e)&&this.hasBinding(e.name))return null;var n=this.generateUidBasedOnNode(e);return this.push({key:n.name,id:n}),n},l.prototype.checkBlockScopedCollisions=function(e,n,l){var t=this.getOwnBindingInfo(n);if(t&&"param"!==e&&!("hoisted"===e&&"let"===t.kind||"let"!==t.kind&&"const"!==t.kind&&"module"!==t.kind))throw this.file.errorWithNode(l,o.get("scopeDuplicateDeclaration",n),TypeError)},l.prototype.rename=function(e,n){n||(n=this.generateUidIdentifier(e).name);var l=this.getBindingInfo(e);if(l){var t=l.identifier,r=l.scope;r.traverse(r.block,{enter:function(l,r,a){if(p.isReferencedIdentifier(l,r)&&l.name===e)l.name=n;else if(p.isDeclaration(l)){var o=p.getBindingIdentifiers(l);for(var u in o)u===e&&(o[u].name=n)}else p.isScope(l,r)&&(a.bindingIdentifierEquals(e,t)||this.skip())}}),this.clearOwnBinding(e),r.bindings[n]=l,t.name=n}},l.prototype.inferType=function(e){var n;if(p.isVariableDeclarator(e)&&(n=e.init),p.isArrayExpression(n))return p.genericTypeAnnotation(p.identifier("Array"));if(!p.isObjectExpression(n)&&!p.isLiteral(n)){if(p.isCallExpression(n)&&p.isIdentifier(n.callee)){var l=this.getBindingInfo(n.callee.name);if(l){var t=l.node;return!l.reassigned&&p.isFunction(t)&&e.returnType}}p.isIdentifier(n)}},l.prototype.isTypeGeneric=function(e,n){var l=this.getBindingInfo(e);if(!l)return!1;var t=l.typeAnnotation;return p.isGenericTypeAnnotation(t)&&p.isIdentifier(t.id,{name:n})},l.prototype.assignTypeGeneric=function(e,n){this.assignType(e,p.genericTypeAnnotation(p.identifier(n)))},l.prototype.assignType=function(e,n){var l=this.getBindingInfo(e);l&&(l.identifier.typeAnnotation=l.typeAnnotation=n)},l.prototype.getTypeAnnotation=function(e,n,l){var t,r={annotation:null,inferred:!1};return n.typeAnnotation&&(t=n.typeAnnotation),t||(r.inferred=!0,t=this.inferType(l)),t&&(p.isTypeAnnotation(t)&&(t=t.typeAnnotation),r.annotation=t),r},l.prototype.toArray=function(e,n){var l=this.file;if(p.isIdentifier(e)&&this.isTypeGeneric(e.name,"Array"))return e;if(p.isArrayExpression(e))return e;if(p.isIdentifier(e,{name:"arguments"}))return p.callExpression(p.memberExpression(l.addHelper("slice"),p.identifier("call")),[e]);var t="to-array",r=[e];return n===!0?t="to-consumable-array":n&&(r.push(p.literal(n)),t="sliced-to-array"),p.callExpression(l.addHelper(t),r)},l.prototype.clearOwnBinding=function(e){delete this.bindings[e]},l.prototype.registerDeclaration=function(e){if(p.isFunctionDeclaration(e))this.registerBinding("hoisted",e);else if(p.isVariableDeclaration(e))for(var n=0;n<e.declarations.length;n++)this.registerBinding(e.kind,e.declarations[n]);else p.isClassDeclaration(e)?this.registerBinding("let",e):p.isImportDeclaration(e)||p.isExportDeclaration(e)?this.registerBinding("module",e):this.registerBinding("unknown",e)},l.prototype.registerBindingReassignment=function(e){var n=p.getBindingIdentifiers(e);for(var l in n){var t=this.getBindingInfo(l);t&&(t.reassigned=!0,t.typeAnnotationInferred&&(t.typeAnnotation=null))}},l.prototype.registerBinding=function(e,n){if(!e)throw new ReferenceError("no `kind`");var l=p.getBindingIdentifiers(n);for(var t in l){var r=l[t];this.checkBlockScopedCollisions(e,t,r);var a=this.getTypeAnnotation(t,r,n);this.bindings[t]={typeAnnotationInferred:a.inferred,typeAnnotation:a.annotation,reassigned:!1,identifier:r,scope:this,node:n,kind:e}}},l.prototype.registerVariableDeclaration=function(e){for(var n=e.declarations,l=0;l<n.length;l++)this.registerBinding(n[l],e.kind)};var f={enter:function(e,n,l,t){return p.isFor(e)&&d(p.FOR_INIT_KEYS,function(n){var l=e[n];p.isVar(l)&&t.scope.registerBinding("var",l)}),p.isFunction(e)?this.skip():void(t.blockId&&e===t.blockId||p.isBlockScoped(e)||p.isExportDeclaration(e)&&p.isDeclaration(e.declaration)||p.isDeclaration(e)&&t.scope.registerDeclaration(e))}};l.prototype.addGlobal=function(e){this.globals[e.name]=e},l.prototype.hasGlobal=function(e){var n=this;do if(n.globals[e])return!0;while(n=n.parent);return!1};var g={enter:function(e,n,l,t){p.isReferencedIdentifier(e,n)&&!l.hasBinding(e.name)?t.addGlobal(e):p.isLabeledStatement(e)?t.addGlobal(e):(p.isAssignmentExpression(e)||p.isUpdateExpression(e)||p.isUnaryExpression(e)&&"delete"===e.operator)&&l.registerBindingReassignment(e)}},h={enter:function(e,n,l,t){p.isFunctionDeclaration(e)||p.isBlockScoped(e)?t.registerDeclaration(e):p.isScope(e,n)&&this.skip()}};l.prototype.crawl=function(){var e,n=this.block,l=n._scopeInfo;if(l)return void i(this,l);if(l=n._scopeInfo={bindings:c(),globals:c()},i(this,l),p.isLoop(n)){for(e=0;e<p.FOR_INIT_KEYS.length;e++){var t=n[p.FOR_INIT_KEYS[e]];p.isBlockScoped(t)&&this.registerBinding("let",t)}p.isBlockStatement(n.body)&&(n=n.body)}if(p.isFunctionExpression(n)&&n.id&&(p.isProperty(this.parentBlock,{method:!0})||this.registerBinding("var",n.id)),p.isFunction(n)){for(e=0;e<n.params.length;e++)this.registerBinding("param",n.params[e]);this.traverse(n.body,h,this)}(p.isBlockStatement(n)||p.isProgram(n))&&this.traverse(n,h,this),p.isCatchClause(n)&&this.registerBinding("let",n.param),p.isComprehensionExpression(n)&&this.registerBinding("let",n),(p.isProgram(n)||p.isFunction(n))&&this.traverse(n,f,{blockId:n.id,scope:this}),p.isProgram(n)&&this.traverse(n,g,this)},l.prototype.push=function(e){var n=this.block;if((p.isLoop(n)||p.isCatchClause(n)||p.isFunction(n))&&(p.ensureBlock(n),n=n.body),!p.isBlockStatement(n)&&!p.isProgram(n))throw new TypeError("cannot add a declaration here in node type "+n.type);var l=n;l._declarations||(l._declarations={}),n._declarations[e.key]={kind:e.kind,id:e.id,init:e.init}},l.prototype.getFunctionParent=function(){for(var e=this;e.parent&&!p.isFunction(e.block);)e=e.parent;return e},l.prototype.getAllBindings=function(){var e=c(),n=this;do a(e,n.bindings),n=n.parent;while(n);return e},l.prototype.getAllBindingsOfKind=function(e){var n=c(),l=this;do{for(var t in l.bindings){var r=l.bindings[t];r.kind===e&&(n[t]=r)}l=l.parent}while(l);return n},l.prototype.bindingIdentifierEquals=function(e,n){return this.getBindingIdentifier(e)===n},l.prototype.getBindingInfo=function(e){var n=this;do{var l=n.getOwnBindingInfo(e);if(l)return l}while(n=n.parent)},l.prototype.getOwnBindingInfo=function(e){return this.bindings[e]},l.prototype.getBindingIdentifier=function(e){var n=this.getBindingInfo(e);return n&&n.identifier},l.prototype.getOwnBindingIdentifier=function(e){var n=this.bindings[e];return n&&n.identifier},l.prototype.hasOwnBinding=function(e){return!!this.getOwnBindingInfo(e)},l.prototype.hasBinding=function(e){return e?this.hasOwnBinding(e)?!0:this.parentHasBinding(e)?!0:t(l.globals,e)?!0:!1:!1},l.prototype.parentHasBinding=function(e){return this.parent&&this.parent.hasBinding(e)}},{"../helpers/object":24,"../messages":27,"../types":120,"./index":115,globals:184,"lodash/array/flatten":193,"lodash/collection/each":198,"lodash/collection/includes":201,"lodash/object/defaults":294,"lodash/object/extend":295}],118:[function(e,n){n.exports={ExpressionStatement:["Statement"],BreakStatement:["Statement"],ContinueStatement:["Statement"],DebuggerStatement:["Statement"],DoWhileStatement:["Statement","Loop","While","Scopable"],IfStatement:["Statement"],ReturnStatement:["Statement"],SwitchStatement:["Statement"],ThrowStatement:["Statement"],TryStatement:["Statement"],WhileStatement:["Statement","Loop","While","Scopable"],WithStatement:["Statement"],EmptyStatement:["Statement"],LabeledStatement:["Statement"],VariableDeclaration:["Statement","Declaration"],ExportDeclaration:["Statement","Declaration"],ImportDeclaration:["Statement","Declaration"],PrivateDeclaration:["Statement","Declaration"],ArrowFunctionExpression:["Scopable","Function","Expression"],FunctionDeclaration:["Scopable","Function","Statement","Declaration"],FunctionExpression:["Scopable","Function","Expression"],ImportSpecifier:["ModuleSpecifier"],ExportSpecifier:["ModuleSpecifier"],BlockStatement:["Statement","Scopable"],Program:["Scopable"],CatchClause:["Scopable"],LogicalExpression:["Binary","Expression"],BinaryExpression:["Binary","Expression"],UnaryExpression:["UnaryLike","Expression"],SpreadProperty:["UnaryLike"],SpreadElement:["UnaryLike"],ClassDeclaration:["Statement","Declaration","Class"],ClassExpression:["Class","Expression"],ForOfStatement:["Scopable","Statement","For","Loop"],ForInStatement:["Scopable","Statement","For","Loop"],ForStatement:["Scopable","Statement","For","Loop"],ObjectPattern:["Pattern"],ArrayPattern:["Pattern"],AssignmentPattern:["Pattern"],Property:["UserWhitespacable"],ArrayExpression:["Expression"],AssignmentExpression:["Expression"],AwaitExpression:["Expression"],BindFunctionExpression:["Expression"],BindMemberExpression:["Expression"],CallExpression:["Expression"],ComprehensionExpression:["Expression","Scopable"],ConditionalExpression:["Expression"],Identifier:["Expression"],Literal:["Expression"],MemberExpression:["Expression"],NewExpression:["Expression"],ObjectExpression:["Expression"],SequenceExpression:["Expression"],TaggedTemplateExpression:["Expression"],ThisExpression:["Expression"],UpdateExpression:["Expression"],VirtualPropertyExpression:["Expression"],JSXEmptyExpression:["Expression"],JSXMemberExpression:["Expression"],YieldExpression:["Expression"],JSXAttribute:["JSX"],JSXClosingElement:["JSX"],JSXElement:["JSX","Expression"],JSXEmptyExpression:["JSX"],JSXExpressionContainer:["JSX"],JSXIdentifier:["JSX"],JSXMemberExpression:["JSX"],JSXNamespacedName:["JSX"],JSXOpeningElement:["JSX"],JSXSpreadAttribute:["JSX"]}},{}],119:[function(e,n){n.exports={ArrayExpression:{elements:null},ArrowFunctionExpression:{params:null,body:null},AssignmentExpression:{operator:null,left:null,right:null},BinaryExpression:{operator:null,left:null,right:null},BlockStatement:{body:null},CallExpression:{callee:null,arguments:null},ConditionalExpression:{test:null,consequent:null,alternate:null},ExpressionStatement:{expression:null},File:{program:null,comments:null,tokens:null},FunctionExpression:{id:null,params:null,body:null,generator:!1},FunctionDeclaration:{id:null,params:null,body:null,generator:!1},GenericTypeAnnotation:{id:null,typeParameters:null},Identifier:{name:null},IfStatement:{test:null,consequent:null,alternate:null},ImportDeclaration:{specifiers:null,source:null},ImportSpecifier:{id:null,name:null},Literal:{value:null},LogicalExpression:{operator:null,left:null,right:null},MemberExpression:{object:null,property:null,computed:!1},MethodDefinition:{key:null,value:null,computed:!1,"static":!1,kind:null},NewExpression:{callee:null,arguments:null},ObjectExpression:{properties:null},Program:{body:null},Property:{kind:null,key:null,value:null,computed:!1},ReturnStatement:{argument:null},SequenceExpression:{expressions:null},ThrowExpression:{argument:null},UnaryExpression:{operator:null,argument:null,prefix:null},VariableDeclaration:{kind:null,declarations:null},VariableDeclarator:{id:null,init:null},WithStatement:{object:null,body:null},YieldExpression:{argument:null,delegate:null}}},{}],120:[function(e,n,l){"use strict";function t(e,n){var l=d["is"+e]=function(l,t){return d.is(e,l,t,n)};d["assert"+e]=function(n,t){if(t||(t={}),!l(n,t))throw new Error("Expected type "+JSON.stringify(e)+" with option "+JSON.stringify(t))}}var r=e("../helpers/to-fast-properties"),a=e("lodash/lang/isString"),o=e("lodash/array/compact"),u=e("esutils"),s=e("../helpers/object"),i=e("lodash/collection/each"),c=e("lodash/array/uniq"),d=l;d.STATEMENT_OR_BLOCK_KEYS=["consequent","body"],d.NATIVE_TYPE_NAMES=["Array","Object","Number","Boolean","Date","Array","String"],d.FOR_INIT_KEYS=["left","init"],d.VISITOR_KEYS=e("./visitor-keys"),d.ALIAS_KEYS=e("./alias-keys"),d.FLIPPED_ALIAS_KEYS={},i(d.VISITOR_KEYS,function(e,n){t(n,!0)}),i(d.ALIAS_KEYS,function(e,n){i(e,function(e){var l=d.FLIPPED_ALIAS_KEYS[e]=d.FLIPPED_ALIAS_KEYS[e]||[];l.push(n)})}),i(d.FLIPPED_ALIAS_KEYS,function(e,n){d[n.toUpperCase()+"_TYPES"]=e,t(n,!1)}),d.is=function(e,n,l,t){if(!n)return!1;var r=e===n.type;if(!r&&!t){var a=d.FLIPPED_ALIAS_KEYS[e];"undefined"!=typeof a&&(r=a.indexOf(n.type)>-1)}return r?"undefined"!=typeof l?d.shallowEqual(n,l):!0:!1},d.BUILDER_KEYS=e("./builder-keys"),i(d.VISITOR_KEYS,function(e,n){if(!d.BUILDER_KEYS[n]){var l={};i(e,function(e){l[e]=null}),d.BUILDER_KEYS[n]=l}}),i(d.BUILDER_KEYS,function(e,n){d[n[0].toLowerCase()+n.slice(1)]=function(){var l={};l.start=null,l.type=n;var t=0;for(var r in e){var a=arguments[t++];void 0===a&&(a=e[r]),l[r]=a}return l}}),d.toComputedKey=function(e,n){return e.computed||d.isIdentifier(n)&&(n=d.literal(n.name)),n},d.isFalsyExpression=function(e){return d.isLiteral(e)?!e.value:d.isIdentifier(e)?"undefined"===e.name:!1},d.toSequenceExpression=function(e,n){var l=[];return i(e,function(e){d.isExpression(e)&&l.push(e),d.isExpressionStatement(e)?l.push(e.expression):d.isVariableDeclaration(e)&&i(e.declarations,function(t){n.push({kind:e.kind,key:t.id.name,id:t.id}),l.push(d.assignmentExpression("=",t.id,t.init))})}),1===l.length?l[0]:d.sequenceExpression(l)},d.shallowEqual=function(e,n){for(var l=Object.keys(n),t=0;t<l.length;t++){var r=l[t];if(e[r]!==n[r])return!1}return!0},d.appendToMemberExpression=function(e,n,l){return e.object=d.memberExpression(e.object,e.property,e.computed),e.property=n,e.computed=!!l,e},d.prependToMemberExpression=function(e,n){return e.object=d.memberExpression(n,e.object),e},d.isReferenced=function(e,n){if(d.isMemberExpression(n))return n.property===e&&n.computed?!0:n.object===e?!0:!1;if(d.isProperty(n)&&n.key===e)return n.computed;if(d.isVariableDeclarator(n))return n.id!==e;if(d.isFunction(n)){for(var l=0;l<n.params.length;l++){var t=n.params[l];if(t===e)return!1}return n.id!==e}return d.isClass(n)?n.id!==e:d.isMethodDefinition(n)?n.key===e&&n.computed:d.isLabeledStatement(n)?!1:d.isCatchClause(n)?n.param!==e:d.isRestElement(n)?!1:d.isAssignmentPattern(n)?n.right===e:d.isPattern(n)?!1:d.isImportSpecifier(n)?!1:d.isImportBatchSpecifier(n)?!1:d.isPrivateDeclaration(n)?!1:!0},d.isReferencedIdentifier=function(e,n,l){return d.isIdentifier(e,l)&&d.isReferenced(e,n)},d.isValidIdentifier=function(e){return a(e)&&u.keyword.isIdentifierName(e)&&!u.keyword.isReservedWordES6(e,!0)},d.toIdentifier=function(e){return d.isIdentifier(e)?e.name:(e+="",e=e.replace(/[^a-zA-Z0-9$_]/g,"-"),e=e.replace(/^[-0-9]+/,""),e=e.replace(/[-\s]+(.)?/g,function(e,n){return n?n.toUpperCase():""}),d.isValidIdentifier(e)||(e="_"+e),e||"_")},d.ensureBlock=function(e,n){return n||(n="body"),e[n]=d.toBlock(e[n],e)},d.buildMatchMemberExpression=function(e,n){var l=e.split(".");return function(e){if(!d.isMemberExpression(e))return!1;for(var t=[e],r=0;t.length;){var a=t.shift();if(n&&r===l.length)return!0;if(d.isIdentifier(a)){if(l[r]!==a.name)return!1}else{if(!d.isLiteral(a)){if(d.isMemberExpression(a)){if(a.computed&&!d.isLiteral(a.property))return!1;t.push(a.object),t.push(a.property);continue}return!1}if(l[r]!==a.value)return!1}if(++r>l.length)return!1}return!0}},d.toStatement=function(e,n){if(d.isStatement(e))return e;var l,t=!1;if(d.isClass(e))t=!0,l="ClassDeclaration";else if(d.isFunction(e))t=!0,l="FunctionDeclaration";else if(d.isAssignmentExpression(e))return d.expressionStatement(e);if(t&&!e.id&&(l=!1),!l){if(n)return!1;throw new Error("cannot turn "+e.type+" to a statement")}return e.type=l,e},l.toExpression=function(e){if(d.isExpressionStatement(e)&&(e=e.expression),d.isClass(e)?e.type="ClassExpression":d.isFunction(e)&&(e.type="FunctionExpression"),d.isExpression(e))return e;throw new Error("cannot turn "+e.type+" to an expression")},d.toBlock=function(e,n){return d.isBlockStatement(e)?e:(d.isEmptyStatement(e)&&(e=[]),Array.isArray(e)||(d.isStatement(e)||(e=d.isFunction(n)?d.returnStatement(e):d.expressionStatement(e)),e=[e]),d.blockStatement(e))},d.getBindingIdentifiers=function(e){for(var n=[].concat(e),l=s();n.length;){var t=n.shift();if(t){var r=d.getBindingIdentifiers.keys[t.type];if(d.isIdentifier(t))l[t.name]=t;else if(d.isImportSpecifier(t))n.push(t.name||t.id);else if(d.isExportDeclaration(t))d.isDeclaration(e.declaration)&&n.push(e.declaration);else if(r)for(var a=0;a<r.length;a++){var o=r[a];n=n.concat(t[o]||[])}}}return l},d.getBindingIdentifiers.keys={UnaryExpression:["argument"],AssignmentExpression:["left"],ImportBatchSpecifier:["name"],VariableDeclarator:["id"],FunctionDeclaration:["id"],ClassDeclaration:["id"],SpreadElement:["argument"],RestElement:["argument"],UpdateExpression:["argument"],SpreadProperty:["argument"],Property:["value"],ComprehensionBlock:["left"],AssignmentPattern:["left"],PrivateDeclaration:["declarations"],ComprehensionExpression:["blocks"],ImportDeclaration:["specifiers"],VariableDeclaration:["declarations"],ArrayPattern:["elements"],ObjectPattern:["properties"]},d.isLet=function(e){return d.isVariableDeclaration(e)&&("var"!==e.kind||e._let)},d.isBlockScoped=function(e){return d.isFunctionDeclaration(e)||d.isClassDeclaration(e)||d.isLet(e)},d.isVar=function(e){return d.isVariableDeclaration(e,{kind:"var"})&&!e._let},d.COMMENT_KEYS=["leadingComments","trailingComments"],d.removeComments=function(e){return i(d.COMMENT_KEYS,function(n){delete e[n]}),e},d.inheritsComments=function(e,n){return i(d.COMMENT_KEYS,function(l){e[l]=c(o([].concat(e[l],n[l])))}),e},d.inherits=function(e,n){return e._declarations=n._declarations,e._scopeInfo=n._scopeInfo,e.range=n.range,e.start=n.start,e.loc=n.loc,e.end=n.end,d.inheritsComments(e,n),e},d.getLastStatements=function(e){var n=[],l=function(e){n=n.concat(d.getLastStatements(e))};return d.isIfStatement(e)?(l(e.consequent),l(e.alternate)):d.isFor(e)||d.isWhile(e)?l(e.body):d.isProgram(e)||d.isBlockStatement(e)?l(e.body[e.body.length-1]):e&&n.push(e),n},d.getSpecifierName=function(e){return e.name||e.id},d.getSpecifierId=function(e){return e["default"]?d.identifier("default"):e.id},d.isSpecifierDefault=function(e){return e["default"]||d.isIdentifier(e.id)&&"default"===e.id.name},d.isScope=function(e,n){if(d.isBlockStatement(e)){if(d.isLoop(n.block,{body:e}))return!1;if(d.isFunction(n.block,{body:e}))return!1}return d.isScopable(e)},r(d),r(d.VISITOR_KEYS)},{"../helpers/object":24,"../helpers/to-fast-properties":26,"./alias-keys":118,"./builder-keys":119,"./visitor-keys":121,esutils:182,"lodash/array/compact":192,"lodash/array/uniq":196,"lodash/collection/each":198,"lodash/lang/isString":291}],121:[function(e,n){n.exports={ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","defaults","rest","body"],AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],AwaitExpression:["argument"],BinaryExpression:["left","right"],BindFunctionExpression:["callee","arguments"],BindMemberExpression:["object","property","arguments"],BlockStatement:["body"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","body","superClass"],ClassExpression:["id","body","superClass"],ComprehensionBlock:["left","right","body"],ComprehensionExpression:["filter","blocks","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportBatchSpecifier:[],ExportDeclaration:["declaration","specifiers","source"],ExportSpecifier:["id","name"],ExpressionStatement:["expression"],File:["program"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],ForStatement:["init","test","update","body"],FunctionDeclaration:["id","params","defaults","rest","body"],FunctionExpression:["id","params","defaults","rest","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportBatchSpecifier:["id"],ImportDeclaration:["specifiers","source"],ImportSpecifier:["id","name"],LabeledStatement:["label","body"],Literal:[],LogicalExpression:["left","right"],MemberExpression:["object","property"],MethodDefinition:["key","value"],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateDeclaration:["declarations"],Program:["body"],Property:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],SpreadProperty:["argument"],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handlers","handler","guardedHandlers","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],VirtualPropertyExpression:["object","property"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"],AnyTypeAnnotation:[],ArrayTypeAnnotation:[],BooleanTypeAnnotation:[],ClassProperty:["key","value"],DeclareClass:[],DeclareFunction:[],DeclareModule:[],DeclareVariable:[],FunctionTypeAnnotation:[],FunctionTypeParam:[],GenericTypeAnnotation:[],InterfaceExtends:[],InterfaceDeclaration:[],IntersectionTypeAnnotation:[],NullableTypeAnnotation:[],NumberTypeAnnotation:[],StringLiteralTypeAnnotation:[],StringTypeAnnotation:[],TupleTypeAnnotation:[],TypeofTypeAnnotation:[],TypeAlias:[],TypeAnnotation:[],TypeCastExpression:["expression"],TypeParameterDeclaration:[],TypeParameterInstantiation:[],ObjectTypeAnnotation:[],ObjectTypeCallProperty:[],ObjectTypeIndexer:[],ObjectTypeProperty:[],QualifiedTypeIdentifier:[],UnionTypeAnnotation:[],VoidTypeAnnotation:[],JSXAttribute:["name","value"],JSXClosingElement:["name"],JSXElement:["openingElement","closingElement","children"],JSXEmptyExpression:[],JSXExpressionContainer:["expression"],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],JSXOpeningElement:["name","attributes"],JSXSpreadAttribute:["argument"]}
},{}],122:[function(e,n,l){(function(n){"use strict";e("./patch");var t=e("lodash/lang/cloneDeep"),r=e("lodash/lang/isBoolean"),a=e("lodash/collection/contains"),o=e("./traversal"),u=e("lodash/lang/isString"),s=e("lodash/lang/isRegExp"),i=e("lodash/lang/isEmpty"),c=e("./helpers/parse"),d=e("debug/node"),p=e("path"),f=e("util"),g=e("lodash/collection/each"),h=e("lodash/object/has"),m=e("fs"),y=e("./types");l.inherits=f.inherits,l.debug=d("babel"),l.canCompile=function(e,n){var t=n||l.canCompile.EXTENSIONS,r=p.extname(e);return a(t,r)},l.canCompile.EXTENSIONS=[".js",".jsx",".es6",".es"],l.resolve=function(n){try{return e.resolve(n)}catch(l){return null}},l.list=function(e){return e?e.split(","):[]},l.regexify=function(e){if(!e)return new RegExp(/.^/);if(Array.isArray(e)&&(e=e.join("|")),u(e))return new RegExp(e);if(s(e))return e;throw new TypeError("illegal type for regexify")},l.arrayify=function(e){if(!e)return[];if(r(e))return[e];if(u(e))return l.list(e);if(Array.isArray(e))return e;throw new TypeError("illegal type for arrayify")},l.booleanify=function(e){return"true"===e?!0:"false"===e?!1:e};var x={enter:function(e,n,l,t){return y.isExpressionStatement(e)&&(e=e.expression),y.isIdentifier(e)&&h(t,e.name)?(this.skip(),t[e.name]):void 0}};l.template=function(e,n,r){var a=l.templates[e];if(!a)throw new ReferenceError("unknown template "+e);if(n===!0&&(r=!0,n=null),a=t(a),i(n)||o(a,x,null,n),a.body.length>1)return a.body;var u=a.body[0];return!r&&y.isExpressionStatement(u)?u.expression:u},l.parseTemplate=function(e,n){var l=c({filename:e},n).program;return o.removeProperties(l)};var b=function(){var e={},t=n+"/transformation/templates";if(!m.existsSync(t))throw new Error("no templates directory - this is most likely the result of a broken `npm publish`. Please report to https://github.com/babel/babel/issues");return g(m.readdirSync(t),function(n){if("."!==n[0]){var r=p.basename(n,p.extname(n)),a=t+"/"+n,o=m.readFileSync(a,"utf8");e[r]=l.parseTemplate(a,o)}}),e};try{l.templates=e("../../templates.json")}catch(_){if("MODULE_NOT_FOUND"!==_.code)throw _;l.templates=b()}}).call(this,"/lib/babel")},{"../../templates.json":339,"./helpers/parse":25,"./patch":28,"./traversal":115,"./types":120,"debug/node":175,fs:138,"lodash/collection/contains":197,"lodash/collection/each":198,"lodash/lang/cloneDeep":281,"lodash/lang/isBoolean":284,"lodash/lang/isEmpty":285,"lodash/lang/isRegExp":290,"lodash/lang/isString":291,"lodash/object/has":296,path:147,util:164}],123:[function(n,l,t){!function(n,r){return"object"==typeof t&&"object"==typeof l?r(t):"function"==typeof e&&e.amd?e(["exports"],r):void r(n.acorn||(n.acorn={}))}(this,function(e){"use strict";function n(e){xt={};for(var n in It)xt[n]=e&&cn(e,n)?e[n]:It[n];if(vt=xt.sourceFile||null,Et(xt.onToken)){var l=xt.onToken;xt.onToken=function(e){l.push(e)}}if(Et(xt.onComment)){var t=xt.onComment;xt.onComment=function(e,n,l,r,a,o){var u={type:e?"Block":"Line",value:n,start:l,end:r};xt.locations&&(u.loc=new J,u.loc.start=a,u.loc.end=o),xt.ranges&&(u.range=[l,r]),t.push(u)}}wa=xt.ecmaVersion>=6?ka:Ea}function l(){this.type=jt,this.value=Tt,this.start=Rt,this.end=St,xt.locations&&(this.loc=new J,this.loc.end=At),xt.ranges&&(this.range=[Rt,St])}function t(){Dt=Bt=wt,xt.locations&&(Nt=u()),Ft=Vt=Ut=!1,qt=[],g(),w()}function r(e,n){var l=kt(bt,e);n+=" ("+l.line+":"+l.column+")";var t=new SyntaxError(n);throw t.pos=e,t.loc=l,t.raisedAt=wt,t}function a(e){return 10===e||13===e||8232===e||8233==e}function o(e,n){this.line=e,this.column=n}function u(){return new o(Ot,wt-Mt)}function s(e){e?(wt=e,Mt=Math.max(0,bt.lastIndexOf("\n",e)),Ot=bt.slice(0,Mt).split(Pa).length):(Ot=1,wt=Mt=0),jt=Kt,Lt=[Ba],Pt=!0,Wt=Gt=!1,0===wt&&xt.allowHashBang&&"#!"===bt.slice(0,2)&&f(2)}function i(){return Lt[Lt.length-1]}function c(e){var n;return e===qr&&"{"==(n=i()).token?!n.isExpr:e===fr?Pa.test(bt.slice(Bt,Rt)):e===sr||e===Ur||e===Kt?!0:e==Dr?i()===Ba:!Pt}function d(e,n){St=wt,xt.locations&&(At=u());var l=jt,t=!1;if(jt=e,Tt=n,e===Fr||e===Br){var r=Lt.pop();r===Fa?t=Pt=!0:r===Ba&&i()===Ga?(Lt.pop(),Pt=!1):Pt=!(r&&r.isExpr)}else if(e===Dr){switch(i()){case Ha:Lt.push(Na);break;case Xa:Lt.push(Fa);break;default:Lt.push(c(l)?Ba:Na)}Pt=!0}else if(e===zr)Lt.push(Fa),Pt=!0;else if(e==Nr){var a=l===pr||l===cr||l===vr||l===_r;Lt.push(a?Va:Ua),Pt=!0}else if(e==la);else if(e.keyword&&l==Gr)Pt=!1;else if(e==dr)i()!==Ba&&Lt.push(Ga),Pt=!1;else if(e===Yr)i()===qa?Lt.pop():(Lt.push(qa),t=!0),Pt=!1;else if(e===ma)Lt.push(Xa),Lt.push(Ha),Pt=!1;else if(e===ya){var r=Lt.pop();r===Ha&&l===Zr||r===Wa?(Lt.pop(),t=Pt=i()===Xa):t=Pt=!0}else e===$r?t=Pt=!0:e===Zr&&l===ma?(Lt.length-=2,Lt.push(Wa),Pt=!1):Pt=e.beforeExpr;t||g()}function p(){var e=xt.onComment&&xt.locations&&u(),n=wt,l=bt.indexOf("*/",wt+=2);if(-1===l&&r(wt-2,"Unterminated comment"),wt=l+2,xt.locations){Oa.lastIndex=n;for(var t;(t=Oa.exec(bt))&&t.index<wt;)++Ot,Mt=t.index+t[0].length}xt.onComment&&xt.onComment(!0,bt.slice(n+2,l),n,wt,e,xt.locations&&u())}function f(e){for(var n=wt,l=xt.onComment&&xt.locations&&u(),t=bt.charCodeAt(wt+=e);_t>wt&&10!==t&&13!==t&&8232!==t&&8233!==t;)++wt,t=bt.charCodeAt(wt);xt.onComment&&xt.onComment(!1,bt.slice(n+e,wt),n,wt,l,xt.locations&&u())}function g(){for(;_t>wt;){var e=bt.charCodeAt(wt);if(32===e)++wt;else if(13===e){++wt;var n=bt.charCodeAt(wt);10===n&&++wt,xt.locations&&(++Ot,Mt=wt)}else if(10===e||8232===e||8233===e)++wt,xt.locations&&(++Ot,Mt=wt);else if(e>8&&14>e)++wt;else if(47===e){var n=bt.charCodeAt(wt+1);if(42===n)p();else{if(47!==n)break;f(2)}}else if(160===e)++wt;else{if(!(e>=5760&&Ra.test(String.fromCharCode(e))))break;++wt}}}function h(){var e=bt.charCodeAt(wt+1);if(e>=48&&57>=e)return j(!0);var n=bt.charCodeAt(wt+2);return xt.ecmaVersion>=6&&46===e&&46===n?(wt+=3,d(Jr)):(++wt,d(Gr))}function m(){var e=bt.charCodeAt(wt+1);return Pt?(++wt,S()):61===e?R(na,2):R(Zr,1)}function y(){var e=bt.charCodeAt(wt+1);return 61===e?R(na,2):R(fa,1)}function x(){var e=ga,n=1,l=bt.charCodeAt(wt+1);return xt.ecmaVersion>=7&&42===l&&(n++,l=bt.charCodeAt(wt+2),e=ha),61===l&&(n++,e=na),R(e,n)}function b(e){var n=bt.charCodeAt(wt+1);return n===e?xt.playground&&61===bt.charCodeAt(wt+2)?R(na,3):R(124===e?ra:aa,2):61===n?R(na,2):R(124===e?oa:sa,1)}function _(){var e=bt.charCodeAt(wt+1);return 61===e?R(na,2):R(ua,1)}function v(e){var n=bt.charCodeAt(wt+1);return n===e?45==n&&62==bt.charCodeAt(wt+2)&&Pa.test(bt.slice(Bt,wt))?(f(3),g(),w()):R(la,2):61===n?R(na,2):R(pa,1)}function I(e){var n=bt.charCodeAt(wt+1),l=1;if(!Wt&&n===e)return l=62===e&&62===bt.charCodeAt(wt+2)?3:2,61===bt.charCodeAt(wt+l)?R(na,l+1):R(da,l);if(33==n&&60==e&&45==bt.charCodeAt(wt+2)&&45==bt.charCodeAt(wt+3))return f(4),g(),w();if(!Wt){if(Pt&&60===e)return++wt,d(ma);if(62===e){var t=i();if(t===Ha||t===Wa)return++wt,d(ya)}}return 61===n&&(l=61===bt.charCodeAt(wt+2)?3:2),R(ca,l)}function E(e){var n=bt.charCodeAt(wt+1);return 61===n?R(ia,61===bt.charCodeAt(wt+2)?3:2):61===e&&62===n&&xt.ecmaVersion>=6?(wt+=2,d(Wr)):R(61===e?ea:ta,1)}function k(e){switch(e){case 46:return h();case 40:return++wt,d(Nr);case 41:return++wt,d(Fr);case 59:return++wt,d(Ur);case 44:return++wt,d(Vr);case 91:return++wt,d(Or);case 93:return++wt,d(Mr);case 123:return++wt,d(Dr);case 125:return++wt,d(Br);case 63:return++wt,d(Hr);case 35:if(xt.playground)return++wt,d(Qr);case 58:if(++wt,xt.ecmaVersion>=7){var n=bt.charCodeAt(wt);if(58===n)return++wt,d(Kr)}return d(qr);case 96:return xt.ecmaVersion>=6?(++wt,d(Yr)):!1;case 48:var n=bt.charCodeAt(wt+1);if(120===n||88===n)return A(16);if(xt.ecmaVersion>=6){if(111===n||79===n)return A(8);if(98===n||66===n)return A(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return j(!1);case 34:case 39:return Ht?F():L(e);case 47:return m();case 37:return y();case 42:return x();case 124:case 38:return b(e);case 94:return _();case 43:case 45:return v(e);case 60:case 62:return I(e);case 61:case 33:return E(e);case 126:return R(ta,1)}return!1}function w(){if(Rt=wt,xt.locations&&(Ct=u()),wt>=_t)return d(Kt);var e=i();if(e===qa)return P();if(e===Xa)return M();var n=bt.charCodeAt(wt);if(e===Ha||e===Wa){if(Ma(n))return G()}else{if(e===Xa)return M();if(Ma(n)||92===n)return q()}var l=k(n);if(l===!1){var t=String.fromCharCode(n);if("\\"===t||Aa.test(t))return q();r(wt,"Unexpected character '"+t+"'")}return l}function R(e,n,l){var t=bt.slice(wt,wt+n);wt+=n,d(e,t,l)}function S(){for(var e,n,l="",t=wt;;){wt>=_t&&r(t,"Unterminated regular expression");var a=un();if(Pa.test(a)&&r(t,"Unterminated regular expression"),e)e=!1;else{if("["===a)n=!0;else if("]"===a&&n)n=!1;else if("/"===a&&!n)break;e="\\"===a}++wt}var l=bt.slice(t,wt);++wt;var o=U(),u=l;if(o){var s=/^[gmsiy]*$/;xt.ecmaVersion>=6&&(s=/^[gmsiyu]*$/),s.test(o)||r(t,"Invalid regular expression flag"),o.indexOf("u")>=0&&!Ja&&(u=u.replace(/\\u\{([0-9a-fA-F]{5,6})\}/g,"x").replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"))}try{new RegExp(u)}catch(i){i instanceof SyntaxError&&r(t,"Error parsing regular expression: "+i.message),r(i)}try{var c=new RegExp(l,o)}catch(p){c=null}return d(Yt,{pattern:l,flags:o,value:c})}function C(e,n){for(var l=wt,t=0,r=0,a=null==n?1/0:n;a>r;++r){var o,u=bt.charCodeAt(wt);if(o=u>=97?u-97+10:u>=65?u-65+10:u>=48&&57>=u?u-48:1/0,o>=e)break;++wt,t=t*e+o}return wt===l||null!=n&&wt-l!==n?null:t}function A(e){wt+=2;var n=C(e);return null==n&&r(Rt+2,"Expected number in radix "+e),Ma(bt.charCodeAt(wt))&&r(wt,"Identifier directly after number"),d(Jt,n)}function j(e){var n=wt,l=!1,t=48===bt.charCodeAt(wt);e||null!==C(10)||r(n,"Invalid number"),46===bt.charCodeAt(wt)&&(++wt,C(10),l=!0);var a=bt.charCodeAt(wt);(69===a||101===a)&&(a=bt.charCodeAt(++wt),(43===a||45===a)&&++wt,null===C(10)&&r(n,"Invalid number"),l=!0),Ma(bt.charCodeAt(wt))&&r(wt,"Identifier directly after number");var o,u=bt.slice(n,wt);return l?o=parseFloat(u):t&&1!==u.length?/[89]/.test(u)||Gt?r(n,"Invalid number"):o=parseInt(u,8):o=parseInt(u,10),d(Jt,o)}function T(){var e,n=bt.charCodeAt(wt);if(123===n?(xt.ecmaVersion<6&&sn(),++wt,e=V(bt.indexOf("}",wt)-wt),++wt,e>1114111&&sn()):e=V(4),65535>=e)return String.fromCharCode(e);var l=(e-65536>>10)+55296,t=(e-65536&1023)+56320;return String.fromCharCode(l,t)}function L(e){for(var n=i()===Ha,l="",t=++wt;;){wt>=_t&&r(Rt,"Unterminated string constant");var o=bt.charCodeAt(wt);if(o===e)break;92!==o||n?38===o&&n?(l+=bt.slice(t,wt),l+=O(),t=wt):(a(o)&&!n&&r(Rt,"Unterminated string constant"),++wt):(l+=bt.slice(t,wt),l+=D(),t=wt)}return l+=bt.slice(t,wt++),d(zt,l)}function P(){for(var e="",n=wt;;){wt>=_t&&r(Rt,"Unterminated template");var l=bt.charCodeAt(wt);if(96===l||36===l&&123===bt.charCodeAt(wt+1))return wt===Rt&&jt===Xr?36===l?(wt+=2,d(zr)):(++wt,d(Yr)):(e+=bt.slice(n,wt),d(Xr,e));92===l?(e+=bt.slice(n,wt),e+=D(),n=wt):a(l)?(e+=bt.slice(n,wt),++wt,13===l&&10===bt.charCodeAt(wt)?(++wt,e+="\n"):e+=String.fromCharCode(l),xt.locations&&(++Ot,Mt=wt),n=wt):++wt}}function O(){var e,n="",l=0,t=bt[wt];"&"!==t&&r(wt,"Entity must start with an ampersand");for(var a=++wt;_t>wt&&l++<10;){if(t=bt[wt++],";"===t){"#"===n[0]?"x"===n[1]?(n=n.substr(2),La.test(n)&&(e=String.fromCharCode(parseInt(n,16)))):(n=n.substr(1),Ta.test(n)&&(e=String.fromCharCode(parseInt(n,10)))):e=$a[n];break}n+=t}return e?e:(wt=a,"&")}function M(){for(var e="",n=wt;;){wt>=_t&&r(Rt,"Unterminated JSX contents");var l=bt.charCodeAt(wt);switch(l){case 123:case 60:return wt===Rt?k(l):(e+=bt.slice(n,wt),d($r,e));case 38:e+=bt.slice(n,wt),e+=O(),n=wt;break;default:a(l)?(e+=bt.slice(n,wt),++wt,13===l&&10===bt.charCodeAt(wt)?(++wt,e+="\n"):e+=String.fromCharCode(l),xt.locations&&(++Ot,Mt=wt),n=wt):++wt}}}function D(){var e=bt.charCodeAt(++wt),n=/^[0-7]+/.exec(bt.slice(wt,wt+3));for(n&&(n=n[0]);n&&parseInt(n,8)>255;)n=n.slice(0,-1);if("0"===n&&(n=null),++wt,n)return Gt&&r(wt-2,"Octal literal in strict mode"),wt+=n.length-1,String.fromCharCode(parseInt(n,8));switch(e){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(V(2));case 117:return T();case 116:return" ";case 98:return"\b";case 118:return"";case 102:return"\f";case 48:return"\x00";case 13:10===bt.charCodeAt(wt)&&++wt;case 10:return xt.locations&&(Mt=wt,++Ot),"";default:return String.fromCharCode(e)}}function B(){var e,n="",l=0,t=un();"&"!==t&&r(wt,"Entity must start with an ampersand");for(var a=++wt;_t>wt&&l++<10;){if(t=un(),wt++,";"===t){"#"===n[0]?"x"===n[1]?(n=n.substr(2),La.test(n)&&(e=String.fromCharCode(parseInt(n,16)))):(n=n.substr(1),Ta.test(n)&&(e=String.fromCharCode(parseInt(n,10)))):e=$a[n];break}n+=t}return e?e:(wt=a,"&")}function N(e){for(var n="";_t>wt;){var l=un();if(-1!==e.indexOf(l))break;"&"===l?n+=B():(++wt,"\r"===l&&"\n"===un()&&(n+=l,++wt,l="\n"),"\n"===l&&xt.locations&&(Mt=wt,++Ot),n+=l)}return d(er,n)}function F(){var e=bt.charCodeAt(wt);return 34!==e&&39!==e&&r("String literal must starts with a quote"),++wt,N([String.fromCharCode(e)]),e!==bt.charCodeAt(wt)&&sn(),++wt,d(jt,Tt)}function V(e){var n=C(16,e);return null===n&&r(Rt,"Bad character escape sequence"),n}function U(){za=!1;for(var e="",n=!0,l=wt;_t>wt;){var t=bt.charCodeAt(wt);if(Da(t))++wt;else{if(92!==t)break;za=!0,e+=bt.slice(l,wt),117!=bt.charCodeAt(++wt)&&r(wt,"Expecting Unicode escape sequence \\uXXXX"),++wt;var a=V(4),o=String.fromCharCode(a);o||r(wt-1,"Invalid Unicode escape"),(n?Ma(a):Da(a))||r(wt-4,"Invalid Unicode escape"),e+=o,l=wt}n=!1}return e+bt.slice(l,wt)}function q(){var e=U(),n=Ht?Zt:$t;return!za&&wa(e)&&(n=Pr[e]),d(n,e)}function G(){var e,n=wt;do e=bt.charCodeAt(++wt);while(Da(e)||45===e);return d(Qt,bt.slice(n,wt))}function H(){xt.onToken&&xt.onToken(new l),Dt=Rt,Bt=St,Nt=At,w()}function W(e){if(Gt=e,jt===Jt||jt===zt){if(wt=Rt,xt.locations)for(;Mt>wt;)Mt=bt.lastIndexOf("\n",Mt-2)+1,--Ot;g(),w()}}function X(){this.type=null,this.start=Rt,this.end=null}function J(){this.start=Ct,this.end=null,null!==vt&&(this.source=vt)}function Y(){var n=new e.Node;return xt.locations&&(n.loc=new J),xt.directSourceFile&&(n.sourceFile=xt.directSourceFile),xt.ranges&&(n.range=[Rt,0]),n}function z(){return xt.locations?[Rt,Ct]:Rt}function $(n){var l=new e.Node,t=n;return xt.locations&&(l.loc=new J,l.loc.start=t[1],t=n[0]),l.start=t,xt.directSourceFile&&(l.sourceFile=xt.directSourceFile),xt.ranges&&(l.range=[t,0]),l}function K(e,n){return e.type=n,e.end=Bt,xt.locations&&(e.loc.end=Nt),xt.ranges&&(e.range[1]=Bt),e}function Q(e,n,l){return xt.locations&&(e.loc.end=l[1],l=l[0]),e.type=n,e.end=l,xt.ranges&&(e.range[1]=l),e}function Z(e){return xt.ecmaVersion>=5&&"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"use strict"===e.expression.value}function en(e){return jt===e?(H(),!0):!1}function nn(e){return jt===$t&&Tt===e}function ln(e){return Tt===e&&en($t)}function tn(e){ln(e)||sn()}function rn(){return!xt.strictSemicolons&&(jt===Kt||jt===Br||Pa.test(bt.slice(Bt,Rt)))}function an(){en(Ur)||rn()||sn()}function on(e){en(e)||sn()}function un(){return bt.charAt(wt)}function sn(e){r(null!=e?e:Rt,"Unexpected token")}function cn(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function dn(e,n){if(xt.ecmaVersion>=6&&e)switch(e.type){case"Identifier":case"VirtualPropertyExpression":case"MemberExpression":case"SpreadProperty":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":break;case"ObjectExpression":e.type="ObjectPattern";for(var l=0;l<e.properties.length;l++){var t=e.properties[l];"SpreadProperty"!==t.type&&("init"!==t.kind&&r(t.key.start,"Object pattern can't contain getter or setter"),dn(t.value,n))}break;case"ArrayExpression":e.type="ArrayPattern",pn(e.elements,n);break;case"AssignmentExpression":"="===e.operator?e.type="AssignmentPattern":r(e.left.end,"Only '=' operator can be used for specifying default value.");break;case"MemberExpression":if(!n)break;default:r(e.start,"Assigning to rvalue")}return e}function pn(e,n){if(e.length){for(var l=0;l<e.length-1;l++)dn(e[l],n);var t=e[e.length-1];switch(t.type){case"RestElement":break;case"SpreadElement":t.type="RestElement";var r=t.argument;dn(r,n),"Identifier"!==r.type&&"MemberExpression"!==r.type&&"ArrayPattern"!==r.type&&sn(r.start);break;default:dn(t,n)}}return e}function fn(e){var n=Y();return H(),n.argument=Xn(e),K(n,"SpreadElement")}function gn(){var e=Y();return H(),e.argument=jt===$t||jt===Or?hn():sn(),K(e,"RestElement")}function hn(){if(xt.ecmaVersion<6)return yl();switch(jt){case $t:return yl();case Or:var e=Y();return H(),e.elements=mn(Mr,!0),K(e,"ArrayPattern");case Dr:return al(!0);default:sn()}}function mn(e,n){for(var l=[],t=!0;!en(e);){if(t?t=!1:on(Vr),jt===Jr){l.push(yn(gn())),on(e);break}var r;if(n&&jt===Vr)r=null;else{var a=xn();yn(a),r=xn(null,a)}l.push(r)}return l}function yn(e){return en(Hr)&&(e.optional=!0),jt===qr&&(e.typeAnnotation=mt()),K(e,e.type),e}function xn(e,n){if(e=e||z(),n=n||hn(),!en(ea))return n;var l=$(e);return l.operator="=",l.left=n,l.right=Xn(),K(l,"AssignmentPattern")}function bn(e,n){switch(e.type){case"Identifier":(va(e.name)||Ia(e.name))&&r(e.start,"Defining '"+e.name+"' in strict mode"),cn(n,e.name)&&r(e.start,"Argument name clash in strict mode"),n[e.name]=!0;break;case"ObjectPattern":for(var l=0;l<e.properties.length;l++){var t=e.properties[l];"SpreadProperty"===t.type?bn(t.argument,n):bn(t.value,n)}break;case"ArrayPattern":for(var l=0;l<e.elements.length;l++){var a=e.elements[l];a&&bn(a,n)}break;case"RestElement":return bn(e.argument,n)}}function _n(e,n){if(!(xt.ecmaVersion>=6)){var l,t=e.key;switch(t.type){case"Identifier":l=t.name;break;case"Literal":l=String(t.value);break;default:return}var a,o=e.kind||"init";if(cn(n,l)){a=n[l];var u="init"!==o;((Gt||u)&&a[o]||!(u^a.init))&&r(t.start,"Redefinition of property")}else a=n[l]={init:!1,get:!1,set:!1};a[o]=!0}}function vn(e,n){switch(e.type){case"Identifier":Gt&&(Ia(e.name)||va(e.name))&&r(e.start,(n?"Binding ":"Assigning to ")+e.name+" in strict mode");break;case"MemberExpression":n&&r(e.start,"Binding to member expression");break;case"ObjectPattern":for(var l=0;l<e.properties.length;l++){var t=e.properties[l];"Property"===t.type&&(t=t.value),vn(t,n)}break;case"ArrayPattern":for(var l=0;l<e.elements.length;l++){var a=e.elements[l];a&&vn(a,n)}break;case"AssignmentPattern":vn(e.left);break;case"SpreadProperty":case"VirtualPropertyExpression":break;case"RestElement":vn(e.argument);break;default:r(e.start,"Assigning to rvalue")}}function In(e){var n=!0;for(e.body||(e.body=[]);jt!==Kt;){var l=En(!0,!0);e.body.push(l),n&&Z(l)&&W(!0),n=!1}return H(),K(e,"Program")}function En(e,n){var l=jt,t=Y();switch(l){case nr:case rr:return kn(t,l.keyword);case ar:return wn(t);case ur:return Rn(t);case cr:return Sn(t);case dr:return!e&&xt.ecmaVersion>=6&&sn(),Cn(t);case kr:return e||sn(),gl(t,!0);case pr:return An(t);case fr:return jn(t);case gr:return Tn(t);case hr:return Ln(t);case mr:return Pn(t);case xr:case br:e||sn();case yr:return On(t,l.keyword);case _r:return Mn(t);case vr:return Dn(t);case Dr:return Un();case Ur:return Bn(t);case Rr:case Sr:return n||xt.allowImportExportEverywhere||r(Rt,"'import' and 'export' may only appear at the top level"),l===Sr?_l(t):xl(t);case $t:if(xt.ecmaVersion>=7&&jt===$t){if("private"===Tt)return H(),fl(t);if("async"===Tt&&"function "===bt.slice(St+1,St+10))return H(),on(dr),sl(t,!0,!0)}default:var a=Tt,o=Wn();if(l===$t&&"Identifier"===o.type){if(en(qr))return Nn(t,a,o);if("declare"===o.name){if(jt===kr||jt===$t||jt===dr||jt===yr)return ql(t)}else if(jt===$t){if("interface"===o.name)return Jl(t);if("type"===o.name)return Yl(t)}}return Fn(t,o)}}function kn(e,n){var l="break"==n;H(),en(Ur)||rn()?e.label=null:jt!==$t?sn():(e.label=yl(),an());for(var t=0;t<qt.length;++t){var a=qt[t];if(null==e.label||a.name===e.label.name){if(null!=a.kind&&(l||"loop"===a.kind))break;if(e.label&&l)break}}return t===qt.length&&r(e.start,"Unsyntactic "+n),K(e,l?"BreakStatement":"ContinueStatement")}function wn(e){return H(),an(),K(e,"DebuggerStatement")}function Rn(e){return H(),qt.push(Ka),e.body=En(!1),qt.pop(),on(_r),e.test=Vn(),xt.ecmaVersion>=6?en(Ur):an(),K(e,"DoWhileStatement")}function Sn(e){if(H(),qt.push(Ka),on(Nr),jt===Ur)return qn(e,null);if(jt===yr||jt===xr){var n=Y(),l=jt.keyword,t=jt===xr;return H(),Hn(n,!0,l),K(n,"VariableDeclaration"),!(jt===Lr||xt.ecmaVersion>=6&&nn("of"))||1!==n.declarations.length||t&&n.declarations[0].init?qn(e,n):Gn(e,n)}var r={start:0},n=Wn(!0,r);return jt===Lr||xt.ecmaVersion>=6&&nn("of")?(dn(n),vn(n),Gn(e,n)):(r.start&&sn(r.start),qn(e,n))}function Cn(e){return H(),sl(e,!0,!1)}function An(e){return H(),e.test=Vn(),e.consequent=En(!1),e.alternate=en(sr)?En(!1):null,K(e,"IfStatement")}function jn(e){return Ft||xt.allowReturnOutsideFunction||r(Rt,"'return' outside of function"),H(),en(Ur)||rn()?e.argument=null:(e.argument=Wn(),an()),K(e,"ReturnStatement")}function Tn(e){H(),e.discriminant=Vn(),e.cases=[],on(Dr),qt.push(Qa);for(var n,l;jt!=Br;)if(jt===lr||jt===or){var t=jt===lr;n&&K(n,"SwitchCase"),e.cases.push(n=Y()),n.consequent=[],H(),t?n.test=Wn():(l&&r(Dt,"Multiple default clauses"),l=!0,n.test=null),on(qr)}else n||sn(),n.consequent.push(En(!0));return n&&K(n,"SwitchCase"),H(),qt.pop(),K(e,"SwitchStatement")}function Ln(e){return H(),Pa.test(bt.slice(Bt,Rt))&&r(Bt,"Illegal newline after throw"),e.argument=Wn(),an(),K(e,"ThrowStatement")}function Pn(e){if(H(),e.block=Un(),e.handler=null,jt===tr){var n=Y();H(),on(Nr),n.param=hn(),vn(n.param,!0),on(Fr),n.guard=null,n.body=Un(),e.handler=K(n,"CatchClause")}return e.guardedHandlers=Xt,e.finalizer=en(ir)?Un():null,e.handler||e.finalizer||r(e.start,"Missing catch or finally clause"),K(e,"TryStatement")}function On(e,n){return H(),Hn(e,!1,n),an(),K(e,"VariableDeclaration")}function Mn(e){return H(),e.test=Vn(),qt.push(Ka),e.body=En(!1),qt.pop(),K(e,"WhileStatement")}function Dn(e){return Gt&&r(Rt,"'with' in strict mode"),H(),e.object=Vn(),e.body=En(!1),K(e,"WithStatement")}function Bn(e){return H(),K(e,"EmptyStatement")}function Nn(e,n,l){for(var t=0;t<qt.length;++t)qt[t].name===n&&r(l.start,"Label '"+n+"' is already declared");var a=jt.isLoop?"loop":jt===gr?"switch":null;return qt.push({name:n,kind:a}),e.body=En(!0),qt.pop(),e.label=l,K(e,"LabeledStatement")}function Fn(e,n){return e.expression=n,an(),K(e,"ExpressionStatement")}function Vn(){on(Nr);var e=Wn();return on(Fr),e}function Un(e){var n,l=Y(),t=!0;for(l.body=[],on(Dr);!en(Br);){var r=En(!0);l.body.push(r),t&&e&&Z(r)&&(n=Gt,W(Gt=!0)),t=!1}return n===!1&&W(!1),K(l,"BlockStatement")}function qn(e,n){return e.init=n,on(Ur),e.test=jt===Ur?null:Wn(),on(Ur),e.update=jt===Fr?null:Wn(),on(Fr),e.body=En(!1),qt.pop(),K(e,"ForStatement")}function Gn(e,n){var l=jt===Lr?"ForInStatement":"ForOfStatement";return H(),e.left=n,e.right=Wn(),on(Fr),e.body=En(!1),qt.pop(),K(e,l)}function Hn(e,n,l){for(e.declarations=[],e.kind=l;;){var t=Y();if(t.id=hn(),vn(t.id,!0),jt===qr&&(t.id.typeAnnotation=mt(),K(t.id,t.id.type)),t.init=en(ea)?Xn(n):l===br.keyword?sn():null,e.declarations.push(K(t,"VariableDeclarator")),!en(Vr))break}return e}function Wn(e,n){var l=z(),t=Xn(e,n);if(jt===Vr){var r=$(l);for(r.expressions=[t];en(Vr);)r.expressions.push(Xn(e,n));return K(r,"SequenceExpression")}return t}function Xn(e,n,l){var t;n?t=!1:(n={start:0},t=!0);var r=z(),a=Jn(e,n);if(l&&(a=l(a,r)),jt.isAssign){var o=$(r);return o.operator=Tt,o.left=jt===ea?dn(a):a,n.start=0,vn(a),H(),o.right=Xn(e),K(o,"AssignmentExpression")}return t&&n.start&&sn(n.start),a}function Jn(e,n){var l=z(),t=Yn(e,n);if(n&&n.start)return t;if(en(Hr)){var a=$(l);if(xt.playground&&en(ea)){var o=a.left=dn(t);return"MemberExpression"!==o.type&&r(o.start,"You can only use member expressions in memoization assignment"),a.right=Xn(e),a.operator="?=",K(a,"AssignmentExpression")}return a.test=t,a.consequent=Xn(),on(qr),a.alternate=Xn(e),K(a,"ConditionalExpression")}return t}function Yn(e,n){var l=z(),t=$n(n);return n&&n.start?t:zn(t,l,-1,e)}function zn(e,n,l,t){var r=jt.binop;if(null!=r&&(!t||jt!==Lr)&&r>l){var a=$(n);a.left=e,a.operator=Tt;var o=jt;H();var u=z();return a.right=zn($n(),u,o.rightAssociative?r-1:r,t),K(a,o===ra||o===aa?"LogicalExpression":"BinaryExpression"),zn(a,n,l,t)}return e}function $n(e){if(jt.prefix){var n=Y(),l=jt.isUpdate;return n.operator=Tt,n.prefix=!0,H(),n.argument=$n(),e&&e.start&&sn(e.start),l?vn(n.argument):Gt&&"delete"===n.operator&&"Identifier"===n.argument.type&&r(n.start,"Deleting local variable in strict mode"),K(n,l?"UpdateExpression":"UnaryExpression")}var t=z(),a=Kn(e);if(e&&e.start)return a;for(;jt.postfix&&!rn();){var n=$(t);n.operator=Tt,n.prefix=!1,n.argument=a,vn(a),H(),a=K(n,"UpdateExpression")}return a}function Kn(e){var n=z(),l=Zn(e);return e&&e.start?l:Qn(l,n)}function Qn(e,n,l){if(xt.playground&&en(Qr)){var t=$(n);return t.object=e,t.property=yl(!0),t.arguments=en(Nr)?ml(Fr,!1):[],Qn(K(t,"BindMemberExpression"),n,l)}if(en(Kr)){var t=$(n);return t.object=e,t.property=yl(!0),Qn(K(t,"VirtualPropertyExpression"),n,l)}if(en(Gr)){var t=$(n);return t.object=e,t.property=yl(!0),t.computed=!1,Qn(K(t,"MemberExpression"),n,l)}if(en(Or)){var t=$(n);return t.object=e,t.property=Wn(),t.computed=!0,on(Mr),Qn(K(t,"MemberExpression"),n,l)}if(!l&&en(Nr)){var t=$(n);return t.callee=e,t.arguments=ml(Fr,!1),Qn(K(t,"CallExpression"),n,l)}if(jt===Yr){var t=$(n);return t.tag=e,t.quasi=rl(),Qn(K(t,"TaggedTemplateExpression"),n,l)}return e}function Zn(e){switch(jt){case Er:var n=Y();return H(),K(n,"ThisExpression");case Cr:if(Vt)return El();case $t:var l=z(),n=Y(),t=yl(jt!==$t);if(xt.ecmaVersion>=7)if("async"===t.name){if(jt===Nr){var r=nl(l,!0);return"ArrowFunctionExpression"===r.type?r:(n.callee=t,n.arguments="SequenceExpression"===r.type?r.expressions:[r],Qn(K(n,"CallExpression"),l))}if(jt===$t)return t=yl(),on(Wr),dl(n,[t],!0);if(jt===dr&&!rn())return H(),sl(n,!1,!0)}else if("await"===t.name&&Ut)return kl(n);return!rn()&&en(Wr)?dl($(l),[t]):t;case Yt:var n=Y();return n.regex={pattern:Tt.pattern,flags:Tt.flags},n.value=Tt.value,n.raw=bt.slice(Rt,St),H(),K(n,"Literal");case Jt:case zt:case $r:var n=Y();return n.value=Tt,n.raw=bt.slice(Rt,St),H(),K(n,"Literal");case Ar:case jr:case Tr:var n=Y();return n.value=jt.atomValue,n.raw=jt.keyword,H(),K(n,"Literal");case Nr:return nl();case Or:var n=Y();return H(),xt.ecmaVersion>=7&&jt===cr?wl(n,!1):(n.elements=ml(Mr,!0,!0,e),K(n,"ArrayExpression"));case Dr:return al(!1,e);case dr:var n=Y();return H(),sl(n,!1,!1);case kr:return gl(Y(),!1);case Ir:return ll();case Yr:return rl();case Qr:return el();case ma:return Fl();default:sn()}}function el(){var e=Y();H();var n=z();return e.callee=Qn(Zn(),n,!0),e.arguments=en(Nr)?ml(Fr,!1):[],K(e,"BindFunctionExpression")}function nl(e,n){e=e||z();var l;if(xt.ecmaVersion>=6){if(H(),xt.ecmaVersion>=7&&jt===cr)return wl($(e),!0);for(var t,r,a=z(),o=[],u=!0,s={start:0},i=function(e,n){if(jt===qr){var l=$(n);return l.expression=e,l.typeAnnotation=mt(),K(l,"TypeCastExpression")}return e};jt!==Fr;){if(u?u=!1:on(Vr),jt===Jr){var c=z();t=Rt,o.push(i(gn(),c));break}jt!==Nr||r||(r=Rt),o.push(Xn(!1,s,i))}var d=z();if(on(Fr),!rn()&&en(Wr)){r&&sn(r);for(var p=0;p<o.length;p++){var f=o[p];if("TypeCastExpression"===f.type){var g=f.expression;g.returnType=f.typeAnnotation,o[p]=g}}return dl($(e),o,n)}o.length||sn(Dt),t&&sn(t),s.start&&sn(s.start),o.length>1?(l=$(a),l.expressions=o,Q(l,"SequenceExpression",d)):l=o[0]}else l=Vn();if(xt.preserveParens){var h=$(e);return h.expression=l,K(h,"ParenthesizedExpression")}return l}function ll(){var e=Y();H();var n=z();return e.callee=Qn(Zn(),n,!0),e.arguments=en(Nr)?ml(Fr,!1):Xt,K(e,"NewExpression")}function tl(){var e=Y();return e.value={raw:bt.slice(Rt,St),cooked:Tt},H(),e.tail=jt===Yr,K(e,"TemplateElement")}function rl(){var e=Y();H(),e.expressions=[];var n=tl();for(e.quasis=[n];!n.tail;)on(zr),e.expressions.push(Wn()),on(Br),e.quasis.push(n=tl());return H(),K(e,"TemplateLiteral")}function al(e,n){var l=Y(),t=!0,r={};for(l.properties=[],H();!en(Br);){if(t)t=!1;else if(on(Vr),xt.allowTrailingCommas&&en(Br))break;var a,o=Y(),u=!1,s=!1;if(xt.ecmaVersion>=7&&jt===Jr)o=fn(),o.type="SpreadProperty",l.properties.push(o);else{if(xt.ecmaVersion>=6&&(o.method=!1,o.shorthand=!1,(e||n)&&(a=z()),e||(u=en(ga))),xt.ecmaVersion>=7&&nn("async")){var i=yl();jt===qr||jt===Nr?o.key=i:(s=!0,ol(o))}else ol(o);var c;Bl("<")&&(c=zl(),jt!==Nr&&sn()),en(qr)?(o.value=e?xn():Xn(!1,n),o.kind="init"):xt.ecmaVersion>=6&&jt===Nr?(e&&sn(),o.kind="init",o.method=!0,o.value=il(u,s)):xt.ecmaVersion>=5&&!o.computed&&"Identifier"===o.key.type&&("get"===o.key.name||"set"===o.key.name||xt.playground&&"memo"===o.key.name)&&jt!=Vr&&jt!=Br?((u||s||e)&&sn(),o.kind=o.key.name,ol(o),o.value=il(!1,!1)):xt.ecmaVersion>=6&&!o.computed&&"Identifier"===o.key.type?(o.kind="init",e?o.value=xn(a,o.key):jt===ea&&n?(n.start||(n.start=Rt),o.value=xn(a,o.key)):o.value=o.key,o.shorthand=!0):sn(),o.value.typeParameters=c,_n(o,r),l.properties.push(K(o,"Property"))}}return K(l,e?"ObjectPattern":"ObjectExpression")}function ol(e){if(xt.ecmaVersion>=6){if(en(Or))return e.computed=!0,e.key=Wn(),void on(Mr);e.computed=!1}e.key=jt===Jt||jt===zt?Zn():yl(!0)}function ul(e,n){e.id=null,xt.ecmaVersion>=6&&(e.generator=!1,e.expression=!1),xt.ecmaVersion>=7&&(e.async=n)}function sl(e,n,l,t){return ul(e,l),xt.ecmaVersion>=6&&(e.generator=en(ga)),(n||jt===$t)&&(e.id=yl()),Bl("<")&&(e.typeParameters=zl()),cl(e),pl(e,t),K(e,n?"FunctionDeclaration":"FunctionExpression")}function il(e,n){var l=Y();ul(l,n),cl(l);var t;return xt.ecmaVersion>=6?(l.generator=e,t=!0):t=!1,pl(l,t),K(l,"FunctionExpression")}function cl(e){on(Nr),e.params=mn(Fr,!1),jt===qr&&(e.returnType=mt())}function dl(e,n,l){return ul(e,l),e.params=pn(n,!0),pl(e,!0),K(e,"ArrowFunctionExpression")}function pl(e,n){var l=n&&jt!==Dr,t=Ut;if(Ut=e.async,l)e.body=Xn(),e.expression=!0;else{var r=Ft,a=Vt,o=qt;Ft=!0,Vt=e.generator,qt=[],e.body=Un(!0),e.expression=!1,Ft=r,Vt=a,qt=o}if(Ut=t,Gt||!l&&e.body.body.length&&Z(e.body.body[0])){var u={};e.id&&bn(e.id,{});for(var s=0;s<e.params.length;s++)bn(e.params[s],u)}}function fl(e){e.declarations=[];do e.declarations.push(yl());while(en(Vr));return an(),K(e,"PrivateDeclaration")}function gl(e,n){H(),e.id=jt===$t?yl():n?sn():null,Bl("<")&&(e.typeParameters=zl()),e.superClass=en(wr)?Kn():null,e.superClass&&Bl("<")&&(e.superTypeParameters=$l()),nn("implements")&&(H(),e.implements=hl());var l=Y();for(l.body=[],on(Dr);!en(Br);)if(!en(Ur)){var t=Y();if(xt.ecmaVersion>=7&&nn("private"))H(),l.body.push(fl(t));else{var r=en(ga),a=!1;ol(t),jt===Nr||t.computed||"Identifier"!==t.key.type||"static"!==t.key.name?t["static"]=!1:((r||a)&&sn(),t["static"]=!0,r=en(ga),ol(t)),jt===Nr||t.computed||"Identifier"!==t.key.type||"async"!==t.key.name||(a=!0,ol(t)),jt!==Nr&&!t.computed&&"Identifier"===t.key.type&&("get"===t.key.name||"set"===t.key.name)||xt.playground&&"memo"===t.key.name?((r||a)&&sn(),t.kind=t.key.name,ol(t)):t.kind="";var o=!1;if(jt===qr&&(t.typeAnnotation=mt(),o=!0),xt.playground&&en(ea)&&(t.value=Xn(),o=!0),o)an(),l.body.push(K(t,"ClassProperty"));else{var u;Bl("<")&&(u=zl()),t.value=il(r,a),t.value.typeParameters=u,l.body.push(K(t,"MethodDefinition")),en(Ur)}}}return e.body=K(l,"ClassBody"),K(e,n?"ClassDeclaration":"ClassExpression")}function hl(){var e=[];do{var n=Y();n.id=yl(),n.typeParameters=Bl("<")?$l():null,e.push(K(n,"ClassImplements"))}while(en(Vr));return e}function ml(e,n,l,t){for(var r=[],a=!0;!en(e);){if(a)a=!1;else if(on(Vr),n&&xt.allowTrailingCommas&&en(e))break;r.push(l&&jt===Vr?null:jt===Jr?fn(t):Xn(!1,t))}return r}function yl(e){var n=Y();return e&&"everywhere"==xt.forbidReserved&&(e=!1),jt===$t?(!e&&(xt.forbidReserved&&(3===xt.ecmaVersion?ba:_a)(Tt)||Gt&&va(Tt))&&-1==bt.slice(Rt,St).indexOf("\\")&&r(Rt,"The keyword '"+Tt+"' is reserved"),n.name=Tt):e&&jt.keyword?n.name=jt.keyword:sn(),H(),K(n,"Identifier")}function xl(e){if(H(),jt===yr||jt===br||jt===xr||jt===dr||jt===kr||nn("async")||nn("type"))e.declaration=En(!0),e["default"]=!1,e.specifiers=null,e.source=null;else if(en(or)){var n=Xn();if(n.id)switch(n.type){case"FunctionExpression":n.type="FunctionDeclaration";break;case"ClassExpression":n.type="ClassDeclaration"}e.declaration=n,e["default"]=!0,e.specifiers=null,e.source=null,an()
}else{var l=jt===ga;e.declaration=null,e["default"]=!1,e.specifiers=bl(),ln("from")?e.source=jt===zt?Zn():sn():(l&&sn(),e.source=null),an()}return K(e,"ExportDeclaration")}function bl(){var e=[],n=!0;if(jt===ga){var l=Y();H(),e.push(K(l,"ExportBatchSpecifier"))}else for(on(Dr);!en(Br);){if(n)n=!1;else if(on(Vr),xt.allowTrailingCommas&&en(Br))break;var l=Y();l.id=yl(jt===or),l.name=ln("as")?yl(!0):null,e.push(K(l,"ExportSpecifier"))}return e}function _l(e){H(),e.isType=!1,e.specifiers=[];var n;if(nn("type")){var l=z();n=yl(),jt===$t&&"from"!==Tt||jt===Dr||jt===ga?e.isType=!0:(e.specifiers.push(Il(n,l)),en(Vr))}return jt===zt?(n&&sn(n.start),e.source=Zn()):(nn("from")||vl(e.specifiers),tn("from"),e.source=jt===zt?Zn():sn()),an(),K(e,"ImportDeclaration")}function vl(e){var n=!0;if(jt===$t){var l=z(),t=yl();if(e.push(Il(t,l)),!en(Vr))return e}if(jt===ga){var r=Y();return H(),tn("as"),r.name=yl(),vn(r.name,!0),e.push(K(r,"ImportBatchSpecifier")),e}for(on(Dr);!en(Br);){if(n)n=!1;else if(on(Vr),xt.allowTrailingCommas&&en(Br))break;var r=Y();r.id=yl(!0),r.name=ln("as")?yl():null,vn(r.name||r.id,!0),r["default"]=!1,e.push(K(r,"ImportSpecifier"))}return e}function Il(e,n){var l=$(n);return l.id=e,vn(l.id,!0),l.name=null,l["default"]=!0,K(l,"ImportSpecifier")}function El(){var e=Y();return H(),en(Ur)||rn()?(e.delegate=!1,e.argument=null):(e.delegate=en(ga),e.argument=Xn()),K(e,"YieldExpression")}function kl(e){return(en(Ur)||rn())&&sn(),e.all=en(ga),e.argument=Xn(!0),K(e,"AwaitExpression")}function wl(e,n){for(e.blocks=[];jt===cr;){var l=Y();H(),on(Nr),l.left=hn(),vn(l.left,!0),tn("of"),l.right=Wn(),on(Fr),e.blocks.push(K(l,"ComprehensionBlock"))}return e.filter=en(pr)?Vn():null,e.body=Wn(),on(n?Fr:Mr),e.generator=n,K(e,"ComprehensionExpression")}function Rl(e){return"JSXIdentifier"===e.type?e.name:"JSXNamespacedName"===e.type?e.namespace.name+":"+e.name.name:"JSXMemberExpression"===e.type?Rl(e.object)+"."+Rl(e.property):void 0}function Sl(){var e=Y();return jt===Qt?e.name=Tt:jt.keyword?e.name=jt.keyword:sn(),H(),K(e,"JSXIdentifier")}function Cl(){var e=z(),n=Sl();if(!en(qr))return n;var l=$(e);return l.namespace=n,l.name=Sl(),K(l,"JSXNamespacedName")}function Al(){for(var e=z(),n=Cl();en(Gr);){var l=$(e);l.object=n,l.property=Sl(),n=K(l,"JSXMemberExpression")}return n}function jl(){switch(jt){case Dr:var e=Ll();return"JSXEmptyExpression"===e.expression.type&&r(e.start,"JSX attributes must only be assigned a non-empty expression"),e;case ma:return Fl();case $r:case zt:return Zn();default:r(Rt,"JSX value should be either an expression or a quoted JSX text")}}function Tl(){jt!==Br&&sn();var e;return e=Rt,Rt=Bt,Bt=e,e=Ct,Ct=Nt,Nt=e,K(Y(),"JSXEmptyExpression")}function Ll(){var e=Y();return H(),e.expression=jt===Br?Tl():Wn(),on(Br),K(e,"JSXExpressionContainer")}function Pl(){var e=Y();return en(Dr)?(on(Jr),e.argument=Xn(),on(Br),K(e,"JSXSpreadAttribute")):(e.name=Cl(),e.value=en(ea)?jl():null,K(e,"JSXAttribute"))}function Ol(e){var n=$(e);for(n.attributes=[],n.name=Al();jt!==Zr&&jt!==ya;)n.attributes.push(Pl());return n.selfClosing=en(Zr),on(ya),K(n,"JSXOpeningElement")}function Ml(e){var n=$(e);return n.name=Al(),on(ya),K(n,"JSXClosingElement")}function Dl(e){var n=$(e),l=[],t=Ol(e),a=null;if(!t.selfClosing){e:for(;;)switch(jt){case ma:if(e=z(),H(),en(Zr)){a=Ml(e);break e}l.push(Dl(e));break;case $r:l.push(Zn());break;case Dr:l.push(Ll());break;default:sn()}Rl(a.name)!==Rl(t.name)&&r(a.start,"Expected corresponding JSX closing tag for <"+Rl(t.name)+">")}return n.openingElement=t,n.closingElement=a,n.children=l,K(n,"JSXElement")}function Bl(e){return jt===ca&&Tt===e}function Nl(e){Bl(e)?H():sn()}function Fl(){var e=z();return H(),Dl(e)}function Vl(e){return H(),Wl(e,!0),K(e,"DeclareClass")}function Ul(e){H();var n=e.id=yl(),l=Y(),t=Y();l.typeParameters=Bl("<")?zl():null,on(Nr);var r=st();return l.params=r.params,l.rest=r.rest,on(Fr),on(qr),l.returnType=ht(),t.typeAnnotation=K(l,"FunctionTypeAnnotation"),n.typeAnnotation=K(t,"TypeAnnotation"),K(n,n.type),an(),K(e,"DeclareFunction")}function ql(e){return jt===kr?Vl(e):jt===dr?Ul(e):jt===yr?Gl(e):nn("module")?Hl(e):void sn()}function Gl(e){return H(),e.id=yt(),an(),K(e,"DeclareVariable")}function Hl(e){H(),e.id=jt===zt?Zn():yl();var n=e.body=Y(),l=n.body=[];for(on(Dr);jt!==Br;){var t=Y();H(),l.push(ql(t))}return on(Br),K(n,"BlockStatement"),K(e,"DeclareModule")}function Wl(e,n){if(e.id=yl(),e.typeParameters=Bl("<")?zl():null,e.extends=[],en(wr))do e.extends.push(Xl());while(en(Vr));e.body=lt(n)}function Xl(){var e=Y();return e.id=yl(),e.typeParameters=Bl("<")?$l():null,K(e,"InterfaceExtends")}function Jl(e){return Wl(e,!1),K(e,"InterfaceDeclaration")}function Yl(e){return e.id=yl(),e.typeParameters=Bl("<")?zl():null,on(ea),e.right=ht(),an(),K(e,"TypeAlias")}function zl(){var e=Y();for(e.params=[],Nl("<");!Bl(">");)e.params.push(yl()),Bl(">")||on(Vr);return Nl(">"),K(e,"TypeParameterDeclaration")}function $l(){var e=Y(),n=Wt;for(e.params=[],Wt=!0,Nl("<");!Bl(">");)e.params.push(ht()),Bl(">")||on(Vr);return Nl(">"),Wt=n,K(e,"TypeParameterInstantiation")}function Kl(){return jt===Jt||jt===zt?Zn():yl(!0)}function Ql(e,n){return e.static=n,on(Or),e.id=Kl(),on(qr),e.key=ht(),on(Mr),on(qr),e.value=ht(),K(e,"ObjectTypeIndexer")}function Zl(e){for(e.params=[],e.rest=null,e.typeParameters=null,Bl("<")&&(e.typeParameters=zl()),on(Nr);jt===$t;)e.params.push(ut()),jt!==Fr&&on(Vr);return en(Jr)&&(e.rest=ut()),on(Fr),on(qr),e.returnType=ht(),K(e,"FunctionTypeAnnotation")}function et(e,n,l){var t=$(e);return t.value=Zl($(e)),t.static=n,t.key=l,t.optional=!1,K(t,"ObjectTypeProperty")}function nt(e,n){var l=Y();return e.static=n,e.value=Zl(l),K(e,"ObjectTypeCallProperty")}function lt(e){var n,l,t,r=Y(),a=!1;for(r.callProperties=[],r.properties=[],r.indexers=[],on(Dr);jt!==Br;){var o=z();n=Y(),e&&nn("static")&&(H(),t=!0),jt===Or?r.indexers.push(Ql(n,t)):jt===Nr||Bl("<")?r.callProperties.push(nt(n,e)):(l=t&&jt===qr?yl():Kl(),Bl("<")||jt===Nr?r.properties.push(et(o,t,l)):(en(Hr)&&(a=!0),on(qr),n.key=l,n.value=ht(),n.optional=a,n.static=t,r.properties.push(K(n,"ObjectTypeProperty")))),en(Ur)||jt===Br||sn()}return on(Br),K(r,"ObjectTypeAnnotation")}function tt(e,n){var l=$(e);for(l.typeParameters=null,l.id=n;en(Gr);){var t=$(e);t.qualification=l.id,t.id=yl(),l.id=K(t,"QualifiedTypeIdentifier")}return Bl("<")&&(l.typeParameters=$l()),K(l,"GenericTypeAnnotation")}function rt(){var e=Y();return on(Pr["void"]),K(e,"VoidTypeAnnotation")}function at(){var e=Y();return on(Pr["typeof"]),e.argument=ct(),K(e,"TypeofTypeAnnotation")}function ot(){var e=Y();for(e.types=[],on(Or);_t>wt&&jt!==Mr&&(e.types.push(ht()),jt!==Mr);)on(Vr);return on(Mr),K(e,"TupleTypeAnnotation")}function ut(){var e=!1,n=Y();return n.name=yl(),en(Hr)&&(e=!0),on(qr),n.optional=e,n.typeAnnotation=ht(),K(n,"FunctionTypeParam")}function st(){for(var e={params:[],rest:null};jt===$t;)e.params.push(ut()),jt!==Fr&&on(Vr);return en(Jr)&&(e.rest=ut()),e}function it(e,n,l){switch(l.name){case"any":return K(n,"AnyTypeAnnotation");case"bool":case"boolean":return K(n,"BooleanTypeAnnotation");case"number":return K(n,"NumberTypeAnnotation");case"string":return K(n,"StringTypeAnnotation");default:return tt(e,l)}}function ct(){var e,n,l=z(),t=Y(),a=!1;switch(jt){case $t:return it(l,t,yl());case Dr:return lt();case Or:return ot();case ca:if("<"===Tt)return t.typeParameters=zl(),on(Nr),e=st(),t.params=e.params,t.rest=e.rest,on(Fr),on(Wr),t.returnType=ht(),K(t,"FunctionTypeAnnotation");case Nr:H();var o;return jt!==Fr&&jt!==Jr&&(jt===$t||(a=!0)),a?(o&&Fr?n=o:(n=ht(),on(Fr)),en(Wr)&&r(t,"Unexpected token =>. It looks like you are trying to write a function type, but you ended up writing a grouped type followed by an =>, which is a syntax error. Remember, function type parameters are named so function types look like (name1: type1, name2: type2) => returnType. You probably wrote (type1) => returnType"),n):(e=st(),t.params=e.params,t.rest=e.rest,on(Fr),on(Wr),t.returnType=ht(),t.typeParameters=null,K(t,"FunctionTypeAnnotation"));case zt:return t.value=Tt,t.raw=bt.slice(Rt,St),H(),K(t,"StringLiteralTypeAnnotation");default:if(jt.keyword)switch(jt.keyword){case"void":return rt();case"typeof":return at()}}sn()}function dt(){var e=Y(),n=e.elementType=ct();return jt===Or?(on(Or),on(Mr),K(e,"ArrayTypeAnnotation")):n}function pt(){var e=Y();return en(Hr)?(e.typeAnnotation=pt(),K(e,"NullableTypeAnnotation")):dt()}function ft(){var e=Y(),n=pt();for(e.types=[n];en(sa);)e.types.push(pt());return 1===e.types.length?n:K(e,"IntersectionTypeAnnotation")}function gt(){var e=Y(),n=ft();for(e.types=[n];en(oa);)e.types.push(ft());return 1===e.types.length?n:K(e,"UnionTypeAnnotation")}function ht(){var e=Wt;Wt=!0;var n=gt();return Wt=e,n}function mt(){var e=Y(),n=Wt;return Wt=!0,on(qr),e.typeAnnotation=ht(),Wt=n,K(e,"TypeAnnotation")}function yt(e,n){var l=(Y(),yl()),t=!1;return n&&en(Hr)&&(on(Hr),t=!0),(e||jt===qr)&&(l.typeAnnotation=mt(),K(l,l.type)),t&&(l.optional=!0,K(l,l.type)),l}e.version="0.11.1";var xt,bt,_t,vt;e.parse=function(e,l){bt=String(e),_t=bt.length,n(l),s();var r=xt.locations?[wt,u()]:wt;return t(),xt.strictMode&&(Gt=!0),In(xt.program||$(r))};var It=e.defaultOptions={strictMode:!1,playground:!1,ecmaVersion:5,strictSemicolons:!1,allowTrailingCommas:!0,forbidReserved:!1,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1};e.parseExpressionAt=function(e,l,r){return bt=String(e),_t=bt.length,n(r),s(l),t(),Wn()};var Et=function(e){return"[object Array]"===Object.prototype.toString.call(e)},kt=e.getLineInfo=function(e,n){for(var l=1,t=0;;){Oa.lastIndex=t;var r=Oa.exec(e);if(!(r&&r.index<n))break;++l,t=r.index+r[0].length}return{line:l,column:n-t}};e.Token=l,e.tokenize=function(e,t){function r(){return Bt=St,w(),new l}return bt=String(e),_t=bt.length,n(t),s(),g(),r.jumpTo=function(e,n){if(wt=e,xt.locations){Ot=1,Mt=Oa.lastIndex=0;for(var l;(l=Oa.exec(bt))&&l.index<e;)++Ot,Mt=l.index+l[0].length}Pt=!!n,g()},r.current=function(){return new l},"undefined"!=typeof Symbol&&(r[Symbol.iterator]=function(){return{next:function(){var e=r();return{done:e.type===Kt,value:e}}}}),r.options=xt,r};var wt,Rt,St,Ct,At,jt,Tt,Lt,Pt,Ot,Mt,Dt,Bt,Nt,Ft,Vt,Ut,qt,Gt,Ht,Wt,Xt=[],Jt={type:"num"},Yt={type:"regexp"},zt={type:"string"},$t={type:"name"},Kt={type:"eof"},Qt={type:"jsxName"},Zt={type:"xjsName"},er={type:"xjsText"},nr={keyword:"break"},lr={keyword:"case",beforeExpr:!0},tr={keyword:"catch"},rr={keyword:"continue"},ar={keyword:"debugger"},or={keyword:"default"},ur={keyword:"do",isLoop:!0},sr={keyword:"else",beforeExpr:!0},ir={keyword:"finally"},cr={keyword:"for",isLoop:!0},dr={keyword:"function"},pr={keyword:"if"},fr={keyword:"return",beforeExpr:!0},gr={keyword:"switch"},hr={keyword:"throw",beforeExpr:!0},mr={keyword:"try"},yr={keyword:"var"},xr={keyword:"let"},br={keyword:"const"},_r={keyword:"while",isLoop:!0},vr={keyword:"with"},Ir={keyword:"new",beforeExpr:!0},Er={keyword:"this"},kr={keyword:"class"},wr={keyword:"extends",beforeExpr:!0},Rr={keyword:"export"},Sr={keyword:"import"},Cr={keyword:"yield",beforeExpr:!0},Ar={keyword:"null",atomValue:null},jr={keyword:"true",atomValue:!0},Tr={keyword:"false",atomValue:!1},Lr={keyword:"in",binop:7,beforeExpr:!0},Pr={"break":nr,"case":lr,"catch":tr,"continue":rr,"debugger":ar,"default":or,"do":ur,"else":sr,"finally":ir,"for":cr,"function":dr,"if":pr,"return":fr,"switch":gr,"throw":hr,"try":mr,"var":yr,let:xr,"const":br,"while":_r,"with":vr,"null":Ar,"true":jr,"false":Tr,"new":Ir,"in":Lr,"instanceof":{keyword:"instanceof",binop:7,beforeExpr:!0},"this":Er,"typeof":{keyword:"typeof",prefix:!0,beforeExpr:!0},"void":{keyword:"void",prefix:!0,beforeExpr:!0},"delete":{keyword:"delete",prefix:!0,beforeExpr:!0},"class":kr,"extends":wr,"export":Rr,"import":Sr,"yield":Cr},Or={type:"[",beforeExpr:!0},Mr={type:"]"},Dr={type:"{",beforeExpr:!0},Br={type:"}"},Nr={type:"(",beforeExpr:!0},Fr={type:")"},Vr={type:",",beforeExpr:!0},Ur={type:";",beforeExpr:!0},qr={type:":",beforeExpr:!0},Gr={type:"."},Hr={type:"?",beforeExpr:!0},Wr={type:"=>",beforeExpr:!0},Xr={type:"template"},Jr={type:"...",beforeExpr:!0},Yr={type:"`"},zr={type:"${",beforeExpr:!0},$r={type:"jsxText"},Kr={type:"::",beforeExpr:!0},Qr={type:"#"},Zr={binop:10,beforeExpr:!0},ea={isAssign:!0,beforeExpr:!0},na={isAssign:!0,beforeExpr:!0},la={postfix:!0,prefix:!0,isUpdate:!0},ta={prefix:!0,beforeExpr:!0},ra={binop:1,beforeExpr:!0},aa={binop:2,beforeExpr:!0},oa={binop:3,beforeExpr:!0},ua={binop:4,beforeExpr:!0},sa={binop:5,beforeExpr:!0},ia={binop:6,beforeExpr:!0},ca={binop:7,beforeExpr:!0},da={binop:8,beforeExpr:!0},pa={binop:9,prefix:!0,beforeExpr:!0},fa={binop:10,beforeExpr:!0},ga={binop:10,beforeExpr:!0},ha={binop:11,beforeExpr:!0,rightAssociative:!0},ma={type:"jsxTagStart"},ya={type:"jsxTagEnd"};e.tokTypes={bracketL:Or,bracketR:Mr,braceL:Dr,braceR:Br,parenL:Nr,parenR:Fr,comma:Vr,semi:Ur,colon:qr,dot:Gr,ellipsis:Jr,question:Hr,slash:Zr,eq:ea,name:$t,eof:Kt,num:Jt,regexp:Yt,string:zt,paamayimNekudotayim:Kr,exponent:ha,hash:Qr,arrow:Wr,template:Xr,star:ga,assign:na,backQuote:Yr,dollarBraceL:zr,jsxName:Qt,jsxText:$r,jsxTagStart:ma,jsxTagEnd:ya};for(var xa in Pr)e.tokTypes["_"+xa]=Pr[xa];var ba=function(e){switch(e.length){case 6:switch(e){case"double":case"export":case"import":case"native":case"public":case"static":case"throws":return!0}return!1;case 4:switch(e){case"byte":case"char":case"enum":case"goto":case"long":return!0}return!1;case 5:switch(e){case"class":case"final":case"float":case"short":case"super":return!0}return!1;case 7:switch(e){case"boolean":case"extends":case"package":case"private":return!0}return!1;case 9:switch(e){case"interface":case"protected":case"transient":return!0}return!1;case 8:switch(e){case"abstract":case"volatile":return!0}return!1;case 10:return"implements"===e;case 3:return"int"===e;case 12:return"synchronized"===e}},_a=function(e){switch(e.length){case 5:switch(e){case"class":case"super":case"const":return!0}return!1;case 6:switch(e){case"export":case"import":return!0}return!1;case 4:return"enum"===e;case 7:return"extends"===e}},va=function(e){switch(e.length){case 9:switch(e){case"interface":case"protected":return!0}return!1;case 7:switch(e){case"package":case"private":return!0}return!1;case 6:switch(e){case"public":case"static":return!0}return!1;case 10:return"implements"===e;case 3:return"let"===e;case 5:return"yield"===e}},Ia=function(e){switch(e){case"eval":case"arguments":return!0}return!1},Ea=function(e){switch(e.length){case 4:switch(e){case"case":case"else":case"with":case"null":case"true":case"void":case"this":return!0}return!1;case 5:switch(e){case"break":case"catch":case"throw":case"while":case"false":return!0}return!1;case 3:switch(e){case"for":case"try":case"var":case"new":return!0}return!1;case 6:switch(e){case"return":case"switch":case"typeof":case"delete":return!0}return!1;case 8:switch(e){case"continue":case"debugger":case"function":return!0}return!1;case 2:switch(e){case"do":case"if":case"in":return!0}return!1;case 7:switch(e){case"default":case"finally":return!0}return!1;case 10:return"instanceof"===e}},ka=function(e){switch(e.length){case 5:switch(e){case"break":case"catch":case"throw":case"while":case"false":case"const":case"class":case"yield":return!0}return!1;case 4:switch(e){case"case":case"else":case"with":case"null":case"true":case"void":case"this":return!0}return!1;case 6:switch(e){case"return":case"switch":case"typeof":case"delete":case"export":case"import":return!0}return!1;case 3:switch(e){case"for":case"try":case"var":case"new":case"let":return!0}return!1;case 8:switch(e){case"continue":case"debugger":case"function":return!0}return!1;case 7:switch(e){case"default":case"finally":case"extends":return!0}return!1;case 2:switch(e){case"do":case"if":case"in":return!0}return!1;case 10:return"instanceof"===e}},wa=Ea,Ra=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/,Sa="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Ca="̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏ᦰ-ᧀᧈᧉ᧐-᧙ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷼-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-꣄꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︭︳︴﹍-﹏0-9_",Aa=new RegExp("["+Sa+"]"),ja=new RegExp("["+Sa+Ca+"]"),Ta=/^\d+$/,La=/^[\da-fA-F]+$/,Pa=/[\n\r\u2028\u2029]/,Oa=/\r\n|[\n\r\u2028\u2029]/g,Ma=e.isIdentifierStart=function(e){return 65>e?36===e:91>e?!0:97>e?95===e:123>e?!0:e>=170&&Aa.test(String.fromCharCode(e))},Da=e.isIdentifierChar=function(e){return 48>e?36===e:58>e?!0:65>e?!1:91>e?!0:97>e?95===e:123>e?!0:e>=170&&ja.test(String.fromCharCode(e))};o.prototype.offset=function(e){return new o(this.line,this.column+e)};var Ba={token:"{",isExpr:!1},Na={token:"{",isExpr:!0},Fa={token:"${",isExpr:!0},Va={token:"(",isExpr:!1},Ua={token:"(",isExpr:!0},qa={token:"`",isExpr:!0},Ga={token:"function",isExpr:!0},Ha={token:"<tag",isExpr:!1},Wa={token:"</tag",isExpr:!1},Xa={token:"<tag>...</tag>",isExpr:!0},Ja=!1;try{new RegExp("","u"),Ja=!0}catch(Ya){}var za,$a={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪","int":"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"},$a={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪","int":"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"};e.Node=X;var Ka={kind:"loop"},Qa={kind:"switch"}})},{}],124:[function(e){var n=e("../lib/types"),l=n.Type,t=l.def,r=l.or,a=n.builtInTypes,o=a.string,u=a.number,s=a.boolean,i=a.RegExp,c=e("../lib/shared"),d=c.defaults,p=c.geq;t("Printable").field("loc",r(t("SourceLocation"),null),d["null"],!0),t("Node").bases("Printable").field("type",o).field("comments",r([t("Comment")],null),d["null"],!0),t("SourceLocation").build("start","end","source").field("start",t("Position")).field("end",t("Position")).field("source",r(o,null),d["null"]),t("Position").build("line","column").field("line",p(1)).field("column",p(0)),t("Program").bases("Node").build("body").field("body",[t("Statement")]),t("Function").bases("Node").field("id",r(t("Identifier"),null),d["null"]).field("params",[t("Pattern")]).field("body",r(t("BlockStatement"),t("Expression"))),t("Statement").bases("Node"),t("EmptyStatement").bases("Statement").build(),t("BlockStatement").bases("Statement").build("body").field("body",[t("Statement")]),t("ExpressionStatement").bases("Statement").build("expression").field("expression",t("Expression")),t("IfStatement").bases("Statement").build("test","consequent","alternate").field("test",t("Expression")).field("consequent",t("Statement")).field("alternate",r(t("Statement"),null),d["null"]),t("LabeledStatement").bases("Statement").build("label","body").field("label",t("Identifier")).field("body",t("Statement")),t("BreakStatement").bases("Statement").build("label").field("label",r(t("Identifier"),null),d["null"]),t("ContinueStatement").bases("Statement").build("label").field("label",r(t("Identifier"),null),d["null"]),t("WithStatement").bases("Statement").build("object","body").field("object",t("Expression")).field("body",t("Statement")),t("SwitchStatement").bases("Statement").build("discriminant","cases","lexical").field("discriminant",t("Expression")).field("cases",[t("SwitchCase")]).field("lexical",s,d["false"]),t("ReturnStatement").bases("Statement").build("argument").field("argument",r(t("Expression"),null)),t("ThrowStatement").bases("Statement").build("argument").field("argument",t("Expression")),t("TryStatement").bases("Statement").build("block","handler","finalizer").field("block",t("BlockStatement")).field("handler",r(t("CatchClause"),null),function(){return this.handlers&&this.handlers[0]||null}).field("handlers",[t("CatchClause")],function(){return this.handler?[this.handler]:[]},!0).field("guardedHandlers",[t("CatchClause")],d.emptyArray).field("finalizer",r(t("BlockStatement"),null),d["null"]),t("CatchClause").bases("Node").build("param","guard","body").field("param",t("Pattern")).field("guard",r(t("Expression"),null),d["null"]).field("body",t("BlockStatement")),t("WhileStatement").bases("Statement").build("test","body").field("test",t("Expression")).field("body",t("Statement")),t("DoWhileStatement").bases("Statement").build("body","test").field("body",t("Statement")).field("test",t("Expression")),t("ForStatement").bases("Statement").build("init","test","update","body").field("init",r(t("VariableDeclaration"),t("Expression"),null)).field("test",r(t("Expression"),null)).field("update",r(t("Expression"),null)).field("body",t("Statement")),t("ForInStatement").bases("Statement").build("left","right","body","each").field("left",r(t("VariableDeclaration"),t("Expression"))).field("right",t("Expression")).field("body",t("Statement")).field("each",s),t("DebuggerStatement").bases("Statement").build(),t("Declaration").bases("Statement"),t("FunctionDeclaration").bases("Function","Declaration").build("id","params","body").field("id",t("Identifier")),t("FunctionExpression").bases("Function","Expression").build("id","params","body"),t("VariableDeclaration").bases("Declaration").build("kind","declarations").field("kind",r("var","let","const")).field("declarations",[r(t("VariableDeclarator"),t("Identifier"))]),t("VariableDeclarator").bases("Node").build("id","init").field("id",t("Pattern")).field("init",r(t("Expression"),null)),t("Expression").bases("Node","Pattern"),t("ThisExpression").bases("Expression").build(),t("ArrayExpression").bases("Expression").build("elements").field("elements",[r(t("Expression"),null)]),t("ObjectExpression").bases("Expression").build("properties").field("properties",[t("Property")]),t("Property").bases("Node").build("kind","key","value").field("kind",r("init","get","set")).field("key",r(t("Literal"),t("Identifier"))).field("value",t("Expression")),t("SequenceExpression").bases("Expression").build("expressions").field("expressions",[t("Expression")]);var f=r("-","+","!","~","typeof","void","delete");t("UnaryExpression").bases("Expression").build("operator","argument","prefix").field("operator",f).field("argument",t("Expression")).field("prefix",s,d["true"]);var g=r("==","!=","===","!==","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","&","|","^","in","instanceof","..");t("BinaryExpression").bases("Expression").build("operator","left","right").field("operator",g).field("left",t("Expression")).field("right",t("Expression"));var h=r("=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","^=","&=");t("AssignmentExpression").bases("Expression").build("operator","left","right").field("operator",h).field("left",t("Pattern")).field("right",t("Expression"));var m=r("++","--");t("UpdateExpression").bases("Expression").build("operator","argument","prefix").field("operator",m).field("argument",t("Expression")).field("prefix",s);var y=r("||","&&");t("LogicalExpression").bases("Expression").build("operator","left","right").field("operator",y).field("left",t("Expression")).field("right",t("Expression")),t("ConditionalExpression").bases("Expression").build("test","consequent","alternate").field("test",t("Expression")).field("consequent",t("Expression")).field("alternate",t("Expression")),t("NewExpression").bases("Expression").build("callee","arguments").field("callee",t("Expression")).field("arguments",[t("Expression")]),t("CallExpression").bases("Expression").build("callee","arguments").field("callee",t("Expression")).field("arguments",[t("Expression")]),t("MemberExpression").bases("Expression").build("object","property","computed").field("object",t("Expression")).field("property",r(t("Identifier"),t("Expression"))).field("computed",s),t("Pattern").bases("Node"),t("ObjectPattern").bases("Pattern").build("properties").field("properties",[t("PropertyPattern")]),t("PropertyPattern").bases("Pattern").build("key","pattern").field("key",r(t("Literal"),t("Identifier"))).field("pattern",t("Pattern")),t("ArrayPattern").bases("Pattern").build("elements").field("elements",[r(t("Pattern"),null)]),t("SwitchCase").bases("Node").build("test","consequent").field("test",r(t("Expression"),null)).field("consequent",[t("Statement")]),t("Identifier").bases("Node","Expression","Pattern").build("name").field("name",o),t("Literal").bases("Node","Expression").build("value").field("value",r(o,s,null,u,i)),t("Comment").bases("Printable").field("value",o).field("leading",s,d["true"]).field("trailing",s,d["false"]),t("Block").bases("Comment").build("value","leading","trailing"),t("Line").bases("Comment").build("value","leading","trailing")},{"../lib/shared":135,"../lib/types":136}],125:[function(e){e("./core");var n=e("../lib/types"),l=n.Type.def,t=n.Type.or,r=n.builtInTypes,a=r.string,o=r.boolean;l("XMLDefaultDeclaration").bases("Declaration").field("namespace",l("Expression")),l("XMLAnyName").bases("Expression"),l("XMLQualifiedIdentifier").bases("Expression").field("left",t(l("Identifier"),l("XMLAnyName"))).field("right",t(l("Identifier"),l("Expression"))).field("computed",o),l("XMLFunctionQualifiedIdentifier").bases("Expression").field("right",t(l("Identifier"),l("Expression"))).field("computed",o),l("XMLAttributeSelector").bases("Expression").field("attribute",l("Expression")),l("XMLFilterExpression").bases("Expression").field("left",l("Expression")).field("right",l("Expression")),l("XMLElement").bases("XML","Expression").field("contents",[l("XML")]),l("XMLList").bases("XML","Expression").field("contents",[l("XML")]),l("XML").bases("Node"),l("XMLEscape").bases("XML").field("expression",l("Expression")),l("XMLText").bases("XML").field("text",a),l("XMLStartTag").bases("XML").field("contents",[l("XML")]),l("XMLEndTag").bases("XML").field("contents",[l("XML")]),l("XMLPointTag").bases("XML").field("contents",[l("XML")]),l("XMLName").bases("XML").field("contents",t(a,[l("XML")])),l("XMLAttribute").bases("XML").field("value",a),l("XMLCdata").bases("XML").field("contents",a),l("XMLComment").bases("XML").field("contents",a),l("XMLProcessingInstruction").bases("XML").field("target",a).field("contents",t(a,null))},{"../lib/types":136,"./core":124}],126:[function(e){e("./core");var n=e("../lib/types"),l=n.Type.def,t=n.Type.or,r=n.builtInTypes,a=r.boolean,o=(r.object,r.string),u=e("../lib/shared").defaults;l("Function").field("generator",a,u["false"]).field("expression",a,u["false"]).field("defaults",[t(l("Expression"),null)],u.emptyArray).field("rest",t(l("Identifier"),null),u["null"]),l("FunctionDeclaration").build("id","params","body","generator","expression"),l("FunctionExpression").build("id","params","body","generator","expression"),l("ArrowFunctionExpression").bases("Function","Expression").build("params","body","expression").field("id",null,u["null"]).field("generator",!1),l("YieldExpression").bases("Expression").build("argument","delegate").field("argument",t(l("Expression"),null)).field("delegate",a,u["false"]),l("GeneratorExpression").bases("Expression").build("body","blocks","filter").field("body",l("Expression")).field("blocks",[l("ComprehensionBlock")]).field("filter",t(l("Expression"),null)),l("ComprehensionExpression").bases("Expression").build("body","blocks","filter").field("body",l("Expression")).field("blocks",[l("ComprehensionBlock")]).field("filter",t(l("Expression"),null)),l("ComprehensionBlock").bases("Node").build("left","right","each").field("left",l("Pattern")).field("right",l("Expression")).field("each",a),l("ModuleSpecifier").bases("Literal").build("value").field("value",o),l("Property").field("key",t(l("Literal"),l("Identifier"),l("Expression"))).field("method",a,u["false"]).field("shorthand",a,u["false"]).field("computed",a,u["false"]),l("PropertyPattern").field("key",t(l("Literal"),l("Identifier"),l("Expression"))).field("computed",a,u["false"]),l("MethodDefinition").bases("Declaration").build("kind","key","value").field("kind",t("init","get","set","")).field("key",t(l("Literal"),l("Identifier"),l("Expression"))).field("value",l("Function")).field("computed",a,u["false"]),l("SpreadElement").bases("Node").build("argument").field("argument",l("Expression")),l("ArrayExpression").field("elements",[t(l("Expression"),l("SpreadElement"),null)]),l("NewExpression").field("arguments",[t(l("Expression"),l("SpreadElement"))]),l("CallExpression").field("arguments",[t(l("Expression"),l("SpreadElement"))]),l("SpreadElementPattern").bases("Pattern").build("argument").field("argument",l("Pattern"));
var s=t(l("MethodDefinition"),l("VariableDeclarator"),l("ClassPropertyDefinition"),l("ClassProperty"));l("ClassProperty").bases("Declaration").build("key").field("key",t(l("Literal"),l("Identifier"),l("Expression"))).field("computed",a,u["false"]),l("ClassPropertyDefinition").bases("Declaration").build("definition").field("definition",s),l("ClassBody").bases("Declaration").build("body").field("body",[s]),l("ClassDeclaration").bases("Declaration").build("id","body","superClass").field("id",l("Identifier")).field("body",l("ClassBody")).field("superClass",t(l("Expression"),null),u["null"]),l("ClassExpression").bases("Expression").build("id","body","superClass").field("id",t(l("Identifier"),null),u["null"]).field("body",l("ClassBody")).field("superClass",t(l("Expression"),null),u["null"]).field("implements",[l("ClassImplements")],u.emptyArray),l("ClassImplements").bases("Node").build("id").field("id",l("Identifier")).field("superClass",t(l("Expression"),null),u["null"]),l("Specifier").bases("Node"),l("NamedSpecifier").bases("Specifier").field("id",l("Identifier")).field("name",t(l("Identifier"),null),u["null"]),l("ExportSpecifier").bases("NamedSpecifier").build("id","name"),l("ExportBatchSpecifier").bases("Specifier").build(),l("ImportSpecifier").bases("NamedSpecifier").build("id","name"),l("ImportNamespaceSpecifier").bases("Specifier").build("id").field("id",l("Identifier")),l("ImportDefaultSpecifier").bases("Specifier").build("id").field("id",l("Identifier")),l("ExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",a).field("declaration",t(l("Declaration"),l("Expression"),null)).field("specifiers",[t(l("ExportSpecifier"),l("ExportBatchSpecifier"))],u.emptyArray).field("source",t(l("ModuleSpecifier"),null),u["null"]),l("ImportDeclaration").bases("Declaration").build("specifiers","source").field("specifiers",[t(l("ImportSpecifier"),l("ImportNamespaceSpecifier"),l("ImportDefaultSpecifier"))],u.emptyArray).field("source",l("ModuleSpecifier")),l("TaggedTemplateExpression").bases("Expression").field("tag",l("Expression")).field("quasi",l("TemplateLiteral")),l("TemplateLiteral").bases("Expression").build("quasis","expressions").field("quasis",[l("TemplateElement")]).field("expressions",[l("Expression")]),l("TemplateElement").bases("Node").build("value","tail").field("value",{cooked:o,raw:o}).field("tail",a)},{"../lib/shared":135,"../lib/types":136,"./core":124}],127:[function(e){e("./core");var n=e("../lib/types"),l=n.Type.def,t=n.Type.or,r=n.builtInTypes,a=r.boolean,o=e("../lib/shared").defaults;l("Function").field("async",a,o["false"]),l("SpreadProperty").bases("Node").build("argument").field("argument",l("Expression")),l("ObjectExpression").field("properties",[t(l("Property"),l("SpreadProperty"))]),l("SpreadPropertyPattern").bases("Pattern").build("argument").field("argument",l("Pattern")),l("ObjectPattern").field("properties",[t(l("PropertyPattern"),l("SpreadPropertyPattern"))]),l("AwaitExpression").bases("Expression").build("argument","all").field("argument",t(l("Expression"),null)).field("all",a,o["false"])},{"../lib/shared":135,"../lib/types":136,"./core":124}],128:[function(e){e("./core");var n=e("../lib/types"),l=n.Type.def,t=n.Type.or,r=n.builtInTypes,a=r.string,o=r.boolean,u=e("../lib/shared").defaults;l("XJSAttribute").bases("Node").build("name","value").field("name",t(l("XJSIdentifier"),l("XJSNamespacedName"))).field("value",t(l("Literal"),l("XJSExpressionContainer"),null),u["null"]),l("XJSIdentifier").bases("Node").build("name").field("name",a),l("XJSNamespacedName").bases("Node").build("namespace","name").field("namespace",l("XJSIdentifier")).field("name",l("XJSIdentifier")),l("XJSMemberExpression").bases("MemberExpression").build("object","property").field("object",t(l("XJSIdentifier"),l("XJSMemberExpression"))).field("property",l("XJSIdentifier")).field("computed",o,u.false);var s=t(l("XJSIdentifier"),l("XJSNamespacedName"),l("XJSMemberExpression"));l("XJSSpreadAttribute").bases("Node").build("argument").field("argument",l("Expression"));var i=[t(l("XJSAttribute"),l("XJSSpreadAttribute"))];l("XJSExpressionContainer").bases("Expression").build("expression").field("expression",l("Expression")),l("XJSElement").bases("Expression").build("openingElement","closingElement","children").field("openingElement",l("XJSOpeningElement")).field("closingElement",t(l("XJSClosingElement"),null),u["null"]).field("children",[t(l("XJSElement"),l("XJSExpressionContainer"),l("XJSText"),l("Literal"))],u.emptyArray).field("name",s,function(){return this.openingElement.name}).field("selfClosing",o,function(){return this.openingElement.selfClosing}).field("attributes",i,function(){return this.openingElement.attributes}),l("XJSOpeningElement").bases("Node").build("name","attributes","selfClosing").field("name",s).field("attributes",i,u.emptyArray).field("selfClosing",o,u["false"]),l("XJSClosingElement").bases("Node").build("name").field("name",s),l("XJSText").bases("Literal").build("value").field("value",a),l("XJSEmptyExpression").bases("Expression").build(),l("Type").bases("Node"),l("AnyTypeAnnotation").bases("Type"),l("VoidTypeAnnotation").bases("Type"),l("NumberTypeAnnotation").bases("Type"),l("StringTypeAnnotation").bases("Type"),l("StringLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",a).field("raw",a),l("BooleanTypeAnnotation").bases("Type"),l("TypeAnnotation").bases("Node").build("typeAnnotation").field("typeAnnotation",l("Type")),l("NullableTypeAnnotation").bases("Type").build("typeAnnotation").field("typeAnnotation",l("Type")),l("FunctionTypeAnnotation").bases("Type").build("params","returnType","rest","typeParameters").field("params",[l("FunctionTypeParam")]).field("returnType",l("Type")).field("rest",t(l("FunctionTypeParam"),null)).field("typeParameters",t(l("TypeParameterDeclaration"),null)),l("FunctionTypeParam").bases("Node").build("name","typeAnnotation","optional").field("name",l("Identifier")).field("typeAnnotation",l("Type")).field("optional",o),l("ArrayTypeAnnotation").bases("Type").build("elementType").field("elementType",l("Type")),l("ObjectTypeAnnotation").bases("Type").build("properties").field("properties",[l("ObjectTypeProperty")]).field("indexers",[l("ObjectTypeIndexer")],u.emptyArray).field("callProperties",[l("ObjectTypeCallProperty")],u.emptyArray),l("ObjectTypeProperty").bases("Node").build("key","value","optional").field("key",t(l("Literal"),l("Identifier"))).field("value",l("Type")).field("optional",o),l("ObjectTypeIndexer").bases("Node").build("id","key","value").field("id",l("Identifier")).field("key",l("Type")).field("value",l("Type")),l("ObjectTypeCallProperty").bases("Node").build("value").field("value",l("FunctionTypeAnnotation")).field("static",o,!1),l("QualifiedTypeIdentifier").bases("Node").build("qualification","id").field("qualification",t(l("Identifier"),l("QualifiedTypeIdentifier"))).field("id",l("Identifier")),l("GenericTypeAnnotation").bases("Type").build("id","typeParameters").field("id",t(l("Identifier"),l("QualifiedTypeIdentifier"))).field("typeParameters",t(l("TypeParameterInstantiation"),null)),l("MemberTypeAnnotation").bases("Type").build("object","property").field("object",l("Identifier")).field("property",t(l("MemberTypeAnnotation"),l("GenericTypeAnnotation"))),l("UnionTypeAnnotation").bases("Type").build("types").field("types",[l("Type")]),l("IntersectionTypeAnnotation").bases("Type").build("types").field("types",[l("Type")]),l("TypeofTypeAnnotation").bases("Type").build("argument").field("argument",l("Type")),l("Identifier").field("typeAnnotation",t(l("TypeAnnotation"),null),u["null"]),l("TypeParameterDeclaration").bases("Node").build("params").field("params",[l("Identifier")]),l("TypeParameterInstantiation").bases("Node").build("params").field("params",[l("Type")]),l("Function").field("returnType",t(l("TypeAnnotation"),null),u["null"]).field("typeParameters",t(l("TypeParameterDeclaration"),null),u["null"]),l("ClassProperty").build("key","typeAnnotation").field("typeAnnotation",l("TypeAnnotation")).field("static",o,!1),l("ClassImplements").field("typeParameters",t(l("TypeParameterInstantiation"),null),u["null"]),l("InterfaceDeclaration").bases("Statement").build("id","body","extends").field("id",l("Identifier")).field("typeParameters",t(l("TypeParameterDeclaration"),null),u["null"]).field("body",l("ObjectTypeAnnotation")).field("extends",[l("InterfaceExtends")]),l("InterfaceExtends").bases("Node").build("id").field("id",l("Identifier")).field("typeParameters",t(l("TypeParameterInstantiation"),null)),l("TypeAlias").bases("Statement").build("id","typeParameters","right").field("id",l("Identifier")).field("typeParameters",t(l("TypeParameterDeclaration"),null)).field("right",l("Type")),l("TypeCastExpression").bases("Expression").build("expression","typeAnnotation").field("expression",l("Expression")).field("typeAnnotation",l("TypeAnnotation")),l("TupleTypeAnnotation").bases("Type").build("types").field("types",[l("Type")]),l("DeclareVariable").bases("Statement").build("id").field("id",l("Identifier")),l("DeclareFunction").bases("Statement").build("id").field("id",l("Identifier")),l("DeclareClass").bases("InterfaceDeclaration").build("id"),l("DeclareModule").bases("Statement").build("id","body").field("id",t(l("Identifier"),l("Literal"))).field("body",l("BlockStatement"))},{"../lib/shared":135,"../lib/types":136,"./core":124}],129:[function(e){e("./core");var n=e("../lib/types"),l=n.Type.def,t=n.Type.or,r=e("../lib/shared").geq;l("ForOfStatement").bases("Statement").build("left","right","body").field("left",t(l("VariableDeclaration"),l("Expression"))).field("right",l("Expression")).field("body",l("Statement")),l("LetStatement").bases("Statement").build("head","body").field("head",[l("VariableDeclarator")]).field("body",l("Statement")),l("LetExpression").bases("Expression").build("head","body").field("head",[l("VariableDeclarator")]).field("body",l("Expression")),l("GraphExpression").bases("Expression").build("index","expression").field("index",r(0)).field("expression",l("Literal")),l("GraphIndexExpression").bases("Expression").build("index").field("index",r(0))},{"../lib/shared":135,"../lib/types":136,"./core":124}],130:[function(e,n){function l(e,n,l){return d.check(l)?l.length=0:l=null,r(e,n,l)}function t(e){return/[_$a-z][_$a-z0-9]*/i.test(e)?"."+e:"["+JSON.stringify(e)+"]"}function r(e,n,l){return e===n?!0:d.check(e)?a(e,n,l):p.check(e)?o(e,n,l):f.check(e)?f.check(n)&&+e===+n:g.check(e)?g.check(n)&&e.source===n.source&&e.global===n.global&&e.multiline===n.multiline&&e.ignoreCase===n.ignoreCase:e==n}function a(e,n,l){d.assert(e);var t=e.length;if(!d.check(n)||n.length!==t)return l&&l.push("length"),!1;for(var a=0;t>a;++a){if(l&&l.push(a),a in e!=a in n)return!1;if(!r(e[a],n[a],l))return!1;l&&u.strictEqual(l.pop(),a)}return!0}function o(e,n,l){if(p.assert(e),!p.check(n))return!1;if(e.type!==n.type)return l&&l.push("type"),!1;var t=i(e),a=t.length,o=i(n),s=o.length;if(a===s){for(var d=0;a>d;++d){var f=t[d],g=c(e,f),m=c(n,f);if(l&&l.push(f),!r(g,m,l))return!1;l&&u.strictEqual(l.pop(),f)}return!0}if(!l)return!1;var y=Object.create(null);for(d=0;a>d;++d)y[t[d]]=!0;for(d=0;s>d;++d){if(f=o[d],!h.call(y,f))return l.push(f),!1;delete y[f]}for(f in y){l.push(f);break}return!1}var u=e("assert"),s=e("../main"),i=s.getFieldNames,c=s.getFieldValue,d=s.builtInTypes.array,p=s.builtInTypes.object,f=s.builtInTypes.Date,g=s.builtInTypes.RegExp,h=Object.prototype.hasOwnProperty;l.assert=function(e,n){var r=[];l(e,n,r)||(0===r.length?u.strictEqual(e,n):u.ok(!1,"Nodes differ in the following path: "+r.map(t).join("")))},n.exports=l},{"../main":137,assert:139}],131:[function(e,n){function l(e,n,t){s.ok(this instanceof l),g.call(this,e,n,t)}function t(e){return c.BinaryExpression.check(e)||c.LogicalExpression.check(e)}function r(e){return c.CallExpression.check(e)?!0:f.check(e)?e.some(r):c.Node.check(e)?i.someField(e,function(e,n){return r(n)}):!1}function a(e){for(var n,l;e.parent;e=e.parent){if(n=e.node,l=e.parent.node,c.BlockStatement.check(l)&&"body"===e.parent.name&&0===e.name)return s.strictEqual(l.body[0],n),!0;if(c.ExpressionStatement.check(l)&&"expression"===e.name)return s.strictEqual(l.expression,n),!0;if(c.SequenceExpression.check(l)&&"expressions"===e.parent.name&&0===e.name)s.strictEqual(l.expressions[0],n);else if(c.CallExpression.check(l)&&"callee"===e.name)s.strictEqual(l.callee,n);else if(c.MemberExpression.check(l)&&"object"===e.name)s.strictEqual(l.object,n);else if(c.ConditionalExpression.check(l)&&"test"===e.name)s.strictEqual(l.test,n);else if(t(l)&&"left"===e.name)s.strictEqual(l.left,n);else{if(!c.UnaryExpression.check(l)||l.prefix||"argument"!==e.name)return!1;s.strictEqual(l.argument,n)}}return!0}function o(e){if(c.VariableDeclaration.check(e.node)){var n=e.get("declarations").value;if(!n||0===n.length)return e.prune()}else if(c.ExpressionStatement.check(e.node)){if(!e.get("expression").value)return e.prune()}else c.IfStatement.check(e.node)&&u(e);return e}function u(e){var n=e.get("test").value,l=e.get("alternate").value,t=e.get("consequent").value;if(t||l){if(!t&&l){var r=d.unaryExpression("!",n,!0);c.UnaryExpression.check(n)&&"!"===n.operator&&(r=n.argument),e.get("test").replace(r),e.get("consequent").replace(l),e.get("alternate").replace()}}else{var a=d.expressionStatement(n);e.replace(a)}}var s=e("assert"),i=e("./types"),c=i.namedTypes,d=i.builders,p=i.builtInTypes.number,f=i.builtInTypes.array,g=e("./path"),h=e("./scope");e("util").inherits(l,g);var m=l.prototype;Object.defineProperties(m,{node:{get:function(){return Object.defineProperty(this,"node",{configurable:!0,value:this._computeNode()}),this.node}},parent:{get:function(){return Object.defineProperty(this,"parent",{configurable:!0,value:this._computeParent()}),this.parent}},scope:{get:function(){return Object.defineProperty(this,"scope",{configurable:!0,value:this._computeScope()}),this.scope}}}),m.replace=function(){return delete this.node,delete this.parent,delete this.scope,g.prototype.replace.apply(this,arguments)},m.prune=function(){var e=this.parent;return this.replace(),o(e)},m._computeNode=function(){var e=this.value;if(c.Node.check(e))return e;var n=this.parentPath;return n&&n.node||null},m._computeParent=function(){var e=this.value,n=this.parentPath;if(!c.Node.check(e)){for(;n&&!c.Node.check(n.value);)n=n.parentPath;n&&(n=n.parentPath)}for(;n&&!c.Node.check(n.value);)n=n.parentPath;return n||null},m._computeScope=function(){var e=this.value,n=this.parentPath,l=n&&n.scope;return c.Node.check(e)&&h.isEstablishedBy(e)&&(l=new h(this,l)),l||null},m.getValueProperty=function(e){return i.getFieldValue(this.value,e)},m.needsParens=function(e){var n=this.parentPath;if(!n)return!1;var l=this.value;if(!c.Expression.check(l))return!1;if("Identifier"===l.type)return!1;for(;!c.Node.check(n.value);)if(n=n.parentPath,!n)return!1;var t=n.value;switch(l.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return"MemberExpression"===t.type&&"object"===this.name&&t.object===l;case"BinaryExpression":case"LogicalExpression":switch(t.type){case"CallExpression":return"callee"===this.name&&t.callee===l;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return!0;case"MemberExpression":return"object"===this.name&&t.object===l;case"BinaryExpression":case"LogicalExpression":var a=t.operator,n=y[a],o=l.operator,u=y[o];if(n>u)return!0;if(n===u&&"right"===this.name)return s.strictEqual(t.right,l),!0;default:return!1}case"SequenceExpression":switch(t.type){case"ForStatement":return!1;case"ExpressionStatement":return"expression"!==this.name;default:return!0}case"YieldExpression":switch(t.type){case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"CallExpression":case"MemberExpression":case"NewExpression":case"ConditionalExpression":case"YieldExpression":return!0;default:return!1}case"Literal":return"MemberExpression"===t.type&&p.check(l.value)&&"object"===this.name&&t.object===l;case"AssignmentExpression":case"ConditionalExpression":switch(t.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return!0;case"CallExpression":return"callee"===this.name&&t.callee===l;case"ConditionalExpression":return"test"===this.name&&t.test===l;case"MemberExpression":return"object"===this.name&&t.object===l;default:return!1}default:if("NewExpression"===t.type&&"callee"===this.name&&t.callee===l)return r(l)}return e!==!0&&!this.canBeFirstInStatement()&&this.firstInStatement()?!0:!1};var y={};[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(e,n){e.forEach(function(e){y[e]=n})}),m.canBeFirstInStatement=function(){var e=this.node;return!c.FunctionExpression.check(e)&&!c.ObjectExpression.check(e)},m.firstInStatement=function(){return a(this)},n.exports=l},{"./path":133,"./scope":134,"./types":136,assert:139,util:164}],132:[function(e,n){function l(){s.ok(this instanceof l),this._reusableContextStack=[],this._methodNameTable=t(this),this.Context=o(this),this._visiting=!1,this._changeReported=!1}function t(e){var n=Object.create(null);for(var l in e)/^visit[A-Z]/.test(l)&&(n[l.slice("visit".length)]=!0);for(var t=i.computeSupertypeLookupTable(n),r=Object.create(null),n=Object.keys(t),a=n.length,o=0;a>o;++o){var u=n[o];l="visit"+t[u],g.check(e[l])&&(r[u]=l)}return r}function r(e,n){for(var l in n)h.call(n,l)&&(e[l]=n[l]);return e}function a(e,n){s.ok(e instanceof c),s.ok(n instanceof l);var t=e.value;if(p.check(t))e.each(n.visitWithoutReset,n);else if(f.check(t)){for(var r=i.getFieldNames(t),a=r.length,o=[],u=0;a>u;++u){var d=r[u];h.call(t,d)||(t[d]=i.getFieldValue(t,d)),o.push(e.get(d))}for(var u=0;a>u;++u)n.visitWithoutReset(o[u])}else;return e.value}function o(e){function n(t){s.ok(this instanceof n),s.ok(this instanceof l),s.ok(t instanceof c),Object.defineProperty(this,"visitor",{value:e,writable:!1,enumerable:!0,configurable:!1}),this.currentPath=t,this.needToCallTraverse=!0,Object.seal(this)}s.ok(e instanceof l);var t=n.prototype=Object.create(e);return t.constructor=n,r(t,x),n}var u,s=e("assert"),i=e("./types"),c=e("./node-path"),d=i.namedTypes.Node,p=i.builtInTypes.array,f=i.builtInTypes.object,g=i.builtInTypes.function,h=Object.prototype.hasOwnProperty;l.fromMethodsObject=function(e){function n(){s.ok(this instanceof n),l.call(this)}if(e instanceof l)return e;if(!f.check(e))return new l;var t=n.prototype=Object.create(m);return t.constructor=n,r(t,e),r(n,l),g.assert(n.fromMethodsObject),g.assert(n.visit),new n},l.visit=function(e,n){return l.fromMethodsObject(n).visit(e)};var m=l.prototype,y=["Recursively calling visitor.visit(path) resets visitor state.","Try this.visit(path) or this.traverse(path) instead."].join(" ");m.visit=function(){s.ok(!this._visiting,y),this._visiting=!0,this._changeReported=!1;for(var e=arguments.length,n=new Array(e),l=0;e>l;++l)n[l]=arguments[l];n[0]instanceof c||(n[0]=new c({root:n[0]}).get("root")),this.reset.apply(this,n);try{return this.visitWithoutReset(n[0])}finally{this._visiting=!1}},m.reset=function(){},m.visitWithoutReset=function(e){if(this instanceof this.Context)return this.visitor.visitWithoutReset(e);s.ok(e instanceof c);var n=e.value,l=d.check(n)&&this._methodNameTable[n.type];if(!l)return a(e,this);var t=this.acquireContext(e);try{return t.invokeVisitorMethod(l)}finally{this.releaseContext(t)}},m.acquireContext=function(e){return 0===this._reusableContextStack.length?new this.Context(e):this._reusableContextStack.pop().reset(e)},m.releaseContext=function(e){s.ok(e instanceof this.Context),this._reusableContextStack.push(e),e.currentPath=null},m.reportChanged=function(){this._changeReported=!0},m.wasChangeReported=function(){return this._changeReported};var x=Object.create(null);x.reset=function(e){return s.ok(this instanceof this.Context),s.ok(e instanceof c),this.currentPath=e,this.needToCallTraverse=!0,this},x.invokeVisitorMethod=function(e){s.ok(this instanceof this.Context),s.ok(this.currentPath instanceof c);var n=this.visitor[e].call(this,this.currentPath);n===!1?this.needToCallTraverse=!1:n!==u&&(this.currentPath=this.currentPath.replace(n)[0],this.needToCallTraverse&&this.traverse(this.currentPath)),s.strictEqual(this.needToCallTraverse,!1,"Must either call this.traverse or return false in "+e);var l=this.currentPath;return l&&l.value},x.traverse=function(e,n){return s.ok(this instanceof this.Context),s.ok(e instanceof c),s.ok(this.currentPath instanceof c),this.needToCallTraverse=!1,a(e,l.fromMethodsObject(n||this.visitor))},x.visit=function(e,n){return s.ok(this instanceof this.Context),s.ok(e instanceof c),s.ok(this.currentPath instanceof c),this.needToCallTraverse=!1,l.fromMethodsObject(n||this.visitor).visitWithoutReset(e)},x.reportChanged=function(){this.visitor.reportChanged()},n.exports=l},{"./node-path":131,"./types":136,assert:139}],133:[function(e,n){function l(e,n,t){s.ok(this instanceof l),n?s.ok(n instanceof l):(n=null,t=null),this.value=e,this.parentPath=n,this.name=t,this.__childCache=null}function t(e){return e.__childCache||(e.__childCache=Object.create(null))}function r(e,n){var l=t(e),r=e.getValueProperty(n),a=l[n];return c.call(l,n)&&a.value===r||(a=l[n]=new e.constructor(r,e,n)),a}function a(){}function o(e,n,l,r){if(p.assert(e.value),0===n)return a;var o=e.value.length;if(1>o)return a;var u=arguments.length;2===u?(l=0,r=o):3===u?(l=Math.max(l,0),r=o):(l=Math.max(l,0),r=Math.min(r,o)),f.assert(l),f.assert(r);for(var i=Object.create(null),d=t(e),g=l;r>g;++g)if(c.call(e.value,g)){var h=e.get(g);s.strictEqual(h.name,g);var m=g+n;h.name=m,i[m]=h,delete d[g]}return delete d.length,function(){for(var n in i){var l=i[n];s.strictEqual(l.name,+n),d[n]=l,e.value[n]=l.value}}}function u(e){s.ok(e instanceof l);var n=e.parentPath;if(!n)return e;var r=n.value,a=t(n);if(r[e.name]===e.value)a[e.name]=e;else if(p.check(r)){var o=r.indexOf(e.value);o>=0&&(a[e.name=o]=e)}else r[e.name]=e.value,a[e.name]=e;return s.strictEqual(r[e.name],e.value),s.strictEqual(e.parentPath.get(e.name),e),e}var s=e("assert"),i=Object.prototype,c=i.hasOwnProperty,d=e("./types"),p=d.builtInTypes.array,f=d.builtInTypes.number,g=Array.prototype,h=(g.slice,g.map,l.prototype);h.getValueProperty=function(e){return this.value[e]},h.get=function(){for(var e=this,n=arguments,l=n.length,t=0;l>t;++t)e=r(e,n[t]);return e},h.each=function(e,n){for(var l=[],t=this.value.length,r=0,r=0;t>r;++r)c.call(this.value,r)&&(l[r]=this.get(r));for(n=n||this,r=0;t>r;++r)c.call(l,r)&&e.call(n,l[r])},h.map=function(e,n){var l=[];return this.each(function(n){l.push(e.call(this,n))},n),l},h.filter=function(e,n){var l=[];return this.each(function(n){e.call(this,n)&&l.push(n)},n),l},h.shift=function(){var e=o(this,-1),n=this.value.shift();return e(),n},h.unshift=function(){var e=o(this,arguments.length),n=this.value.unshift.apply(this.value,arguments);return e(),n},h.push=function(){return p.assert(this.value),delete t(this).length,this.value.push.apply(this.value,arguments)},h.pop=function(){p.assert(this.value);var e=t(this);return delete e[this.value.length-1],delete e.length,this.value.pop()},h.insertAt=function(e){var n=arguments.length,l=o(this,n-1,e);if(l===a)return this;e=Math.max(e,0);for(var t=1;n>t;++t)this.value[e+t-1]=arguments[t];return l(),this},h.insertBefore=function(){for(var e=this.parentPath,n=arguments.length,l=[this.name],t=0;n>t;++t)l.push(arguments[t]);return e.insertAt.apply(e,l)},h.insertAfter=function(){for(var e=this.parentPath,n=arguments.length,l=[this.name+1],t=0;n>t;++t)l.push(arguments[t]);return e.insertAt.apply(e,l)},h.replace=function(e){var n=[],l=this.parentPath.value,r=t(this.parentPath),a=arguments.length;if(u(this),p.check(l)){for(var i=l.length,c=o(this.parentPath,a-1,this.name+1),d=[this.name,1],f=0;a>f;++f)d.push(arguments[f]);var g=l.splice.apply(l,d);if(s.strictEqual(g[0],this.value),s.strictEqual(l.length,i-1+a),c(),0===a)delete this.value,delete r[this.name],this.__childCache=null;else{for(s.strictEqual(l[this.name],e),this.value!==e&&(this.value=e,this.__childCache=null),f=0;a>f;++f)n.push(this.parentPath.get(this.name+f));s.strictEqual(n[0],this)}}else 1===a?(this.value!==e&&(this.__childCache=null),this.value=l[this.name]=e,n.push(this)):0===a?(delete l[this.name],delete this.value,this.__childCache=null):s.ok(!1,"Could not replace path");return n},n.exports=l},{"./types":136,assert:139}],134:[function(e,n){function l(n,t){u.ok(this instanceof l),u.ok(n instanceof e("./node-path")),y.assert(n.value);var r;t?(u.ok(t instanceof l),r=t.depth+1):(t=null,r=0),Object.defineProperties(this,{path:{value:n},node:{value:n.value},isGlobal:{value:!t,enumerable:!0},depth:{value:r},parent:{value:t},bindings:{value:{}}})}function t(e,n){var l=e.value;y.assert(l),c.CatchClause.check(l)?o(e.get("param"),n):r(e,n)}function r(e,n){var l=e.value;e.parent&&c.FunctionExpression.check(e.parent.node)&&e.parent.node.id&&o(e.parent.get("id"),n),l&&(f.check(l)?e.each(function(e){a(e,n)}):c.Function.check(l)?(e.get("params").each(function(e){o(e,n)}),a(e.get("body"),n)):c.VariableDeclarator.check(l)?(o(e.get("id"),n),a(e.get("init"),n)):"ImportSpecifier"===l.type||"ImportNamespaceSpecifier"===l.type||"ImportDefaultSpecifier"===l.type?o(e.get(l.name?"name":"id"),n):d.check(l)&&!p.check(l)&&s.eachField(l,function(l,t){var r=e.get(l);u.strictEqual(r.value,t),a(r,n)}))}function a(e,n){var l=e.value;if(!l||p.check(l));else if(c.FunctionDeclaration.check(l))o(e.get("id"),n);else if(c.ClassDeclaration&&c.ClassDeclaration.check(l))o(e.get("id"),n);else if(y.check(l)){if(c.CatchClause.check(l)){var t=l.param.name,a=g.call(n,t);r(e.get("body"),n),a||delete n[t]}}else r(e,n)}function o(e,n){var l=e.value;c.Pattern.assert(l),c.Identifier.check(l)?g.call(n,l.name)?n[l.name].push(e):n[l.name]=[e]:c.SpreadElement&&c.SpreadElement.check(l)&&o(e.get("argument"),n)}var u=e("assert"),s=e("./types"),i=s.Type,c=s.namedTypes,d=c.Node,p=c.Expression,f=s.builtInTypes.array,g=Object.prototype.hasOwnProperty,h=s.builders,m=[c.Program,c.Function,c.CatchClause],y=i.or.apply(i,m);l.isEstablishedBy=function(e){return y.check(e)};var x=l.prototype;x.didScan=!1,x.declares=function(e){return this.scan(),g.call(this.bindings,e)},x.declareTemporary=function(e){e?u.ok(/^[a-z$_]/i.test(e),e):e="t$",e+=this.depth.toString(36)+"$",this.scan();for(var n=0;this.declares(e+n);)++n;var l=e+n;return this.bindings[l]=s.builders.identifier(l)},x.injectTemporary=function(e,n){e||(e=this.declareTemporary());var l=this.path.get("body");return c.BlockStatement.check(l.value)&&(l=l.get("body")),l.unshift(h.variableDeclaration("var",[h.variableDeclarator(e,n||null)])),e},x.scan=function(e){if(e||!this.didScan){for(var n in this.bindings)delete this.bindings[n];t(this.path,this.bindings),this.didScan=!0}},x.getBindings=function(){return this.scan(),this.bindings},x.lookup=function(e){for(var n=this;n&&!n.declares(e);n=n.parent);return n},x.getGlobalScope=function(){for(var e=this;!e.isGlobal;)e=e.parent;return e},n.exports=l},{"./node-path":131,"./types":136,assert:139}],135:[function(e,n,l){var t=e("../lib/types"),r=t.Type,a=t.builtInTypes,o=a.number;l.geq=function(e){return new r(function(n){return o.check(n)&&n>=e},o+" >= "+e)},l.defaults={"null":function(){return null},emptyArray:function(){return[]},"false":function(){return!1},"true":function(){return!0},undefined:function(){}};var u=r.or(a.string,a.number,a.boolean,a.null,a.undefined);l.isPrimitive=new r(function(e){if(null===e)return!0;var n=typeof e;return!("object"===n||"function"===n)},u.toString())},{"../lib/types":136}],136:[function(e,n,l){function t(e,n){var l=this;g.ok(l instanceof t,l),g.strictEqual(b.call(e),_,e+" is not a function");var r=b.call(n);g.ok(r===_||r===v,n+" is neither a function nor a string"),Object.defineProperties(l,{name:{value:n},check:{value:function(n,t){var r=e.call(l,n,t);return!r&&t&&b.call(t)===_&&t(l,n),r}}})}function r(e){return C.check(e)?"{"+Object.keys(e).map(function(n){return n+": "+e[n]}).join(", ")+"}":S.check(e)?"["+e.map(r).join(", ")+"]":JSON.stringify(e)}function a(e,n){var l=b.call(e);return Object.defineProperty(k,n,{enumerable:!0,value:new t(function(e){return b.call(e)===l},n)}),k[n]}function o(e,n){return e instanceof t?e:e instanceof s?e.type:S.check(e)?t.fromArray(e):C.check(e)?t.fromObject(e):R.check(e)?new t(e,n):new t(function(n){return n===e},j.check(n)?function(){return e+""}:n)}function u(e,n,l,t){var r=this;g.ok(r instanceof u),w.assert(e),n=o(n);var a={name:{value:e},type:{value:n},hidden:{value:!!t}};R.check(l)&&(a.defaultFn={value:l}),Object.defineProperties(r,a)}function s(e){var n=this;g.ok(n instanceof s),Object.defineProperties(n,{typeName:{value:e},baseNames:{value:[]},ownFields:{value:Object.create(null)},allSupertypes:{value:Object.create(null)},supertypeList:{value:[]},allFields:{value:Object.create(null)},fieldNames:{value:[]},type:{value:new t(function(e,l){return n.check(e,l)},e)}})}function i(e){return e.replace(/^[A-Z]+/,function(e){var n=e.length;switch(n){case 0:return"";case 1:return e.toLowerCase();default:return e.slice(0,n-1).toLowerCase()+e.charAt(n-1)}})}function c(e){var n=s.fromValue(e);return n?n.fieldNames.slice(0):("type"in e&&g.ok(!1,"did not recognize object of type "+JSON.stringify(e.type)),Object.keys(e))}function d(e,n){var l=s.fromValue(e);if(l){var t=l.allFields[n];if(t)return t.getValue(e)}return e[n]}function p(e,n){n.length=0,n.push(e);for(var l=Object.create(null),t=0;t<n.length;++t){e=n[t];var r=L[e];g.strictEqual(r.finalized,!0),I.call(l,e)&&delete n[l[e]],l[e]=t,n.push.apply(n,r.baseNames)}for(var a=0,o=a,u=n.length;u>o;++o)I.call(n,o)&&(n[a++]=n[o]);n.length=a}function f(e,n){return Object.keys(n).forEach(function(l){e[l]=n[l]}),e}var g=e("assert"),h=Array.prototype,m=h.slice,y=(h.map,h.forEach),x=Object.prototype,b=x.toString,_=b.call(function(){}),v=b.call(""),I=x.hasOwnProperty,E=t.prototype;l.Type=t,E.assert=function(e,n){if(!this.check(e,n)){var l=r(e);return g.ok(!1,l+" does not match type "+this),!1}return!0},E.toString=function(){var e=this.name;return w.check(e)?e:R.check(e)?e.call(this)+"":e+" type"};var k={};l.builtInTypes=k;var w=a("","string"),R=a(function(){},"function"),S=a([],"array"),C=a({},"object"),A=(a(/./,"RegExp"),a(new Date,"Date"),a(3,"number")),j=(a(!0,"boolean"),a(null,"null"),a(void 0,"undefined"));t.or=function(){for(var e=[],n=arguments.length,l=0;n>l;++l)e.push(o(arguments[l]));return new t(function(l,t){for(var r=0;n>r;++r)if(e[r].check(l,t))return!0;return!1},function(){return e.join(" | ")})},t.fromArray=function(e){return g.ok(S.check(e)),g.strictEqual(e.length,1,"only one element type is permitted for typed arrays"),o(e[0]).arrayOf()},E.arrayOf=function(){var e=this;return new t(function(n,l){return S.check(n)&&n.every(function(n){return e.check(n,l)})},function(){return"["+e+"]"})},t.fromObject=function(e){var n=Object.keys(e).map(function(n){return new u(n,e[n])});return new t(function(e,l){return C.check(e)&&n.every(function(n){return n.type.check(e[n.name],l)})},function(){return"{ "+n.join(", ")+" }"})};var T=u.prototype;T.toString=function(){return JSON.stringify(this.name)+": "+this.type},T.getValue=function(e){var n=e[this.name];return j.check(n)?(this.defaultFn&&(n=this.defaultFn.call(e)),n):n},t.def=function(e){return w.assert(e),I.call(L,e)?L[e]:L[e]=new s(e)};var L=Object.create(null);s.fromValue=function(e){if(e&&"object"==typeof e){var n=e.type;if("string"==typeof n&&I.call(L,n)){var l=L[n];if(l.finalized)return l}}return null};var P=s.prototype;P.isSupertypeOf=function(e){return e instanceof s?(g.strictEqual(this.finalized,!0),g.strictEqual(e.finalized,!0),I.call(e.allSupertypes,this.typeName)):void g.ok(!1,e+" is not a Def")},l.getSupertypeNames=function(e){g.ok(I.call(L,e));var n=L[e];return g.strictEqual(n.finalized,!0),n.supertypeList.slice(1)},l.computeSupertypeLookupTable=function(e){for(var n={},l=Object.keys(L),t=l.length,r=0;t>r;++r){var a=l[r],o=L[a];
g.strictEqual(o.finalized,!0);for(var u=0;u<o.supertypeList.length;++u){var s=o.supertypeList[u];if(I.call(e,s)){n[a]=s;break}}}return n},P.checkAllFields=function(e,n){function l(l){var r=t[l],a=r.type,o=r.getValue(e);return a.check(o,n)}var t=this.allFields;return g.strictEqual(this.finalized,!0),C.check(e)&&Object.keys(t).every(l)},P.check=function(e,n){if(g.strictEqual(this.finalized,!0,"prematurely checking unfinalized type "+this.typeName),!C.check(e))return!1;var l=s.fromValue(e);return l?n&&l===this?this.checkAllFields(e,n):this.isSupertypeOf(l)?n?l.checkAllFields(e,n)&&this.checkAllFields(e,!1):!0:!1:"SourceLocation"===this.typeName||"Position"===this.typeName?this.checkAllFields(e,n):!1},P.bases=function(){var e=this.baseNames;return g.strictEqual(this.finalized,!1),y.call(arguments,function(n){w.assert(n),e.indexOf(n)<0&&e.push(n)}),this},Object.defineProperty(P,"buildable",{value:!1});var O={};l.builders=O;var M={};l.defineMethod=function(e,n){var l=M[e];return j.check(n)?delete M[e]:(R.assert(n),Object.defineProperty(M,e,{enumerable:!0,configurable:!0,value:n})),l},P.build=function(){var e=this;return Object.defineProperty(e,"buildParams",{value:m.call(arguments),writable:!1,enumerable:!1,configurable:!0}),g.strictEqual(e.finalized,!1),w.arrayOf().assert(e.buildParams),e.buildable?e:(e.field("type",e.typeName,function(){return e.typeName}),Object.defineProperty(e,"buildable",{value:!0}),Object.defineProperty(O,i(e.typeName),{enumerable:!0,value:function(){function n(n,o){if(!I.call(a,n)){var u=e.allFields;g.ok(I.call(u,n),n);var s,i=u[n],c=i.type;if(A.check(o)&&t>o)s=l[o];else if(i.defaultFn)s=i.defaultFn.call(a);else{var d="no value or default function given for field "+JSON.stringify(n)+" of "+e.typeName+"("+e.buildParams.map(function(e){return u[e]}).join(", ")+")";g.ok(!1,d)}c.check(s)||g.ok(!1,r(s)+" does not match field "+i+" of type "+e.typeName),a[n]=s}}var l=arguments,t=l.length,a=Object.create(M);return g.ok(e.finalized,"attempting to instantiate unfinalized type "+e.typeName),e.buildParams.forEach(function(e,l){n(e,l)}),Object.keys(e.allFields).forEach(function(e){n(e)}),g.strictEqual(a.type,e.typeName),a}}),e)},P.field=function(e,n,l,t){return g.strictEqual(this.finalized,!1),this.ownFields[e]=new u(e,n,l,t),this};var D={};l.namedTypes=D,l.getFieldNames=c,l.getFieldValue=d,l.eachField=function(e,n,l){c(e).forEach(function(l){n.call(this,l,d(e,l))},l)},l.someField=function(e,n,l){return c(e).some(function(l){return n.call(this,l,d(e,l))},l)},Object.defineProperty(P,"finalized",{value:!1}),P.finalize=function(){if(!this.finalized){var e=this.allFields,n=this.allSupertypes;this.baseNames.forEach(function(l){var t=L[l];t.finalize(),f(e,t.allFields),f(n,t.allSupertypes)}),f(e,this.ownFields),n[this.typeName]=this,this.fieldNames.length=0;for(var l in e)I.call(e,l)&&!e[l].hidden&&this.fieldNames.push(l);Object.defineProperty(D,this.typeName,{enumerable:!0,value:this.type}),Object.defineProperty(this,"finalized",{value:!0}),p(this.typeName,this.supertypeList)}},l.finalize=function(){Object.keys(L).forEach(function(e){L[e].finalize()})}},{assert:139}],137:[function(e,n,l){var t=e("./lib/types");e("./def/core"),e("./def/es6"),e("./def/es7"),e("./def/mozilla"),e("./def/e4x"),e("./def/fb-harmony"),t.finalize(),l.Type=t.Type,l.builtInTypes=t.builtInTypes,l.namedTypes=t.namedTypes,l.builders=t.builders,l.defineMethod=t.defineMethod,l.getFieldNames=t.getFieldNames,l.getFieldValue=t.getFieldValue,l.eachField=t.eachField,l.someField=t.someField,l.getSupertypeNames=t.getSupertypeNames,l.astNodesAreEquivalent=e("./lib/equiv"),l.finalize=t.finalize,l.NodePath=e("./lib/node-path"),l.PathVisitor=e("./lib/path-visitor"),l.visit=l.PathVisitor.visit},{"./def/core":124,"./def/e4x":125,"./def/es6":126,"./def/es7":127,"./def/fb-harmony":128,"./def/mozilla":129,"./lib/equiv":130,"./lib/node-path":131,"./lib/path-visitor":132,"./lib/types":136}],138:[function(){},{}],139:[function(e,n){function l(e,n){return p.isUndefined(n)?""+n:p.isNumber(n)&&!isFinite(n)?n.toString():p.isFunction(n)||p.isRegExp(n)?n.toString():n}function t(e,n){return p.isString(e)?e.length<n?e:e.slice(0,n):e}function r(e){return t(JSON.stringify(e.actual,l),128)+" "+e.operator+" "+t(JSON.stringify(e.expected,l),128)}function a(e,n,l,t,r){throw new h.AssertionError({message:l,actual:e,expected:n,operator:t,stackStartFunction:r})}function o(e,n){e||a(e,!0,n,"==",h.ok)}function u(e,n){if(e===n)return!0;if(p.isBuffer(e)&&p.isBuffer(n)){if(e.length!=n.length)return!1;for(var l=0;l<e.length;l++)if(e[l]!==n[l])return!1;return!0}return p.isDate(e)&&p.isDate(n)?e.getTime()===n.getTime():p.isRegExp(e)&&p.isRegExp(n)?e.source===n.source&&e.global===n.global&&e.multiline===n.multiline&&e.lastIndex===n.lastIndex&&e.ignoreCase===n.ignoreCase:p.isObject(e)||p.isObject(n)?i(e,n):e==n}function s(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function i(e,n){if(p.isNullOrUndefined(e)||p.isNullOrUndefined(n))return!1;if(e.prototype!==n.prototype)return!1;if(p.isPrimitive(e)||p.isPrimitive(n))return e===n;var l=s(e),t=s(n);if(l&&!t||!l&&t)return!1;if(l)return e=f.call(e),n=f.call(n),u(e,n);var r,a,o=m(e),i=m(n);if(o.length!=i.length)return!1;for(o.sort(),i.sort(),a=o.length-1;a>=0;a--)if(o[a]!=i[a])return!1;for(a=o.length-1;a>=0;a--)if(r=o[a],!u(e[r],n[r]))return!1;return!0}function c(e,n){return e&&n?"[object RegExp]"==Object.prototype.toString.call(n)?n.test(e):e instanceof n?!0:n.call({},e)===!0?!0:!1:!1}function d(e,n,l,t){var r;p.isString(l)&&(t=l,l=null);try{n()}catch(o){r=o}if(t=(l&&l.name?" ("+l.name+").":".")+(t?" "+t:"."),e&&!r&&a(r,l,"Missing expected exception"+t),!e&&c(r,l)&&a(r,l,"Got unwanted exception"+t),e&&r&&l&&!c(r,l)||!e&&r)throw r}var p=e("util/"),f=Array.prototype.slice,g=Object.prototype.hasOwnProperty,h=n.exports=o;h.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=r(this),this.generatedMessage=!0);var n=e.stackStartFunction||a;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var l=new Error;if(l.stack){var t=l.stack,o=n.name,u=t.indexOf("\n"+o);if(u>=0){var s=t.indexOf("\n",u+1);t=t.substring(s+1)}this.stack=t}}},p.inherits(h.AssertionError,Error),h.fail=a,h.ok=o,h.equal=function(e,n,l){e!=n&&a(e,n,l,"==",h.equal)},h.notEqual=function(e,n,l){e==n&&a(e,n,l,"!=",h.notEqual)},h.deepEqual=function(e,n,l){u(e,n)||a(e,n,l,"deepEqual",h.deepEqual)},h.notDeepEqual=function(e,n,l){u(e,n)&&a(e,n,l,"notDeepEqual",h.notDeepEqual)},h.strictEqual=function(e,n,l){e!==n&&a(e,n,l,"===",h.strictEqual)},h.notStrictEqual=function(e,n,l){e===n&&a(e,n,l,"!==",h.notStrictEqual)},h.throws=function(){d.apply(this,[!0].concat(f.call(arguments)))},h.doesNotThrow=function(){d.apply(this,[!1].concat(f.call(arguments)))},h.ifError=function(e){if(e)throw e};var m=Object.keys||function(e){var n=[];for(var l in e)g.call(e,l)&&n.push(l);return n}},{"util/":164}],140:[function(e,n,l){function t(e,n,l){if(!(this instanceof t))return new t(e,n,l);var r,a=typeof e;if("number"===a)r=+e;else if("string"===a)r=t.byteLength(e,n);else{if("object"!==a||null===e)throw new TypeError("must start with number, buffer, array or string");"Buffer"===e.type&&D(e.data)&&(e=e.data),r=+e.length}if(r>B)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+B.toString(16)+" bytes");0>r?r=0:r>>>=0;var o=this;t.TYPED_ARRAY_SUPPORT?o=t._augment(new Uint8Array(r)):(o.length=r,o._isBuffer=!0);var u;if(t.TYPED_ARRAY_SUPPORT&&"number"==typeof e.byteLength)o._set(e);else if(R(e))if(t.isBuffer(e))for(u=0;r>u;u++)o[u]=e.readUInt8(u);else for(u=0;r>u;u++)o[u]=(e[u]%256+256)%256;else if("string"===a)o.write(e,0,n);else if("number"===a&&!t.TYPED_ARRAY_SUPPORT&&!l)for(u=0;r>u;u++)o[u]=0;return r>0&&r<=t.poolSize&&(o.parent=N),o}function r(e,n,l){if(!(this instanceof r))return new r(e,n,l);var a=new t(e,n,l);return delete a.parent,a}function a(e,n,l,t){l=Number(l)||0;var r=e.length-l;t?(t=Number(t),t>r&&(t=r)):t=r;var a=n.length;if(a%2!==0)throw new Error("Invalid hex string");t>a/2&&(t=a/2);for(var o=0;t>o;o++){var u=parseInt(n.substr(2*o,2),16);if(isNaN(u))throw new Error("Invalid hex string");e[l+o]=u}return o}function o(e,n,l,t){var r=L(C(n,e.length-l),e,l,t);return r}function u(e,n,l,t){var r=L(A(n),e,l,t);return r}function s(e,n,l,t){return u(e,n,l,t)}function i(e,n,l,t){var r=L(T(n),e,l,t);return r}function c(e,n,l,t){var r=L(j(n,e.length-l),e,l,t,2);return r}function d(e,n,l){return O.fromByteArray(0===n&&l===e.length?e:e.slice(n,l))}function p(e,n,l){var t="",r="";l=Math.min(e.length,l);for(var a=n;l>a;a++)e[a]<=127?(t+=P(r)+String.fromCharCode(e[a]),r=""):r+="%"+e[a].toString(16);return t+P(r)}function f(e,n,l){var t="";l=Math.min(e.length,l);for(var r=n;l>r;r++)t+=String.fromCharCode(127&e[r]);return t}function g(e,n,l){var t="";l=Math.min(e.length,l);for(var r=n;l>r;r++)t+=String.fromCharCode(e[r]);return t}function h(e,n,l){var t=e.length;(!n||0>n)&&(n=0),(!l||0>l||l>t)&&(l=t);for(var r="",a=n;l>a;a++)r+=S(e[a]);return r}function m(e,n,l){for(var t=e.slice(n,l),r="",a=0;a<t.length;a+=2)r+=String.fromCharCode(t[a]+256*t[a+1]);return r}function y(e,n,l){if(e%1!==0||0>e)throw new RangeError("offset is not uint");if(e+n>l)throw new RangeError("Trying to access beyond buffer length")}function x(e,n,l,r,a,o){if(!t.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(n>a||o>n)throw new RangeError("value is out of bounds");if(l+r>e.length)throw new RangeError("index out of range")}function b(e,n,l,t){0>n&&(n=65535+n+1);for(var r=0,a=Math.min(e.length-l,2);a>r;r++)e[l+r]=(n&255<<8*(t?r:1-r))>>>8*(t?r:1-r)}function _(e,n,l,t){0>n&&(n=4294967295+n+1);for(var r=0,a=Math.min(e.length-l,4);a>r;r++)e[l+r]=n>>>8*(t?r:3-r)&255}function v(e,n,l,t,r,a){if(n>r||a>n)throw new RangeError("value is out of bounds");if(l+t>e.length)throw new RangeError("index out of range");if(0>l)throw new RangeError("index out of range")}function I(e,n,l,t,r){return r||v(e,n,l,4,3.4028234663852886e38,-3.4028234663852886e38),M.write(e,n,l,t,23,4),l+4}function E(e,n,l,t,r){return r||v(e,n,l,8,1.7976931348623157e308,-1.7976931348623157e308),M.write(e,n,l,t,52,8),l+8}function k(e){if(e=w(e).replace(V,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function w(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function R(e){return D(e)||t.isBuffer(e)||e&&"object"==typeof e&&"number"==typeof e.length}function S(e){return 16>e?"0"+e.toString(16):e.toString(16)}function C(e,n){n=n||1/0;for(var l,t=e.length,r=null,a=[],o=0;t>o;o++){if(l=e.charCodeAt(o),l>55295&&57344>l){if(!r){if(l>56319){(n-=3)>-1&&a.push(239,191,189);continue}if(o+1===t){(n-=3)>-1&&a.push(239,191,189);continue}r=l;continue}if(56320>l){(n-=3)>-1&&a.push(239,191,189),r=l;continue}l=r-55296<<10|l-56320|65536,r=null}else r&&((n-=3)>-1&&a.push(239,191,189),r=null);if(128>l){if((n-=1)<0)break;a.push(l)}else if(2048>l){if((n-=2)<0)break;a.push(l>>6|192,63&l|128)}else if(65536>l){if((n-=3)<0)break;a.push(l>>12|224,l>>6&63|128,63&l|128)}else{if(!(2097152>l))throw new Error("Invalid code point");if((n-=4)<0)break;a.push(l>>18|240,l>>12&63|128,l>>6&63|128,63&l|128)}}return a}function A(e){for(var n=[],l=0;l<e.length;l++)n.push(255&e.charCodeAt(l));return n}function j(e,n){for(var l,t,r,a=[],o=0;o<e.length&&!((n-=2)<0);o++)l=e.charCodeAt(o),t=l>>8,r=l%256,a.push(r),a.push(t);return a}function T(e){return O.toByteArray(k(e))}function L(e,n,l,t,r){r&&(t-=t%r);for(var a=0;t>a&&!(a+l>=n.length||a>=e.length);a++)n[a+l]=e[a];return a}function P(e){try{return decodeURIComponent(e)}catch(n){return String.fromCharCode(65533)}}var O=e("base64-js"),M=e("ieee754"),D=e("is-array");l.Buffer=t,l.SlowBuffer=r,l.INSPECT_MAX_BYTES=50,t.poolSize=8192;var B=1073741823,N={};t.TYPED_ARRAY_SUPPORT=function(){try{var e=new ArrayBuffer(0),n=new Uint8Array(e);return n.foo=function(){return 42},42===n.foo()&&"function"==typeof n.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(l){return!1}}(),t.isBuffer=function(e){return!(null==e||!e._isBuffer)},t.compare=function(e,n){if(!t.isBuffer(e)||!t.isBuffer(n))throw new TypeError("Arguments must be Buffers");if(e===n)return 0;for(var l=e.length,r=n.length,a=0,o=Math.min(l,r);o>a&&e[a]===n[a];a++);return a!==o&&(l=e[a],r=n[a]),r>l?-1:l>r?1:0},t.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},t.concat=function(e,n){if(!D(e))throw new TypeError("Usage: Buffer.concat(list[, length])");if(0===e.length)return new t(0);if(1===e.length)return e[0];var l;if(void 0===n)for(n=0,l=0;l<e.length;l++)n+=e[l].length;var r=new t(n),a=0;for(l=0;l<e.length;l++){var o=e[l];o.copy(r,a),a+=o.length}return r},t.byteLength=function(e,n){var l;switch(e+="",n||"utf8"){case"ascii":case"binary":case"raw":l=e.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":l=2*e.length;break;case"hex":l=e.length>>>1;break;case"utf8":case"utf-8":l=C(e).length;break;case"base64":l=T(e).length;break;default:l=e.length}return l},t.prototype.length=void 0,t.prototype.parent=void 0,t.prototype.toString=function(e,n,l){var t=!1;if(n>>>=0,l=void 0===l||1/0===l?this.length:l>>>0,e||(e="utf8"),0>n&&(n=0),l>this.length&&(l=this.length),n>=l)return"";for(;;)switch(e){case"hex":return h(this,n,l);case"utf8":case"utf-8":return p(this,n,l);case"ascii":return f(this,n,l);case"binary":return g(this,n,l);case"base64":return d(this,n,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m(this,n,l);default:if(t)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),t=!0}},t.prototype.equals=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:0===t.compare(this,e)},t.prototype.inspect=function(){var e="",n=l.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},t.prototype.compare=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?0:t.compare(this,e)},t.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},t.prototype.set=function(e,n){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,n)},t.prototype.write=function(e,n,l,t){if(isFinite(n))isFinite(l)||(t=l,l=void 0);else{var r=t;t=n,n=l,l=r}if(n=Number(n)||0,0>l||0>n||n>this.length)throw new RangeError("attempt to write outside buffer bounds");var d=this.length-n;l?(l=Number(l),l>d&&(l=d)):l=d,t=String(t||"utf8").toLowerCase();var p;switch(t){case"hex":p=a(this,e,n,l);break;case"utf8":case"utf-8":p=o(this,e,n,l);break;case"ascii":p=u(this,e,n,l);break;case"binary":p=s(this,e,n,l);break;case"base64":p=i(this,e,n,l);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":p=c(this,e,n,l);break;default:throw new TypeError("Unknown encoding: "+t)}return p},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},t.prototype.slice=function(e,n){var l=this.length;e=~~e,n=void 0===n?l:~~n,0>e?(e+=l,0>e&&(e=0)):e>l&&(e=l),0>n?(n+=l,0>n&&(n=0)):n>l&&(n=l),e>n&&(n=e);var r;if(t.TYPED_ARRAY_SUPPORT)r=t._augment(this.subarray(e,n));else{var a=n-e;r=new t(a,void 0,!0);for(var o=0;a>o;o++)r[o]=this[o+e]}return r.length&&(r.parent=this.parent||this),r},t.prototype.readUIntLE=function(e,n,l){e>>>=0,n>>>=0,l||y(e,n,this.length);for(var t=this[e],r=1,a=0;++a<n&&(r*=256);)t+=this[e+a]*r;return t},t.prototype.readUIntBE=function(e,n,l){e>>>=0,n>>>=0,l||y(e,n,this.length);for(var t=this[e+--n],r=1;n>0&&(r*=256);)t+=this[e+--n]*r;return t},t.prototype.readUInt8=function(e,n){return n||y(e,1,this.length),this[e]},t.prototype.readUInt16LE=function(e,n){return n||y(e,2,this.length),this[e]|this[e+1]<<8},t.prototype.readUInt16BE=function(e,n){return n||y(e,2,this.length),this[e]<<8|this[e+1]},t.prototype.readUInt32LE=function(e,n){return n||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},t.prototype.readUInt32BE=function(e,n){return n||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},t.prototype.readIntLE=function(e,n,l){e>>>=0,n>>>=0,l||y(e,n,this.length);for(var t=this[e],r=1,a=0;++a<n&&(r*=256);)t+=this[e+a]*r;return r*=128,t>=r&&(t-=Math.pow(2,8*n)),t},t.prototype.readIntBE=function(e,n,l){e>>>=0,n>>>=0,l||y(e,n,this.length);for(var t=n,r=1,a=this[e+--t];t>0&&(r*=256);)a+=this[e+--t]*r;return r*=128,a>=r&&(a-=Math.pow(2,8*n)),a},t.prototype.readInt8=function(e,n){return n||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},t.prototype.readInt16LE=function(e,n){n||y(e,2,this.length);var l=this[e]|this[e+1]<<8;return 32768&l?4294901760|l:l},t.prototype.readInt16BE=function(e,n){n||y(e,2,this.length);var l=this[e+1]|this[e]<<8;return 32768&l?4294901760|l:l},t.prototype.readInt32LE=function(e,n){return n||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},t.prototype.readInt32BE=function(e,n){return n||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},t.prototype.readFloatLE=function(e,n){return n||y(e,4,this.length),M.read(this,e,!0,23,4)},t.prototype.readFloatBE=function(e,n){return n||y(e,4,this.length),M.read(this,e,!1,23,4)},t.prototype.readDoubleLE=function(e,n){return n||y(e,8,this.length),M.read(this,e,!0,52,8)},t.prototype.readDoubleBE=function(e,n){return n||y(e,8,this.length),M.read(this,e,!1,52,8)},t.prototype.writeUIntLE=function(e,n,l,t){e=+e,n>>>=0,l>>>=0,t||x(this,e,n,l,Math.pow(2,8*l),0);var r=1,a=0;for(this[n]=255&e;++a<l&&(r*=256);)this[n+a]=e/r>>>0&255;return n+l},t.prototype.writeUIntBE=function(e,n,l,t){e=+e,n>>>=0,l>>>=0,t||x(this,e,n,l,Math.pow(2,8*l),0);var r=l-1,a=1;for(this[n+r]=255&e;--r>=0&&(a*=256);)this[n+r]=e/a>>>0&255;return n+l},t.prototype.writeUInt8=function(e,n,l){return e=+e,n>>>=0,l||x(this,e,n,1,255,0),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[n]=e,n+1},t.prototype.writeUInt16LE=function(e,n,l){return e=+e,n>>>=0,l||x(this,e,n,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[n]=e,this[n+1]=e>>>8):b(this,e,n,!0),n+2},t.prototype.writeUInt16BE=function(e,n,l){return e=+e,n>>>=0,l||x(this,e,n,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>8,this[n+1]=e):b(this,e,n,!1),n+2},t.prototype.writeUInt32LE=function(e,n,l){return e=+e,n>>>=0,l||x(this,e,n,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[n+3]=e>>>24,this[n+2]=e>>>16,this[n+1]=e>>>8,this[n]=e):_(this,e,n,!0),n+4},t.prototype.writeUInt32BE=function(e,n,l){return e=+e,n>>>=0,l||x(this,e,n,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e):_(this,e,n,!1),n+4},t.prototype.writeIntLE=function(e,n,l,t){e=+e,n>>>=0,t||x(this,e,n,l,Math.pow(2,8*l-1)-1,-Math.pow(2,8*l-1));var r=0,a=1,o=0>e?1:0;for(this[n]=255&e;++r<l&&(a*=256);)this[n+r]=(e/a>>0)-o&255;return n+l},t.prototype.writeIntBE=function(e,n,l,t){e=+e,n>>>=0,t||x(this,e,n,l,Math.pow(2,8*l-1)-1,-Math.pow(2,8*l-1));var r=l-1,a=1,o=0>e?1:0;for(this[n+r]=255&e;--r>=0&&(a*=256);)this[n+r]=(e/a>>0)-o&255;return n+l},t.prototype.writeInt8=function(e,n,l){return e=+e,n>>>=0,l||x(this,e,n,1,127,-128),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[n]=e,n+1},t.prototype.writeInt16LE=function(e,n,l){return e=+e,n>>>=0,l||x(this,e,n,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[n]=e,this[n+1]=e>>>8):b(this,e,n,!0),n+2},t.prototype.writeInt16BE=function(e,n,l){return e=+e,n>>>=0,l||x(this,e,n,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>8,this[n+1]=e):b(this,e,n,!1),n+2},t.prototype.writeInt32LE=function(e,n,l){return e=+e,n>>>=0,l||x(this,e,n,4,2147483647,-2147483648),t.TYPED_ARRAY_SUPPORT?(this[n]=e,this[n+1]=e>>>8,this[n+2]=e>>>16,this[n+3]=e>>>24):_(this,e,n,!0),n+4},t.prototype.writeInt32BE=function(e,n,l){return e=+e,n>>>=0,l||x(this,e,n,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e):_(this,e,n,!1),n+4},t.prototype.writeFloatLE=function(e,n,l){return I(this,e,n,!0,l)},t.prototype.writeFloatBE=function(e,n,l){return I(this,e,n,!1,l)},t.prototype.writeDoubleLE=function(e,n,l){return E(this,e,n,!0,l)},t.prototype.writeDoubleBE=function(e,n,l){return E(this,e,n,!1,l)},t.prototype.copy=function(e,n,l,r){var a=this;if(l||(l=0),r||0===r||(r=this.length),n>=e.length&&(n=e.length),n||(n=0),r>0&&l>r&&(r=l),r===l)return 0;if(0===e.length||0===a.length)return 0;if(0>n)throw new RangeError("targetStart out of bounds");if(0>l||l>=a.length)throw new RangeError("sourceStart out of bounds");if(0>r)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-n<r-l&&(r=e.length-n+l);var o=r-l;if(1e3>o||!t.TYPED_ARRAY_SUPPORT)for(var u=0;o>u;u++)e[u+n]=this[u+l];else e._set(this.subarray(l,l+o),n);return o},t.prototype.fill=function(e,n,l){if(e||(e=0),n||(n=0),l||(l=this.length),n>l)throw new RangeError("end < start");if(l!==n&&0!==this.length){if(0>n||n>=this.length)throw new RangeError("start out of bounds");if(0>l||l>this.length)throw new RangeError("end out of bounds");var t;if("number"==typeof e)for(t=n;l>t;t++)this[t]=e;else{var r=C(e.toString()),a=r.length;for(t=n;l>t;t++)this[t]=r[t%a]}return this}},t.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(t.TYPED_ARRAY_SUPPORT)return new t(this).buffer;for(var e=new Uint8Array(this.length),n=0,l=e.length;l>n;n+=1)e[n]=this[n];return e.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var F=t.prototype;t._augment=function(e){return e.constructor=t,e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=F.get,e.set=F.set,e.write=F.write,e.toString=F.toString,e.toLocaleString=F.toString,e.toJSON=F.toJSON,e.equals=F.equals,e.compare=F.compare,e.copy=F.copy,e.slice=F.slice,e.readUIntLE=F.readUIntLE,e.readUIntBE=F.readUIntBE,e.readUInt8=F.readUInt8,e.readUInt16LE=F.readUInt16LE,e.readUInt16BE=F.readUInt16BE,e.readUInt32LE=F.readUInt32LE,e.readUInt32BE=F.readUInt32BE,e.readIntLE=F.readIntLE,e.readIntBE=F.readIntBE,e.readInt8=F.readInt8,e.readInt16LE=F.readInt16LE,e.readInt16BE=F.readInt16BE,e.readInt32LE=F.readInt32LE,e.readInt32BE=F.readInt32BE,e.readFloatLE=F.readFloatLE,e.readFloatBE=F.readFloatBE,e.readDoubleLE=F.readDoubleLE,e.readDoubleBE=F.readDoubleBE,e.writeUInt8=F.writeUInt8,e.writeUIntLE=F.writeUIntLE,e.writeUIntBE=F.writeUIntBE,e.writeUInt16LE=F.writeUInt16LE,e.writeUInt16BE=F.writeUInt16BE,e.writeUInt32LE=F.writeUInt32LE,e.writeUInt32BE=F.writeUInt32BE,e.writeIntLE=F.writeIntLE,e.writeIntBE=F.writeIntBE,e.writeInt8=F.writeInt8,e.writeInt16LE=F.writeInt16LE,e.writeInt16BE=F.writeInt16BE,e.writeInt32LE=F.writeInt32LE,e.writeInt32BE=F.writeInt32BE,e.writeFloatLE=F.writeFloatLE,e.writeFloatBE=F.writeFloatBE,e.writeDoubleLE=F.writeDoubleLE,e.writeDoubleBE=F.writeDoubleBE,e.fill=F.fill,e.inspect=F.inspect,e.toArrayBuffer=F.toArrayBuffer,e};var V=/[^+\/0-9A-z\-]/g},{"base64-js":141,ieee754:142,"is-array":143}],141:[function(e,n,l){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(e){"use strict";function n(e){var n=e.charCodeAt(0);return n===o||n===d?62:n===u||n===p?63:s>n?-1:s+10>n?n-s+26+26:c+26>n?n-c:i+26>n?n-i+26:void 0}function l(e){function l(e){i[d++]=e}var t,r,o,u,s,i;if(e.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var c=e.length;s="="===e.charAt(c-2)?2:"="===e.charAt(c-1)?1:0,i=new a(3*e.length/4-s),o=s>0?e.length-4:e.length;var d=0;for(t=0,r=0;o>t;t+=4,r+=3)u=n(e.charAt(t))<<18|n(e.charAt(t+1))<<12|n(e.charAt(t+2))<<6|n(e.charAt(t+3)),l((16711680&u)>>16),l((65280&u)>>8),l(255&u);return 2===s?(u=n(e.charAt(t))<<2|n(e.charAt(t+1))>>4,l(255&u)):1===s&&(u=n(e.charAt(t))<<10|n(e.charAt(t+1))<<4|n(e.charAt(t+2))>>2,l(u>>8&255),l(255&u)),i}function r(e){function n(e){return t.charAt(e)}function l(e){return n(e>>18&63)+n(e>>12&63)+n(e>>6&63)+n(63&e)}var r,a,o,u=e.length%3,s="";for(r=0,o=e.length-u;o>r;r+=3)a=(e[r]<<16)+(e[r+1]<<8)+e[r+2],s+=l(a);switch(u){case 1:a=e[e.length-1],s+=n(a>>2),s+=n(a<<4&63),s+="==";break;case 2:a=(e[e.length-2]<<8)+e[e.length-1],s+=n(a>>10),s+=n(a>>4&63),s+=n(a<<2&63),s+="="}return s}var a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="+".charCodeAt(0),u="/".charCodeAt(0),s="0".charCodeAt(0),i="a".charCodeAt(0),c="A".charCodeAt(0),d="-".charCodeAt(0),p="_".charCodeAt(0);e.toByteArray=l,e.fromByteArray=r}("undefined"==typeof l?this.base64js={}:l)},{}],142:[function(e,n,l){l.read=function(e,n,l,t,r){var a,o,u=8*r-t-1,s=(1<<u)-1,i=s>>1,c=-7,d=l?r-1:0,p=l?-1:1,f=e[n+d];for(d+=p,a=f&(1<<-c)-1,f>>=-c,c+=u;c>0;a=256*a+e[n+d],d+=p,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=t;c>0;o=256*o+e[n+d],d+=p,c-=8);if(0===a)a=1-i;else{if(a===s)return o?0/0:1/0*(f?-1:1);o+=Math.pow(2,t),a-=i}return(f?-1:1)*o*Math.pow(2,a-t)},l.write=function(e,n,l,t,r,a){var o,u,s,i=8*a-r-1,c=(1<<i)-1,d=c>>1,p=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=t?0:a-1,g=t?1:-1,h=0>n||0===n&&0>1/n?1:0;for(n=Math.abs(n),isNaN(n)||1/0===n?(u=isNaN(n)?1:0,o=c):(o=Math.floor(Math.log(n)/Math.LN2),n*(s=Math.pow(2,-o))<1&&(o--,s*=2),n+=o+d>=1?p/s:p*Math.pow(2,1-d),n*s>=2&&(o++,s/=2),o+d>=c?(u=0,o=c):o+d>=1?(u=(n*s-1)*Math.pow(2,r),o+=d):(u=n*Math.pow(2,d-1)*Math.pow(2,r),o=0));r>=8;e[l+f]=255&u,f+=g,u/=256,r-=8);for(o=o<<r|u,i+=r;i>0;e[l+f]=255&o,f+=g,o/=256,i-=8);e[l+f-g]|=128*h}},{}],143:[function(e,n){var l=Array.isArray,t=Object.prototype.toString;n.exports=l||function(e){return!!e&&"[object Array]"==t.call(e)}},{}],144:[function(e,n){function l(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function t(e){return"function"==typeof e}function r(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}n.exports=l,l.EventEmitter=l,l.prototype._events=void 0,l.prototype._maxListeners=void 0,l.defaultMaxListeners=10,l.prototype.setMaxListeners=function(e){if(!r(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},l.prototype.emit=function(e){var n,l,r,u,s,i;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(n=arguments[1],n instanceof Error)throw n;throw TypeError('Uncaught, unspecified "error" event.')}if(l=this._events[e],o(l))return!1;if(t(l))switch(arguments.length){case 1:l.call(this);break;case 2:l.call(this,arguments[1]);break;case 3:l.call(this,arguments[1],arguments[2]);break;default:for(r=arguments.length,u=new Array(r-1),s=1;r>s;s++)u[s-1]=arguments[s];l.apply(this,u)}else if(a(l)){for(r=arguments.length,u=new Array(r-1),s=1;r>s;s++)u[s-1]=arguments[s];for(i=l.slice(),r=i.length,s=0;r>s;s++)i[s].apply(this,u)}return!0},l.prototype.addListener=function(e,n){var r;if(!t(n))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,t(n.listener)?n.listener:n),this._events[e]?a(this._events[e])?this._events[e].push(n):this._events[e]=[this._events[e],n]:this._events[e]=n,a(this._events[e])&&!this._events[e].warned){var r;r=o(this._maxListeners)?l.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())}return this},l.prototype.on=l.prototype.addListener,l.prototype.once=function(e,n){function l(){this.removeListener(e,l),r||(r=!0,n.apply(this,arguments))}if(!t(n))throw TypeError("listener must be a function");var r=!1;return l.listener=n,this.on(e,l),this},l.prototype.removeListener=function(e,n){var l,r,o,u;if(!t(n))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(l=this._events[e],o=l.length,r=-1,l===n||t(l.listener)&&l.listener===n)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,n);else if(a(l)){for(u=o;u-->0;)if(l[u]===n||l[u].listener&&l[u].listener===n){r=u;break}if(0>r)return this;1===l.length?(l.length=0,delete this._events[e]):l.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,n)}return this},l.prototype.removeAllListeners=function(e){var n,l;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(n in this._events)"removeListener"!==n&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events={},this}if(l=this._events[e],t(l))this.removeListener(e,l);else for(;l.length;)this.removeListener(e,l[l.length-1]);return delete this._events[e],this},l.prototype.listeners=function(e){var n;return n=this._events&&this._events[e]?t(this._events[e])?[this._events[e]]:this._events[e].slice():[]},l.listenerCount=function(e,n){var l;return l=e._events&&e._events[n]?t(e._events[n])?1:e._events[n].length:0}},{}],145:[function(e,n){n.exports="function"==typeof Object.create?function(e,n){e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,n){e.super_=n;var l=function(){};l.prototype=n.prototype,e.prototype=new l,e.prototype.constructor=e}},{}],146:[function(e,n){n.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{}],147:[function(e,n,l){(function(e){function n(e,n){for(var l=0,t=e.length-1;t>=0;t--){var r=e[t];"."===r?e.splice(t,1):".."===r?(e.splice(t,1),l++):l&&(e.splice(t,1),l--)}if(n)for(;l--;l)e.unshift("..");return e}function t(e,n){if(e.filter)return e.filter(n);for(var l=[],t=0;t<e.length;t++)n(e[t],t,e)&&l.push(e[t]);return l}var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,a=function(e){return r.exec(e).slice(1)};l.resolve=function(){for(var l="",r=!1,a=arguments.length-1;a>=-1&&!r;a--){var o=a>=0?arguments[a]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(l=o+"/"+l,r="/"===o.charAt(0))}return l=n(t(l.split("/"),function(e){return!!e}),!r).join("/"),(r?"/":"")+l||"."},l.normalize=function(e){var r=l.isAbsolute(e),a="/"===o(e,-1);return e=n(t(e.split("/"),function(e){return!!e}),!r).join("/"),e||r||(e="."),e&&a&&(e+="/"),(r?"/":"")+e},l.isAbsolute=function(e){return"/"===e.charAt(0)},l.join=function(){var e=Array.prototype.slice.call(arguments,0);return l.normalize(t(e,function(e){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},l.relative=function(e,n){function t(e){for(var n=0;n<e.length&&""===e[n];n++);for(var l=e.length-1;l>=0&&""===e[l];l--);return n>l?[]:e.slice(n,l-n+1)}e=l.resolve(e).substr(1),n=l.resolve(n).substr(1);for(var r=t(e.split("/")),a=t(n.split("/")),o=Math.min(r.length,a.length),u=o,s=0;o>s;s++)if(r[s]!==a[s]){u=s;break}for(var i=[],s=u;s<r.length;s++)i.push("..");return i=i.concat(a.slice(u)),i.join("/")},l.sep="/",l.delimiter=":",l.dirname=function(e){var n=a(e),l=n[0],t=n[1];return l||t?(t&&(t=t.substr(0,t.length-1)),l+t):"."},l.basename=function(e,n){var l=a(e)[2];return n&&l.substr(-1*n.length)===n&&(l=l.substr(0,l.length-n.length)),l},l.extname=function(e){return a(e)[3]};var o="b"==="ab".substr(-1)?function(e,n,l){return e.substr(n,l)}:function(e,n,l){return 0>n&&(n=e.length+n),e.substr(n,l)}}).call(this,e("_process"))},{_process:148}],148:[function(e,n){function l(){if(!o){o=!0;for(var e,n=a.length;n;){e=a,a=[];for(var l=-1;++l<n;)e[l]();n=a.length}o=!1}}function t(){}var r=n.exports={},a=[],o=!1;r.nextTick=function(e){a.push(e),o||setTimeout(l,0)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.on=t,r.addListener=t,r.once=t,r.off=t,r.removeListener=t,r.removeAllListeners=t,r.emit=t,r.binding=function(){throw new Error("process.binding is not supported")
},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},{}],149:[function(e,n){n.exports=e("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":150}],150:[function(e,n){(function(l){function t(e){return this instanceof t?(s.call(this,e),i.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",r)):new t(e)}function r(){this.allowHalfOpen||this._writableState.ended||l.nextTick(this.end.bind(this))}function a(e,n){for(var l=0,t=e.length;t>l;l++)n(e[l],l)}n.exports=t;var o=Object.keys||function(e){var n=[];for(var l in e)n.push(l);return n},u=e("core-util-is");u.inherits=e("inherits");var s=e("./_stream_readable"),i=e("./_stream_writable");u.inherits(t,s),a(o(i.prototype),function(e){t.prototype[e]||(t.prototype[e]=i.prototype[e])})}).call(this,e("_process"))},{"./_stream_readable":152,"./_stream_writable":154,_process:148,"core-util-is":155,inherits:145}],151:[function(e,n){function l(e){return this instanceof l?void t.call(this,e):new l(e)}n.exports=l;var t=e("./_stream_transform"),r=e("core-util-is");r.inherits=e("inherits"),r.inherits(l,t),l.prototype._transform=function(e,n,l){l(null,e)}},{"./_stream_transform":153,"core-util-is":155,inherits:145}],152:[function(e,n){(function(l){function t(n){n=n||{};var l=n.highWaterMark;this.highWaterMark=l||0===l?l:16384,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=!1,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.calledRead=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!n.objectMode,this.defaultEncoding=n.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,n.encoding&&(C||(C=e("string_decoder/").StringDecoder),this.decoder=new C(n.encoding),this.encoding=n.encoding)}function r(e){return this instanceof r?(this._readableState=new t(e,this),this.readable=!0,void R.call(this)):new r(e)}function a(e,n,l,t,r){var a=i(n,l);if(a)e.emit("error",a);else if(null===l||void 0===l)n.reading=!1,n.ended||c(e,n);else if(n.objectMode||l&&l.length>0)if(n.ended&&!r){var u=new Error("stream.push() after EOF");e.emit("error",u)}else if(n.endEmitted&&r){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else!n.decoder||r||t||(l=n.decoder.write(l)),n.length+=n.objectMode?1:l.length,r?n.buffer.unshift(l):(n.reading=!1,n.buffer.push(l)),n.needReadable&&d(e),f(e,n);else r||(n.reading=!1);return o(n)}function o(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}function u(e){if(e>=A)e=A;else{e--;for(var n=1;32>n;n<<=1)e|=e>>n;e++}return e}function s(e,n){return 0===n.length&&n.ended?0:n.objectMode?0===e?0:1:null===e||isNaN(e)?n.flowing&&n.buffer.length?n.buffer[0].length:n.length:0>=e?0:(e>n.highWaterMark&&(n.highWaterMark=u(e)),e>n.length?n.ended?n.length:(n.needReadable=!0,0):e)}function i(e,n){var l=null;return k.isBuffer(n)||"string"==typeof n||null===n||void 0===n||e.objectMode||(l=new TypeError("Invalid non-string/buffer chunk")),l}function c(e,n){if(n.decoder&&!n.ended){var l=n.decoder.end();l&&l.length&&(n.buffer.push(l),n.length+=n.objectMode?1:l.length)}n.ended=!0,n.length>0?d(e):_(e)}function d(e){var n=e._readableState;n.needReadable=!1,n.emittedReadable||(n.emittedReadable=!0,n.sync?l.nextTick(function(){p(e)}):p(e))}function p(e){e.emit("readable")}function f(e,n){n.readingMore||(n.readingMore=!0,l.nextTick(function(){g(e,n)}))}function g(e,n){for(var l=n.length;!n.reading&&!n.flowing&&!n.ended&&n.length<n.highWaterMark&&(e.read(0),l!==n.length);)l=n.length;n.readingMore=!1}function h(e){return function(){var n=e._readableState;n.awaitDrain--,0===n.awaitDrain&&m(e)}}function m(e){function n(e){var n=e.write(l);!1===n&&t.awaitDrain++}var l,t=e._readableState;for(t.awaitDrain=0;t.pipesCount&&null!==(l=e.read());)if(1===t.pipesCount?n(t.pipes,0,null):v(t.pipes,n),e.emit("data",l),t.awaitDrain>0)return;return 0===t.pipesCount?(t.flowing=!1,void(w.listenerCount(e,"data")>0&&x(e))):void(t.ranOut=!0)}function y(){this._readableState.ranOut&&(this._readableState.ranOut=!1,m(this))}function x(e,n){var t=e._readableState;if(t.flowing)throw new Error("Cannot switch to old mode now.");var r=n||!1,a=!1;e.readable=!0,e.pipe=R.prototype.pipe,e.on=e.addListener=R.prototype.on,e.on("readable",function(){a=!0;for(var n;!r&&null!==(n=e.read());)e.emit("data",n);null===n&&(a=!1,e._readableState.needReadable=!0)}),e.pause=function(){r=!0,this.emit("pause")},e.resume=function(){r=!1,a?l.nextTick(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function b(e,n){var l,t=n.buffer,r=n.length,a=!!n.decoder,o=!!n.objectMode;if(0===t.length)return null;if(0===r)l=null;else if(o)l=t.shift();else if(!e||e>=r)l=a?t.join(""):k.concat(t,r),t.length=0;else if(e<t[0].length){var u=t[0];l=u.slice(0,e),t[0]=u.slice(e)}else if(e===t[0].length)l=t.shift();else{l=a?"":new k(e);for(var s=0,i=0,c=t.length;c>i&&e>s;i++){var u=t[0],d=Math.min(e-s,u.length);a?l+=u.slice(0,d):u.copy(l,s,0,d),d<u.length?t[0]=u.slice(d):t.shift(),s+=d}}return l}function _(e){var n=e._readableState;if(n.length>0)throw new Error("endReadable called on non-empty stream");!n.endEmitted&&n.calledRead&&(n.ended=!0,l.nextTick(function(){n.endEmitted||0!==n.length||(n.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function v(e,n){for(var l=0,t=e.length;t>l;l++)n(e[l],l)}function I(e,n){for(var l=0,t=e.length;t>l;l++)if(e[l]===n)return l;return-1}n.exports=r;var E=e("isarray"),k=e("buffer").Buffer;r.ReadableState=t;var w=e("events").EventEmitter;w.listenerCount||(w.listenerCount=function(e,n){return e.listeners(n).length});var R=e("stream"),S=e("core-util-is");S.inherits=e("inherits");var C;S.inherits(r,R),r.prototype.push=function(e,n){var l=this._readableState;return"string"!=typeof e||l.objectMode||(n=n||l.defaultEncoding,n!==l.encoding&&(e=new k(e,n),n="")),a(this,l,e,n,!1)},r.prototype.unshift=function(e){var n=this._readableState;return a(this,n,e,"",!0)},r.prototype.setEncoding=function(n){C||(C=e("string_decoder/").StringDecoder),this._readableState.decoder=new C(n),this._readableState.encoding=n};var A=8388608;r.prototype.read=function(e){var n=this._readableState;n.calledRead=!0;var l,t=e;if(("number"!=typeof e||e>0)&&(n.emittedReadable=!1),0===e&&n.needReadable&&(n.length>=n.highWaterMark||n.ended))return d(this),null;if(e=s(e,n),0===e&&n.ended)return l=null,n.length>0&&n.decoder&&(l=b(e,n),n.length-=l.length),0===n.length&&_(this),l;var r=n.needReadable;return n.length-e<=n.highWaterMark&&(r=!0),(n.ended||n.reading)&&(r=!1),r&&(n.reading=!0,n.sync=!0,0===n.length&&(n.needReadable=!0),this._read(n.highWaterMark),n.sync=!1),r&&!n.reading&&(e=s(t,n)),l=e>0?b(e,n):null,null===l&&(n.needReadable=!0,e=0),n.length-=e,0!==n.length||n.ended||(n.needReadable=!0),n.ended&&!n.endEmitted&&0===n.length&&_(this),l},r.prototype._read=function(){this.emit("error",new Error("not implemented"))},r.prototype.pipe=function(e,n){function t(e){e===c&&a()}function r(){e.end()}function a(){e.removeListener("close",u),e.removeListener("finish",s),e.removeListener("drain",g),e.removeListener("error",o),e.removeListener("unpipe",t),c.removeListener("end",r),c.removeListener("end",a),(!e._writableState||e._writableState.needDrain)&&g()}function o(n){i(),e.removeListener("error",o),0===w.listenerCount(e,"error")&&e.emit("error",n)}function u(){e.removeListener("finish",s),i()}function s(){e.removeListener("close",u),i()}function i(){c.unpipe(e)}var c=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=e;break;case 1:d.pipes=[d.pipes,e];break;default:d.pipes.push(e)}d.pipesCount+=1;var p=(!n||n.end!==!1)&&e!==l.stdout&&e!==l.stderr,f=p?r:a;d.endEmitted?l.nextTick(f):c.once("end",f),e.on("unpipe",t);var g=h(c);return e.on("drain",g),e._events&&e._events.error?E(e._events.error)?e._events.error.unshift(o):e._events.error=[o,e._events.error]:e.on("error",o),e.once("close",u),e.once("finish",s),e.emit("pipe",c),d.flowing||(this.on("readable",y),d.flowing=!0,l.nextTick(function(){m(c)})),e},r.prototype.unpipe=function(e){var n=this._readableState;if(0===n.pipesCount)return this;if(1===n.pipesCount)return e&&e!==n.pipes?this:(e||(e=n.pipes),n.pipes=null,n.pipesCount=0,this.removeListener("readable",y),n.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var l=n.pipes,t=n.pipesCount;n.pipes=null,n.pipesCount=0,this.removeListener("readable",y),n.flowing=!1;for(var r=0;t>r;r++)l[r].emit("unpipe",this);return this}var r=I(n.pipes,e);return-1===r?this:(n.pipes.splice(r,1),n.pipesCount-=1,1===n.pipesCount&&(n.pipes=n.pipes[0]),e.emit("unpipe",this),this)},r.prototype.on=function(e,n){var l=R.prototype.on.call(this,e,n);if("data"!==e||this._readableState.flowing||x(this),"readable"===e&&this.readable){var t=this._readableState;t.readableListening||(t.readableListening=!0,t.emittedReadable=!1,t.needReadable=!0,t.reading?t.length&&d(this,t):this.read(0))}return l},r.prototype.addListener=r.prototype.on,r.prototype.resume=function(){x(this),this.read(0),this.emit("resume")},r.prototype.pause=function(){x(this,!0),this.emit("pause")},r.prototype.wrap=function(e){var n=this._readableState,l=!1,t=this;e.on("end",function(){if(n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(r){if(n.decoder&&(r=n.decoder.write(r)),(!n.objectMode||null!==r&&void 0!==r)&&(n.objectMode||r&&r.length)){var a=t.push(r);a||(l=!0,e.pause())}});for(var r in e)"function"==typeof e[r]&&"undefined"==typeof this[r]&&(this[r]=function(n){return function(){return e[n].apply(e,arguments)}}(r));var a=["error","close","destroy","pause","resume"];return v(a,function(n){e.on(n,t.emit.bind(t,n))}),t._read=function(){l&&(l=!1,e.resume())},t},r._fromList=b}).call(this,e("_process"))},{_process:148,buffer:140,"core-util-is":155,events:144,inherits:145,isarray:146,stream:160,"string_decoder/":161}],153:[function(e,n){function l(e,n){this.afterTransform=function(e,l){return t(n,e,l)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function t(e,n,l){var t=e._transformState;t.transforming=!1;var r=t.writecb;if(!r)return e.emit("error",new Error("no writecb in Transform class"));t.writechunk=null,t.writecb=null,null!==l&&void 0!==l&&e.push(l),r&&r(n);var a=e._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&e._read(a.highWaterMark)}function r(e){if(!(this instanceof r))return new r(e);o.call(this,e);var n=(this._transformState=new l(e,this),this);this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("finish",function(){"function"==typeof this._flush?this._flush(function(e){a(n,e)}):a(n)})}function a(e,n){if(n)return e.emit("error",n);var l=e._writableState,t=(e._readableState,e._transformState);if(l.length)throw new Error("calling transform done when ws.length != 0");if(t.transforming)throw new Error("calling transform done when still transforming");return e.push(null)}n.exports=r;var o=e("./_stream_duplex"),u=e("core-util-is");u.inherits=e("inherits"),u.inherits(r,o),r.prototype.push=function(e,n){return this._transformState.needTransform=!1,o.prototype.push.call(this,e,n)},r.prototype._transform=function(){throw new Error("not implemented")},r.prototype._write=function(e,n,l){var t=this._transformState;if(t.writecb=l,t.writechunk=e,t.writeencoding=n,!t.transforming){var r=this._readableState;(t.needTransform||r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}},r.prototype._read=function(){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0}},{"./_stream_duplex":150,"core-util-is":155,inherits:145}],154:[function(e,n){(function(l){function t(e,n,l){this.chunk=e,this.encoding=n,this.callback=l}function r(e,n){e=e||{};var l=e.highWaterMark;this.highWaterMark=l||0===l?l:16384,this.objectMode=!!e.objectMode,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var t=e.decodeStrings===!1;this.decodeStrings=!t,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){f(n,e)},this.writecb=null,this.writelen=0,this.buffer=[],this.errorEmitted=!1}function a(n){var l=e("./_stream_duplex");return this instanceof a||this instanceof l?(this._writableState=new r(n,this),this.writable=!0,void I.call(this)):new a(n)}function o(e,n,t){var r=new Error("write after end");e.emit("error",r),l.nextTick(function(){t(r)})}function u(e,n,t,r){var a=!0;if(!_.isBuffer(t)&&"string"!=typeof t&&null!==t&&void 0!==t&&!n.objectMode){var o=new TypeError("Invalid non-string/buffer chunk");e.emit("error",o),l.nextTick(function(){r(o)}),a=!1}return a}function s(e,n,l){return e.objectMode||e.decodeStrings===!1||"string"!=typeof n||(n=new _(n,l)),n}function i(e,n,l,r,a){l=s(n,l,r),_.isBuffer(l)&&(r="buffer");var o=n.objectMode?1:l.length;n.length+=o;var u=n.length<n.highWaterMark;return u||(n.needDrain=!0),n.writing?n.buffer.push(new t(l,r,a)):c(e,n,o,l,r,a),u}function c(e,n,l,t,r,a){n.writelen=l,n.writecb=a,n.writing=!0,n.sync=!0,e._write(t,r,n.onwrite),n.sync=!1}function d(e,n,t,r,a){t?l.nextTick(function(){a(r)}):a(r),e._writableState.errorEmitted=!0,e.emit("error",r)}function p(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function f(e,n){var t=e._writableState,r=t.sync,a=t.writecb;if(p(t),n)d(e,t,r,n,a);else{var o=y(e,t);o||t.bufferProcessing||!t.buffer.length||m(e,t),r?l.nextTick(function(){g(e,t,o,a)}):g(e,t,o,a)}}function g(e,n,l,t){l||h(e,n),t(),l&&x(e,n)}function h(e,n){0===n.length&&n.needDrain&&(n.needDrain=!1,e.emit("drain"))}function m(e,n){n.bufferProcessing=!0;for(var l=0;l<n.buffer.length;l++){var t=n.buffer[l],r=t.chunk,a=t.encoding,o=t.callback,u=n.objectMode?1:r.length;if(c(e,n,u,r,a,o),n.writing){l++;break}}n.bufferProcessing=!1,l<n.buffer.length?n.buffer=n.buffer.slice(l):n.buffer.length=0}function y(e,n){return n.ending&&0===n.length&&!n.finished&&!n.writing}function x(e,n){var l=y(e,n);return l&&(n.finished=!0,e.emit("finish")),l}function b(e,n,t){n.ending=!0,x(e,n),t&&(n.finished?l.nextTick(t):e.once("finish",t)),n.ended=!0}n.exports=a;var _=e("buffer").Buffer;a.WritableState=r;var v=e("core-util-is");v.inherits=e("inherits");var I=e("stream");v.inherits(a,I),a.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},a.prototype.write=function(e,n,l){var t=this._writableState,r=!1;return"function"==typeof n&&(l=n,n=null),_.isBuffer(e)?n="buffer":n||(n=t.defaultEncoding),"function"!=typeof l&&(l=function(){}),t.ended?o(this,t,l):u(this,t,e,l)&&(r=i(this,t,e,n,l)),r},a.prototype._write=function(e,n,l){l(new Error("not implemented"))},a.prototype.end=function(e,n,l){var t=this._writableState;"function"==typeof e?(l=e,e=null,n=null):"function"==typeof n&&(l=n,n=null),"undefined"!=typeof e&&null!==e&&this.write(e,n),t.ending||t.finished||b(this,t,l)}}).call(this,e("_process"))},{"./_stream_duplex":150,_process:148,buffer:140,"core-util-is":155,inherits:145,stream:160}],155:[function(e,n,l){(function(e){function n(e){return Array.isArray(e)}function t(e){return"boolean"==typeof e}function r(e){return null===e}function a(e){return null==e}function o(e){return"number"==typeof e}function u(e){return"string"==typeof e}function s(e){return"symbol"==typeof e}function i(e){return void 0===e}function c(e){return d(e)&&"[object RegExp]"===y(e)}function d(e){return"object"==typeof e&&null!==e}function p(e){return d(e)&&"[object Date]"===y(e)}function f(e){return d(e)&&("[object Error]"===y(e)||e instanceof Error)}function g(e){return"function"==typeof e}function h(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function m(n){return e.isBuffer(n)}function y(e){return Object.prototype.toString.call(e)}l.isArray=n,l.isBoolean=t,l.isNull=r,l.isNullOrUndefined=a,l.isNumber=o,l.isString=u,l.isSymbol=s,l.isUndefined=i,l.isRegExp=c,l.isObject=d,l.isDate=p,l.isError=f,l.isFunction=g,l.isPrimitive=h,l.isBuffer=m}).call(this,e("buffer").Buffer)},{buffer:140}],156:[function(e,n){n.exports=e("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":151}],157:[function(e,n,l){var t=e("stream");l=n.exports=e("./lib/_stream_readable.js"),l.Stream=t,l.Readable=l,l.Writable=e("./lib/_stream_writable.js"),l.Duplex=e("./lib/_stream_duplex.js"),l.Transform=e("./lib/_stream_transform.js"),l.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":150,"./lib/_stream_passthrough.js":151,"./lib/_stream_readable.js":152,"./lib/_stream_transform.js":153,"./lib/_stream_writable.js":154,stream:160}],158:[function(e,n){n.exports=e("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":153}],159:[function(e,n){n.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":154}],160:[function(e,n){function l(){t.call(this)}n.exports=l;var t=e("events").EventEmitter,r=e("inherits");r(l,t),l.Readable=e("readable-stream/readable.js"),l.Writable=e("readable-stream/writable.js"),l.Duplex=e("readable-stream/duplex.js"),l.Transform=e("readable-stream/transform.js"),l.PassThrough=e("readable-stream/passthrough.js"),l.Stream=l,l.prototype.pipe=function(e,n){function l(n){e.writable&&!1===e.write(n)&&i.pause&&i.pause()}function r(){i.readable&&i.resume&&i.resume()}function a(){c||(c=!0,e.end())}function o(){c||(c=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){if(s(),0===t.listenerCount(this,"error"))throw e}function s(){i.removeListener("data",l),e.removeListener("drain",r),i.removeListener("end",a),i.removeListener("close",o),i.removeListener("error",u),e.removeListener("error",u),i.removeListener("end",s),i.removeListener("close",s),e.removeListener("close",s)}var i=this;i.on("data",l),e.on("drain",r),e._isStdio||n&&n.end===!1||(i.on("end",a),i.on("close",o));var c=!1;return i.on("error",u),e.on("error",u),i.on("end",s),i.on("close",s),e.on("close",s),e.emit("pipe",i),e}},{events:144,inherits:145,"readable-stream/duplex.js":149,"readable-stream/passthrough.js":156,"readable-stream/readable.js":157,"readable-stream/transform.js":158,"readable-stream/writable.js":159}],161:[function(e,n,l){function t(e){if(e&&!s(e))throw new Error("Unknown encoding: "+e)}function r(e){return e.toString(this.encoding)}function a(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function o(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var u=e("buffer").Buffer,s=u.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},i=l.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),t(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=a;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=o;break;default:return void(this.write=r)}this.charBuffer=new u(6),this.charReceived=0,this.charLength=0};i.prototype.write=function(e){for(var n="";this.charLength;){var l=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,l),this.charReceived+=l,this.charReceived<this.charLength)return"";e=e.slice(l,e.length),n=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var t=n.charCodeAt(n.length-1);if(!(t>=55296&&56319>=t)){if(this.charReceived=this.charLength=0,0===e.length)return n;break}this.charLength+=this.surrogateSize,n=""}this.detectIncompleteChar(e);var r=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,r),r-=this.charReceived),n+=e.toString(this.encoding,0,r);var r=n.length-1,t=n.charCodeAt(r);if(t>=55296&&56319>=t){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),e.copy(this.charBuffer,0,0,a),n.substring(0,r)}return n},i.prototype.detectIncompleteChar=function(e){for(var n=e.length>=3?3:e.length;n>0;n--){var l=e[e.length-n];if(1==n&&l>>5==6){this.charLength=2;break}if(2>=n&&l>>4==14){this.charLength=3;break}if(3>=n&&l>>3==30){this.charLength=4;break}}this.charReceived=n},i.prototype.end=function(e){var n="";if(e&&e.length&&(n=this.write(e)),this.charReceived){var l=this.charReceived,t=this.charBuffer,r=this.encoding;n+=t.slice(0,l).toString(r)}return n}},{buffer:140}],162:[function(e,n,l){function t(){throw new Error("tty.ReadStream is not implemented")}function r(){throw new Error("tty.ReadStream is not implemented")}l.isatty=function(){return!1},l.ReadStream=t,l.WriteStream=r},{}],163:[function(e,n){n.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],164:[function(e,n,l){(function(n,t){function r(e,n){var t={seen:[],stylize:o};return arguments.length>=3&&(t.depth=arguments[2]),arguments.length>=4&&(t.colors=arguments[3]),h(n)?t.showHidden=n:n&&l._extend(t,n),v(t.showHidden)&&(t.showHidden=!1),v(t.depth)&&(t.depth=2),v(t.colors)&&(t.colors=!1),v(t.customInspect)&&(t.customInspect=!0),t.colors&&(t.stylize=a),s(t,e,t.depth)}function a(e,n){var l=r.styles[n];return l?"["+r.colors[l][0]+"m"+e+"["+r.colors[l][1]+"m":e}function o(e){return e}function u(e){var n={};return e.forEach(function(e){n[e]=!0}),n}function s(e,n,t){if(e.customInspect&&n&&R(n.inspect)&&n.inspect!==l.inspect&&(!n.constructor||n.constructor.prototype!==n)){var r=n.inspect(t,e);return b(r)||(r=s(e,r,t)),r}var a=i(e,n);if(a)return a;var o=Object.keys(n),h=u(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(n)),w(n)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return c(n);if(0===o.length){if(R(n)){var m=n.name?": "+n.name:"";return e.stylize("[Function"+m+"]","special")}if(I(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(k(n))return e.stylize(Date.prototype.toString.call(n),"date");if(w(n))return c(n)}var y="",x=!1,_=["{","}"];if(g(n)&&(x=!0,_=["[","]"]),R(n)){var v=n.name?": "+n.name:"";y=" [Function"+v+"]"}if(I(n)&&(y=" "+RegExp.prototype.toString.call(n)),k(n)&&(y=" "+Date.prototype.toUTCString.call(n)),w(n)&&(y=" "+c(n)),0===o.length&&(!x||0==n.length))return _[0]+y+_[1];if(0>t)return I(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special");e.seen.push(n);var E;return E=x?d(e,n,t,h,o):o.map(function(l){return p(e,n,t,h,l,x)}),e.seen.pop(),f(E,y,_)}function i(e,n){if(v(n))return e.stylize("undefined","undefined");if(b(n)){var l="'"+JSON.stringify(n).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(l,"string")}return x(n)?e.stylize(""+n,"number"):h(n)?e.stylize(""+n,"boolean"):m(n)?e.stylize("null","null"):void 0}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,n,l,t,r){for(var a=[],o=0,u=n.length;u>o;++o)a.push(T(n,String(o))?p(e,n,l,t,String(o),!0):"");return r.forEach(function(r){r.match(/^\d+$/)||a.push(p(e,n,l,t,r,!0))}),a}function p(e,n,l,t,r,a){var o,u,i;if(i=Object.getOwnPropertyDescriptor(n,r)||{value:n[r]},i.get?u=i.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):i.set&&(u=e.stylize("[Setter]","special")),T(t,r)||(o="["+r+"]"),u||(e.seen.indexOf(i.value)<0?(u=m(l)?s(e,i.value,null):s(e,i.value,l-1),u.indexOf("\n")>-1&&(u=a?u.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+u.split("\n").map(function(e){return" "+e}).join("\n"))):u=e.stylize("[Circular]","special")),v(o)){if(a&&r.match(/^\d+$/))return u;o=JSON.stringify(""+r),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+u}function f(e,n,l){var t=0,r=e.reduce(function(e,n){return t++,n.indexOf("\n")>=0&&t++,e+n.replace(/\u001b\[\d\d?m/g,"").length+1},0);return r>60?l[0]+(""===n?"":n+"\n ")+" "+e.join(",\n ")+" "+l[1]:l[0]+n+" "+e.join(", ")+" "+l[1]}function g(e){return Array.isArray(e)}function h(e){return"boolean"==typeof e}function m(e){return null===e}function y(e){return null==e}function x(e){return"number"==typeof e}function b(e){return"string"==typeof e}function _(e){return"symbol"==typeof e}function v(e){return void 0===e}function I(e){return E(e)&&"[object RegExp]"===C(e)}function E(e){return"object"==typeof e&&null!==e}function k(e){return E(e)&&"[object Date]"===C(e)}function w(e){return E(e)&&("[object Error]"===C(e)||e instanceof Error)}function R(e){return"function"==typeof e}function S(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function C(e){return Object.prototype.toString.call(e)}function A(e){return 10>e?"0"+e.toString(10):e.toString(10)}function j(){var e=new Date,n=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":");return[e.getDate(),M[e.getMonth()],n].join(" ")}function T(e,n){return Object.prototype.hasOwnProperty.call(e,n)}var L=/%[sdj%]/g;l.format=function(e){if(!b(e)){for(var n=[],l=0;l<arguments.length;l++)n.push(r(arguments[l]));return n.join(" ")}for(var l=1,t=arguments,a=t.length,o=String(e).replace(L,function(e){if("%%"===e)return"%";if(l>=a)return e;switch(e){case"%s":return String(t[l++]);case"%d":return Number(t[l++]);case"%j":try{return JSON.stringify(t[l++])}catch(n){return"[Circular]"}default:return e}}),u=t[l];a>l;u=t[++l])o+=m(u)||!E(u)?" "+u:" "+r(u);return o},l.deprecate=function(e,r){function a(){if(!o){if(n.throwDeprecation)throw new Error(r);n.traceDeprecation?console.trace(r):console.error(r),o=!0}return e.apply(this,arguments)}if(v(t.process))return function(){return l.deprecate(e,r).apply(this,arguments)};if(n.noDeprecation===!0)return e;var o=!1;return a};var P,O={};l.debuglog=function(e){if(v(P)&&(P=n.env.NODE_DEBUG||""),e=e.toUpperCase(),!O[e])if(new RegExp("\\b"+e+"\\b","i").test(P)){var t=n.pid;O[e]=function(){var n=l.format.apply(l,arguments);console.error("%s %d: %s",e,t,n)}}else O[e]=function(){};return O[e]},l.inspect=r,r.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},r.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},l.isArray=g,l.isBoolean=h,l.isNull=m,l.isNullOrUndefined=y,l.isNumber=x,l.isString=b,l.isSymbol=_,l.isUndefined=v,l.isRegExp=I,l.isObject=E,l.isDate=k,l.isError=w,l.isFunction=R,l.isPrimitive=S,l.isBuffer=e("./support/isBuffer");var M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];l.log=function(){console.log("%s - %s",j(),l.format.apply(l,arguments))},l.inherits=e("inherits"),l._extend=function(e,n){if(!n||!E(n))return e;for(var l=Object.keys(n),t=l.length;t--;)e[l[t]]=n[l[t]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":163,_process:148,inherits:145}],165:[function(e,n){(function(l){"use strict";function t(e){this.enabled=e&&void 0!==e.enabled?e.enabled:d}function r(e){var n=function l(){return a.apply(l,arguments)};return n._styles=e,n.enabled=this.enabled,n.__proto__=g,n}function a(){var e=arguments,n=e.length,l=0!==n&&String(arguments[0]);if(n>1)for(var t=1;n>t;t++)l+=" "+e[t];if(!this.enabled||!l)return l;for(var r=this._styles,a=r.length;a--;){var o=s[r[a]];l=o.open+l.replace(o.closeRe,o.open)+o.close}return l}function o(){var e={};return Object.keys(f).forEach(function(n){e[n]={get:function(){return r.call(this,[n])}}}),e}var u=e("escape-string-regexp"),s=e("ansi-styles"),i=e("strip-ansi"),c=e("has-ansi"),d=e("supports-color"),p=Object.defineProperties;"win32"===l.platform&&(s.blue.open="[94m");var f=function(){var e={};return Object.keys(s).forEach(function(n){s[n].closeRe=new RegExp(u(s[n].close),"g"),e[n]={get:function(){return r.call(this,this._styles.concat(n))}}}),e}(),g=p(function(){},f);p(t.prototype,o()),n.exports=new t,n.exports.styles=s,n.exports.hasColor=c,n.exports.stripColor=i,n.exports.supportsColor=d}).call(this,e("_process"))},{_process:148,"ansi-styles":166,"escape-string-regexp":167,"has-ansi":168,"strip-ansi":170,"supports-color":172}],166:[function(e,n){"use strict";var l=n.exports={modifiers:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},colors:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39]},bgColors:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49]}};l.colors.grey=l.colors.gray,Object.keys(l).forEach(function(e){var n=l[e];Object.keys(n).forEach(function(e){var t=n[e];l[e]=n[e]={open:"["+t[0]+"m",close:"["+t[1]+"m"}}),Object.defineProperty(l,e,{value:n,enumerable:!1})})},{}],167:[function(e,n){"use strict";var l=/[|\\{}()[\]^$+*?.]/g;n.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(l,"\\$&")}},{}],168:[function(e,n){"use strict";var l=e("ansi-regex"),t=new RegExp(l().source);n.exports=t.test.bind(t)},{"ansi-regex":169}],169:[function(e,n){"use strict";n.exports=function(){return/(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/g}},{}],170:[function(e,n){"use strict";var l=e("ansi-regex")();n.exports=function(e){return"string"==typeof e?e.replace(l,""):e}},{"ansi-regex":171}],171:[function(e,n,l){arguments[4][169][0].apply(l,arguments)},{dup:169}],172:[function(e,n){(function(e){"use strict";var l=e.argv;n.exports=function(){return"FORCE_COLOR"in e.env?!0:-1!==l.indexOf("--no-color")||-1!==l.indexOf("--no-colors")||-1!==l.indexOf("--color=false")?!1:-1!==l.indexOf("--color")||-1!==l.indexOf("--colors")||-1!==l.indexOf("--color=true")||-1!==l.indexOf("--color=always")?!0:e.stdout&&!e.stdout.isTTY?!1:"UPSTART_JOB"in e.env?!1:"win32"===e.platform?!0:"COLORTERM"in e.env?!0:"dumb"===e.env.TERM?!1:/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(e.env.TERM)?!0:!1}()}).call(this,e("_process"))},{_process:148}],173:[function(e,n){!function(e,l,t){"use strict";function r(e){return null!==e&&("object"==typeof e||"function"==typeof e)}function a(e){return"function"==typeof e}function o(e,n,l){e&&!bl(e=l?e:e[_n],Ul)&&Dl(e,Ul,n)}function u(e){return ul.call(e).slice(8,-1)}function s(e){var n,l;return e==t?e===t?"Undefined":"Null":"string"==typeof(l=(n=Ln(e))[Ul])?l:u(n)}function i(){for(var e=T(this),n=arguments.length,l=Pn(n),t=0,r=Wl._,a=!1;n>t;)(l[t]=arguments[t++])===r&&(a=!0);return function(){var t,o=this,u=arguments.length,s=0,i=0;if(!a&&!u)return d(e,l,o);if(t=l.slice(),a)for(;n>s;s++)t[s]===r&&(t[s]=arguments[i++]);for(;u>i;)t.push(arguments[i++]);return d(e,t,o)}}function c(e,n,l){if(T(e),~l&&n===t)return e;switch(l){case 1:return function(l){return e.call(n,l)};case 2:return function(l,t){return e.call(n,l,t)};case 3:return function(l,t,r){return e.call(n,l,t,r)}}return function(){return e.apply(n,arguments)}}function d(e,n,l){var r=l===t;switch(0|n.length){case 0:return r?e():e.call(l);case 1:return r?e(n[0]):e.call(l,n[0]);case 2:return r?e(n[0],n[1]):e.call(l,n[0],n[1]);case 3:return r?e(n[0],n[1],n[2]):e.call(l,n[0],n[1],n[2]);case 4:return r?e(n[0],n[1],n[2],n[3]):e.call(l,n[0],n[1],n[2],n[3]);case 5:return r?e(n[0],n[1],n[2],n[3],n[4]):e.call(l,n[0],n[1],n[2],n[3],n[4])}return e.apply(l,n)}function p(e){return _l(j(e))}function f(e){return e}function g(){return this
}function h(e,n){return bl(e,n)?e[n]:void 0}function m(e){return L(e),yl?ml(e).concat(yl(e)):ml(e)}function y(e,n){for(var l,t=p(e),r=hl(t),a=r.length,o=0;a>o;)if(t[l=r[o++]]===n)return l}function x(e){return On(e).split(",")}function b(e){var n=1==e,l=2==e,r=3==e,a=4==e,o=6==e,u=5==e||o;return function(s){for(var i,d,p=Ln(j(this)),f=arguments[1],g=_l(p),h=c(s,f,3),m=k(g.length),y=0,x=n?Pn(m):l?[]:t;m>y;y++)if((u||y in g)&&(i=g[y],d=h(i,y,p),e))if(n)x[y]=d;else if(d)switch(e){case 3:return!0;case 5:return i;case 6:return y;case 2:x.push(i)}else if(a)return!1;return o?-1:r||a?a:x}}function _(e){return function(n){var l=p(this),t=k(l.length),r=w(arguments[1],t);if(e&&n!=n){for(;t>r;r++)if(I(l[r]))return e||r}else for(;t>r;r++)if((e||r in l)&&l[r]===n)return e||r;return!e&&-1}}function v(e,n){return"function"==typeof e?e:n}function I(e){return e!=e}function E(e){return isNaN(e)?0:Ll(e)}function k(e){return e>0?jl(E(e),kl):0}function w(e,n){var e=E(e);return 0>e?Al(e+n,0):jl(e,n)}function R(e){return e>9?e:"0"+e}function S(e,n,l){var t=r(n)?function(e){return n[e]}:n;return function(n){return On(l?n:this).replace(e,t)}}function C(e){return function(n){var l,r,a=On(j(this)),o=E(n),u=a.length;return 0>o||o>=u?e?"":t:(l=a.charCodeAt(o),55296>l||l>56319||o+1===u||(r=a.charCodeAt(o+1))<56320||r>57343?e?a.charAt(o):l:e?a.slice(o,o+2):(l-55296<<10)+(r-56320)+65536)}}function A(e,n,l){if(!e)throw qn(l?n+l:n)}function j(e){if(e==t)throw qn("Function called on null or undefined");return e}function T(e){return A(a(e),e," is not a function!"),e}function L(e){return A(r(e),e," is not an object!"),e}function P(e,n,l){A(e instanceof n,l,": use the 'new' operator!")}function O(e,n){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:n}}function M(e,n,l){return e[n]=l,e}function D(e){return Ol?function(n,l,t){return fl(n,l,O(e,t))}:M}function B(e){return mn+"("+e+")_"+(++Ml+Tl())[In](36)}function N(e,n){return Vn&&Vn[e]||(n?Vn:Nl)(mn+al+e)}function F(e,n){for(var l in n)Dl(e,l,n[l]);return e}function V(e){!Ol||!l&&ol(e)||fl(e,ql,{configurable:!0,get:g})}function U(n,t,r){var o,u,s,i,d=n&Yl,p=d?e:n&zl?e[t]:(e[t]||ll)[_n],f=d?Hl:Hl[t]||(Hl[t]={});d&&(r=t);for(o in r)u=!(n&Jl)&&p&&o in p&&(!a(p[o])||ol(p[o])),s=(u?p:r)[o],l||!d||a(p[o])?n&Kl&&u?i=c(s,e):n&Ql&&!l&&p[o]==s?(i=function(e){return this instanceof s?new s(e):s(e)},i[_n]=s[_n]):i=n&$l&&a(s)?c(sl,s):s:i=r[o],l&&p&&!u&&(d?p[o]=s:delete p[o]&&Dl(p,o,s)),f[o]!=s&&Dl(f,o,i)}function q(e,n){Dl(e,ln,n),Cn in nl&&Dl(e,Cn,n)}function G(e,n,l,t){e[_n]=cl(t||tt,{next:O(1,l)}),o(e,n+" Iterator")}function H(e,n,t,r){var a=e[_n],u=h(a,ln)||h(a,Cn)||r&&h(a,r)||t;if(l&&(q(a,u),u!==t)){var s=dl(u.call(new e));o(s,n+" Iterator",!0),bl(a,Cn)&&q(s,g)}return lt[n]=u,lt[n+" Iterator"]=g,u}function W(e,n,l,t,r,a){function o(e){return function(){return new l(this,e)}}G(l,n,t);var u=o(et+nt),s=o(nt);r==nt?s=H(e,n,s,"values"):u=H(e,n,u,"entries"),r&&U($l+Jl*rt,n,{entries:u,keys:a?s:o(et),values:s})}function X(e,n){return{value:n,done:!!e}}function J(n){var l=Ln(n),t=e[mn],r=(t&&t[Sn]||Cn)in l;return r||ln in l||bl(lt,s(l))}function Y(n){var l=e[mn],t=n[l&&l[Sn]||Cn],r=t||n[ln]||lt[s(n)];return L(r.call(n))}function z(e,n,l){return l?d(e,n):e(n)}function $(e){var n=!0,l={next:function(){throw 1},"return":function(){n=!1}};l[ln]=g;try{e(l)}catch(t){}return n}function K(e){var n=e["return"];n!==t&&n.call(e)}function Q(e,n){try{e(n)}catch(l){throw K(n),l}}function Z(e,n,l,t){Q(function(e){for(var r,a=c(l,t,n?2:1);!(r=e.next()).done;)if(z(a,r.value,n)===!1)return K(e)},Y(e))}var en,nn,ln,tn,rn="Object",an="Function",on="Array",un="String",sn="Number",cn="RegExp",dn="Date",pn="Map",fn="Set",gn="WeakMap",hn="WeakSet",mn="Symbol",yn="Promise",xn="Math",bn="Arguments",_n="prototype",vn="constructor",In="toString",En=In+"Tag",kn="toLocaleString",wn="hasOwnProperty",Rn="forEach",Sn="iterator",Cn="@@"+Sn,An="process",jn="createElement",Tn=e[an],Ln=e[rn],Pn=e[on],On=e[un],Mn=e[sn],Dn=(e[cn],e[dn],e[pn]),Bn=e[fn],Nn=e[gn],Fn=e[hn],Vn=e[mn],Un=e[xn],qn=e.TypeError,Gn=e.RangeError,Hn=e.setTimeout,Wn=e.setImmediate,Xn=e.clearImmediate,Jn=e.parseInt,Yn=e.isFinite,zn=e[An],$n=zn&&zn.nextTick,Kn=e.document,Qn=Kn&&Kn.documentElement,Zn=(e.navigator,e.define),el=e.console||{},nl=Pn[_n],ll=Ln[_n],tl=Tn[_n],rl=1/0,al=".",ol=c(/./.test,/\[native code\]\s*\}\s*$/,1),ul=ll[In],sl=tl.call,il=tl.apply,cl=Ln.create,dl=Ln.getPrototypeOf,pl=Ln.setPrototypeOf,fl=Ln.defineProperty,gl=(Ln.defineProperties,Ln.getOwnPropertyDescriptor),hl=Ln.keys,ml=Ln.getOwnPropertyNames,yl=Ln.getOwnPropertySymbols,xl=Ln.isFrozen,bl=c(sl,ll[wn],2),_l=Ln,vl=Ln.assign||function(e){for(var n=Ln(j(e)),l=arguments.length,t=1;l>t;)for(var r,a=_l(arguments[t++]),o=hl(a),u=o.length,s=0;u>s;)n[r=o[s++]]=a[r];return n},Il=nl.push,El=(nl.unshift,nl.slice,nl.splice,nl.indexOf,nl[Rn]),kl=9007199254740991,wl=Un.pow,Rl=Un.abs,Sl=Un.ceil,Cl=Un.floor,Al=Un.max,jl=Un.min,Tl=Un.random,Ll=Un.trunc||function(e){return(e>0?Cl:Sl)(e)},Pl="Reduce of empty object with no initial value",Ol=!!function(){try{return 2==fl({},"a",{get:function(){return 2}}).a}catch(e){}}(),Ml=0,Dl=D(1),Bl=Vn?M:Dl,Nl=Vn||B,Fl=N("unscopables"),Vl=nl[Fl]||{},Ul=N(En),ql=N("species"),Gl=u(zn)==An,Hl={},Wl=l?e:Hl,Xl=e.core,Jl=1,Yl=2,zl=4,$l=8,Kl=16,Ql=32;"undefined"!=typeof n&&n.exports?n.exports=Hl:a(Zn)&&Zn.amd?Zn(function(){return Hl}):tn=!0,(tn||l)&&(Hl.noConflict=function(){return e.core=Xl,Hl},e.core=Hl),ln=N(Sn);var Zl=Nl("iter"),et=1,nt=2,lt={},tt={},rt="keys"in nl&&!("next"in[].keys());q(tt,g),!function(n,l,t,r){ol(Vn)||(Vn=function(e){A(!(this instanceof Vn),mn+" is not a "+vn);var l=B(e),a=Bl(cl(Vn[_n]),n,l);return t[l]=a,Ol&&r&&fl(ll,l,{configurable:!0,set:function(e){Dl(this,l,e)}}),a},Dl(Vn[_n],In,function(){return this[n]})),U(Yl+Ql,{Symbol:Vn});var a={"for":function(e){return bl(l,e+="")?l[e]:l[e]=Vn(e)},iterator:ln||N(Sn),keyFor:i.call(y,l),species:ql,toStringTag:Ul=N(En,!0),unscopables:Fl,pure:Nl,set:Bl,useSetter:function(){r=!0},useSimple:function(){r=!1}};El.call(x("hasInstance,isConcatSpreadable,match,replace,search,split,toPrimitive"),function(e){a[e]=N(e)}),U(zl,mn,a),o(Vn,mn),U(zl+Jl*!ol(Vn),rn,{getOwnPropertyNames:function(e){for(var n,l=ml(p(e)),r=[],a=0;l.length>a;)bl(t,n=l[a++])||r.push(n);return r},getOwnPropertySymbols:function(e){for(var n,l=ml(p(e)),r=[],a=0;l.length>a;)bl(t,n=l[a++])&&r.push(t[n]);return r}}),o(Un,xn,!0),o(e.JSON,"JSON",!0)}(Nl("tag"),{},{},!0),!function(){var e={assign:vl,is:function(e,n){return e===n?0!==e||1/e===1/n:e!=e&&n!=n}};"__proto__"in ll&&function(n,l){try{l=c(sl,gl(ll,"__proto__").set,2),l({},nl)}catch(t){n=!0}e.setPrototypeOf=pl=pl||function(e,t){return L(e),A(null===t||r(t),t,": can't set as prototype!"),n?e.__proto__=t:l(e,t),e}}(),U(zl,rn,e)}(),!function(){function e(e,n){var l=Ln[e],t=Hl[rn][e],a=0,o={};if(!t||ol(t)){o[e]=1==n?function(e){return r(e)?l(e):e}:2==n?function(e){return r(e)?l(e):!0}:3==n?function(e){return r(e)?l(e):!1}:4==n?function(e,n){return l(p(e),n)}:function(e){return l(p(e))};try{l(al)}catch(u){a=1}U(zl+Jl*a,rn,o)}}e("freeze",1),e("seal",1),e("preventExtensions",1),e("isFrozen",2),e("isSealed",2),e("isExtensible",3),e("getOwnPropertyDescriptor",4),e("getPrototypeOf"),e("keys"),e("getOwnPropertyNames")}(),!function(e){U(zl,sn,{EPSILON:wl(2,-52),isFinite:function(e){return"number"==typeof e&&Yn(e)},isInteger:e,isNaN:I,isSafeInteger:function(n){return e(n)&&Rl(n)<=kl},MAX_SAFE_INTEGER:kl,MIN_SAFE_INTEGER:-kl,parseFloat:parseFloat,parseInt:Jn})}(Mn.isInteger||function(e){return!r(e)&&Yn(e)&&Cl(e)===e}),!function(){function e(n){return Yn(n=+n)&&0!=n?0>n?-e(-n):r(n+a(n*n+1)):n}function n(e){return 0==(e=+e)?e:e>-1e-6&&1e-6>e?e+e*e/2:t(e)-1}var l=Un.E,t=Un.exp,r=Un.log,a=Un.sqrt,o=Un.sign||function(e){return 0==(e=+e)||e!=e?e:0>e?-1:1};U(zl,xn,{acosh:function(e){return(e=+e)<1?0/0:Yn(e)?r(e/l+a(e+1)*a(e-1)/l)+1:e},asinh:e,atanh:function(e){return 0==(e=+e)?e:r((1+e)/(1-e))/2},cbrt:function(e){return o(e=+e)*wl(Rl(e),1/3)},clz32:function(e){return(e>>>=0)?32-e[In](2).length:32},cosh:function(e){return(t(e=+e)+t(-e))/2},expm1:n,fround:function(e){return new Float32Array([e])[0]},hypot:function(){for(var e,n=0,l=arguments.length,t=l,r=Pn(l),o=-rl;l--;){if(e=r[l]=+arguments[l],e==rl||e==-rl)return rl;e>o&&(o=e)}for(o=e||1;t--;)n+=wl(r[t]/o,2);return o*a(n)},imul:function(e,n){var l=65535,t=+e,r=+n,a=l&t,o=l&r;return 0|a*o+((l&t>>>16)*o+a*(l&r>>>16)<<16>>>0)},log1p:function(e){return(e=+e)>-1e-8&&1e-8>e?e-e*e/2:r(1+e)},log10:function(e){return r(e)/Un.LN10},log2:function(e){return r(e)/Un.LN2},sign:o,sinh:function(e){return Rl(e=+e)<1?(n(e)-n(-e))/2:(t(e-1)-t(-e-1))*(l/2)},tanh:function(e){var l=n(e=+e),r=n(-e);return l==rl?1:r==rl?-1:(l-r)/(t(e)+t(-e))},trunc:Ll})}(),!function(e){function n(e){if(u(e)==cn)throw qn()}U(zl,un,{fromCodePoint:function(){for(var n,l=[],t=arguments.length,r=0;t>r;){if(n=+arguments[r++],w(n,1114111)!==n)throw Gn(n+" is not a valid code point");l.push(65536>n?e(n):e(((n-=65536)>>10)+55296,n%1024+56320))}return l.join("")},raw:function(e){for(var n=p(e.raw),l=k(n.length),t=arguments.length,r=[],a=0;l>a;)r.push(On(n[a++])),t>a&&r.push(On(arguments[a]));return r.join("")}}),U($l,un,{codePointAt:C(!1),endsWith:function(e){n(e);var l=On(j(this)),r=arguments[1],a=k(l.length),o=r===t?a:jl(k(r),a);return e+="",l.slice(o-e.length,o)===e},includes:function(e){return n(e),!!~On(j(this)).indexOf(e,arguments[1])},repeat:function(e){var n=On(j(this)),l="",t=E(e);if(0>t||t==rl)throw Gn("Count can't be negative");for(;t>0;(t>>>=1)&&(n+=n))1&t&&(l+=n);return l},startsWith:function(e){n(e);var l=On(j(this)),t=k(jl(arguments[1],l.length));return e+="",l.slice(t,t+e.length)===e}})}(On.fromCharCode),!function(){U(zl+Jl*$(Pn.from),on,{from:function(e){var n,l,r,a=Ln(j(e)),o=arguments[1],u=o!==t,s=u?c(o,arguments[2],2):t,i=0;if(J(a))l=new(v(this,Pn)),Q(function(e){for(;!(r=e.next()).done;i++)l[i]=u?s(r.value,i):r.value},Y(a));else for(l=new(v(this,Pn))(n=k(a.length));n>i;i++)l[i]=u?s(a[i],i):a[i];return l.length=i,l}}),U(zl,on,{of:function(){for(var e=0,n=arguments.length,l=new(v(this,Pn))(n);n>e;)l[e]=arguments[e++];return l.length=n,l}}),V(Pn)}(),!function(){U($l,on,{copyWithin:function(e,n){var l=Ln(j(this)),r=k(l.length),a=w(e,r),o=w(n,r),u=arguments[2],s=u===t?r:w(u,r),i=jl(s-o,r-a),c=1;for(a>o&&o+i>a&&(c=-1,o=o+i-1,a=a+i-1);i-->0;)o in l?l[a]=l[o]:delete l[a],a+=c,o+=c;return l},fill:function(e){for(var n=Ln(j(this)),l=k(n.length),r=w(arguments[1],l),a=arguments[2],o=a===t?l:w(a,l);o>r;)n[r++]=e;return n},find:b(5),findIndex:b(6)}),l&&(El.call(x("find,findIndex,fill,copyWithin,entries,keys,values"),function(e){Vl[e]=!0}),Fl in nl||Dl(nl,Fl,Vl))}(),!function(e){W(Pn,on,function(e,n){Bl(this,Zl,{o:p(e),i:0,k:n})},function(){var e=this[Zl],n=e.o,l=e.k,r=e.i++;return!n||r>=n.length?(e.o=t,X(1)):l==et?X(0,r):l==nt?X(0,n[r]):X(0,[r,n[r]])},nt),lt[bn]=lt[on],W(On,un,function(e){Bl(this,Zl,{o:On(e),i:0})},function(){var n,l=this[Zl],t=l.o,r=l.i;return r>=t.length?X(1):(n=e.call(t,r),l.i+=n.length,X(0,n))})}(C(!0)),a(Wn)&&a(Xn)||function(n){function l(e){if(bl(h,e)){var n=h[e];delete h[e],n()}}function t(e){l(e.data)}var r,o,u,s=e.postMessage,p=e.addEventListener,f=e.MessageChannel,g=0,h={};Wn=function(e){for(var n=[],l=1;arguments.length>l;)n.push(arguments[l++]);return h[++g]=function(){d(a(e)?e:Tn(e),n)},r(g),g},Xn=function(e){delete h[e]},Gl?r=function(e){$n(i.call(l,e))}:p&&a(s)&&!e.importScripts?(r=function(e){s(e,"*")},p("message",t,!1)):a(f)?(o=new f,u=o.port2,o.port1.onmessage=t,r=c(u.postMessage,u,1)):r=Kn&&n in Kn[jn]("script")?function(e){Qn.appendChild(Kn[jn]("script"))[n]=function(){Qn.removeChild(this),l(e)}}:function(e){Hn(l,0,e)}}("onreadystatechange"),U(Yl+Kl,{setImmediate:Wn,clearImmediate:Xn}),!function(e,n){a(e)&&a(e.resolve)&&e.resolve(n=new e(function(){}))==n||function(n,l){function o(e){var n;return r(e)&&(n=e.then),a(n)?n:!1}function u(e){var n,t=e[l],r=t.c,a=0;if(t.h)return!0;for(;r.length>a;)if(n=r[a++],n.fail||u(n.P))return!0}function s(e,l){var t=e.c;(l||t.length)&&n(function(){var n=e.p,r=e.v,s=1==e.s,i=0;if(l&&!u(n))Hn(function(){u(n)||(Gl?!zn.emit("unhandledRejection",r,n):a(el.error)&&el.error("Unhandled promise rejection",r))},1e3);else for(;t.length>i;)!function(n){var l,t,a=s?n.ok:n.fail;try{a?(s||(e.h=!0),l=a===!0?r:a(r),l===n.P?n.rej(qn(yn+"-chain cycle")):(t=o(l))?t.call(l,n.res,n.rej):n.res(l)):n.rej(r)}catch(u){n.rej(u)}}(t[i++]);t.length=0})}function i(e){var n,l,t=this;if(!t.d){t.d=!0,t=t.r||t;try{(n=o(e))?(l={r:t,d:!1},n.call(e,c(i,l,1),c(d,l,1))):(t.v=e,t.s=1,s(t))}catch(r){d.call(l||{r:t,d:!1},r)}}}function d(e){var n=this;n.d||(n.d=!0,n=n.r||n,n.v=e,n.s=2,s(n,!0))}function p(e){var n=L(e)[ql];return n!=t?n:e}e=function(n){T(n),P(this,e,yn);var r={p:this,c:[],s:0,d:!1,v:t,h:!1};Dl(this,l,r);try{n(c(i,r,1),c(d,r,1))}catch(a){d.call(r,a)}},F(e[_n],{then:function(n,r){var o=L(L(this)[vn])[ql],u={ok:a(n)?n:!0,fail:a(r)?r:!1},i=u.P=new(o!=t?o:e)(function(e,n){u.res=T(e),u.rej=T(n)}),c=this[l];return c.c.push(u),c.s&&s(c),i},"catch":function(e){return this.then(t,e)}}),F(e,{all:function(e){var n=p(this),l=[];return new n(function(t,r){Z(e,!1,Il,l);var a=l.length,o=Pn(a);a?El.call(l,function(e,l){n.resolve(e).then(function(e){o[l]=e,--a||t(o)},r)}):t(o)})},race:function(e){var n=p(this);return new n(function(l,t){Z(e,!1,function(e){n.resolve(e).then(l,t)})})},reject:function(e){return new(p(this))(function(n,l){l(e)})},resolve:function(e){return r(e)&&l in e&&dl(e)===this[_n]?e:new(p(this))(function(n){n(e)})}})}($n||Wn,Nl("record")),o(e,yn),V(e),U(Yl+Jl*!ol(e),{Promise:e})}(e[yn]),!function(){function e(e,n,r,a,u,s){function i(e,n){return n!=t&&Z(n,u,e[f],e),e}function c(e,n){var t=g[e];l&&(g[e]=function(e,l){var r=t.call(this,0===e?0:e,l);return n?this:r})}var f=u?"set":"add",g=e&&e[_n],x={};if(ol(e)&&(s||!rt&&bl(g,Rn)&&bl(g,"entries"))){var _,v=e,I=new e,E=I[f](s?{}:-0,1);$(function(n){new e(n)})&&(e=function(l){return P(this,e,n),i(new v,l)},e[_n]=g,l&&(g[vn]=e)),s||I[Rn](function(e,n){_=1/n===-rl}),_&&(c("delete"),c("has"),u&&c("get")),(_||E!==I)&&c(f,!0)}else e=s?function(l){P(this,e,n),Bl(this,d,b++),i(this,l)}:function(l){var r=this;P(r,e,n),Bl(r,p,cl(null)),Bl(r,y,0),Bl(r,h,t),Bl(r,m,t),i(r,l)},F(F(e[_n],r),a),s||!Ol||fl(e[_n],"size",{get:function(){return j(this[y])}});return o(e,n),V(e),x[n]=e,U(Yl+Ql+Jl*!ol(e),x),s||W(e,n,function(e,n){Bl(this,Zl,{o:e,k:n})},function(){for(var e=this[Zl],n=e.k,l=e.l;l&&l.r;)l=l.p;return e.o&&(e.l=l=l?l.n:e.o[m])?n==et?X(0,l.k):n==nt?X(0,l.v):X(0,[l.k,l.v]):(e.o=t,X(1))},u?et+nt:nt,!u),e}function n(e,n){if(!r(e))return("string"==typeof e?"S":"P")+e;if(xl(e))return"F";if(!bl(e,d)){if(!n)return"E";Dl(e,d,++b)}return"O"+e[d]}function a(e,l){var t,r=n(l);if("F"!=r)return e[p][r];for(t=e[m];t;t=t.n)if(t.k==l)return t}function u(e,l,r){var o,u,s=a(e,l);return s?s.v=r:(e[h]=s={i:u=n(l,!0),k:l,v:r,p:o=e[h],n:t,r:!1},e[m]||(e[m]=s),o&&(o.n=s),e[y]++,"F"!=u&&(e[p][u]=s)),e}function s(e,n,l){return xl(L(n))?i(e).set(n,l):(bl(n,f)||Dl(n,f,{}),n[f][e[d]]=l),e}function i(e){return e[g]||Dl(e,g,new Dn)[g]}var d=Nl("uid"),p=Nl("O1"),f=Nl("weak"),g=Nl("leak"),h=Nl("last"),m=Nl("first"),y=Ol?Nl("size"):"size",b=0,_={},v={clear:function(){for(var e=this,n=e[p],l=e[m];l;l=l.n)l.r=!0,l.p&&(l.p=l.p.n=t),delete n[l.i];e[m]=e[h]=t,e[y]=0},"delete":function(e){var n=this,l=a(n,e);if(l){var t=l.n,r=l.p;delete n[p][l.i],l.r=!0,r&&(r.n=t),t&&(t.p=r),n[m]==l&&(n[m]=t),n[h]==l&&(n[h]=r),n[y]--}return!!l},forEach:function(e){for(var n,l=c(e,arguments[1],3);n=n?n.n:this[m];)for(l(n.v,n.k,this);n&&n.r;)n=n.p},has:function(e){return!!a(this,e)}};Dn=e(Dn,pn,{get:function(e){var n=a(this,e);return n&&n.v},set:function(e,n){return u(this,0===e?0:e,n)}},v,!0),Bn=e(Bn,fn,{add:function(e){return u(this,e=0===e?0:e,e)}},v);var I={"delete":function(e){return r(e)?xl(e)?i(this)["delete"](e):bl(e,f)&&bl(e[f],this[d])&&delete e[f][this[d]]:!1},has:function(e){return r(e)?xl(e)?i(this).has(e):bl(e,f)&&bl(e[f],this[d]):!1}};Nn=e(Nn,gn,{get:function(e){if(r(e)){if(xl(e))return i(this).get(e);if(bl(e,f))return e[f][this[d]]}},set:function(e,n){return s(this,e,n)}},I,!0,!0),l&&7!=(new Nn).set(Ln.freeze(_),7).get(_)&&El.call(x("delete,has,get,set"),function(e){var n=Nn[_n][e];Nn[_n][e]=function(l,t){if(r(l)&&xl(l)){var a=i(this)[e](l,t);return"set"==e?this:a}return n.call(this,l,t)}}),Fn=e(Fn,hn,{add:function(e){return s(this,e,!0)}},I,!1,!0)}(),!function(){function e(e){var n,l=[];for(n in e)l.push(n);Bl(this,Zl,{o:e,a:l,i:0})}function n(e){return function(n){L(n);try{return e.apply(t,arguments),!0}catch(l){return!1}}}function l(e,n){var a,o=arguments.length<3?e:arguments[2],u=gl(L(e),n);return u?bl(u,"value")?u.value:u.get===t?t:u.get.call(o):r(a=dl(e))?l(a,n,o):t}function a(e,n,l){var o,u,s=arguments.length<4?e:arguments[3],i=gl(L(e),n);if(!i){if(r(u=dl(e)))return a(u,n,l,s);i=O(0)}return bl(i,"value")?i.writable!==!1&&r(s)?(o=gl(s,n)||O(0),o.value=l,fl(s,n,o),!0):!1:i.set===t?!1:(i.set.call(s,l),!0)}G(e,rn,function(){var e,n=this[Zl],l=n.a;do if(n.i>=l.length)return X(1);while(!((e=l[n.i++])in n.o));return X(0,e)});var o=Ln.isExtensible||f,u={apply:c(sl,il,3),construct:function(e,n){var l=T(arguments.length<3?e:arguments[2])[_n],t=cl(r(l)?l:ll),a=il.call(e,t,n);return r(a)?a:t},defineProperty:n(fl),deleteProperty:function(e,n){var l=gl(L(e),n);return l&&!l.configurable?!1:delete e[n]},enumerate:function(n){return new e(L(n))},get:l,getOwnPropertyDescriptor:function(e,n){return gl(L(e),n)},getPrototypeOf:function(e){return dl(L(e))},has:function(e,n){return n in e},isExtensible:function(e){return!!o(L(e))},ownKeys:m,preventExtensions:n(Ln.preventExtensions||f),set:a};pl&&(u.setPrototypeOf=function(e,n){return pl(L(e),n),!0}),U(Yl,{Reflect:{}}),U(zl,"Reflect",u)}(),!function(){function e(e){return function(n){var l,t=p(n),r=hl(n),a=r.length,o=0,u=Pn(a);if(e)for(;a>o;)u[o]=[l=r[o++],t[l]];else for(;a>o;)u[o]=t[r[o++]];return u}}U($l,on,{includes:_(!0)}),U($l,un,{at:C(!0)}),U(zl,rn,{getOwnPropertyDescriptors:function(e){var n=p(e),l={};return El.call(m(n),function(e){fl(l,e,O(0,gl(n,e)))}),l},values:e(!1),entries:e(!0)}),U(zl,cn,{escape:S(/([\\\-[\]{}()*+?.,^$|])/g,"\\$1",!0)})}(),!function(e){function n(e){if(e){var n=e[_n];Dl(n,en,n.get),Dl(n,l,n.set),Dl(n,t,n["delete"])}}en=N(e+"Get",!0);var l=N(e+fn,!0),t=N(e+"Delete",!0);U(zl,mn,{referenceGet:en,referenceSet:l,referenceDelete:t}),Dl(tl,en,g),n(Dn),n(Nn)}("reference"),!function(e){function n(e,n){Bl(this,Zl,{o:p(e),a:hl(e),i:0,k:n})}function l(e){return function(l){return new n(l,e)}}function a(e){var n=1==e,l=4==e;return function(r,a,o){var u,s,i,d=c(a,o,3),f=p(r),g=n||7==e||2==e?new(v(this,nn)):t;for(u in f)if(bl(f,u)&&(s=f[u],i=d(s,u,r),e))if(n)g[u]=i;else if(i)switch(e){case 2:g[u]=s;break;case 3:return!0;case 5:return s;case 6:return u;case 7:g[i[0]]=i[1]}else if(l)return!1;return 3==e||l?l:g}}function o(e){return function(n,l,r){T(l);var a,o,u,s=p(n),i=hl(s),c=i.length,d=0;for(e?a=r==t?new(v(this,nn)):Ln(r):arguments.length<3?(A(c,Pl),a=s[i[d++]]):a=Ln(r);c>d;)if(bl(s,o=i[d++]))if(u=l(a,s[o],o,n),e){if(u===!1)break}else a=u;return a}}function u(e,n){return(n==n?y(e,n):s(e,I))!==t}nn=function(e){var n=cl(null);return e!=t&&(J(e)?Z(e,!0,function(e,l){n[e]=l}):vl(n,e)),n},nn[_n]=null,G(n,e,function(){var e,n=this[Zl],l=n.o,r=n.a,a=n.k;do if(n.i>=r.length)return n.o=t,X(1);while(!bl(l,e=r[n.i++]));return a==et?X(0,e):a==nt?X(0,l[e]):X(0,[e,l[e]])});var s=a(6),i={keys:l(et),values:l(nt),entries:l(et+nt),forEach:a(0),map:a(1),filter:a(2),some:a(3),every:a(4),find:a(5),findKey:s,mapPairs:a(7),reduce:o(!1),turn:o(!0),keyOf:y,includes:u,has:bl,get:h,set:D(0),isDict:function(e){return r(e)&&dl(e)===nn[_n]}};if(en)for(var f in i)!function(e){function n(){for(var n=[this],l=0;l<arguments.length;)n.push(arguments[l++]);return d(e,n)}e[en]=function(){return n}}(i[f]);U(Yl+Jl,{Dict:F(nn,i)})}("Dict"),!function(e,n){function l(n,t){return this instanceof l?(this[Zl]=Y(n),void(this[e]=!!t)):new l(n,t)}function r(l){function t(l,t,r){this[Zl]=Y(l),this[e]=l[e],this[n]=c(t,r,l[e]?2:1)}return G(t,"Chain",l,a),q(t[_n],g),t}G(l,"Wrapper",function(){return this[Zl].next()});var a=l[_n];q(a,function(){return this[Zl]});var o=r(function(){var l=this[Zl].next();return l.done?l:X(0,z(this[n],l.value,this[e]))}),u=r(function(){for(;;){var l=this[Zl].next();if(l.done||z(this[n],l.value,this[e]))return l}});F(a,{of:function(n,l){Z(this,this[e],n,l)},array:function(e,n){var l=[];return Z(e!=t?this.map(e,n):this,!1,Il,l),l},filter:function(e,n){return new u(this,e,n)},map:function(e,n){return new o(this,e,n)}}),l.isIterable=J,l.getIterator=Y,U(Yl+Jl,{$for:l})}("entries",Nl("fn")),U(Yl+Jl,{delay:function(e){return new Promise(function(n){Hn(n,e,!0)})}}),!function(e,n){function l(l){var r=this,a={};return Dl(r,e,function(e){return e!==t&&e in r?bl(a,e)?a[e]:a[e]=c(r[e],r,-1):n.call(r)})[e](l)}Hl._=Wl._=Wl._||{},U($l+Jl,an,{part:i,only:function(e,n){var l=T(this),t=k(e),r=arguments.length>1;return function(){for(var e=jl(t,arguments.length),a=Pn(e),o=0;e>o;)a[o]=arguments[o++];return d(l,a,r?n:this)}}}),Dl(Wl._,In,function(){return e}),Dl(ll,e,l),Ol||Dl(nl,e,l)}(Ol?B("tie"):kn,ll[kn]),!function(){function e(e,n){for(var l,t=m(p(n)),r=t.length,a=0;r>a;)fl(e,l=t[a++],gl(n,l));return e}U(zl+Jl,rn,{isObject:r,classof:s,define:e,make:function(n,l){return e(cl(n),l)}})}(),U($l+Jl,on,{turn:function(e,n){T(e);for(var l=n==t?[]:Ln(n),r=_l(this),a=k(r.length),o=0;a>o&&e(l,r[o],o++,this)!==!1;);return l}}),l&&(Vl.turn=!0),!function(e){function n(e){Bl(this,Zl,{l:k(e),i:0})}G(n,sn,function(){var e=this[Zl],n=e.i++;return n<e.l?X(0,n):X(1)}),H(Mn,sn,function(){return new n(this)}),e.random=function(e){var n=+this,l=e==t?0:+e,r=jl(n,l);return Tl()*(Al(n,l)-r)+r},El.call(x("round,floor,ceil,abs,sin,asin,cos,acos,tan,atan,exp,sqrt,max,min,pow,atan2,acosh,asinh,atanh,cbrt,clz32,cosh,expm1,hypot,imul,log1p,log10,log2,sign,sinh,tanh,trunc"),function(n){var l=Un[n];l&&(e[n]=function(){for(var e=[+this],n=0;arguments.length>n;)e.push(arguments[n++]);return d(l,e)})}),U($l+Jl,sn,e)}({}),!function(){var e,n={"&":"&","<":"<",">":">",'"':""","'":"'"},l={};for(e in n)l[n[e]]=e;U($l+Jl,un,{escapeHTML:S(/[&<>"']/g,n),unescapeHTML:S(/&(?:amp|lt|gt|quot|apos);/g,l)})}(),!function(e,n,l,t,r,a,o,u,s){function i(n){return function(i,c){function d(e){return p[n+e]()}var p=this,f=l[bl(l,c)?c:t];return On(i).replace(e,function(e){switch(e){case"s":return d(r);case"ss":return R(d(r));case"m":return d(a);case"mm":return R(d(a));case"h":return d(o);case"hh":return R(d(o));case"D":return d(dn);case"DD":return R(d(dn));case"W":return f[0][d("Day")];case"N":return d(u)+1;case"NN":return R(d(u)+1);case"M":return f[2][d(u)];case"MM":return f[1][d(u)];case"Y":return d(s);case"YY":return R(d(s)%100)}return e})}}function c(e,t){function r(e){var l=[];return El.call(x(t.months),function(t){l.push(t.replace(n,"$"+e))}),l}return l[e]=[x(t.weekdays),r(1),r(2)],Hl}U($l+Jl,dn,{format:i("get"),formatUTC:i("getUTC")}),c(t,{weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",months:"January,February,March,April,May,June,July,August,September,October,November,December"}),c("ru",{weekdays:"Воскресенье,Понедельник,Вторник,Среда,Четверг,Пятница,Суббота",months:"Январ:я|ь,Феврал:я|ь,Март:а|,Апрел:я|ь,Ма:я|й,Июн:я|ь,Июл:я|ь,Август:а|,Сентябр:я|ь,Октябр:я|ь,Ноябр:я|ь,Декабр:я|ь"}),Hl.locale=function(e){return bl(l,e)?t=e:t},Hl.addLocale=c}(/\b\w\w?\b/g,/:(.*)\|(.*)$/,{},"en","Seconds","Minutes","Hours","Month","FullYear"),U(Yl+Jl,{global:e}),!function(e){function n(n,l){El.call(x(n),function(n){n in nl&&(e[n]=c(sl,nl[n],l))})}n("pop,reverse,shift,keys,values,entries",1),n("indexOf,every,some,forEach,map,filter,find,findIndex,includes",3),n("join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill,turn"),U(zl,on,e)}({}),!function(e){!l||!e||ln in e[_n]||Dl(e[_n],ln,lt[on]),lt.NodeList=lt[on]}(e.NodeList),!function(e,n){El.call(x("assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,isIndependentlyComposed,log,markTimeline,profile,profileEnd,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn"),function(l){e[l]=function(){return n&&l in el?il.call(el[l],el,arguments):void 0}}),U(Yl+Jl,{log:vl(e.log,e,{enable:function(){n=!0},disable:function(){n=!1}})})}({},!0)}("undefined"!=typeof self&&self.Math===Math?self:Function("return this")(),!1)},{}],174:[function(e,n,l){function t(){return l.colors[c++%l.colors.length]}function r(e){function n(){}function r(){var e=r,n=+new Date,a=n-(i||n);e.diff=a,e.prev=i,e.curr=n,i=n,null==e.useColors&&(e.useColors=l.useColors()),null==e.color&&e.useColors&&(e.color=t());var o=Array.prototype.slice.call(arguments);o[0]=l.coerce(o[0]),"string"!=typeof o[0]&&(o=["%o"].concat(o));var u=0;o[0]=o[0].replace(/%([a-z%])/g,function(n,t){if("%%"===n)return n;u++;var r=l.formatters[t];if("function"==typeof r){var a=o[u];n=r.call(e,a),o.splice(u,1),u--}return n}),"function"==typeof l.formatArgs&&(o=l.formatArgs.apply(e,o));var s=r.log||l.log||console.log.bind(console);s.apply(e,o)}n.enabled=!1,r.enabled=!0;var a=l.enabled(e)?r:n;return a.namespace=e,a}function a(e){l.save(e);for(var n=(e||"").split(/[\s,]+/),t=n.length,r=0;t>r;r++)n[r]&&(e=n[r].replace(/\*/g,".*?"),"-"===e[0]?l.skips.push(new RegExp("^"+e.substr(1)+"$")):l.names.push(new RegExp("^"+e+"$")))}function o(){l.enable("")}function u(e){var n,t;for(n=0,t=l.skips.length;t>n;n++)if(l.skips[n].test(e))return!1;for(n=0,t=l.names.length;t>n;n++)if(l.names[n].test(e))return!0;return!1}function s(e){return e instanceof Error?e.stack||e.message:e}l=n.exports=r,l.coerce=s,l.disable=o,l.enable=a,l.enabled=u,l.humanize=e("ms"),l.names=[],l.skips=[],l.formatters={};var i,c=0},{ms:176}],175:[function(e,n,l){(function(t){function r(){var e=(t.env.DEBUG_COLORS||"").trim().toLowerCase();return 0===e.length?c.isatty(p):"0"!==e&&"no"!==e&&"false"!==e&&"disabled"!==e}function a(){var e=arguments,n=this.useColors,t=this.namespace;if(n){var r=this.color;e[0]=" [9"+r+"m"+t+" [0m"+e[0]+"[3"+r+"m +"+l.humanize(this.diff)+"[0m"}else e[0]=(new Date).toUTCString()+" "+t+" "+e[0];return e}function o(){return f.write(d.format.apply(this,arguments)+"\n")}function u(e){null==e?delete t.env.DEBUG:t.env.DEBUG=e}function s(){return t.env.DEBUG}function i(n){var l,r=t.binding("tty_wrap");switch(r.guessHandleType(n)){case"TTY":l=new c.WriteStream(n),l._type="tty",l._handle&&l._handle.unref&&l._handle.unref();break;case"FILE":var a=e("fs");l=new a.SyncWriteStream(n,{autoClose:!1}),l._type="fs";break;case"PIPE":case"TCP":var o=e("net");l=new o.Socket({fd:n,readable:!1,writable:!0}),l.readable=!1,l.read=null,l._type="pipe",l._handle&&l._handle.unref&&l._handle.unref();break;default:throw new Error("Implement me. Unknown stream file type!")}return l.fd=n,l._isStdio=!0,l}var c=e("tty"),d=e("util");l=n.exports=e("./debug"),l.log=o,l.formatArgs=a,l.save=u,l.load=s,l.useColors=r,l.colors=[6,2,3,4,5,1];var p=parseInt(t.env.DEBUG_FD,10)||2,f=1===p?t.stdout:2===p?t.stderr:i(p),g=4===d.inspect.length?function(e,n){return d.inspect(e,void 0,void 0,n)}:function(e,n){return d.inspect(e,{colors:n})};l.formatters.o=function(e){return g(e,this.useColors).replace(/\s*\n\s*/g," ")},l.enable(s())}).call(this,e("_process"))},{"./debug":174,_process:148,fs:138,net:138,tty:162,util:164}],176:[function(e,n){function l(e){var n=/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(e);if(n){var l=parseFloat(n[1]),t=(n[2]||"ms").toLowerCase();switch(t){case"years":case"year":case"y":return l*c;case"days":case"day":case"d":return l*i;case"hours":case"hour":case"h":return l*s;case"minutes":case"minute":case"m":return l*u;case"seconds":case"second":case"s":return l*o;case"ms":return l}}}function t(e){return e>=i?Math.round(e/i)+"d":e>=s?Math.round(e/s)+"h":e>=u?Math.round(e/u)+"m":e>=o?Math.round(e/o)+"s":e+"ms"}function r(e){return a(e,i,"day")||a(e,s,"hour")||a(e,u,"minute")||a(e,o,"second")||e+" ms"}function a(e,n,l){return n>e?void 0:1.5*n>e?Math.floor(e/n)+" "+l:Math.ceil(e/n)+" "+l+"s"}var o=1e3,u=60*o,s=60*u,i=24*s,c=365.25*i;n.exports=function(e,n){return n=n||{},"string"==typeof e?l(e):n.long?r(e):t(e)}},{}],177:[function(e,n){"use strict";function l(e){var n=0,l=0,t=0;for(var r in e){var a=e[r],o=a[0],u=a[1];(o>l||o===l&&u>t)&&(l=o,t=u,n=+r)}return n}var t=e("repeating"),r=/^(?:( )+|\t+)/;n.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");var n,a,o=0,u=0,s=0,i={};e.split(/\n/g).forEach(function(e){if(e){var l,t=e.match(r);t?(l=t[0].length,t[1]?u++:o++):l=0;var c=l-s;s=l,c?(a=c>0,n=i[a?c:-c],n?n[0]++:n=i[c]=[1,0]):n&&(n[1]+=+a)}});var c,d,p=l(i);return p?u>=o?(c="space",d=t(" ",p)):(c="tab",d=t(" ",p)):(c=null,d=""),{amount:p,type:c,indent:d}}},{repeating:321}],178:[function(n,l,t){!function(n,l){"use strict";"function"==typeof e&&e.amd?e(["exports"],l):l("undefined"!=typeof t?t:n.estraverse={})}(this,function r(e){"use strict";function n(){}function l(e){var n,t,r={};for(n in e)e.hasOwnProperty(n)&&(t=e[n],r[n]="object"==typeof t&&null!==t?l(t):t);return r}function t(e){var n,l={};for(n in e)e.hasOwnProperty(n)&&(l[n]=e[n]);return l}function a(e,n){var l,t,r,a;for(t=e.length,r=0;t;)l=t>>>1,a=r+l,n(e[a])?t=l:(r=a+1,t-=l+1);return r}function o(e,n){var l,t,r,a;for(t=e.length,r=0;t;)l=t>>>1,a=r+l,n(e[a])?(r=a+1,t-=l+1):t=l;return r}function u(e,n){return I(n).forEach(function(l){e[l]=n[l]}),e}function s(e,n){this.parent=e,this.key=n}function i(e,n,l,t){this.node=e,this.path=n,this.wrap=l,this.ref=t}function c(){}function d(e){return null==e?!1:"object"==typeof e&&"string"==typeof e.type}function p(e,n){return(e===y.ObjectExpression||e===y.ObjectPattern)&&"properties"===n}function f(e,n){var l=new c;return l.traverse(e,n)}function g(e,n){var l=new c;return l.replace(e,n)}function h(e,n){var l;return l=a(n,function(n){return n.range[0]>e.range[0]}),e.extendedRange=[e.range[0],e.range[1]],l!==n.length&&(e.extendedRange[1]=n[l].range[0]),l-=1,l>=0&&(e.extendedRange[0]=n[l].range[1]),e}function m(e,n,t){var r,a,o,u,s=[];if(!e.range)throw new Error("attachComments needs range information");if(!t.length){if(n.length){for(o=0,a=n.length;a>o;o+=1)r=l(n[o]),r.extendedRange=[0,e.range[0]],s.push(r);e.leadingComments=s}return e}for(o=0,a=n.length;a>o;o+=1)s.push(h(l(n[o]),t));return u=0,f(e,{enter:function(e){for(var n;u<s.length&&(n=s[u],!(n.extendedRange[1]>e.range[0]));)n.extendedRange[1]===e.range[0]?(e.leadingComments||(e.leadingComments=[]),e.leadingComments.push(n),s.splice(u,1)):u+=1;return u===s.length?b.Break:s[u].extendedRange[0]>e.range[1]?b.Skip:void 0}}),u=0,f(e,{leave:function(e){for(var n;u<s.length&&(n=s[u],!(e.range[1]<n.extendedRange[0]));)e.range[1]===n.extendedRange[0]?(e.trailingComments||(e.trailingComments=[]),e.trailingComments.push(n),s.splice(u,1)):u+=1;return u===s.length?b.Break:s[u].extendedRange[0]>e.range[1]?b.Skip:void 0}}),e}var y,x,b,_,v,I,E,k,w;return x=Array.isArray,x||(x=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),n(t),n(o),v=Object.create||function(){function e(){}return function(n){return e.prototype=n,new e}}(),I=Object.keys||function(e){var n,l=[];for(n in e)l.push(n);return l},y={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportBatchSpecifier:"ExportBatchSpecifier",ExportDeclaration:"ExportDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"},_={AssignmentExpression:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","defaults","rest","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","body","superClass"],ClassExpression:["id","body","superClass"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportBatchSpecifier:[],ExportDeclaration:["declaration","specifiers","source"],ExportSpecifier:["id","name"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","defaults","rest","body"],FunctionExpression:["id","params","defaults","rest","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["id"],ImportNamespaceSpecifier:["id"],ImportSpecifier:["id","name"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handlers","handler","guardedHandlers","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]},E={},k={},w={},b={Break:E,Skip:k,Remove:w},s.prototype.replace=function(e){this.parent[this.key]=e
},s.prototype.remove=function(){return x(this.parent)?(this.parent.splice(this.key,1),!0):(this.replace(null),!1)},c.prototype.path=function(){function e(e,n){if(x(n))for(t=0,r=n.length;r>t;++t)e.push(n[t]);else e.push(n)}var n,l,t,r,a,o;if(!this.__current.path)return null;for(a=[],n=2,l=this.__leavelist.length;l>n;++n)o=this.__leavelist[n],e(a,o.path);return e(a,this.__current.path),a},c.prototype.type=function(){var e=this.current();return e.type||this.__current.wrap},c.prototype.parents=function(){var e,n,l;for(l=[],e=1,n=this.__leavelist.length;n>e;++e)l.push(this.__leavelist[e].node);return l},c.prototype.current=function(){return this.__current.node},c.prototype.__execute=function(e,n){var l,t;return t=void 0,l=this.__current,this.__current=n,this.__state=null,e&&(t=e.call(this,n.node,this.__leavelist[this.__leavelist.length-1].node)),this.__current=l,t},c.prototype.notify=function(e){this.__state=e},c.prototype.skip=function(){this.notify(k)},c.prototype["break"]=function(){this.notify(E)},c.prototype.remove=function(){this.notify(w)},c.prototype.__initialize=function(e,n){this.visitor=n,this.root=e,this.__worklist=[],this.__leavelist=[],this.__current=null,this.__state=null,this.__fallback="iteration"===n.fallback,this.__keys=_,n.keys&&(this.__keys=u(v(this.__keys),n.keys))},c.prototype.traverse=function(e,n){var l,t,r,a,o,u,s,c,f,g,h,m;for(this.__initialize(e,n),m={},l=this.__worklist,t=this.__leavelist,l.push(new i(e,null,null,null)),t.push(new i(null,null,null,null));l.length;)if(r=l.pop(),r!==m){if(r.node){if(u=this.__execute(n.enter,r),this.__state===E||u===E)return;if(l.push(m),t.push(r),this.__state===k||u===k)continue;if(a=r.node,o=r.wrap||a.type,g=this.__keys[o],!g){if(!this.__fallback)throw new Error("Unknown node type "+o+".");g=I(a)}for(c=g.length;(c-=1)>=0;)if(s=g[c],h=a[s])if(x(h)){for(f=h.length;(f-=1)>=0;)if(h[f]){if(p(o,g[c]))r=new i(h[f],[s,f],"Property",null);else{if(!d(h[f]))continue;r=new i(h[f],[s,f],null,null)}l.push(r)}}else d(h)&&l.push(new i(h,s,null,null))}}else if(r=t.pop(),u=this.__execute(n.leave,r),this.__state===E||u===E)return},c.prototype.replace=function(e,n){function l(e){var n,l,r,a;if(e.ref.remove())for(l=e.ref.key,a=e.ref.parent,n=t.length;n--;)if(r=t[n],r.ref&&r.ref.parent===a){if(r.ref.key<l)break;--r.ref.key}}var t,r,a,o,u,c,f,g,h,m,y,b,_;for(this.__initialize(e,n),y={},t=this.__worklist,r=this.__leavelist,b={root:e},c=new i(e,null,null,new s(b,"root")),t.push(c),r.push(c);t.length;)if(c=t.pop(),c!==y){if(u=this.__execute(n.enter,c),void 0!==u&&u!==E&&u!==k&&u!==w&&(c.ref.replace(u),c.node=u),(this.__state===w||u===w)&&(l(c),c.node=null),this.__state===E||u===E)return b.root;if(a=c.node,a&&(t.push(y),r.push(c),this.__state!==k&&u!==k)){if(o=c.wrap||a.type,h=this.__keys[o],!h){if(!this.__fallback)throw new Error("Unknown node type "+o+".");h=I(a)}for(f=h.length;(f-=1)>=0;)if(_=h[f],m=a[_])if(x(m)){for(g=m.length;(g-=1)>=0;)if(m[g]){if(p(o,h[f]))c=new i(m[g],[_,g],"Property",new s(m,g));else{if(!d(m[g]))continue;c=new i(m[g],[_,g],null,new s(m,g))}t.push(c)}}else d(m)&&t.push(new i(m,_,null,new s(a,_)))}}else if(c=r.pop(),u=this.__execute(n.leave,c),void 0!==u&&u!==E&&u!==k&&u!==w&&c.ref.replace(u),(this.__state===w||u===w)&&l(c),this.__state===E||u===E)return b.root;return b.root},e.version="1.8.1-dev",e.Syntax=y,e.traverse=f,e.replace=g,e.attachComments=m,e.VisitorKeys=_,e.VisitorOption=b,e.Controller=c,e.cloneEnvironment=function(){return r({})},e})},{}],179:[function(e,n){!function(){"use strict";function e(e){if(null==e)return!1;switch(e.type){case"ArrayExpression":case"AssignmentExpression":case"BinaryExpression":case"CallExpression":case"ConditionalExpression":case"FunctionExpression":case"Identifier":case"Literal":case"LogicalExpression":case"MemberExpression":case"NewExpression":case"ObjectExpression":case"SequenceExpression":case"ThisExpression":case"UnaryExpression":case"UpdateExpression":return!0}return!1}function l(e){if(null==e)return!1;switch(e.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return!0}return!1}function t(e){if(null==e)return!1;switch(e.type){case"BlockStatement":case"BreakStatement":case"ContinueStatement":case"DebuggerStatement":case"DoWhileStatement":case"EmptyStatement":case"ExpressionStatement":case"ForInStatement":case"ForStatement":case"IfStatement":case"LabeledStatement":case"ReturnStatement":case"SwitchStatement":case"ThrowStatement":case"TryStatement":case"VariableDeclaration":case"WhileStatement":case"WithStatement":return!0}return!1}function r(e){return t(e)||null!=e&&"FunctionDeclaration"===e.type}function a(e){switch(e.type){case"IfStatement":return null!=e.alternate?e.alternate:e.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return e.body}return null}function o(e){var n;if("IfStatement"!==e.type)return!1;if(null==e.alternate)return!1;n=e.consequent;do{if("IfStatement"===n.type&&null==n.alternate)return!0;n=a(n)}while(n);return!1}n.exports={isExpression:e,isStatement:t,isIterationStatement:l,isSourceElement:r,isProblematicIfStatement:o,trailingStatement:a}}()},{}],180:[function(e,n){!function(){"use strict";function e(e){return e>=48&&57>=e}function l(n){return e(n)||n>=97&&102>=n||n>=65&&70>=n}function t(e){return e>=48&&55>=e}function r(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&i.indexOf(e)>=0}function a(e){return 10===e||13===e||8232===e||8233===e}function o(e){return e>=97&&122>=e||e>=65&&90>=e||36===e||95===e||92===e||e>=128&&s.NonAsciiIdentifierStart.test(String.fromCharCode(e))}function u(e){return e>=97&&122>=e||e>=65&&90>=e||e>=48&&57>=e||36===e||95===e||92===e||e>=128&&s.NonAsciiIdentifierPart.test(String.fromCharCode(e))}var s,i;s={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԧԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠࢢ-ࢬࣤ-ࣾऀ-ॣ०-९ॱ-ॷॹ-ॿঁ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఁ-ఃఅ-ఌఎ-ఐఒ-నప-ళవ-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಂಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲംഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤜᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶᴀ-ᷦ᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺꩻꪀ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︦︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]")},i=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],n.exports={isDecimalDigit:e,isHexDigit:l,isOctalDigit:t,isWhiteSpace:r,isLineTerminator:a,isIdentifierStart:o,isIdentifierPart:u}}()},{}],181:[function(e,n){!function(){"use strict";function l(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return!0;default:return!1}}function t(e,n){return n||"yield"!==e?r(e,n):!1}function r(e,n){if(n&&l(e))return!0;switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}}function a(e,n){return"null"===e||"true"===e||"false"===e||t(e,n)}function o(e,n){return"null"===e||"true"===e||"false"===e||r(e,n)}function u(e){return"eval"===e||"arguments"===e}function s(e){var n,l,t;if(0===e.length)return!1;if(t=e.charCodeAt(0),!d.isIdentifierStart(t)||92===t)return!1;for(n=1,l=e.length;l>n;++n)if(t=e.charCodeAt(n),!d.isIdentifierPart(t)||92===t)return!1;return!0}function i(e,n){return s(e)&&!a(e,n)}function c(e,n){return s(e)&&!o(e,n)}var d=e("./code");n.exports={isKeywordES5:t,isKeywordES6:r,isReservedWordES5:a,isReservedWordES6:o,isRestrictedWord:u,isIdentifierName:s,isIdentifierES5:i,isIdentifierES6:c}}()},{"./code":180}],182:[function(e,n,l){!function(){"use strict";l.ast=e("./ast"),l.code=e("./code"),l.keyword=e("./keyword")}()},{"./ast":179,"./code":180,"./keyword":181}],183:[function(e,n){n.exports={builtin:{Array:!1,ArrayBuffer:!1,Boolean:!1,constructor:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,eval:!1,EvalError:!1,Float32Array:!1,Float64Array:!1,Function:!1,hasOwnProperty:!1,Infinity:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,isFinite:!1,isNaN:!1,isPrototypeOf:!1,JSON:!1,Map:!1,Math:!1,NaN:!1,Number:!1,Object:!1,parseFloat:!1,parseInt:!1,Promise:!1,propertyIsEnumerable:!1,Proxy:!1,RangeError:!1,ReferenceError:!1,Reflect:!1,RegExp:!1,Set:!1,String:!1,Symbol:!1,SyntaxError:!1,System:!1,toLocaleString:!1,toString:!1,TypeError:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1,undefined:!1,URIError:!1,valueOf:!1,WeakMap:!1,WeakSet:!1},nonstandard:{escape:!1,unescape:!1},browser:{addEventListener:!1,alert:!1,applicationCache:!1,atob:!1,Audio:!1,AudioProcessingEvent:!1,BeforeUnloadEvent:!1,Blob:!1,blur:!1,btoa:!1,cancelAnimationFrame:!1,CanvasGradient:!1,CanvasPattern:!1,CanvasRenderingContext2D:!1,clearInterval:!1,clearTimeout:!1,close:!1,closed:!1,CloseEvent:!1,Comment:!1,CompositionEvent:!1,confirm:!1,console:!1,crypto:!1,CSS:!1,CustomEvent:!1,DataView:!1,Debug:!1,defaultStatus:!1,devicePixelRatio:!1,dispatchEvent:!1,document:!1,Document:!1,DocumentFragment:!1,DOMParser:!1,DragEvent:!1,Element:!1,ElementTimeControl:!1,ErrorEvent:!1,event:!1,Event:!1,FileReader:!1,find:!1,focus:!1,FocusEvent:!1,FormData:!1,frameElement:!1,frames:!1,GamepadEvent:!1,getComputedStyle:!1,getSelection:!1,HashChangeEvent:!1,history:!1,HTMLAnchorElement:!1,HTMLBaseElement:!1,HTMLBlockquoteElement:!1,HTMLBodyElement:!1,HTMLBRElement:!1,HTMLButtonElement:!1,HTMLCanvasElement:!1,HTMLDirectoryElement:!1,HTMLDivElement:!1,HTMLDListElement:!1,HTMLElement:!1,HTMLFieldSetElement:!1,HTMLFontElement:!1,HTMLFormElement:!1,HTMLFrameElement:!1,HTMLFrameSetElement:!1,HTMLHeadElement:!1,HTMLHeadingElement:!1,HTMLHRElement:!1,HTMLHtmlElement:!1,HTMLIFrameElement:!1,HTMLImageElement:!1,HTMLInputElement:!1,HTMLIsIndexElement:!1,HTMLLabelElement:!1,HTMLLayerElement:!1,HTMLLegendElement:!1,HTMLLIElement:!1,HTMLLinkElement:!1,HTMLMapElement:!1,HTMLMenuElement:!1,HTMLMetaElement:!1,HTMLModElement:!1,HTMLObjectElement:!1,HTMLOListElement:!1,HTMLOptGroupElement:!1,HTMLOptionElement:!1,HTMLParagraphElement:!1,HTMLParamElement:!1,HTMLPreElement:!1,HTMLQuoteElement:!1,HTMLScriptElement:!1,HTMLSelectElement:!1,HTMLStyleElement:!1,HTMLTableCaptionElement:!1,HTMLTableCellElement:!1,HTMLTableColElement:!1,HTMLTableElement:!1,HTMLTableRowElement:!1,HTMLTableSectionElement:!1,HTMLTextAreaElement:!1,HTMLTitleElement:!1,HTMLUListElement:!1,HTMLVideoElement:!1,IDBCursor:!1,IDBCursorWithValue:!1,IDBDatabase:!1,IDBEnvironment:!1,IDBFactory:!1,IDBIndex:!1,IDBKeyRange:!1,IDBObjectStore:!1,IDBOpenDBRequest:!1,IDBRequest:!1,IDBTransaction:!1,IDBVersionChangeEvent:!1,Image:!1,indexedDB:!1,innerHeight:!1,innerWidth:!1,InputEvent:!1,Intl:!1,KeyboardEvent:!1,length:!1,localStorage:!1,location:!1,matchMedia:!1,MessageChannel:!1,MessageEvent:!1,MessagePort:!1,MouseEvent:!1,moveBy:!1,moveTo:!1,MutationObserver:!1,name:!1,navigator:!1,Node:!1,NodeFilter:!1,NodeList:!1,Notification:!1,OfflineAudioCompletionEvent:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,opera:!1,Option:!1,outerHeight:!1,outerWidth:!1,PageTransitionEvent:!1,pageXOffset:!1,pageYOffset:!1,parent:!1,PopStateEvent:!1,postMessage:!1,print:!1,ProgressEvent:!1,prompt:!1,Range:!1,removeEventListener:!1,requestAnimationFrame:!1,resizeBy:!1,resizeTo:!1,screen:!1,screenX:!1,screenY:!1,scroll:!1,scrollbars:!1,scrollBy:!1,scrollTo:!1,scrollX:!1,scrollY:!1,self:!1,sessionStorage:!1,setInterval:!1,setTimeout:!1,SharedWorker:!1,showModalDialog:!1,status:!1,stop:!1,StorageEvent:!1,SVGAElement:!1,SVGAltGlyphDefElement:!1,SVGAltGlyphElement:!1,SVGAltGlyphItemElement:!1,SVGAngle:!1,SVGAnimateColorElement:!1,SVGAnimatedAngle:!1,SVGAnimatedBoolean:!1,SVGAnimatedEnumeration:!1,SVGAnimatedInteger:!1,SVGAnimatedLength:!1,SVGAnimatedLengthList:!1,SVGAnimatedNumber:!1,SVGAnimatedNumberList:!1,SVGAnimatedPathData:!1,SVGAnimatedPoints:!1,SVGAnimatedPreserveAspectRatio:!1,SVGAnimatedRect:!1,SVGAnimatedString:!1,SVGAnimatedTransformList:!1,SVGAnimateElement:!1,SVGAnimateMotionElement:!1,SVGAnimateTransformElement:!1,SVGAnimationElement:!1,SVGCircleElement:!1,SVGClipPathElement:!1,SVGColor:!1,SVGColorProfileElement:!1,SVGColorProfileRule:!1,SVGComponentTransferFunctionElement:!1,SVGCSSRule:!1,SVGCursorElement:!1,SVGDefsElement:!1,SVGDescElement:!1,SVGDocument:!1,SVGElement:!1,SVGElementInstance:!1,SVGElementInstanceList:!1,SVGEllipseElement:!1,SVGEvent:!1,SVGExternalResourcesRequired:!1,SVGFEBlendElement:!1,SVGFEColorMatrixElement:!1,SVGFEComponentTransferElement:!1,SVGFECompositeElement:!1,SVGFEConvolveMatrixElement:!1,SVGFEDiffuseLightingElement:!1,SVGFEDisplacementMapElement:!1,SVGFEDistantLightElement:!1,SVGFEFloodElement:!1,SVGFEFuncAElement:!1,SVGFEFuncBElement:!1,SVGFEFuncGElement:!1,SVGFEFuncRElement:!1,SVGFEGaussianBlurElement:!1,SVGFEImageElement:!1,SVGFEMergeElement:!1,SVGFEMergeNodeElement:!1,SVGFEMorphologyElement:!1,SVGFEOffsetElement:!1,SVGFEPointLightElement:!1,SVGFESpecularLightingElement:!1,SVGFESpotLightElement:!1,SVGFETileElement:!1,SVGFETurbulenceElement:!1,SVGFilterElement:!1,SVGFilterPrimitiveStandardAttributes:!1,SVGFitToViewBox:!1,SVGFontElement:!1,SVGFontFaceElement:!1,SVGFontFaceFormatElement:!1,SVGFontFaceNameElement:!1,SVGFontFaceSrcElement:!1,SVGFontFaceUriElement:!1,SVGForeignObjectElement:!1,SVGGElement:!1,SVGGlyphElement:!1,SVGGlyphRefElement:!1,SVGGradientElement:!1,SVGHKernElement:!1,SVGICCColor:!1,SVGImageElement:!1,SVGLangSpace:!1,SVGLength:!1,SVGLengthList:!1,SVGLinearGradientElement:!1,SVGLineElement:!1,SVGLocatable:!1,SVGMarkerElement:!1,SVGMaskElement:!1,SVGMatrix:!1,SVGMetadataElement:!1,SVGMissingGlyphElement:!1,SVGMPathElement:!1,SVGNumber:!1,SVGNumberList:!1,SVGPaint:!1,SVGPathElement:!1,SVGPathSeg:!1,SVGPathSegArcAbs:!1,SVGPathSegArcRel:!1,SVGPathSegClosePath:!1,SVGPathSegCurvetoCubicAbs:!1,SVGPathSegCurvetoCubicRel:!1,SVGPathSegCurvetoCubicSmoothAbs:!1,SVGPathSegCurvetoCubicSmoothRel:!1,SVGPathSegCurvetoQuadraticAbs:!1,SVGPathSegCurvetoQuadraticRel:!1,SVGPathSegCurvetoQuadraticSmoothAbs:!1,SVGPathSegCurvetoQuadraticSmoothRel:!1,SVGPathSegLinetoAbs:!1,SVGPathSegLinetoHorizontalAbs:!1,SVGPathSegLinetoHorizontalRel:!1,SVGPathSegLinetoRel:!1,SVGPathSegLinetoVerticalAbs:!1,SVGPathSegLinetoVerticalRel:!1,SVGPathSegList:!1,SVGPathSegMovetoAbs:!1,SVGPathSegMovetoRel:!1,SVGPatternElement:!1,SVGPoint:!1,SVGPointList:!1,SVGPolygonElement:!1,SVGPolylineElement:!1,SVGPreserveAspectRatio:!1,SVGRadialGradientElement:!1,SVGRect:!1,SVGRectElement:!1,SVGRenderingIntent:!1,SVGScriptElement:!1,SVGSetElement:!1,SVGStopElement:!1,SVGStringList:!1,SVGStylable:!1,SVGStyleElement:!1,SVGSVGElement:!1,SVGSwitchElement:!1,SVGSymbolElement:!1,SVGTests:!1,SVGTextContentElement:!1,SVGTextElement:!1,SVGTextPathElement:!1,SVGTextPositioningElement:!1,SVGTitleElement:!1,SVGTransform:!1,SVGTransformable:!1,SVGTransformList:!1,SVGTRefElement:!1,SVGTSpanElement:!1,SVGUnitTypes:!1,SVGURIReference:!1,SVGUseElement:!1,SVGViewElement:!1,SVGViewSpec:!1,SVGVKernElement:!1,SVGZoomAndPan:!1,Text:!1,TextDecoder:!1,TextEncoder:!1,TimeEvent:!1,top:!1,TouchEvent:!1,UIEvent:!1,URL:!1,WebGLActiveInfo:!1,WebGLBuffer:!1,WebGLContextEvent:!1,WebGLFramebuffer:!1,WebGLProgram:!1,WebGLRenderbuffer:!1,WebGLRenderingContext:!1,WebGLShader:!1,WebGLShaderPrecisionFormat:!1,WebGLTexture:!1,WebGLUniformLocation:!1,WebSocket:!1,WheelEvent:!1,window:!1,Window:!1,Worker:!1,XDomainRequest:!1,XMLHttpRequest:!1,XMLSerializer:!1,XPathEvaluator:!1,XPathException:!1,XPathExpression:!1,XPathNamespace:!1,XPathNSResolver:!1,XPathResult:!1},worker:{importScripts:!0,postMessage:!0,self:!0},node:{__dirname:!1,__filename:!1,arguments:!1,Buffer:!1,clearImmediate:!1,clearInterval:!1,clearTimeout:!1,console:!1,DataView:!1,exports:!0,GLOBAL:!1,global:!1,module:!1,process:!1,require:!1,setImmediate:!1,setInterval:!1,setTimeout:!1},amd:{define:!1,require:!1},mocha:{after:!1,afterEach:!1,before:!1,beforeEach:!1,context:!1,describe:!1,it:!1,setup:!1,specify:!1,suite:!1,suiteSetup:!1,suiteTeardown:!1,teardown:!1,test:!1,xcontext:!1,xdescribe:!1,xit:!1,xspecify:!1},jasmine:{afterAll:!1,afterEach:!1,beforeAll:!1,beforeEach:!1,describe:!1,expect:!1,fail:!1,fdescribe:!1,fit:!1,it:!1,jasmine:!1,pending:!1,runs:!1,spyOn:!1,waits:!1,waitsFor:!1,xdescribe:!1,xit:!1},qunit:{asyncTest:!1,deepEqual:!1,equal:!1,expect:!1,module:!1,notDeepEqual:!1,notEqual:!1,notPropEqual:!1,notStrictEqual:!1,ok:!1,propEqual:!1,QUnit:!1,raises:!1,start:!1,stop:!1,strictEqual:!1,test:!1,"throws":!1},phantomjs:{console:!0,exports:!0,phantom:!0,require:!0,WebPage:!0},couch:{emit:!1,exports:!1,getRow:!1,log:!1,module:!1,provides:!1,require:!1,respond:!1,send:!1,start:!1,sum:!1},rhino:{defineClass:!1,deserialize:!1,gc:!1,help:!1,importClass:!1,importPackage:!1,java:!1,load:!1,loadClass:!1,Packages:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},wsh:{ActiveXObject:!0,Enumerator:!0,GetObject:!0,ScriptEngine:!0,ScriptEngineBuildVersion:!0,ScriptEngineMajorVersion:!0,ScriptEngineMinorVersion:!0,VBArray:!0,WScript:!0,WSH:!0,XDomainRequest:!0},jquery:{$:!1,jQuery:!1},yui:{Y:!1,YUI:!1,YUI_config:!1},shelljs:{cat:!1,cd:!1,chmod:!1,config:!1,cp:!1,dirs:!1,echo:!1,env:!1,error:!1,exec:!1,exit:!1,find:!1,grep:!1,ls:!1,mkdir:!1,mv:!1,popd:!1,pushd:!1,pwd:!1,rm:!1,sed:!1,target:!1,tempdir:!1,test:!1,which:!1},prototypejs:{$:!1,$$:!1,$A:!1,$break:!1,$continue:!1,$F:!1,$H:!1,$R:!1,$w:!1,Abstract:!1,Ajax:!1,Autocompleter:!1,Builder:!1,Class:!1,Control:!1,Draggable:!1,Draggables:!1,Droppables:!1,Effect:!1,Element:!1,Enumerable:!1,Event:!1,Field:!1,Form:!1,Hash:!1,Insertion:!1,ObjectRange:!1,PeriodicalExecuter:!1,Position:!1,Prototype:!1,Scriptaculous:!1,Selector:!1,Sortable:!1,SortableObserver:!1,Sound:!1,Template:!1,Toggle:!1,Try:!1},meteor:{$:!1,_:!1,Accounts:!1,App:!1,Assets:!1,Blaze:!1,check:!1,Cordova:!1,DDP:!1,DDPServer:!1,Deps:!1,EJSON:!1,Email:!1,HTTP:!1,Log:!1,Match:!1,Meteor:!1,Mongo:!1,MongoInternals:!1,Npm:!1,Package:!1,Plugin:!1,process:!1,Random:!1,ReactiveDict:!1,ReactiveVar:!1,Router:!1,Session:!1,share:!1,Spacebars:!1,Template:!1,Tinytest:!1,Tracker:!1,UI:!1,Utils:!1,WebApp:!1,WebAppInternals:!1},mongo:{_isWindows:!1,_rand:!1,BulkWriteResult:!1,cat:!1,cd:!1,connect:!1,db:!1,getHostName:!1,getMemInfo:!1,hostname:!1,listFiles:!1,load:!1,ls:!1,md5sumFile:!1,mkdir:!1,Mongo:!1,ObjectId:!1,PlanCache:!1,pwd:!1,quit:!1,removeFile:!1,rs:!1,sh:!1,UUID:!1,version:!1,WriteResult:!1}}},{}],184:[function(e,n){n.exports=e("./globals.json")},{"./globals.json":183}],185:[function(e,n){var l=e("is-nan"),t=e("is-finite");n.exports=Number.isInteger||function(e){return"number"==typeof e&&!l(e)&&t(e)&&parseInt(e,10)===e}},{"is-finite":186,"is-nan":187}],186:[function(e,n){"use strict";n.exports=Number.isFinite||function(e){return"number"!=typeof e||e!==e||1/0===e||e===-1/0?!1:!0}},{}],187:[function(e,n){"use strict";n.exports=function(e){return e!==e}},{}],188:[function(e,n){n.exports=/((['"])(?:(?!\2)[^\\\r\n\u2028\u2029]|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:[^\]\\\r\n\u2028\u2029]|\\.)*\]|[^\/\]\\\r\n\u2028\u2029]|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(-?(?:0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?))|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]{1,6}\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-*\/%&|^]|<{1,2}|>{1,3}|!=?|={1,2})=?|[?:~])|([;,.[\](){}])|(\s+)|(^$|[\s\S])/g,n.exports.matchToToken=function(e){return token={type:"invalid",value:e[0]},e[1]?(token.type="string",token.closed=!(!e[3]&&!e[4])):e[5]?token.type="comment":e[6]?(token.type="comment",token.closed=!!e[7]):e[8]?token.type="regex":e[9]?token.type="number":e[10]?token.type="name":e[11]?token.type="operator":e[12]?token.type="punctuation":e[13]&&(token.type="whitespace"),token}},{}],189:[function(e,n){var l=[],t=[];n.exports=function(e,n){if(e===n)return 0;var r=e.length,a=n.length;if(0===r)return a;if(0===a)return r;for(var o,u,s,i,c=0,d=0;r>c;)t[c]=e.charCodeAt(c),l[c]=++c;for(;a>d;)for(o=n.charCodeAt(d),s=d++,u=d,c=0;r>c;c++)i=o===t[c]?s:s+1,s=l[c],u=l[c]=s>u?i>u?u+1:i:i>s?s+1:i;return u}},{}],190:[function(e,n){function l(e,n,l){return n in e?e[n]:l}function t(e,n){var t=l.bind(null,n||{}),a=t("transform",Function.prototype),o=t("padding"," "),u=t("before"," "),s=t("after"," | "),i=t("start",1),c=Array.isArray(e),d=c?e:e.split("\n"),p=i+d.length-1,f=String(p).length,g=d.map(function(e,n){var l=i+n,t={before:u,number:l,width:f,after:s,line:e};return a(t),t.before+r(t.number,f,o)+t.after+t.line});return c?g:g.join("\n")}var r=e("left-pad");n.exports=t},{"left-pad":191}],191:[function(e,n){function l(e,n,l){e=String(e);var t=-1;for(l||(l=" "),n-=e.length;++t<n;)e=l+e;return e}n.exports=l},{}],192:[function(e,n){function l(e){for(var n=-1,l=e?e.length:0,t=-1,r=[];++n<l;){var a=e[n];a&&(r[++t]=a)}return r}n.exports=l},{}],193:[function(e,n){function l(e,n,l){var a=e?e.length:0;return l&&r(e,n,l)&&(n=!1),a?t(e,n):[]}var t=e("../internal/baseFlatten"),r=e("../internal/isIterateeCall");n.exports=l},{"../internal/baseFlatten":223,"../internal/isIterateeCall":268}],194:[function(e,n){function l(e){var n=e?e.length:0;return n?e[n-1]:void 0}n.exports=l},{}],195:[function(e,n){function l(){var e=arguments[0];if(!e||!e.length)return e;for(var n=0,l=t,r=arguments.length;++n<r;)for(var o=0,u=arguments[n];(o=l(e,u,o))>-1;)a.call(e,o,1);return e}var t=e("../internal/baseIndexOf"),r=Array.prototype,a=r.splice;n.exports=l},{"../internal/baseIndexOf":228}],196:[function(e,n){function l(e,n,l,u){var s=e?e.length:0;return s?("boolean"!=typeof n&&null!=n&&(u=l,l=a(e,n,u)?null:n,n=!1),l=null==l?l:t(l,u,3),n?o(e,l):r(e,l)):[]}var t=e("../internal/baseCallback"),r=e("../internal/baseUniq"),a=e("../internal/isIterateeCall"),o=e("../internal/sortedUniq");n.exports=l},{"../internal/baseCallback":216,"../internal/baseUniq":241,"../internal/isIterateeCall":268,"../internal/sortedUniq":278}],197:[function(e,n){n.exports=e("./includes")},{"./includes":201}],198:[function(e,n){n.exports=e("./forEach")},{"./forEach":199}],199:[function(e,n){function l(e,n,l){return"function"==typeof n&&"undefined"==typeof l&&o(e)?t(e,n):r(e,a(n,l,3))}var t=e("../internal/arrayEach"),r=e("../internal/baseEach"),a=e("../internal/bindCallback"),o=e("../lang/isArray");n.exports=l},{"../internal/arrayEach":210,"../internal/baseEach":221,"../internal/bindCallback":243,"../lang/isArray":283}],200:[function(e,n){var l=e("../internal/createAggregator"),t=Object.prototype,r=t.hasOwnProperty,a=l(function(e,n,l){r.call(e,l)?e[l].push(n):e[l]=[n]});n.exports=a},{"../internal/createAggregator":250}],201:[function(e,n){function l(e,n,l){var i=e?e.length:0;return a(i)||(e=u(e),i=e.length),i?(l="number"==typeof l?0>l?s(i+l,0):l||0:0,"string"==typeof e||!r(e)&&o(e)?i>l&&e.indexOf(n,l)>-1:t(e,n,l)>-1):!1}var t=e("../internal/baseIndexOf"),r=e("../lang/isArray"),a=e("../internal/isLength"),o=e("../lang/isString"),u=e("../object/values"),s=Math.max;n.exports=l},{"../internal/baseIndexOf":228,"../internal/isLength":269,"../lang/isArray":283,"../lang/isString":291,"../object/values":299}],202:[function(e,n){function l(e,n,l){var u=o(e)?t:a;return n=r(n,l,3),u(e,n)}var t=e("../internal/arrayMap"),r=e("../internal/baseCallback"),a=e("../internal/baseMap"),o=e("../lang/isArray");n.exports=l},{"../internal/arrayMap":211,"../internal/baseCallback":216,"../internal/baseMap":232,"../lang/isArray":283}],203:[function(e,n){function l(e,n,l,s){var i=u(e)?t:o;return i(e,r(n,s,4),l,arguments.length<3,a)}var t=e("../internal/arrayReduceRight"),r=e("../internal/baseCallback"),a=e("../internal/baseEachRight"),o=e("../internal/baseReduce"),u=e("../lang/isArray");n.exports=l},{"../internal/arrayReduceRight":212,"../internal/baseCallback":216,"../internal/baseEachRight":222,"../internal/baseReduce":236,"../lang/isArray":283}],204:[function(e,n){function l(e,n,l){var u=o(e)?t:a;return("function"!=typeof n||"undefined"!=typeof l)&&(n=r(n,l,3)),u(e,n)}var t=e("../internal/arraySome"),r=e("../internal/baseCallback"),a=e("../internal/baseSome"),o=e("../lang/isArray");n.exports=l},{"../internal/arraySome":213,"../internal/baseCallback":216,"../internal/baseSome":238,"../lang/isArray":283}],205:[function(e,n){function l(e,n,l){var i=-1,c=e?e.length:0,d=s(c)?Array(c):[];return l&&u(e,n,l)&&(n=null),n=t(n,l,3),r(e,function(e,l,t){d[++i]={criteria:n(e,l,t),index:i,value:e}}),a(d,o)}var t=e("../internal/baseCallback"),r=e("../internal/baseEach"),a=e("../internal/baseSortBy"),o=e("../internal/compareAscending"),u=e("../internal/isIterateeCall"),s=e("../internal/isLength");n.exports=l},{"../internal/baseCallback":216,"../internal/baseEach":221,"../internal/baseSortBy":239,"../internal/compareAscending":247,"../internal/isIterateeCall":268,"../internal/isLength":269}],206:[function(e,n){var l=e("../lang/isNative"),t=l(t=Date.now)&&t,r=t||function(){return(new Date).getTime()};n.exports=r},{"../lang/isNative":287}],207:[function(e,n){function l(e,n,l){return l&&r(e,n,l)&&(n=null),n=e&&null==n?e.length:o(+n||0,0),t(e,a,null,null,null,null,n)}var t=e("../internal/createWrapper"),r=e("../internal/isIterateeCall"),a=256,o=Math.max;n.exports=l},{"../internal/createWrapper":257,"../internal/isIterateeCall":268}],208:[function(e,n){(function(l){function t(e){var n=e?e.length:0;for(this.data={hash:u(null),set:new o};n--;)this.push(e[n])}var r=e("./cachePush"),a=e("../lang/isNative"),o=a(o=l.Set)&&o,u=a(u=Object.create)&&u;t.prototype.push=r,n.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lang/isNative":287,"./cachePush":246}],209:[function(e,n){function l(e,n){var l=-1,t=e.length;for(n||(n=Array(t));++l<t;)n[l]=e[l];return n}n.exports=l},{}],210:[function(e,n){function l(e,n){for(var l=-1,t=e.length;++l<t&&n(e[l],l,e)!==!1;);return e}n.exports=l},{}],211:[function(e,n){function l(e,n){for(var l=-1,t=e.length,r=Array(t);++l<t;)r[l]=n(e[l],l,e);return r}n.exports=l},{}],212:[function(e,n){function l(e,n,l,t){var r=e.length;for(t&&r&&(l=e[--r]);r--;)l=n(l,e[r],r,e);return l}n.exports=l},{}],213:[function(e,n){function l(e,n){for(var l=-1,t=e.length;++l<t;)if(n(e[l],l,e))return!0;return!1}n.exports=l},{}],214:[function(e,n){function l(e,n){return"undefined"==typeof e?n:e}n.exports=l},{}],215:[function(e,n){function l(e,n,l){var a=r(n);if(!l)return t(n,e,a);for(var o=-1,u=a.length;++o<u;){var s=a[o],i=e[s],c=l(i,n[s],s,e,n);(c===c?c===i:i!==i)&&("undefined"!=typeof i||s in e)||(e[s]=c)}return e}var t=e("./baseCopy"),r=e("../object/keys");n.exports=l},{"../object/keys":297,"./baseCopy":219}],216:[function(e,n){function l(e,n,l){var i=typeof e;return"function"==i?"undefined"!=typeof n&&s(e)?o(e,n,l):e:null==e?u:"object"==i?t(e):"undefined"==typeof n?a(e+""):r(e+"",n)}var t=e("./baseMatches"),r=e("./baseMatchesProperty"),a=e("./baseProperty"),o=e("./bindCallback"),u=e("../utility/identity"),s=e("./isBindable");n.exports=l},{"../utility/identity":303,"./baseMatches":233,"./baseMatchesProperty":234,"./baseProperty":235,"./bindCallback":243,"./isBindable":266}],217:[function(e,n){function l(e,n,g,h,m,y,b){var _;if(g&&(_=m?g(e,h,m):g(e)),"undefined"!=typeof _)return _;if(!d(e))return e;var I=c(e);if(I){if(_=u(e),!n)return t(e,_)}else{var E=N.call(e),k=E==x;if(E!=v&&E!=f&&(!k||m))return D[E]?s(e,E,n):m?e:{};if(_=i(k?{}:e),!n)return a(e,_,p(e))}y||(y=[]),b||(b=[]);for(var w=y.length;w--;)if(y[w]==e)return b[w];return y.push(e),b.push(_),(I?r:o)(e,function(t,r){_[r]=l(t,n,g,r,e,y,b)}),_}var t=e("./arrayCopy"),r=e("./arrayEach"),a=e("./baseCopy"),o=e("./baseForOwn"),u=e("./initCloneArray"),s=e("./initCloneByTag"),i=e("./initCloneObject"),c=e("../lang/isArray"),d=e("../lang/isObject"),p=e("../object/keys"),f="[object Arguments]",g="[object Array]",h="[object Boolean]",m="[object Date]",y="[object Error]",x="[object Function]",b="[object Map]",_="[object Number]",v="[object Object]",I="[object RegExp]",E="[object Set]",k="[object String]",w="[object WeakMap]",R="[object ArrayBuffer]",S="[object Float32Array]",C="[object Float64Array]",A="[object Int8Array]",j="[object Int16Array]",T="[object Int32Array]",L="[object Uint8Array]",P="[object Uint8ClampedArray]",O="[object Uint16Array]",M="[object Uint32Array]",D={};D[f]=D[g]=D[R]=D[h]=D[m]=D[S]=D[C]=D[A]=D[j]=D[T]=D[_]=D[v]=D[I]=D[k]=D[L]=D[P]=D[O]=D[M]=!0,D[y]=D[x]=D[b]=D[E]=D[w]=!1;var B=Object.prototype,N=B.toString;n.exports=l},{"../lang/isArray":283,"../lang/isObject":289,"../object/keys":297,"./arrayCopy":209,"./arrayEach":210,"./baseCopy":219,"./baseForOwn":225,"./initCloneArray":263,"./initCloneByTag":264,"./initCloneObject":265}],218:[function(e,n){function l(e,n){if(e!==n){var l=e===e,t=n===n;if(e>n||!l||"undefined"==typeof e&&t)return 1;if(n>e||!t||"undefined"==typeof n&&l)return-1}return 0}n.exports=l},{}],219:[function(e,n){function l(e,n,l){l||(l=n,n={});for(var t=-1,r=l.length;++t<r;){var a=l[t];n[a]=e[a]}return n}n.exports=l},{}],220:[function(e,n){(function(l){var t=e("../lang/isObject"),r=function(){function e(){}return function(n){if(t(n)){e.prototype=n;var r=new e;e.prototype=null}return r||l.Object()}}();n.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lang/isObject":289}],221:[function(e,n){function l(e,n){var l=e?e.length:0;if(!r(l))return t(e,n);for(var o=-1,u=a(e);++o<l&&n(u[o],o,u)!==!1;);return e}var t=e("./baseForOwn"),r=e("./isLength"),a=e("./toObject");n.exports=l},{"./baseForOwn":225,"./isLength":269,"./toObject":279}],222:[function(e,n){function l(e,n){var l=e?e.length:0;if(!r(l))return t(e,n);for(var o=a(e);l--&&n(o[l],l,o)!==!1;);return e}var t=e("./baseForOwnRight"),r=e("./isLength"),a=e("./toObject");n.exports=l},{"./baseForOwnRight":226,"./isLength":269,"./toObject":279}],223:[function(e,n){function l(e,n,u,s){for(var i=(s||0)-1,c=e.length,d=-1,p=[];++i<c;){var f=e[i];
if(o(f)&&a(f.length)&&(r(f)||t(f))){n&&(f=l(f,n,u));var g=-1,h=f.length;for(p.length+=h;++g<h;)p[++d]=f[g]}else u||(p[++d]=f)}return p}var t=e("../lang/isArguments"),r=e("../lang/isArray"),a=e("./isLength"),o=e("./isObjectLike");n.exports=l},{"../lang/isArguments":282,"../lang/isArray":283,"./isLength":269,"./isObjectLike":270}],224:[function(e,n){function l(e,n,l){for(var r=-1,a=t(e),o=l(e),u=o.length;++r<u;){var s=o[r];if(n(a[s],s,a)===!1)break}return e}var t=e("./toObject");n.exports=l},{"./toObject":279}],225:[function(e,n){function l(e,n){return t(e,n,r)}var t=e("./baseFor"),r=e("../object/keys");n.exports=l},{"../object/keys":297,"./baseFor":224}],226:[function(e,n){function l(e,n){return t(e,n,r)}var t=e("./baseForRight"),r=e("../object/keys");n.exports=l},{"../object/keys":297,"./baseForRight":227}],227:[function(e,n){function l(e,n,l){for(var r=t(e),a=l(e),o=a.length;o--;){var u=a[o];if(n(r[u],u,r)===!1)break}return e}var t=e("./toObject");n.exports=l},{"./toObject":279}],228:[function(e,n){function l(e,n,l){if(n!==n)return t(e,l);for(var r=(l||0)-1,a=e.length;++r<a;)if(e[r]===n)return r;return-1}var t=e("./indexOfNaN");n.exports=l},{"./indexOfNaN":262}],229:[function(e,n){function l(e,n,r,a,o,u){if(e===n)return 0!==e||1/e==1/n;var s=typeof e,i=typeof n;return"function"!=s&&"object"!=s&&"function"!=i&&"object"!=i||null==e||null==n?e!==e&&n!==n:t(e,n,l,r,a,o,u)}var t=e("./baseIsEqualDeep");n.exports=l},{"./baseIsEqualDeep":230}],230:[function(e,n){function l(e,n,l,d,g,h,m){var y=o(e),x=o(n),b=i,_=i;y||(b=f.call(e),b==s?b=c:b!=c&&(y=u(e))),x||(_=f.call(n),_==s?_=c:_!=c&&(x=u(n)));var v=b==c,I=_==c,E=b==_;if(E&&!y&&!v)return r(e,n,b);var k=v&&p.call(e,"__wrapped__"),w=I&&p.call(n,"__wrapped__");if(k||w)return l(k?e.value():e,w?n.value():n,d,g,h,m);if(!E)return!1;h||(h=[]),m||(m=[]);for(var R=h.length;R--;)if(h[R]==e)return m[R]==n;h.push(e),m.push(n);var S=(y?t:a)(e,n,l,d,g,h,m);return h.pop(),m.pop(),S}var t=e("./equalArrays"),r=e("./equalByTag"),a=e("./equalObjects"),o=e("../lang/isArray"),u=e("../lang/isTypedArray"),s="[object Arguments]",i="[object Array]",c="[object Object]",d=Object.prototype,p=d.hasOwnProperty,f=d.toString;n.exports=l},{"../lang/isArray":283,"../lang/isTypedArray":292,"./equalArrays":258,"./equalByTag":259,"./equalObjects":260}],231:[function(e,n){function l(e,n,l,r,o){var u=n.length;if(null==e)return!u;for(var s=-1,i=!o;++s<u;)if(i&&r[s]?l[s]!==e[n[s]]:!a.call(e,n[s]))return!1;for(s=-1;++s<u;){var c=n[s];if(i&&r[s])var d=a.call(e,c);else{var p=e[c],f=l[s];d=o?o(p,f,c):void 0,"undefined"==typeof d&&(d=t(f,p,o,!0))}if(!d)return!1}return!0}var t=e("./baseIsEqual"),r=Object.prototype,a=r.hasOwnProperty;n.exports=l},{"./baseIsEqual":229}],232:[function(e,n){function l(e,n){var l=[];return t(e,function(e,t,r){l.push(n(e,t,r))}),l}var t=e("./baseEach");n.exports=l},{"./baseEach":221}],233:[function(e,n){function l(e){var n=a(e),l=n.length;if(1==l){var o=n[0],s=e[o];if(r(s))return function(e){return null!=e&&s===e[o]&&u.call(e,o)}}for(var i=Array(l),c=Array(l);l--;)s=e[n[l]],i[l]=s,c[l]=r(s);return function(e){return t(e,n,i,c)}}var t=e("./baseIsMatch"),r=e("./isStrictComparable"),a=e("../object/keys"),o=Object.prototype,u=o.hasOwnProperty;n.exports=l},{"../object/keys":297,"./baseIsMatch":231,"./isStrictComparable":271}],234:[function(e,n){function l(e,n){return r(n)?function(l){return null!=l&&l[e]===n}:function(l){return null!=l&&t(n,l[e],null,!0)}}var t=e("./baseIsEqual"),r=e("./isStrictComparable");n.exports=l},{"./baseIsEqual":229,"./isStrictComparable":271}],235:[function(e,n){function l(e){return function(n){return null==n?void 0:n[e]}}n.exports=l},{}],236:[function(e,n){function l(e,n,l,t,r){return r(e,function(e,r,a){l=t?(t=!1,e):n(l,e,r,a)}),l}n.exports=l},{}],237:[function(e,n){var l=e("../utility/identity"),t=e("./metaMap"),r=t?function(e,n){return t.set(e,n),e}:l;n.exports=r},{"../utility/identity":303,"./metaMap":273}],238:[function(e,n){function l(e,n){var l;return t(e,function(e,t,r){return l=n(e,t,r),!l}),!!l}var t=e("./baseEach");n.exports=l},{"./baseEach":221}],239:[function(e,n){function l(e,n){var l=e.length;for(e.sort(n);l--;)e[l]=e[l].value;return e}n.exports=l},{}],240:[function(e,n){function l(e){return"string"==typeof e?e:null==e?"":e+""}n.exports=l},{}],241:[function(e,n){function l(e,n){var l=-1,o=t,u=e.length,s=!0,i=s&&u>=200,c=i&&a(),d=[];c?(o=r,s=!1):(i=!1,c=n?[]:d);e:for(;++l<u;){var p=e[l],f=n?n(p,l,e):p;if(s&&p===p){for(var g=c.length;g--;)if(c[g]===f)continue e;n&&c.push(f),d.push(p)}else o(c,f)<0&&((n||i)&&c.push(f),d.push(p))}return d}var t=e("./baseIndexOf"),r=e("./cacheIndexOf"),a=e("./createCache");n.exports=l},{"./baseIndexOf":228,"./cacheIndexOf":245,"./createCache":253}],242:[function(e,n){function l(e,n){for(var l=-1,t=n.length,r=Array(t);++l<t;)r[l]=e[n[l]];return r}n.exports=l},{}],243:[function(e,n){function l(e,n,l){if("function"!=typeof e)return t;if("undefined"==typeof n)return e;switch(l){case 1:return function(l){return e.call(n,l)};case 3:return function(l,t,r){return e.call(n,l,t,r)};case 4:return function(l,t,r,a){return e.call(n,l,t,r,a)};case 5:return function(l,t,r,a,o){return e.call(n,l,t,r,a,o)}}return function(){return e.apply(n,arguments)}}var t=e("../utility/identity");n.exports=l},{"../utility/identity":303}],244:[function(e,n){(function(l){function t(e){return u.call(e,0)}var r=e("../utility/constant"),a=e("../lang/isNative"),o=a(o=l.ArrayBuffer)&&o,u=a(u=o&&new o(0).slice)&&u,s=Math.floor,i=a(i=l.Uint8Array)&&i,c=function(){try{var e=a(e=l.Float64Array)&&e,n=new e(new o(10),0,1)&&e}catch(t){}return n}(),d=c?c.BYTES_PER_ELEMENT:0;u||(t=o&&i?function(e){var n=e.byteLength,l=c?s(n/d):0,t=l*d,r=new o(n);if(l){var a=new c(r,0,l);a.set(new c(e,0,l))}return n!=t&&(a=new i(r,t),a.set(new i(e,t))),r}:r(null)),n.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lang/isNative":287,"../utility/constant":302}],245:[function(e,n){function l(e,n){var l=e.data,r="string"==typeof n||t(n)?l.set.has(n):l.hash[n];return r?0:-1}var t=e("../lang/isObject");n.exports=l},{"../lang/isObject":289}],246:[function(e,n){function l(e){var n=this.data;"string"==typeof e||t(e)?n.set.add(e):n.hash[e]=!0}var t=e("../lang/isObject");n.exports=l},{"../lang/isObject":289}],247:[function(e,n){function l(e,n){return t(e.criteria,n.criteria)||e.index-n.index}var t=e("./baseCompareAscending");n.exports=l},{"./baseCompareAscending":218}],248:[function(e,n){function l(e,n,l){for(var r=l.length,a=-1,o=t(e.length-r,0),u=-1,s=n.length,i=Array(o+s);++u<s;)i[u]=n[u];for(;++a<r;)i[l[a]]=e[a];for(;o--;)i[u++]=e[a++];return i}var t=Math.max;n.exports=l},{}],249:[function(e,n){function l(e,n,l){for(var r=-1,a=l.length,o=-1,u=t(e.length-a,0),s=-1,i=n.length,c=Array(u+i);++o<u;)c[o]=e[o];for(var d=o;++s<i;)c[d+s]=n[s];for(;++r<a;)c[d+l[r]]=e[o++];return c}var t=Math.max;n.exports=l},{}],250:[function(e,n){function l(e,n){return function(l,o,u){var s=n?n():{};if(o=t(o,u,3),a(l))for(var i=-1,c=l.length;++i<c;){var d=l[i];e(s,d,o(d,i,l),l)}else r(l,function(n,l,t){e(s,n,o(n,l,t),t)});return s}}var t=e("./baseCallback"),r=e("./baseEach"),a=e("../lang/isArray");n.exports=l},{"../lang/isArray":283,"./baseCallback":216,"./baseEach":221}],251:[function(e,n){function l(e){return function(){var n=arguments.length,l=arguments[0];if(2>n||null==l)return l;if(n>3&&r(arguments[1],arguments[2],arguments[3])&&(n=2),n>3&&"function"==typeof arguments[n-2])var a=t(arguments[--n-1],arguments[n--],5);else n>2&&"function"==typeof arguments[n-1]&&(a=arguments[--n]);for(var o=0;++o<n;){var u=arguments[o];u&&e(l,u,a)}return l}}var t=e("./bindCallback"),r=e("./isIterateeCall");n.exports=l},{"./bindCallback":243,"./isIterateeCall":268}],252:[function(e,n){function l(e,n){function l(){return(this instanceof l?r:e).apply(n,arguments)}var r=t(e);return l}var t=e("./createCtorWrapper");n.exports=l},{"./createCtorWrapper":254}],253:[function(e,n){(function(l){var t=e("./SetCache"),r=e("../utility/constant"),a=e("../lang/isNative"),o=a(o=l.Set)&&o,u=a(u=Object.create)&&u,s=u&&o?function(e){return new t(e)}:r(null);n.exports=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lang/isNative":287,"../utility/constant":302,"./SetCache":208}],254:[function(e,n){function l(e){return function(){var n=t(e.prototype),l=e.apply(n,arguments);return r(l)?l:n}}var t=e("./baseCreate"),r=e("../lang/isObject");n.exports=l},{"../lang/isObject":289,"./baseCreate":220}],255:[function(e,n){function l(e,n,x,b,_,v,I,E,k,w){function R(){for(var d=arguments.length,p=d,f=Array(d);p--;)f[p]=arguments[p];if(b&&(f=r(f,b,_)),v&&(f=a(f,v,I)),j||L){var m=R.placeholder,M=s(f,m);if(d-=M.length,w>d){var D=E?t(E):null,B=y(w-d,0),N=j?M:null,F=j?null:M,V=j?f:null,U=j?null:f;n|=j?g:h,n&=~(j?h:g),T||(n&=~(i|c));var q=l(e,n,x,V,N,U,F,D,k,B);return q.placeholder=m,q}}var G=C?x:this;return A&&(e=G[O]),E&&(f=u(f,E)),S&&k<f.length&&(f.length=k),(this instanceof R?P||o(e):e).apply(G,f)}var S=n&m,C=n&i,A=n&c,j=n&p,T=n&d,L=n&f,P=!A&&o(e),O=e;return R}var t=e("./arrayCopy"),r=e("./composeArgs"),a=e("./composeArgsRight"),o=e("./createCtorWrapper"),u=e("./reorder"),s=e("./replaceHolders"),i=1,c=2,d=4,p=8,f=16,g=32,h=64,m=256,y=Math.max;n.exports=l},{"./arrayCopy":209,"./composeArgs":248,"./composeArgsRight":249,"./createCtorWrapper":254,"./reorder":274,"./replaceHolders":275}],256:[function(e,n){function l(e,n,l,a){function o(){for(var n=-1,t=arguments.length,r=-1,i=a.length,c=Array(t+i);++r<i;)c[r]=a[r];for(;t--;)c[r++]=arguments[++n];return(this instanceof o?s:e).apply(u?l:this,c)}var u=n&r,s=t(e);return o}var t=e("./createCtorWrapper"),r=1;n.exports=l},{"./createCtorWrapper":254}],257:[function(e,n){function l(e,n,l,m,y,x,b,_){var v=n&d;if(!v&&"function"!=typeof e)throw new TypeError(g);var I=m?m.length:0;if(I||(n&=~(p|f),m=y=null),I-=y?y.length:0,n&f){var E=m,k=y;m=y=null}var w=!v&&u(e),R=[e,n,l,m,y,E,k,x,b,_];if(w&&w!==!0&&(s(R,w),n=R[1],_=R[9]),R[9]=null==_?v?0:e.length:h(_-I,0)||0,n==c)var S=r(R[0],R[2]);else S=n!=p&&n!=(c|p)||R[4].length?a.apply(void 0,R):o.apply(void 0,R);var C=w?t:i;return C(S,R)}var t=e("./baseSetData"),r=e("./createBindWrapper"),a=e("./createHybridWrapper"),o=e("./createPartialWrapper"),u=e("./getData"),s=e("./mergeData"),i=e("./setData"),c=1,d=2,p=32,f=64,g="Expected a function",h=Math.max;n.exports=l},{"./baseSetData":237,"./createBindWrapper":252,"./createHybridWrapper":255,"./createPartialWrapper":256,"./getData":261,"./mergeData":272,"./setData":276}],258:[function(e,n){function l(e,n,l,t,r,a,o){var u=-1,s=e.length,i=n.length,c=!0;if(s!=i&&!(r&&i>s))return!1;for(;c&&++u<s;){var d=e[u],p=n[u];if(c=void 0,t&&(c=r?t(p,d,u):t(d,p,u)),"undefined"==typeof c)if(r)for(var f=i;f--&&(p=n[f],!(c=d&&d===p||l(d,p,t,r,a,o))););else c=d&&d===p||l(d,p,t,r,a,o)}return!!c}n.exports=l},{}],259:[function(e,n){function l(e,n,l){switch(l){case t:case r:return+e==+n;case a:return e.name==n.name&&e.message==n.message;case o:return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case u:case s:return e==n+""}return!1}var t="[object Boolean]",r="[object Date]",a="[object Error]",o="[object Number]",u="[object RegExp]",s="[object String]";n.exports=l},{}],260:[function(e,n){function l(e,n,l,r,o,u,s){var i=t(e),c=i.length,d=t(n),p=d.length;if(c!=p&&!o)return!1;for(var f,g=-1;++g<c;){var h=i[g],m=a.call(n,h);if(m){var y=e[h],x=n[h];m=void 0,r&&(m=o?r(x,y,h):r(y,x,h)),"undefined"==typeof m&&(m=y&&y===x||l(y,x,r,o,u,s))}if(!m)return!1;f||(f="constructor"==h)}if(!f){var b=e.constructor,_=n.constructor;if(b!=_&&"constructor"in e&&"constructor"in n&&!("function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _))return!1}return!0}var t=e("../object/keys"),r=Object.prototype,a=r.hasOwnProperty;n.exports=l},{"../object/keys":297}],261:[function(e,n){var l=e("./metaMap"),t=e("../utility/noop"),r=l?function(e){return l.get(e)}:t;n.exports=r},{"../utility/noop":304,"./metaMap":273}],262:[function(e,n){function l(e,n,l){for(var t=e.length,r=l?n||t:(n||0)-1;l?r--:++r<t;){var a=e[r];if(a!==a)return r}return-1}n.exports=l},{}],263:[function(e,n){function l(e){var n=e.length,l=new e.constructor(n);return n&&"string"==typeof e[0]&&r.call(e,"index")&&(l.index=e.index,l.input=e.input),l}var t=Object.prototype,r=t.hasOwnProperty;n.exports=l},{}],264:[function(e,n){function l(e,n,l){var _=e.constructor;switch(n){case i:return t(e);case r:case a:return new _(+e);case c:case d:case p:case f:case g:case h:case m:case y:case x:var v=e.buffer;return new _(l?t(v):v,e.byteOffset,e.length);case o:case s:return new _(e);case u:var I=new _(e.source,b.exec(e));I.lastIndex=e.lastIndex}return I}var t=e("./bufferClone"),r="[object Boolean]",a="[object Date]",o="[object Number]",u="[object RegExp]",s="[object String]",i="[object ArrayBuffer]",c="[object Float32Array]",d="[object Float64Array]",p="[object Int8Array]",f="[object Int16Array]",g="[object Int32Array]",h="[object Uint8Array]",m="[object Uint8ClampedArray]",y="[object Uint16Array]",x="[object Uint32Array]",b=/\w*$/;n.exports=l},{"./bufferClone":244}],265:[function(e,n){function l(e){var n=e.constructor;return"function"==typeof n&&n instanceof n||(n=Object),new n}n.exports=l},{}],266:[function(e,n){function l(e){var n=!(a.funcNames?e.name:a.funcDecomp);if(!n){var l=s.call(e);a.funcNames||(n=!o.test(l)),n||(n=u.test(l)||r(e),t(e,n))}return n}var t=e("./baseSetData"),r=e("../lang/isNative"),a=e("../support"),o=/^\s*function[ \n\r\t]+\w/,u=/\bthis\b/,s=Function.prototype.toString;n.exports=l},{"../lang/isNative":287,"../support":301,"./baseSetData":237}],267:[function(e,n){function l(e,n){return e=+e,n=null==n?t:n,e>-1&&e%1==0&&n>e}var t=Math.pow(2,53)-1;n.exports=l},{}],268:[function(e,n){function l(e,n,l){if(!a(l))return!1;var o=typeof n;if("number"==o)var u=l.length,s=r(u)&&t(n,u);else s="string"==o&&n in l;return s&&l[n]===e}var t=e("./isIndex"),r=e("./isLength"),a=e("../lang/isObject");n.exports=l},{"../lang/isObject":289,"./isIndex":267,"./isLength":269}],269:[function(e,n){function l(e){return"number"==typeof e&&e>-1&&e%1==0&&t>=e}var t=Math.pow(2,53)-1;n.exports=l},{}],270:[function(e,n){function l(e){return e&&"object"==typeof e||!1}n.exports=l},{}],271:[function(e,n){function l(e){return e===e&&(0===e?1/e>0:!t(e))}var t=e("../lang/isObject");n.exports=l},{"../lang/isObject":289}],272:[function(e,n){function l(e,n){var l=e[1],h=n[1],m=l|h,y=p|d,x=u|s,b=y|x|i|c,_=l&p&&!(h&p),v=l&d&&!(h&d),I=(v?e:n)[7],E=(_?e:n)[8],k=!(l>=d&&h>x||l>x&&h>=d),w=m>=y&&b>=m&&(d>l||(v||_)&&I.length<=E);if(!k&&!w)return e;h&u&&(e[2]=n[2],m|=l&u?0:i);var R=n[3];if(R){var S=e[3];e[3]=S?r(S,R,n[4]):t(R),e[4]=S?o(e[3],f):t(n[4])}return R=n[5],R&&(S=e[5],e[5]=S?a(S,R,n[6]):t(R),e[6]=S?o(e[5],f):t(n[6])),R=n[7],R&&(e[7]=t(R)),h&p&&(e[8]=null==e[8]?n[8]:g(e[8],n[8])),null==e[9]&&(e[9]=n[9]),e[0]=n[0],e[1]=m,e}var t=e("./arrayCopy"),r=e("./composeArgs"),a=e("./composeArgsRight"),o=e("./replaceHolders"),u=1,s=2,i=4,c=16,d=128,p=256,f="__lodash_placeholder__",g=Math.min;n.exports=l},{"./arrayCopy":209,"./composeArgs":248,"./composeArgsRight":249,"./replaceHolders":275}],273:[function(e,n){(function(l){var t=e("../lang/isNative"),r=t(r=l.WeakMap)&&r,a=r&&new r;n.exports=a}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lang/isNative":287}],274:[function(e,n){function l(e,n){for(var l=e.length,o=a(n.length,l),u=t(e);o--;){var s=n[o];e[o]=r(s,l)?u[s]:void 0}return e}var t=e("./arrayCopy"),r=e("./isIndex"),a=Math.min;n.exports=l},{"./arrayCopy":209,"./isIndex":267}],275:[function(e,n){function l(e,n){for(var l=-1,r=e.length,a=-1,o=[];++l<r;)e[l]===n&&(e[l]=t,o[++a]=l);return o}var t="__lodash_placeholder__";n.exports=l},{}],276:[function(e,n){var l=e("./baseSetData"),t=e("../date/now"),r=150,a=16,o=function(){var e=0,n=0;return function(o,u){var s=t(),i=a-(s-n);if(n=s,i>0){if(++e>=r)return o}else e=0;return l(o,u)}}();n.exports=o},{"../date/now":206,"./baseSetData":237}],277:[function(e,n){function l(e){for(var n=u(e),l=n.length,i=l&&e.length,d=i&&o(i)&&(r(e)||s.nonEnumArgs&&t(e)),p=-1,f=[];++p<l;){var g=n[p];(d&&a(g,i)||c.call(e,g))&&f.push(g)}return f}var t=e("../lang/isArguments"),r=e("../lang/isArray"),a=e("./isIndex"),o=e("./isLength"),u=e("../object/keysIn"),s=e("../support"),i=Object.prototype,c=i.hasOwnProperty;n.exports=l},{"../lang/isArguments":282,"../lang/isArray":283,"../object/keysIn":298,"../support":301,"./isIndex":267,"./isLength":269}],278:[function(e,n){function l(e,n){for(var l,t=-1,r=e.length,a=-1,o=[];++t<r;){var u=e[t],s=n?n(u,t,e):u;t&&l===s||(l=s,o[++a]=u)}return o}n.exports=l},{}],279:[function(e,n){function l(e){return t(e)?e:Object(e)}var t=e("../lang/isObject");n.exports=l},{"../lang/isObject":289}],280:[function(e,n){function l(e,n,l,o){return"boolean"!=typeof n&&null!=n&&(o=l,l=a(e,n,o)?null:n,n=!1),l="function"==typeof l&&r(l,o,1),t(e,n,l)}var t=e("../internal/baseClone"),r=e("../internal/bindCallback"),a=e("../internal/isIterateeCall");n.exports=l},{"../internal/baseClone":217,"../internal/bindCallback":243,"../internal/isIterateeCall":268}],281:[function(e,n){function l(e,n,l){return n="function"==typeof n&&r(n,l,1),t(e,!0,n)}var t=e("../internal/baseClone"),r=e("../internal/bindCallback");n.exports=l},{"../internal/baseClone":217,"../internal/bindCallback":243}],282:[function(e,n){function l(e){var n=r(e)?e.length:void 0;return t(n)&&u.call(e)==a||!1}var t=e("../internal/isLength"),r=e("../internal/isObjectLike"),a="[object Arguments]",o=Object.prototype,u=o.toString;n.exports=l},{"../internal/isLength":269,"../internal/isObjectLike":270}],283:[function(e,n){var l=e("../internal/isLength"),t=e("./isNative"),r=e("../internal/isObjectLike"),a="[object Array]",o=Object.prototype,u=o.toString,s=t(s=Array.isArray)&&s,i=s||function(e){return r(e)&&l(e.length)&&u.call(e)==a||!1};n.exports=i},{"../internal/isLength":269,"../internal/isObjectLike":270,"./isNative":287}],284:[function(e,n){function l(e){return e===!0||e===!1||t(e)&&o.call(e)==r||!1}var t=e("../internal/isObjectLike"),r="[object Boolean]",a=Object.prototype,o=a.toString;n.exports=l},{"../internal/isObjectLike":270}],285:[function(e,n){function l(e){if(null==e)return!0;var n=e.length;return o(n)&&(r(e)||s(e)||t(e)||u(e)&&a(e.splice))?!n:!i(e).length}var t=e("./isArguments"),r=e("./isArray"),a=e("./isFunction"),o=e("../internal/isLength"),u=e("../internal/isObjectLike"),s=e("./isString"),i=e("../object/keys");n.exports=l},{"../internal/isLength":269,"../internal/isObjectLike":270,"../object/keys":297,"./isArguments":282,"./isArray":283,"./isFunction":286,"./isString":291}],286:[function(e,n){(function(l){function t(e){return"function"==typeof e||!1}var r=e("./isNative"),a="[object Function]",o=Object.prototype,u=o.toString,s=r(s=l.Uint8Array)&&s;(t(/x/)||s&&!t(s))&&(t=function(e){return u.call(e)==a}),n.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./isNative":287}],287:[function(e,n){function l(e){return null==e?!1:i.call(e)==a?c.test(s.call(e)):r(e)&&o.test(e)||!1}var t=e("../string/escapeRegExp"),r=e("../internal/isObjectLike"),a="[object Function]",o=/^\[object .+?Constructor\]$/,u=Object.prototype,s=Function.prototype.toString,i=u.toString,c=RegExp("^"+t(i).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");n.exports=l},{"../internal/isObjectLike":270,"../string/escapeRegExp":300}],288:[function(e,n){function l(e){return"number"==typeof e||t(e)&&o.call(e)==r||!1}var t=e("../internal/isObjectLike"),r="[object Number]",a=Object.prototype,o=a.toString;n.exports=l},{"../internal/isObjectLike":270}],289:[function(e,n){function l(e){var n=typeof e;return"function"==n||e&&"object"==n||!1}n.exports=l},{}],290:[function(e,n){function l(e){return t(e)&&o.call(e)==r||!1}var t=e("../internal/isObjectLike"),r="[object RegExp]",a=Object.prototype,o=a.toString;n.exports=l},{"../internal/isObjectLike":270}],291:[function(e,n){function l(e){return"string"==typeof e||t(e)&&o.call(e)==r||!1}var t=e("../internal/isObjectLike"),r="[object String]",a=Object.prototype,o=a.toString;n.exports=l},{"../internal/isObjectLike":270}],292:[function(e,n){function l(e){return r(e)&&t(e.length)&&C[j.call(e)]||!1}var t=e("../internal/isLength"),r=e("../internal/isObjectLike"),a="[object Arguments]",o="[object Array]",u="[object Boolean]",s="[object Date]",i="[object Error]",c="[object Function]",d="[object Map]",p="[object Number]",f="[object Object]",g="[object RegExp]",h="[object Set]",m="[object String]",y="[object WeakMap]",x="[object ArrayBuffer]",b="[object Float32Array]",_="[object Float64Array]",v="[object Int8Array]",I="[object Int16Array]",E="[object Int32Array]",k="[object Uint8Array]",w="[object Uint8ClampedArray]",R="[object Uint16Array]",S="[object Uint32Array]",C={};C[b]=C[_]=C[v]=C[I]=C[E]=C[k]=C[w]=C[R]=C[S]=!0,C[a]=C[o]=C[x]=C[u]=C[s]=C[i]=C[c]=C[d]=C[p]=C[f]=C[g]=C[h]=C[m]=C[y]=!1;var A=Object.prototype,j=A.toString;n.exports=l},{"../internal/isLength":269,"../internal/isObjectLike":270}],293:[function(e,n){var l=e("../internal/baseAssign"),t=e("../internal/createAssigner"),r=t(l);n.exports=r},{"../internal/baseAssign":215,"../internal/createAssigner":251}],294:[function(e,n){function l(e){if(null==e)return e;var n=t(arguments);return n.push(a),r.apply(void 0,n)}var t=e("../internal/arrayCopy"),r=e("./assign"),a=e("../internal/assignDefaults");n.exports=l},{"../internal/arrayCopy":209,"../internal/assignDefaults":214,"./assign":293}],295:[function(e,n){n.exports=e("./assign")},{"./assign":293}],296:[function(e,n){function l(e,n){return e?r.call(e,n):!1}var t=Object.prototype,r=t.hasOwnProperty;n.exports=l},{}],297:[function(e,n){var l=e("../internal/isLength"),t=e("../lang/isNative"),r=e("../lang/isObject"),a=e("../internal/shimKeys"),o=t(o=Object.keys)&&o,u=o?function(e){if(e)var n=e.constructor,t=e.length;return"function"==typeof n&&n.prototype===e||"function"!=typeof e&&t&&l(t)?a(e):r(e)?o(e):[]}:a;n.exports=u},{"../internal/isLength":269,"../internal/shimKeys":277,"../lang/isNative":287,"../lang/isObject":289}],298:[function(e,n){function l(e){if(null==e)return[];u(e)||(e=Object(e));var n=e.length;n=n&&o(n)&&(r(e)||s.nonEnumArgs&&t(e))&&n||0;for(var l=e.constructor,i=-1,d="function"==typeof l&&l.prototype===e,p=Array(n),f=n>0;++i<n;)p[i]=i+"";for(var g in e)f&&a(g,n)||"constructor"==g&&(d||!c.call(e,g))||p.push(g);return p}var t=e("../lang/isArguments"),r=e("../lang/isArray"),a=e("../internal/isIndex"),o=e("../internal/isLength"),u=e("../lang/isObject"),s=e("../support"),i=Object.prototype,c=i.hasOwnProperty;n.exports=l},{"../internal/isIndex":267,"../internal/isLength":269,"../lang/isArguments":282,"../lang/isArray":283,"../lang/isObject":289,"../support":301}],299:[function(e,n){function l(e){return t(e,r(e))}var t=e("../internal/baseValues"),r=e("./keys");n.exports=l},{"../internal/baseValues":242,"./keys":297}],300:[function(e,n){function l(e){return e=t(e),e&&a.test(e)?e.replace(r,"\\$&"):e}var t=e("../internal/baseToString"),r=/[.*+?^${}()|[\]\/\\]/g,a=RegExp(r.source);n.exports=l},{"../internal/baseToString":240}],301:[function(e,n){(function(l){var t=e("./lang/isNative"),r=/\bthis\b/,a=Object.prototype,o=(o=l.window)&&o.document,u=a.propertyIsEnumerable,s={};!function(){s.funcDecomp=!t(l.WinRTError)&&r.test(function(){return this}),s.funcNames="string"==typeof Function.name;try{s.dom=11===o.createDocumentFragment().nodeType}catch(e){s.dom=!1}try{s.nonEnumArgs=!u.call(arguments,1)}catch(e){s.nonEnumArgs=!0}}(0,0),n.exports=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lang/isNative":287}],302:[function(e,n){function l(e){return function(){return e}}n.exports=l},{}],303:[function(e,n){function l(e){return e}n.exports=l},{}],304:[function(e,n){function l(){}n.exports=l},{}],305:[function(e,n,l){"use strict";function t(e,n,l){if(d)try{d.call(c,e,n,{value:l})}catch(t){e[n]=l}else e[n]=l}function r(e){return e&&(t(e,"call",e.call),t(e,"apply",e.apply)),e}function a(e){return p?p.call(c,e):(m.prototype=e||null,new m)}function o(){do var e=u(h.call(g.call(y(),36),2));while(f.call(x,e));return x[e]=e}function u(e){var n={};return n[e]=!0,Object.keys(n)[0]}function s(){return a(null)}function i(e){function n(n){function l(l,t){return l===u?t?a=null:a||(a=e(n)):void 0}var a;t(n,r,l)}function l(e){return f.call(e,r)||n(e),e[r](u)}var r=o(),u=a(null);return e=e||s,l.forget=function(e){f.call(e,r)&&e[r](u,!0)},l}var c=Object,d=Object.defineProperty,p=Object.create;r(d),r(p);var f=r(Object.prototype.hasOwnProperty),g=r(Number.prototype.toString),h=r(String.prototype.slice),m=function(){},y=Math.random,x=a(null);t(l,"makeUniqueKey",o);var b=Object.getOwnPropertyNames;Object.getOwnPropertyNames=function(e){for(var n=b(e),l=0,t=0,r=n.length;r>l;++l)f.call(x,n[l])||(l>t&&(n[t]=n[l]),++t);return n.length=t,n},t(l,"makeAccessor",i)},{}],306:[function(e,n,l){function t(e){s.ok(this instanceof t),d.Identifier.assert(e),Object.defineProperties(this,{contextId:{value:e},listing:{value:[]},marked:{value:[!0]},finalLoc:{value:r()},tryEntries:{value:[]}}),Object.defineProperties(this,{leapManager:{value:new p.LeapManager(this)}})}function r(){return c.literal(-1)}function a(e){return d.BreakStatement.check(e)||d.ContinueStatement.check(e)||d.ReturnStatement.check(e)||d.ThrowStatement.check(e)}function o(e){return new Error("all declarations should have been transformed into assignments before the Exploder began its work: "+JSON.stringify(e))}function u(e){var n=e.type;return"normal"===n?!h.call(e,"target"):"break"===n||"continue"===n?!h.call(e,"value")&&d.Literal.check(e.target):"return"===n||"throw"===n?h.call(e,"value")&&!h.call(e,"target"):!1}var s=e("assert"),i=e("ast-types"),c=(i.builtInTypes.array,i.builders),d=i.namedTypes,p=e("./leap"),f=e("./meta"),g=e("./util"),h=Object.prototype.hasOwnProperty,m=t.prototype;l.Emitter=t,m.mark=function(e){d.Literal.assert(e);var n=this.listing.length;return-1===e.value?e.value=n:s.strictEqual(e.value,n),this.marked[n]=!0,e},m.emit=function(e){d.Expression.check(e)&&(e=c.expressionStatement(e)),d.Statement.assert(e),this.listing.push(e)},m.emitAssign=function(e,n){return this.emit(this.assign(e,n)),e},m.assign=function(e,n){return c.expressionStatement(c.assignmentExpression("=",e,n))},m.contextProperty=function(e,n){return c.memberExpression(this.contextId,n?c.literal(e):c.identifier(e),!!n)};var y={prev:!0,next:!0,sent:!0,rval:!0};m.isVolatileContextProperty=function(e){if(d.MemberExpression.check(e)){if(e.computed)return!0;if(d.Identifier.check(e.object)&&d.Identifier.check(e.property)&&e.object.name===this.contextId.name&&h.call(y,e.property.name))return!0}return!1},m.stop=function(e){e&&this.setReturnValue(e),this.jump(this.finalLoc)},m.setReturnValue=function(e){d.Expression.assert(e.value),this.emitAssign(this.contextProperty("rval"),this.explodeExpression(e))},m.clearPendingException=function(e,n){d.Literal.assert(e);var l=c.callExpression(this.contextProperty("catch",!0),[e]);n?this.emitAssign(n,l):this.emit(l)},m.jump=function(e){this.emitAssign(this.contextProperty("next"),e),this.emit(c.breakStatement())},m.jumpIf=function(e,n){d.Expression.assert(e),d.Literal.assert(n),this.emit(c.ifStatement(e,c.blockStatement([this.assign(this.contextProperty("next"),n),c.breakStatement()])))},m.jumpIfNot=function(e,n){d.Expression.assert(e),d.Literal.assert(n);var l;l=d.UnaryExpression.check(e)&&"!"===e.operator?e.argument:c.unaryExpression("!",e),this.emit(c.ifStatement(l,c.blockStatement([this.assign(this.contextProperty("next"),n),c.breakStatement()])))};var x=0;m.makeTempVar=function(){return this.contextProperty("t"+x++)},m.getContextFunction=function(e){var n=c.functionExpression(e||null,[this.contextId],c.blockStatement([this.getDispatchLoop()]),!1,!1);return n._aliasFunction=!0,n},m.getDispatchLoop=function(){var e,n=this,l=[],t=!1;return n.listing.forEach(function(r,o){n.marked.hasOwnProperty(o)&&(l.push(c.switchCase(c.literal(o),e=[])),t=!1),t||(e.push(r),a(r)&&(t=!0))}),this.finalLoc.value=this.listing.length,l.push(c.switchCase(this.finalLoc,[]),c.switchCase(c.literal("end"),[c.returnStatement(c.callExpression(this.contextProperty("stop"),[]))])),c.whileStatement(c.literal(1),c.switchStatement(c.assignmentExpression("=",this.contextProperty("prev"),this.contextProperty("next")),l))},m.getTryLocsList=function(){if(0===this.tryEntries.length)return null;var e=0;return c.arrayExpression(this.tryEntries.map(function(n){var l=n.firstLoc.value;s.ok(l>=e,"try entries out of order"),e=l;var t=n.catchEntry,r=n.finallyEntry,a=[n.firstLoc,t?t.firstLoc:null];return r&&(a[2]=r.firstLoc,a[3]=r.afterLoc),c.arrayExpression(a)}))},m.explode=function(e,n){s.ok(e instanceof i.NodePath);var l=e.value,t=this;if(d.Node.assert(l),d.Statement.check(l))return t.explodeStatement(e);if(d.Expression.check(l))return t.explodeExpression(e,n);if(d.Declaration.check(l))throw o(l);switch(l.type){case"Program":return e.get("body").map(t.explodeStatement,t);case"VariableDeclarator":throw o(l);case"Property":case"SwitchCase":case"CatchClause":throw new Error(l.type+" nodes should be handled by their parents");default:throw new Error("unknown Node of type "+JSON.stringify(l.type))}},m.explodeStatement=function(e,n){s.ok(e instanceof i.NodePath);var l=e.value,t=this;if(d.Statement.assert(l),n?d.Identifier.assert(n):n=null,d.BlockStatement.check(l))return e.get("body").each(t.explodeStatement,t);if(!f.containsLeap(l))return void t.emit(l);switch(l.type){case"ExpressionStatement":t.explodeExpression(e.get("expression"),!0);break;case"LabeledStatement":var a=r();t.leapManager.withEntry(new p.LabeledEntry(a,l.label),function(){t.explodeStatement(e.get("body"),l.label)}),t.mark(a);break;case"WhileStatement":var o=r(),a=r();t.mark(o),t.jumpIfNot(t.explodeExpression(e.get("test")),a),t.leapManager.withEntry(new p.LoopEntry(a,o,n),function(){t.explodeStatement(e.get("body"))}),t.jump(o),t.mark(a);break;case"DoWhileStatement":var u=r(),h=r(),a=r();t.mark(u),t.leapManager.withEntry(new p.LoopEntry(a,h,n),function(){t.explode(e.get("body"))}),t.mark(h),t.jumpIf(t.explodeExpression(e.get("test")),u),t.mark(a);break;case"ForStatement":var m=r(),y=r(),a=r();l.init&&t.explode(e.get("init"),!0),t.mark(m),l.test&&t.jumpIfNot(t.explodeExpression(e.get("test")),a),t.leapManager.withEntry(new p.LoopEntry(a,y,n),function(){t.explodeStatement(e.get("body"))}),t.mark(y),l.update&&t.explode(e.get("update"),!0),t.jump(m),t.mark(a);break;case"ForInStatement":d.Identifier.assert(l.left);var m=r(),a=r(),x=t.makeTempVar();t.emitAssign(x,c.callExpression(g.runtimeProperty("keys"),[t.explodeExpression(e.get("right"))])),t.mark(m);var b=t.makeTempVar();t.jumpIf(c.memberExpression(c.assignmentExpression("=",b,c.callExpression(x,[])),c.identifier("done"),!1),a),t.emitAssign(l.left,c.memberExpression(b,c.identifier("value"),!1)),t.leapManager.withEntry(new p.LoopEntry(a,m,n),function(){t.explodeStatement(e.get("body"))}),t.jump(m),t.mark(a);break;case"BreakStatement":t.emitAbruptCompletion({type:"break",target:t.leapManager.getBreakLoc(l.label)});break;case"ContinueStatement":t.emitAbruptCompletion({type:"continue",target:t.leapManager.getContinueLoc(l.label)});break;case"SwitchStatement":for(var _=t.emitAssign(t.makeTempVar(),t.explodeExpression(e.get("discriminant"))),a=r(),v=r(),I=v,E=[],k=l.cases||[],w=k.length-1;w>=0;--w){var R=k[w];d.SwitchCase.assert(R),R.test?I=c.conditionalExpression(c.binaryExpression("===",_,R.test),E[w]=r(),I):E[w]=v}t.jump(t.explodeExpression(new i.NodePath(I,e,"discriminant"))),t.leapManager.withEntry(new p.SwitchEntry(a),function(){e.get("cases").each(function(e){var n=(e.value,e.name);t.mark(E[n]),e.get("consequent").each(t.explodeStatement,t)})}),t.mark(a),-1===v.value&&(t.mark(v),s.strictEqual(a.value,v.value));break;case"IfStatement":var S=l.alternate&&r(),a=r();
t.jumpIfNot(t.explodeExpression(e.get("test")),S||a),t.explodeStatement(e.get("consequent")),S&&(t.jump(a),t.mark(S),t.explodeStatement(e.get("alternate"))),t.mark(a);break;case"ReturnStatement":t.emitAbruptCompletion({type:"return",value:t.explodeExpression(e.get("argument"))});break;case"WithStatement":throw new Error(node.type+" not supported in generator functions.");case"TryStatement":var a=r(),C=l.handler;!C&&l.handlers&&(C=l.handlers[0]||null);var A=C&&r(),j=A&&new p.CatchEntry(A,C.param),T=l.finalizer&&r(),L=T&&new p.FinallyEntry(T,a),P=new p.TryEntry(t.getUnmarkedCurrentLoc(),j,L);t.tryEntries.push(P),t.updateContextPrevLoc(P.firstLoc),t.leapManager.withEntry(P,function(){if(t.explodeStatement(e.get("block")),A){t.jump(T?T:a),t.updateContextPrevLoc(t.mark(A));var n=e.get("handler","body"),l=t.makeTempVar();t.clearPendingException(P.firstLoc,l);var r=n.scope,o=C.param.name;d.CatchClause.assert(r.node),s.strictEqual(r.lookup(o),r),i.visit(n,{visitIdentifier:function(e){return g.isReference(e,o)&&e.scope.lookup(o)===r?l:void this.traverse(e)},visitFunction:function(e){return e.scope.declares(o)?!1:void this.traverse(e)}}),t.leapManager.withEntry(j,function(){t.explodeStatement(n)})}T&&(t.updateContextPrevLoc(t.mark(T)),t.leapManager.withEntry(L,function(){t.explodeStatement(e.get("finalizer"))}),t.emit(c.returnStatement(c.callExpression(t.contextProperty("finish"),[L.firstLoc]))))}),t.mark(a);break;case"ThrowStatement":t.emit(c.throwStatement(t.explodeExpression(e.get("argument"))));break;default:throw new Error("unknown Statement of type "+JSON.stringify(l.type))}},m.emitAbruptCompletion=function(e){u(e)||s.ok(!1,"invalid completion record: "+JSON.stringify(e)),s.notStrictEqual(e.type,"normal","normal completions are not abrupt");var n=[c.literal(e.type)];"break"===e.type||"continue"===e.type?(d.Literal.assert(e.target),n[1]=e.target):("return"===e.type||"throw"===e.type)&&e.value&&(d.Expression.assert(e.value),n[1]=e.value),this.emit(c.returnStatement(c.callExpression(this.contextProperty("abrupt"),n)))},m.getUnmarkedCurrentLoc=function(){return c.literal(this.listing.length)},m.updateContextPrevLoc=function(e){e?(d.Literal.assert(e),-1===e.value?e.value=this.listing.length:s.strictEqual(e.value,this.listing.length)):e=this.getUnmarkedCurrentLoc(),this.emitAssign(this.contextProperty("prev"),e)},m.explodeExpression=function(e,n){function l(e){return d.Expression.assert(e),n?void u.emit(e):e}function t(e,n,l){s.ok(n instanceof i.NodePath),s.ok(!l||!e,"Ignoring the result of a child expression but forcing it to be assigned to a temporary variable?");var t=u.explodeExpression(n,l);return l||(e||p&&(u.isVolatileContextProperty(t)||f.hasSideEffects(t)))&&(t=u.emitAssign(e||u.makeTempVar(),t)),t}s.ok(e instanceof i.NodePath);var a=e.value;if(!a)return a;d.Expression.assert(a);var o,u=this;if(!f.containsLeap(a))return l(a);var p=f.containsLeap.onlyChildren(a);switch(a.type){case"MemberExpression":return l(c.memberExpression(u.explodeExpression(e.get("object")),a.computed?t(null,e.get("property")):a.property,a.computed));case"CallExpression":var g=e.get("callee"),h=u.explodeExpression(g);return!d.MemberExpression.check(g.node)&&d.MemberExpression.check(h)&&(h=c.sequenceExpression([c.literal(0),h])),l(c.callExpression(h,e.get("arguments").map(function(e){return t(null,e)})));case"NewExpression":return l(c.newExpression(t(null,e.get("callee")),e.get("arguments").map(function(e){return t(null,e)})));case"ObjectExpression":return l(c.objectExpression(e.get("properties").map(function(e){return c.property(e.value.kind,e.value.key,t(null,e.get("value")))})));case"ArrayExpression":return l(c.arrayExpression(e.get("elements").map(function(e){return t(null,e)})));case"SequenceExpression":var m=a.expressions.length-1;return e.get("expressions").each(function(e){e.name===m?o=u.explodeExpression(e,n):u.explodeExpression(e,!0)}),o;case"LogicalExpression":var y=r();n||(o=u.makeTempVar());var x=t(o,e.get("left"));return"&&"===a.operator?u.jumpIfNot(x,y):(s.strictEqual(a.operator,"||"),u.jumpIf(x,y)),t(o,e.get("right"),n),u.mark(y),o;case"ConditionalExpression":var b=r(),y=r(),_=u.explodeExpression(e.get("test"));return u.jumpIfNot(_,b),n||(o=u.makeTempVar()),t(o,e.get("consequent"),n),u.jump(y),u.mark(b),t(o,e.get("alternate"),n),u.mark(y),o;case"UnaryExpression":return l(c.unaryExpression(a.operator,u.explodeExpression(e.get("argument")),!!a.prefix));case"BinaryExpression":return l(c.binaryExpression(a.operator,t(null,e.get("left")),t(null,e.get("right"))));case"AssignmentExpression":return l(c.assignmentExpression(a.operator,u.explodeExpression(e.get("left")),u.explodeExpression(e.get("right"))));case"UpdateExpression":return l(c.updateExpression(a.operator,u.explodeExpression(e.get("argument")),a.prefix));case"YieldExpression":var y=r(),v=a.argument&&u.explodeExpression(e.get("argument"));if(v&&a.delegate){var o=u.makeTempVar();return u.emit(c.returnStatement(c.callExpression(u.contextProperty("delegateYield"),[v,c.literal(o.property.name),y]))),u.mark(y),o}return u.emitAssign(u.contextProperty("next"),y),u.emit(c.returnStatement(v||null)),u.mark(y),u.contextProperty("sent");default:throw new Error("unknown Expression of type "+JSON.stringify(a.type))}}},{"./leap":308,"./meta":309,"./util":310,assert:139,"ast-types":137}],307:[function(e,n,l){var t=e("assert"),r=e("ast-types"),a=r.namedTypes,o=r.builders,u=Object.prototype.hasOwnProperty;l.hoist=function(e){function n(e,n){a.VariableDeclaration.assert(e);var t=[];return e.declarations.forEach(function(e){l[e.id.name]=e.id,e.init?t.push(o.assignmentExpression("=",e.id,e.init)):n&&t.push(e.id)}),0===t.length?null:1===t.length?t[0]:o.sequenceExpression(t)}t.ok(e instanceof r.NodePath),a.Function.assert(e.value);var l={};r.visit(e.get("body"),{visitVariableDeclaration:function(e){var l=n(e.value,!1);return null!==l?o.expressionStatement(l):(e.replace(),!1)},visitForStatement:function(e){var l=e.value.init;a.VariableDeclaration.check(l)&&e.get("init").replace(n(l,!1)),this.traverse(e)},visitForInStatement:function(e){var l=e.value.left;a.VariableDeclaration.check(l)&&e.get("left").replace(n(l,!0)),this.traverse(e)},visitFunctionDeclaration:function(e){var n=e.value;l[n.id.name]=n.id;var t=(e.parent.node,o.expressionStatement(o.assignmentExpression("=",n.id,o.functionExpression(n.id,n.params,n.body,n.generator,n.expression))));return a.BlockStatement.check(e.parent.node)?(e.parent.get("body").unshift(t),e.replace()):e.replace(t),!1},visitFunctionExpression:function(){return!1}});var s={};e.get("params").each(function(e){var n=e.value;a.Identifier.check(n)&&(s[n.name]=n)});var i=[];return Object.keys(l).forEach(function(e){u.call(s,e)||i.push(o.variableDeclarator(l[e],null))}),0===i.length?null:o.variableDeclaration("var",i)}},{assert:139,"ast-types":137}],308:[function(e,n,l){function t(){p.ok(this instanceof t)}function r(e){t.call(this),g.Literal.assert(e),this.returnLoc=e}function a(e,n,l){t.call(this),g.Literal.assert(e),g.Literal.assert(n),l?g.Identifier.assert(l):l=null,this.breakLoc=e,this.continueLoc=n,this.label=l}function o(e){t.call(this),g.Literal.assert(e),this.breakLoc=e}function u(e,n,l){t.call(this),g.Literal.assert(e),n?p.ok(n instanceof s):n=null,l?p.ok(l instanceof i):l=null,p.ok(n||l),this.firstLoc=e,this.catchEntry=n,this.finallyEntry=l}function s(e,n){t.call(this),g.Literal.assert(e),g.Identifier.assert(n),this.firstLoc=e,this.paramId=n}function i(e,n){t.call(this),g.Literal.assert(e),g.Literal.assert(n),this.firstLoc=e,this.afterLoc=n}function c(e,n){t.call(this),g.Literal.assert(e),g.Identifier.assert(n),this.breakLoc=e,this.label=n}function d(n){p.ok(this instanceof d);var l=e("./emit").Emitter;p.ok(n instanceof l),this.emitter=n,this.entryStack=[new r(n.finalLoc)]}{var p=e("assert"),f=e("ast-types"),g=f.namedTypes,h=(f.builders,e("util").inherits);Object.prototype.hasOwnProperty}h(r,t),l.FunctionEntry=r,h(a,t),l.LoopEntry=a,h(o,t),l.SwitchEntry=o,h(u,t),l.TryEntry=u,h(s,t),l.CatchEntry=s,h(i,t),l.FinallyEntry=i,h(c,t),l.LabeledEntry=c;var m=d.prototype;l.LeapManager=d,m.withEntry=function(e,n){p.ok(e instanceof t),this.entryStack.push(e);try{n.call(this.emitter)}finally{var l=this.entryStack.pop();p.strictEqual(l,e)}},m._findLeapLocation=function(e,n){for(var l=this.entryStack.length-1;l>=0;--l){var t=this.entryStack[l],r=t[e];if(r)if(n){if(t.label&&t.label.name===n.name)return r}else if(!(t instanceof c))return r}return null},m.getBreakLoc=function(e){return this._findLeapLocation("breakLoc",e)},m.getContinueLoc=function(e){return this._findLeapLocation("continueLoc",e)}},{"./emit":306,assert:139,"ast-types":137,util:164}],309:[function(e,n,l){function t(e,n){function l(e){function n(e){return l||(u.check(e)?e.some(n):s.Node.check(e)&&(r.strictEqual(l,!1),l=t(e))),l}s.Node.assert(e);var l=!1;return o.eachField(e,function(e,l){n(l)}),l}function t(t){s.Node.assert(t);var r=a(t);return i.call(r,e)?r[e]:r[e]=i.call(c,t.type)?!1:i.call(n,t.type)?!0:l(t)}return t.onlyChildren=l,t}var r=e("assert"),a=e("private").makeAccessor(),o=e("ast-types"),u=o.builtInTypes.array,s=o.namedTypes,i=Object.prototype.hasOwnProperty,c={FunctionExpression:!0},d={CallExpression:!0,ForInStatement:!0,UnaryExpression:!0,BinaryExpression:!0,AssignmentExpression:!0,UpdateExpression:!0,NewExpression:!0},p={YieldExpression:!0,BreakStatement:!0,ContinueStatement:!0,ReturnStatement:!0,ThrowStatement:!0};for(var f in p)i.call(p,f)&&(d[f]=p[f]);l.hasSideEffects=t("hasSideEffects",d),l.containsLeap=t("containsLeap",p)},{assert:139,"ast-types":137,"private":305}],310:[function(e,n,l){var t=(e("assert"),e("ast-types")),r=t.namedTypes,a=t.builders,o=Object.prototype.hasOwnProperty;l.defaults=function(e){for(var n,l=arguments.length,t=1;l>t;++t)if(n=arguments[t])for(var r in n)o.call(n,r)&&!o.call(e,r)&&(e[r]=n[r]);return e},l.runtimeProperty=function(e){return a.memberExpression(a.identifier("regeneratorRuntime"),a.identifier(e),!1)},l.isReference=function(e,n){var l=e.value;if(!r.Identifier.check(l))return!1;if(n&&l.name!==n)return!1;var t=e.parent.value;switch(t.type){case"VariableDeclarator":return"init"===e.name;case"MemberExpression":return"object"===e.name||t.computed&&"property"===e.name;case"FunctionExpression":case"FunctionDeclaration":case"ArrowFunctionExpression":return"id"===e.name?!1:t.params===e.parentPath&&t.params[e.name]===l?!1:!0;case"ClassDeclaration":case"ClassExpression":return"id"!==e.name;case"CatchClause":return"param"!==e.name;case"Property":case"MethodDefinition":return"key"!==e.name;case"ImportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"LabeledStatement":return!1;default:return!0}}},{assert:139,"ast-types":137}],311:[function(e,n,l){var t=(e("assert"),e("fs"),e("ast-types")),r=t.namedTypes,a=t.builders,o=(t.builtInTypes.array,t.builtInTypes.object,t.NodePath),u=e("./hoist").hoist,s=e("./emit").Emitter,i=e("./util").runtimeProperty;l.transform=function(e,n){n=n||{};var l=e instanceof o?e:new o(e);return c.visit(l,n),e=l.value,n.madeChanges=c.wasChangeReported(),e};var c=t.PathVisitor.fromMethodsObject({reset:function(e,n){this.options=n},visitFunction:function(e){this.traverse(e);var n=e.value,l=n.async&&!this.options.disableAsync;if(n.generator||l){this.reportChanged(),n.generator=!1,n.expression&&(n.expression=!1,n.body=a.blockStatement([a.returnStatement(n.body)])),l&&d.visit(e.get("body"));var t=n.id||(n.id=e.scope.parent.declareTemporary("callee$")),o=[],c=e.value.body;c.body=c.body.filter(function(e){return e&&null!=e._blockHoist?(o.push(e),!1):!0});var p=a.identifier(n.id.name+"$"),f=e.scope.declareTemporary("context$"),g=u(e),h=new s(f);h.explode(e.get("body")),g&&g.declarations.length>0&&o.push(g);var m=[h.getContextFunction(p),l?a.literal(null):t,a.thisExpression()],y=h.getTryLocsList();y&&m.push(y);var x=a.callExpression(i(l?"async":"wrap"),m);if(o.push(a.returnStatement(x)),n.body=a.blockStatement(o),n.body._declarations=c._declarations,l)return void(n.async=!1);if(!r.FunctionDeclaration.check(n))return r.FunctionExpression.assert(n),a.callExpression(i("mark"),[n]);for(var b=e.parent;b&&!r.BlockStatement.check(b.value)&&!r.Program.check(b.value);)b=b.parent;if(b){e.replace(),n.type="FunctionExpression";var _=a.variableDeclaration("var",[a.variableDeclarator(n.id,a.callExpression(i("mark"),[n]))]);n.comments&&(_.leadingComments=n.leadingComments,_.trailingComments=n.trailingComments,n.leadingComments=null,n.trailingComments=null),_._blockHoist=3;{var v=b.get("body");v.value.length}v.push(_)}}}}),d=t.PathVisitor.fromMethodsObject({visitFunction:function(){return!1},visitAwaitExpression:function(e){var n=e.value.argument;return e.value.all&&(n=a.callExpression(a.memberExpression(a.identifier("Promise"),a.identifier("all"),!1),[n])),a.yieldExpression(n,!1)}})},{"./emit":306,"./hoist":307,"./util":310,assert:139,"ast-types":137,fs:138}],312:[function(e,n){(function(l){function t(e,n){function l(e){r.push(e)}function t(){this.queue(compile(r.join(""),n).code),this.queue(null)}var r=[];return o(l,t)}function r(){e("./runtime")}{var a=(e("assert"),e("path")),o=(e("fs"),e("through")),u=e("./lib/visit").transform;e("./lib/util"),e("ast-types")}n.exports=t,t.runtime=r,r.path=a.join(l,"runtime.js"),t.transform=u}).call(this,"/node_modules/regenerator-babel")},{"./lib/util":310,"./lib/visit":311,"./runtime":314,assert:139,"ast-types":137,fs:138,path:147,through:313}],313:[function(e,n,l){(function(t){function r(e,n,l){function r(){for(;i.length&&!d.paused;){var e=i.shift();if(null===e)return d.emit("end");d.emit("data",e)}}function o(){d.writable=!1,n.call(d),!d.readable&&d.autoDestroy&&d.destroy()}e=e||function(e){this.queue(e)},n=n||function(){this.queue(null)};var u=!1,s=!1,i=[],c=!1,d=new a;return d.readable=d.writable=!0,d.paused=!1,d.autoDestroy=!(l&&l.autoDestroy===!1),d.write=function(n){return e.call(this,n),!d.paused},d.queue=d.push=function(e){return c?d:(null==e&&(c=!0),i.push(e),r(),d)},d.on("end",function(){d.readable=!1,!d.writable&&d.autoDestroy&&t.nextTick(function(){d.destroy()})}),d.end=function(e){return u?void 0:(u=!0,arguments.length&&d.write(e),o(),d)},d.destroy=function(){return s?void 0:(s=!0,u=!0,i.length=0,d.writable=d.readable=!1,d.emit("close"),d)},d.pause=function(){return d.paused?void 0:(d.paused=!0,d)},d.resume=function(){return d.paused&&(d.paused=!1,d.emit("resume")),r(),d.paused||d.emit("drain"),d},d}var a=e("stream");l=n.exports=r,r.through=r}).call(this,e("_process"))},{_process:148,stream:160}],314:[function(e,n){(function(e){!function(e){"use strict";function l(e,n,l,t){return new o(e,n,l||null,t||[])}function t(e,n,l){try{return{type:"normal",arg:e.call(n,l)}}catch(t){return{type:"throw",arg:t}}}function r(){}function a(){}function o(e,n,l,r){function a(n,r){if(s===b)throw new Error("Generator is already running");if(s===_)return d();for(;;){var a=u.delegate;if(a){var o=t(a.iterator[n],a.iterator,r);if("throw"===o.type){u.delegate=null,n="throw",r=o.arg;continue}n="next",r=p;var i=o.arg;if(!i.done)return s=x,i;u[a.resultName]=i.value,u.next=a.nextLoc,u.delegate=null}if("next"===n){if(s===y&&"undefined"!=typeof r)throw new TypeError("attempt to send "+JSON.stringify(r)+" to newborn generator");s===x?u.sent=r:delete u.sent}else if("throw"===n){if(s===y)throw s=_,r;u.dispatchException(r)&&(n="next",r=p)}else"return"===n&&u.abrupt("return",r);s=b;var o=t(e,l,u);if("normal"===o.type){s=u.done?_:x;var i={value:o.arg,done:u.done};if(o.arg!==v)return i;u.delegate&&"next"===n&&(r=p)}else"throw"===o.type&&(s=_,"next"===n?u.dispatchException(o.arg):r=o.arg)}}var o=n?Object.create(n.prototype):this,u=new i(r),s=y;return o.next=a.bind(o,"next"),o["throw"]=a.bind(o,"throw"),o["return"]=a.bind(o,"return"),o}function u(e){var n={tryLoc:e[0]};1 in e&&(n.catchLoc=e[1]),2 in e&&(n.finallyLoc=e[2],n.afterLoc=e[3]),this.tryEntries.push(n)}function s(e){var n=e.completion||{};n.type="normal",delete n.arg,e.completion=n}function i(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(u,this),this.reset()}function c(e){if(e){var n=e[g];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var l=-1,t=function r(){for(;++l<e.length;)if(f.call(e,l))return r.value=e[l],r.done=!1,r;return r.value=p,r.done=!0,r};return t.next=t}}return{next:d}}function d(){return{value:p,done:!0}}var p,f=Object.prototype.hasOwnProperty,g="function"==typeof Symbol&&Symbol.iterator||"@@iterator",h="object"==typeof n,m=e.regeneratorRuntime;if(m)return void(h&&(n.exports=m));m=e.regeneratorRuntime=h?n.exports:{},m.wrap=l;var y="suspendedStart",x="suspendedYield",b="executing",_="completed",v={},I=a.prototype=o.prototype;r.prototype=I.constructor=a,a.constructor=r,r.displayName="GeneratorFunction",m.isGeneratorFunction=function(e){var n="function"==typeof e&&e.constructor;return n?n===r||"GeneratorFunction"===(n.displayName||n.name):!1},m.mark=function(e){return e.__proto__=a,e.prototype=Object.create(I),e},m.async=function(e,n,r,a){return new Promise(function(o,u){function s(e){var n=t(this,null,e);if("throw"===n.type)return void u(n.arg);var l=n.arg;l.done?o(l.value):Promise.resolve(l.value).then(c,d)}var i=l(e,n,r,a),c=s.bind(i.next),d=s.bind(i["throw"]);c()})},I[g]=function(){return this},I.toString=function(){return"[object Generator]"},m.keys=function(e){var n=[];for(var l in e)n.push(l);return n.reverse(),function t(){for(;n.length;){var l=n.pop();if(l in e)return t.value=l,t.done=!1,t}return t.done=!0,t}},m.values=c,i.prototype={constructor:i,reset:function(){this.prev=0,this.next=0,this.sent=p,this.done=!1,this.delegate=null,this.tryEntries.forEach(s);for(var e,n=0;f.call(this,e="t"+n)||20>n;++n)this[e]=null},stop:function(){this.done=!0;var e=this.tryEntries[0],n=e.completion;if("throw"===n.type)throw n.arg;return this.rval},dispatchException:function(e){function n(n,t){return a.type="throw",a.arg=e,l.next=n,!!t}if(this.done)throw e;for(var l=this,t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t],a=r.completion;if("root"===r.tryLoc)return n("end");if(r.tryLoc<=this.prev){var o=f.call(r,"catchLoc"),u=f.call(r,"finallyLoc");if(o&&u){if(this.prev<r.catchLoc)return n(r.catchLoc,!0);if(this.prev<r.finallyLoc)return n(r.finallyLoc)}else if(o){if(this.prev<r.catchLoc)return n(r.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return n(r.finallyLoc)}}}},abrupt:function(e,n){for(var l=this.tryEntries.length-1;l>=0;--l){var t=this.tryEntries[l];if(t.tryLoc<=this.prev&&f.call(t,"finallyLoc")&&this.prev<t.finallyLoc){var r=t;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=n&&n<r.finallyLoc&&(r=null);var a=r?r.completion:{};return a.type=e,a.arg=n,r?this.next=r.finallyLoc:this.complete(a),v},complete:function(e,n){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=e.arg,this.next="end"):"normal"===e.type&&n&&(this.next=n),v},finish:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var l=this.tryEntries[n];if(l.finallyLoc===e)return this.complete(l.completion,l.afterLoc)}},"catch":function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var l=this.tryEntries[n];if(l.tryLoc===e){var t=l.completion;if("throw"===t.type){var r=t.arg;s(l)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,l){return this.delegate={iterator:c(e),resultName:n,nextLoc:l},v}}}("object"==typeof e?e:"object"==typeof window?window:this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],315:[function(e,n,l){var t=e("regenerate");l.REGULAR={d:t().addRange(48,57),D:t().addRange(0,47).addRange(58,65535),s:t(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:t().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,65535),w:t(95).addRange(48,57).addRange(65,90).addRange(97,122),W:t(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,65535)},l.UNICODE={d:t().addRange(48,57),D:t().addRange(0,47).addRange(58,1114111),s:t(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:t().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111),w:t(95).addRange(48,57).addRange(65,90).addRange(97,122),W:t(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)},l.UNICODE_IGNORE_CASE={d:t().addRange(48,57),D:t().addRange(0,47).addRange(58,1114111),s:t(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:t().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111),w:t(95,383,8490).addRange(48,57).addRange(65,90).addRange(97,122),W:t(75,83,96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)}},{regenerate:317}],316:[function(e,n){n.exports={75:8490,83:383,107:8490,115:383,181:924,197:8491,383:83,452:453,453:452,455:456,456:455,458:459,459:458,497:498,498:497,837:8126,914:976,917:1013,920:1012,921:8126,922:1008,924:181,928:982,929:1009,931:962,934:981,937:8486,962:931,976:914,977:1012,981:934,982:928,1008:922,1009:929,1012:[920,977],1013:917,7776:7835,7835:7776,8126:[837,921],8486:937,8490:75,8491:197,66560:66600,66561:66601,66562:66602,66563:66603,66564:66604,66565:66605,66566:66606,66567:66607,66568:66608,66569:66609,66570:66610,66571:66611,66572:66612,66573:66613,66574:66614,66575:66615,66576:66616,66577:66617,66578:66618,66579:66619,66580:66620,66581:66621,66582:66622,66583:66623,66584:66624,66585:66625,66586:66626,66587:66627,66588:66628,66589:66629,66590:66630,66591:66631,66592:66632,66593:66633,66594:66634,66595:66635,66596:66636,66597:66637,66598:66638,66599:66639,66600:66560,66601:66561,66602:66562,66603:66563,66604:66564,66605:66565,66606:66566,66607:66567,66608:66568,66609:66569,66610:66570,66611:66571,66612:66572,66613:66573,66614:66574,66615:66575,66616:66576,66617:66577,66618:66578,66619:66579,66620:66580,66621:66581,66622:66582,66623:66583,66624:66584,66625:66585,66626:66586,66627:66587,66628:66588,66629:66589,66630:66590,66631:66591,66632:66592,66633:66593,66634:66594,66635:66595,66636:66596,66637:66597,66638:66598,66639:66599,71840:71872,71841:71873,71842:71874,71843:71875,71844:71876,71845:71877,71846:71878,71847:71879,71848:71880,71849:71881,71850:71882,71851:71883,71852:71884,71853:71885,71854:71886,71855:71887,71856:71888,71857:71889,71858:71890,71859:71891,71860:71892,71861:71893,71862:71894,71863:71895,71864:71896,71865:71897,71866:71898,71867:71899,71868:71900,71869:71901,71870:71902,71871:71903,71872:71840,71873:71841,71874:71842,71875:71843,71876:71844,71877:71845,71878:71846,71879:71847,71880:71848,71881:71849,71882:71850,71883:71851,71884:71852,71885:71853,71886:71854,71887:71855,71888:71856,71889:71857,71890:71858,71891:71859,71892:71860,71893:71861,71894:71862,71895:71863,71896:71864,71897:71865,71898:71866,71899:71867,71900:71868,71901:71869,71902:71870,71903:71871}},{}],317:[function(n,l,t){(function(n){!function(r){var a="object"==typeof t&&t,o="object"==typeof l&&l&&l.exports==a&&l,u="object"==typeof n&&n;(u.global===u||u.window===u)&&(r=u);var s={rangeOrder:"A range’s `stop` value must be greater than or equal to the `start` value.",codePointRange:"Invalid code point value. Code points range from U+000000 to U+10FFFF."},i=55296,c=56319,d=56320,p=57343,f=/\\x00([^0123456789]|$)/g,g={},h=g.hasOwnProperty,m=function(e,n){var l;for(l in n)h.call(n,l)&&(e[l]=n[l]);return e},y=function(e,n){for(var l=-1,t=e.length;++l<t;)n(e[l],l)},x=g.toString,b=function(e){return"[object Array]"==x.call(e)},_=function(e){return"number"==typeof e||"[object Number]"==x.call(e)},v="0000",I=function(e,n){var l=String(e);return l.length<n?(v+l).slice(-n):l},E=function(e){return Number(e).toString(16).toUpperCase()},k=[].slice,w=function(e){for(var n,l=-1,t=e.length,r=t-1,a=[],o=!0,u=0;++l<t;)if(n=e[l],o)a.push(n),u=n,o=!1;else if(n==u+1){if(l!=r){u=n;continue}o=!0,a.push(n+1)}else a.push(u+1,n),u=n;return o||a.push(n+1),a},R=function(e,n){for(var l,t,r=0,a=e.length;a>r;){if(l=e[r],t=e[r+1],n>=l&&t>n)return n==l?t==l+1?(e.splice(r,2),e):(e[r]=n+1,e):n==t-1?(e[r+1]=n,e):(e.splice(r,2,l,n,n+1,t),e);r+=2}return e},S=function(e,n,l){if(n>l)throw Error(s.rangeOrder);for(var t,r,a=0;a<e.length;){if(t=e[a],r=e[a+1]-1,t>l)return e;if(t>=n&&l>=r)e.splice(a,2);else{if(n>=t&&r>l)return n==t?(e[a]=l+1,e[a+1]=r+1,e):(e.splice(a,2,t,n,l+1,r+1),e);if(n>=t&&r>=n)e[a+1]=n;else if(l>=t&&r>=l)return e[a]=l+1,e;a+=2}}return e},C=function(e,n){var l,t,r=0,a=null,o=e.length;if(0>n||n>1114111)throw RangeError(s.codePointRange);for(;o>r;){if(l=e[r],t=e[r+1],n>=l&&t>n)return e;if(n==l-1)return e[r]=n,e;if(l>n)return e.splice(null!=a?a+2:0,0,n,n+1),e;if(n==t)return n+1==e[r+2]?(e.splice(r,4,l,e[r+3]),e):(e[r+1]=n+1,e);a=r,r+=2}return e.push(n,n+1),e},A=function(e,n){for(var l,t,r=0,a=e.slice(),o=n.length;o>r;)l=n[r],t=n[r+1]-1,a=l==t?C(a,l):T(a,l,t),r+=2;return a},j=function(e,n){for(var l,t,r=0,a=e.slice(),o=n.length;o>r;)l=n[r],t=n[r+1]-1,a=l==t?R(a,l):S(a,l,t),r+=2;return a},T=function(e,n,l){if(n>l)throw Error(s.rangeOrder);if(0>n||n>1114111||0>l||l>1114111)throw RangeError(s.codePointRange);for(var t,r,a=0,o=!1,u=e.length;u>a;){if(t=e[a],r=e[a+1],o){if(t==l+1)return e.splice(a-1,2),e;if(t>l)return e;t>=n&&l>=t&&(r>n&&l>=r-1?(e.splice(a,2),a-=2):(e.splice(a-1,2),a-=2))}else{if(t==l+1)return e[a]=n,e;if(t>l)return e.splice(a,0,n,l+1),e;if(n>=t&&r>n&&r>=l+1)return e;n>=t&&r>n||r==n?(e[a+1]=l+1,o=!0):t>=n&&l+1>=r&&(e[a]=n,e[a+1]=l+1,o=!0)}a+=2}return o||e.push(n,l+1),e},L=function(e,n){var l=0,t=e.length,r=e[l],a=e[t-1];if(t>=2&&(r>n||n>a))return!1;for(;t>l;){if(r=e[l],a=e[l+1],n>=r&&a>n)return!0;l+=2}return!1},P=function(e,n){for(var l,t=0,r=n.length,a=[];r>t;)l=n[t],L(e,l)&&a.push(l),++t;return w(a)},O=function(e){return!e.length},M=function(e){return 2==e.length&&e[0]+1==e[1]},D=function(e){for(var n,l,t=0,r=[],a=e.length;a>t;){for(n=e[t],l=e[t+1];l>n;)r.push(n),++n;t+=2}return r},B=Math.floor,N=function(e){return parseInt(B((e-65536)/1024)+i,10)},F=function(e){return parseInt((e-65536)%1024+d,10)},V=String.fromCharCode,U=function(e){var n;return n=9==e?"\\t":10==e?"\\n":12==e?"\\f":13==e?"\\r":92==e?"\\\\":36==e||e>=40&&43>=e||45==e||46==e||63==e||e>=91&&94>=e||e>=123&&125>=e?"\\"+V(e):e>=32&&126>=e?V(e):255>=e?"\\x"+I(E(e),2):"\\u"+I(E(e),4)},q=function(e){var n,l=e.length,t=e.charCodeAt(0);return t>=i&&c>=t&&l>1?(n=e.charCodeAt(1),1024*(t-i)+n-d+65536):t},G=function(e){var n,l,t="",r=0,a=e.length;if(M(e))return U(e[0]);for(;a>r;)n=e[r],l=e[r+1]-1,t+=n==l?U(n):n+1==l?U(n)+U(l):U(n)+"-"+U(l),r+=2;return"["+t+"]"},H=function(e){for(var n,l,t=[],r=[],a=[],o=[],u=0,s=e.length;s>u;)n=e[u],l=e[u+1]-1,i>n?(i>l&&a.push(n,l+1),l>=i&&c>=l&&(a.push(n,i),t.push(i,l+1)),l>=d&&p>=l&&(a.push(n,i),t.push(i,c+1),r.push(d,l+1)),l>p&&(a.push(n,i),t.push(i,c+1),r.push(d,p+1),65535>=l?a.push(p+1,l+1):(a.push(p+1,65536),o.push(65536,l+1)))):n>=i&&c>=n?(l>=i&&c>=l&&t.push(n,l+1),l>=d&&p>=l&&(t.push(n,c+1),r.push(d,l+1)),l>p&&(t.push(n,c+1),r.push(d,p+1),65535>=l?a.push(p+1,l+1):(a.push(p+1,65536),o.push(65536,l+1)))):n>=d&&p>=n?(l>=d&&p>=l&&r.push(n,l+1),l>p&&(r.push(n,p+1),65535>=l?a.push(p+1,l+1):(a.push(p+1,65536),o.push(65536,l+1)))):n>p&&65535>=n?65535>=l?a.push(n,l+1):(a.push(n,65536),o.push(65536,l+1)):o.push(n,l+1),u+=2;return{loneHighSurrogates:t,loneLowSurrogates:r,bmp:a,astral:o}},W=function(e){for(var n,l,t,r,a,o,u=[],s=[],i=!1,c=-1,d=e.length;++c<d;)if(n=e[c],l=e[c+1]){for(t=n[0],r=n[1],a=l[0],o=l[1],s=r;a&&t[0]==a[0]&&t[1]==a[1];)s=M(o)?C(s,o[0]):T(s,o[0],o[1]-1),++c,n=e[c],t=n[0],r=n[1],l=e[c+1],a=l&&l[0],o=l&&l[1],i=!0;u.push([t,i?s:r]),i=!1}else u.push(n);return X(u)},X=function(e){if(1==e.length)return e;for(var n=-1,l=-1;++n<e.length;){var t=e[n],r=t[1],a=r[0],o=r[1];for(l=n;++l<e.length;){var u=e[l],s=u[1],i=s[0],c=s[1];a==i&&o==c&&(t[0]=M(u[0])?C(t[0],u[0][0]):T(t[0],u[0][0],u[0][1]-1),e.splice(l,1),--l)}}return e},J=function(e){if(!e.length)return[];for(var n,l,t,r,a,o,u=0,s=0,i=0,c=[],f=e.length;f>u;){n=e[u],l=e[u+1]-1,t=N(n),r=F(n),a=N(l),o=F(l);var g=r==d,h=o==p,m=!1;t==a||g&&h?(c.push([[t,a+1],[r,o+1]]),m=!0):c.push([[t,t+1],[r,p+1]]),!m&&a>t+1&&(h?(c.push([[t+1,a+1],[d,o+1]]),m=!0):c.push([[t+1,a],[d,p+1]])),m||c.push([[a,a+1],[d,o+1]]),s=t,i=a,u+=2}return W(c)},Y=function(e){var n=[];return y(e,function(e){var l=e[0],t=e[1];n.push(G(l)+G(t))}),n.join("|")},z=function(e,n){var l=[],t=H(e),r=t.loneHighSurrogates,a=t.loneLowSurrogates,o=t.bmp,u=t.astral,s=(!O(t.astral),!O(r)),i=!O(a),c=J(u);return n&&(o=A(o,r),s=!1,o=A(o,a),i=!1),O(o)||l.push(G(o)),c.length&&l.push(Y(c)),s&&l.push(G(r)+"(?![\\uDC00-\\uDFFF])"),i&&l.push("(?:[^\\uD800-\\uDBFF]|^)"+G(a)),l.join("|")},$=function(e){return arguments.length>1&&(e=k.call(arguments)),this instanceof $?(this.data=[],e?this.add(e):this):(new $).add(e)};$.version="1.2.0";var K=$.prototype;m(K,{add:function(e){var n=this;return null==e?n:e instanceof $?(n.data=A(n.data,e.data),n):(arguments.length>1&&(e=k.call(arguments)),b(e)?(y(e,function(e){n.add(e)}),n):(n.data=C(n.data,_(e)?e:q(e)),n))},remove:function(e){var n=this;return null==e?n:e instanceof $?(n.data=j(n.data,e.data),n):(arguments.length>1&&(e=k.call(arguments)),b(e)?(y(e,function(e){n.remove(e)}),n):(n.data=R(n.data,_(e)?e:q(e)),n))},addRange:function(e,n){var l=this;return l.data=T(l.data,_(e)?e:q(e),_(n)?n:q(n)),l},removeRange:function(e,n){var l=this,t=_(e)?e:q(e),r=_(n)?n:q(n);return l.data=S(l.data,t,r),l},intersection:function(e){var n=this,l=e instanceof $?D(e.data):e;return n.data=P(n.data,l),n},contains:function(e){return L(this.data,_(e)?e:q(e))},clone:function(){var e=new $;return e.data=this.data.slice(0),e},toString:function(e){var n=z(this.data,e?e.bmpOnly:!1);return n.replace(f,"\\0$1")},toRegExp:function(e){return RegExp(this.toString(),e||"")},valueOf:function(){return D(this.data)}}),K.toArray=K.valueOf,"function"==typeof e&&"object"==typeof e.amd&&e.amd?e(function(){return $}):a&&!a.nodeType?o?o.exports=$:a.regenerate=$:r.regenerate=$}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],318:[function(n,l,t){(function(n){(function(){"use strict";function r(){var e,n,l=16384,t=[],r=-1,a=arguments.length;if(!a)return"";for(var o="";++r<a;){var u=Number(arguments[r]);if(!isFinite(u)||0>u||u>1114111||S(u)!=u)throw RangeError("Invalid code point: "+u);65535>=u?t.push(u):(u-=65536,e=(u>>10)+55296,n=u%1024+56320,t.push(e,n)),(r+1==a||t.length>l)&&(o+=R.apply(null,t),t.length=0)}return o}function a(e,n){if(-1==n.indexOf("|")){if(e==n)return;throw Error("Invalid node type: "+e)}if(n=a.hasOwnProperty(n)?a[n]:a[n]=RegExp("^(?:"+n+")$"),!n.test(e))throw Error("Invalid node type: "+e)}function o(e){var n=e.type;if(o.hasOwnProperty(n)&&"function"==typeof o[n])return o[n](e);throw Error("Invalid node type: "+n)}function u(e){a(e.type,"alternative");var n=e.body,l=n?n.length:0;if(1==l)return b(n[0]);for(var t=-1,r="";++t<l;)r+=b(n[t]);return r}function s(e){switch(a(e.type,"anchor"),e.kind){case"start":return"^";case"end":return"$";case"boundary":return"\\b";case"not-boundary":return"\\B";default:throw Error("Invalid assertion")}}function i(e){return a(e.type,"anchor|characterClass|characterClassEscape|dot|group|reference|value"),o(e)}function c(e){a(e.type,"characterClass");var n=e.body,l=n?n.length:0,t=-1,r="[";for(e.negative&&(r+="^");++t<l;)r+=f(n[t]);return r+="]"}function d(e){return a(e.type,"characterClassEscape"),"\\"+e.value}function p(e){a(e.type,"characterClassRange");
var n=e.min,l=e.max;if("characterClassRange"==n.type||"characterClassRange"==l.type)throw Error("Invalid character class range");return f(n)+"-"+f(l)}function f(e){return a(e.type,"anchor|characterClassEscape|characterClassRange|dot|value"),o(e)}function g(e){a(e.type,"disjunction");var n=e.body,l=n?n.length:0;if(0==l)throw Error("No body");if(1==l)return o(n[0]);for(var t=-1,r="";++t<l;)0!=t&&(r+="|"),r+=o(n[t]);return r}function h(e){return a(e.type,"dot"),"."}function m(e){a(e.type,"group");var n="(";switch(e.behavior){case"normal":break;case"ignore":n+="?:";break;case"lookahead":n+="?=";break;case"negativeLookahead":n+="?!";break;default:throw Error("Invalid behaviour: "+e.behaviour)}var l=e.body,t=l?l.length:0;if(1==t)n+=o(l[0]);else for(var r=-1;++r<t;)n+=o(l[r]);return n+=")"}function y(e){a(e.type,"quantifier");var n="",l=e.min,t=e.max;switch(t){case void 0:case null:switch(l){case 0:n="*";break;case 1:n="+";break;default:n="{"+l+",}"}break;default:n=l==t?"{"+l+"}":0==l&&1==t?"?":"{"+l+","+t+"}"}return e.greedy||(n+="?"),i(e.body[0])+n}function x(e){return a(e.type,"reference"),"\\"+e.matchIndex}function b(e){return a(e.type,"anchor|characterClass|characterClassEscape|empty|group|quantifier|reference|value"),o(e)}function _(e){a(e.type,"value");var n=e.kind,l=e.codePoint;switch(n){case"controlLetter":return"\\c"+r(l+64);case"hexadecimalEscape":return"\\x"+("00"+l.toString(16).toUpperCase()).slice(-2);case"identifier":return"\\"+r(l);case"null":return"\\"+l;case"octal":return"\\"+l.toString(8);case"singleEscape":switch(l){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r";default:throw Error("Invalid codepoint: "+l)}case"symbol":return r(l);case"unicodeEscape":return"\\u"+("0000"+l.toString(16).toUpperCase()).slice(-4);case"unicodeCodePointEscape":return"\\u{"+l.toString(16).toUpperCase()+"}";default:throw Error("Unsupported node kind: "+n)}}var v={"function":!0,object:!0},I=v[typeof window]&&window||this,E=v[typeof t]&&t,k=v[typeof l]&&l&&!l.nodeType&&l,w=E&&k&&"object"==typeof n&&n;!w||w.global!==w&&w.window!==w&&w.self!==w||(I=w);var R=String.fromCharCode,S=Math.floor;o.alternative=u,o.anchor=s,o.characterClass=c,o.characterClassEscape=d,o.characterClassRange=p,o.disjunction=g,o.dot=h,o.group=m,o.quantifier=y,o.reference=x,o.value=_,"function"==typeof e&&"object"==typeof e.amd&&e.amd?e(function(){return{generate:o}}):E&&k?E.generate=o:I.regjsgen={generate:o}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],319:[function(e,n){!function(){function e(e,n){function l(n){return n.raw=e.substring(n.range[0],n.range[1]),n}function t(e,n){return e.range[0]=n,l(e)}function r(e,n){return l({type:"anchor",kind:e,range:[J-n,J]})}function a(e,n,t,r){return l({type:"value",kind:e,codePoint:n,range:[t,r]})}function o(e,n,l,t){return t=t||0,a(e,n,J-(l.length+t),J)}function u(e){var n=e[0],l=n.charCodeAt(0);if(X){var t;if(1===n.length&&l>=55296&&56319>=l&&(t=v().charCodeAt(0),t>=56320&&57343>=t))return J++,a("symbol",1024*(l-55296)+t-56320+65536,J-2,J)}return a("symbol",l,J-1,J)}function s(e,n,t){return l({type:"disjunction",body:e,range:[n,t]})}function i(){return l({type:"dot",range:[J-1,J]})}function c(e){return l({type:"characterClassEscape",value:e,range:[J-2,J]})}function d(e){return l({type:"reference",matchIndex:parseInt(e,10),range:[J-1-e.length,J]})}function p(e,n,t,r){return l({type:"group",behavior:e,body:n,range:[t,r]})}function f(e,n,t,r){return null==r&&(t=J-1,r=J),l({type:"quantifier",min:e,max:n,greedy:!0,body:null,range:[t,r]})}function g(e,n,t){return l({type:"alternative",body:e,range:[n,t]})}function h(e,n,t,r){return l({type:"characterClass",body:e,negative:n,range:[t,r]})}function m(e,n,t,r){if(e.codePoint>n.codePoint)throw SyntaxError("invalid range in character class");return l({type:"characterClassRange",min:e,max:n,range:[t,r]})}function y(e){return"alternative"===e.type?e.body:[e]}function x(n){n=n||1;var l=e.substring(J,J+n);return J+=n||1,l}function b(e){if(!_(e))throw SyntaxError("character: "+e)}function _(n){return e.indexOf(n,J)===J?x(n.length):void 0}function v(){return e[J]}function I(n){return e.indexOf(n,J)===J}function E(n){return e[J+1]===n}function k(n){var l=e.substring(J),t=l.match(n);return t&&(t.range=[],t.range[0]=J,x(t[0].length),t.range[1]=J),t}function w(){var e=[],n=J;for(e.push(R());_("|");)e.push(R());return 1===e.length?e[0]:s(e,n,J)}function R(){for(var e,n=[],l=J;e=S();)n.push(e);return 1===n.length?n[0]:g(n,l,J)}function S(){if(J>=e.length||I("|")||I(")"))return null;var n=A();if(n)return n;var l=T();if(!l)throw SyntaxError("Expected atom");var r=j()||!1;return r?(r.body=y(l),t(r,l.range[0]),r):l}function C(e,n,l,t){var r=null,a=J;if(_(e))r=n;else{if(!_(l))return!1;r=t}var o=w();if(!o)throw SyntaxError("Expected disjunction");b(")");var u=p(r,y(o),a,J);return"normal"==r&&Y++,u}function A(){return _("^")?r("start",1):_("$")?r("end",1):_("\\b")?r("boundary",2):_("\\B")?r("not-boundary",2):C("(?=","lookahead","(?!","negativeLookahead")}function j(){var e,n,l,t;if(_("*"))n=f(0);else if(_("+"))n=f(1);else if(_("?"))n=f(0,1);else if(e=k(/^\{([0-9]+)\}/))l=parseInt(e[1],10),n=f(l,l,e.range[0],e.range[1]);else if(e=k(/^\{([0-9]+),\}/))l=parseInt(e[1],10),n=f(l,void 0,e.range[0],e.range[1]);else if(e=k(/^\{([0-9]+),([0-9]+)\}/)){if(l=parseInt(e[1],10),t=parseInt(e[2],10),l>t)throw SyntaxError("numbers out of order in {} quantifier");n=f(l,t,e.range[0],e.range[1])}return n&&_("?")&&(n.greedy=!1,n.range[1]+=1),n}function T(){var e;if(e=k(/^[^^$\\.*+?(){[|]/))return u(e);if(_("."))return i();if(_("\\")){if(e=O(),!e)throw SyntaxError("atomEscape");return e}return(e=F())?e:C("(?:","ignore","(","normal")}function L(e){if(X){var n,t;if("unicodeEscape"==e.kind&&(n=e.codePoint)>=55296&&56319>=n&&I("\\")&&E("u")){var r=J;J++;var a=P();"unicodeEscape"==a.kind&&(t=a.codePoint)>=56320&&57343>=t?(e.range[1]=a.range[1],e.codePoint=1024*(n-55296)+t-56320+65536,e.type="value",e.kind="unicodeCodePointEscape",l(e)):J=r}}return e}function P(){return O(!0)}function O(e){var n;if(n=M())return n;if(e){if(_("b"))return o("singleEscape",8,"\\b");if(_("B"))throw SyntaxError("\\B not possible inside of CharacterClass")}return n=D()}function M(){var e,n;if(e=k(/^(?!0)\d+/)){n=e[0];var l=parseInt(e[0],10);return Y>=l?d(e[0]):(x(-e[0].length),(e=k(/^[0-7]{1,3}/))?o("octal",parseInt(e[0],8),e[0],1):(e=u(k(/^[89]/)),t(e,e.range[0]-1)))}return(e=k(/^[0-7]{1,3}/))?(n=e[0],/^0{1,3}$/.test(n)?o("null",0,"0",n.length+1):o("octal",parseInt(n,8),n,1)):(e=k(/^[dDsSwW]/))?c(e[0]):!1}function D(){var e;if(e=k(/^[fnrtv]/)){var n=0;switch(e[0]){case"t":n=9;break;case"n":n=10;break;case"v":n=11;break;case"f":n=12;break;case"r":n=13}return o("singleEscape",n,"\\"+e[0])}return(e=k(/^c([a-zA-Z])/))?o("controlLetter",e[1].charCodeAt(0)%32,e[1],2):(e=k(/^x([0-9a-fA-F]{2})/))?o("hexadecimalEscape",parseInt(e[1],16),e[1],2):(e=k(/^u([0-9a-fA-F]{4})/))?L(o("unicodeEscape",parseInt(e[1],16),e[1],2)):X&&(e=k(/^u\{([0-9a-fA-F]{1,})\}/))?o("unicodeCodePointEscape",parseInt(e[1],16),e[1],4):N()}function B(e){var n=new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԯԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠ-ࢲࣤ-ॣ०-९ॱ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఀ-ఃఅ-ఌఎ-ఐఒ-నప-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಁ-ಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲഁ-ഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟ෦-෯ෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧ᪰-᪽ᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶ᳸᳹ᴀ-᷵᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚝꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꧠ-ꧾꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︭︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]");return 36===e||95===e||e>=65&&90>=e||e>=97&&122>=e||e>=48&&57>=e||92===e||e>=128&&n.test(String.fromCharCode(e))}function N(){var e,n="",l="";return B(v())?_(n)?o("identifier",8204,n):_(l)?o("identifier",8205,l):null:(e=x(),o("identifier",e.charCodeAt(0),e,1))}function F(){var e,n=J;return(e=k(/^\[\^/))?(e=V(),b("]"),h(e,!0,n,J)):_("[")?(e=V(),b("]"),h(e,!1,n,J)):null}function V(){var e;if(I("]"))return[];if(e=q(),!e)throw SyntaxError("nonEmptyClassRanges");return e}function U(e){var n,l,t;if(I("-")&&!E("]")){if(b("-"),t=H(),!t)throw SyntaxError("classAtom");l=J;var r=V();if(!r)throw SyntaxError("classRanges");return n=e.range[0],"empty"===r.type?[m(e,t,n,l)]:[m(e,t,n,l)].concat(r)}if(t=G(),!t)throw SyntaxError("nonEmptyClassRangesNoDash");return[e].concat(t)}function q(){var e=H();if(!e)throw SyntaxError("classAtom");return I("]")?[e]:U(e)}function G(){var e=H();if(!e)throw SyntaxError("classAtom");return I("]")?e:U(e)}function H(){return _("-")?u("-"):W()}function W(){var e;if(e=k(/^[^\\\]-]/))return u(e[0]);if(_("\\")){if(e=P(),!e)throw SyntaxError("classEscape");return L(e)}}var X=-1!==(n||"").indexOf("u"),J=0,Y=0;e=String(e),""===e&&(e="(?:)");var z=w();if(z.range[1]!==e.length)throw SyntaxError("Could not parse entire input - got stuck: "+e);return z}var l={parse:e};"undefined"!=typeof n&&n.exports?n.exports=l:window.regjsparser=l}()},{}],320:[function(e,n){function l(e){return I?v?g.UNICODE_IGNORE_CASE[e]:g.UNICODE[e]:g.REGULAR[e]}function t(e,n){return m.call(e,n)}function r(e,n){for(var l in n)e[l]=n[l]}function a(e,n){if(n){var l=d(n,"");switch(l.type){case"characterClass":case"group":case"value":break;default:l=o(l,n)}r(e,l)}}function o(e,n){return{type:"group",behavior:"ignore",body:[e],raw:"(?:"+n+")"}}function u(e){return t(f,e)?f[e]:!1}function s(e){{var n=p();e.body.forEach(function(e){switch(e.type){case"value":if(n.add(e.codePoint),v&&I){var t=u(e.codePoint);t&&n.add(t)}break;case"characterClassRange":var r=e.min.codePoint,a=e.max.codePoint;n.addRange(r,a),v&&I&&n.iuAddRange(r,a);break;case"characterClassEscape":n.add(l(e.value));break;default:throw Error("Unknown term type: "+e.type)}})}return e.negative&&(n=(I?y:x).clone().remove(n)),a(e,n.toString()),e}function i(e){switch(e.type){case"dot":a(e,(I?b:_).toString());break;case"characterClass":e=s(e);break;case"characterClassEscape":a(e,l(e.value).toString());break;case"alternative":case"disjunction":case"group":case"quantifier":e.body=e.body.map(i);break;case"value":var n=e.codePoint,t=p(n);if(v&&I){var r=u(n);r&&t.add(r)}a(e,t.toString());break;case"anchor":case"empty":case"group":case"reference":break;default:throw Error("Unknown term type: "+e.type)}return e}var c=e("regjsgen").generate,d=e("regjsparser").parse,p=e("regenerate"),f=e("./data/iu-mappings.json"),g=e("./data/character-class-escape-sets.js"),h={},m=h.hasOwnProperty,y=p().addRange(0,1114111),x=p().addRange(0,65535),b=y.clone().remove(10,13,8232,8233),_=b.clone().intersection(x);p.prototype.iuAddRange=function(e,n){var l=this;do{var t=u(e);t&&l.add(t)}while(++e<=n);return l};var v=!1,I=!1;n.exports=function(e,n){var l=d(e,n);return v=n?n.indexOf("i")>-1:!1,I=n?n.indexOf("u")>-1:!1,r(l,i(l)),c(l)}},{"./data/character-class-escape-sets.js":315,"./data/iu-mappings.json":316,regenerate:317,regjsgen:318,regjsparser:319}],321:[function(e,n){"use strict";var l=e("is-finite");n.exports=function(e,n){if("string"!=typeof e)throw new TypeError("Expected a string as the first argument");if(0>n||!l(n))throw new TypeError("Expected a finite positive number");var t="";do 1&n&&(t+=e),e+=e;while(n>>=1);return t}},{"is-finite":322}],322:[function(e,n,l){arguments[4][186][0].apply(l,arguments)},{dup:186}],323:[function(e,n){"use strict";n.exports=/^#!.*/},{}],324:[function(e,n){"use strict";n.exports=function(e){var n=/^\\\\\?\\/.test(e),l=/[^\x00-\x80]+/.test(e);return n||l?e:e.replace(/\\/g,"/")}},{}],325:[function(e,n){(function(e){"use strict";n.exports=function(n){var l=new e(JSON.stringify(n)).toString("base64");return"//# sourceMappingURL=data:application/json;base64,"+l}}).call(this,e("buffer").Buffer)},{buffer:140}],326:[function(e,n,l){l.SourceMapGenerator=e("./source-map/source-map-generator").SourceMapGenerator,l.SourceMapConsumer=e("./source-map/source-map-consumer").SourceMapConsumer,l.SourceNode=e("./source-map/source-node").SourceNode},{"./source-map/source-map-consumer":332,"./source-map/source-map-generator":333,"./source-map/source-node":334}],327:[function(e,n){if("function"!=typeof l)var l=e("amdefine")(n,e);l(function(e,n){function l(){this._array=[],this._set={}}var t=e("./util");l.fromArray=function(e,n){for(var t=new l,r=0,a=e.length;a>r;r++)t.add(e[r],n);return t},l.prototype.add=function(e,n){var l=this.has(e),r=this._array.length;(!l||n)&&this._array.push(e),l||(this._set[t.toSetString(e)]=r)},l.prototype.has=function(e){return Object.prototype.hasOwnProperty.call(this._set,t.toSetString(e))},l.prototype.indexOf=function(e){if(this.has(e))return this._set[t.toSetString(e)];throw new Error('"'+e+'" is not in the set.')},l.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},l.prototype.toArray=function(){return this._array.slice()},n.ArraySet=l})},{"./util":335,amdefine:336}],328:[function(e,n){if("function"!=typeof l)var l=e("amdefine")(n,e);l(function(e,n){function l(e){return 0>e?(-e<<1)+1:(e<<1)+0}function t(e){var n=1===(1&e),l=e>>1;return n?-l:l}var r=e("./base64"),a=5,o=1<<a,u=o-1,s=o;n.encode=function(e){var n,t="",o=l(e);do n=o&u,o>>>=a,o>0&&(n|=s),t+=r.encode(n);while(o>0);return t},n.decode=function(e,n){var l,o,i=0,c=e.length,d=0,p=0;do{if(i>=c)throw new Error("Expected more digits in base 64 VLQ value.");o=r.decode(e.charAt(i++)),l=!!(o&s),o&=u,d+=o<<p,p+=a}while(l);n.value=t(d),n.rest=e.slice(i)}})},{"./base64":329,amdefine:336}],329:[function(e,n){if("function"!=typeof l)var l=e("amdefine")(n,e);l(function(e,n){var l={},t={};"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").forEach(function(e,n){l[e]=n,t[n]=e}),n.encode=function(e){if(e in t)return t[e];throw new TypeError("Must be between 0 and 63: "+e)},n.decode=function(e){if(e in l)return l[e];throw new TypeError("Not a valid base 64 digit: "+e)}})},{amdefine:336}],330:[function(e,n){if("function"!=typeof l)var l=e("amdefine")(n,e);l(function(e,n){function l(e,n,t,r,a){var o=Math.floor((n-e)/2)+e,u=a(t,r[o],!0);return 0===u?o:u>0?n-o>1?l(o,n,t,r,a):o:o-e>1?l(e,o,t,r,a):0>e?-1:e}n.search=function(e,n,t){return 0===n.length?-1:l(-1,n.length,e,n,t)}})},{amdefine:336}],331:[function(e,n){if("function"!=typeof l)var l=e("amdefine")(n,e);l(function(e,n){function l(e,n){var l=e.generatedLine,t=n.generatedLine,a=e.generatedColumn,o=n.generatedColumn;return t>l||t==l&&o>=a||r.compareByGeneratedPositions(e,n)<=0}function t(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var r=e("./util");t.prototype.unsortedForEach=function(e,n){this._array.forEach(e,n)},t.prototype.add=function(e){l(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},t.prototype.toArray=function(){return this._sorted||(this._array.sort(r.compareByGeneratedPositions),this._sorted=!0),this._array},n.MappingList=t})},{"./util":335,amdefine:336}],332:[function(e,n){if("function"!=typeof l)var l=e("amdefine")(n,e);l(function(e,n){function l(e){var n=e;"string"==typeof e&&(n=JSON.parse(e.replace(/^\)\]\}'/,"")));var l=t.getArg(n,"version"),r=t.getArg(n,"sources"),o=t.getArg(n,"names",[]),u=t.getArg(n,"sourceRoot",null),s=t.getArg(n,"sourcesContent",null),i=t.getArg(n,"mappings"),c=t.getArg(n,"file",null);if(l!=this._version)throw new Error("Unsupported version: "+l);r=r.map(t.normalize),this._names=a.fromArray(o,!0),this._sources=a.fromArray(r,!0),this.sourceRoot=u,this.sourcesContent=s,this._mappings=i,this.file=c}var t=e("./util"),r=e("./binary-search"),a=e("./array-set").ArraySet,o=e("./base64-vlq");l.fromSourceMap=function(e){var n=Object.create(l.prototype);return n._names=a.fromArray(e._names.toArray(),!0),n._sources=a.fromArray(e._sources.toArray(),!0),n.sourceRoot=e._sourceRoot,n.sourcesContent=e._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=e._file,n.__generatedMappings=e._mappings.toArray().slice(),n.__originalMappings=e._mappings.toArray().slice().sort(t.compareByOriginalPositions),n},l.prototype._version=3,Object.defineProperty(l.prototype,"sources",{get:function(){return this._sources.toArray().map(function(e){return null!=this.sourceRoot?t.join(this.sourceRoot,e):e},this)}}),l.prototype.__generatedMappings=null,Object.defineProperty(l.prototype,"_generatedMappings",{get:function(){return this.__generatedMappings||(this.__generatedMappings=[],this.__originalMappings=[],this._parseMappings(this._mappings,this.sourceRoot)),this.__generatedMappings}}),l.prototype.__originalMappings=null,Object.defineProperty(l.prototype,"_originalMappings",{get:function(){return this.__originalMappings||(this.__generatedMappings=[],this.__originalMappings=[],this._parseMappings(this._mappings,this.sourceRoot)),this.__originalMappings}}),l.prototype._nextCharIsMappingSeparator=function(e){var n=e.charAt(0);return";"===n||","===n},l.prototype._parseMappings=function(e){for(var n,l=1,r=0,a=0,u=0,s=0,i=0,c=e,d={};c.length>0;)if(";"===c.charAt(0))l++,c=c.slice(1),r=0;else if(","===c.charAt(0))c=c.slice(1);else{if(n={},n.generatedLine=l,o.decode(c,d),n.generatedColumn=r+d.value,r=n.generatedColumn,c=d.rest,c.length>0&&!this._nextCharIsMappingSeparator(c)){if(o.decode(c,d),n.source=this._sources.at(s+d.value),s+=d.value,c=d.rest,0===c.length||this._nextCharIsMappingSeparator(c))throw new Error("Found a source, but no line and column");if(o.decode(c,d),n.originalLine=a+d.value,a=n.originalLine,n.originalLine+=1,c=d.rest,0===c.length||this._nextCharIsMappingSeparator(c))throw new Error("Found a source and line, but no column");o.decode(c,d),n.originalColumn=u+d.value,u=n.originalColumn,c=d.rest,c.length>0&&!this._nextCharIsMappingSeparator(c)&&(o.decode(c,d),n.name=this._names.at(i+d.value),i+=d.value,c=d.rest)}this.__generatedMappings.push(n),"number"==typeof n.originalLine&&this.__originalMappings.push(n)}this.__generatedMappings.sort(t.compareByGeneratedPositions),this.__originalMappings.sort(t.compareByOriginalPositions)},l.prototype._findMapping=function(e,n,l,t,a){if(e[l]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[l]);if(e[t]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[t]);return r.search(e,n,a)},l.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var n=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var l=this._generatedMappings[e+1];if(n.generatedLine===l.generatedLine){n.lastGeneratedColumn=l.generatedColumn-1;continue}}n.lastGeneratedColumn=1/0}},l.prototype.originalPositionFor=function(e){var n={generatedLine:t.getArg(e,"line"),generatedColumn:t.getArg(e,"column")},l=this._findMapping(n,this._generatedMappings,"generatedLine","generatedColumn",t.compareByGeneratedPositions);if(l>=0){var r=this._generatedMappings[l];if(r.generatedLine===n.generatedLine){var a=t.getArg(r,"source",null);return null!=a&&null!=this.sourceRoot&&(a=t.join(this.sourceRoot,a)),{source:a,line:t.getArg(r,"originalLine",null),column:t.getArg(r,"originalColumn",null),name:t.getArg(r,"name",null)}}}return{source:null,line:null,column:null,name:null}},l.prototype.sourceContentFor=function(e){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=t.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var n;if(null!=this.sourceRoot&&(n=t.urlParse(this.sourceRoot))){var l=e.replace(/^file:\/\//,"");if("file"==n.scheme&&this._sources.has(l))return this.sourcesContent[this._sources.indexOf(l)];if((!n.path||"/"==n.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}throw new Error('"'+e+'" is not in the SourceMap.')},l.prototype.generatedPositionFor=function(e){var n={source:t.getArg(e,"source"),originalLine:t.getArg(e,"line"),originalColumn:t.getArg(e,"column")};null!=this.sourceRoot&&(n.source=t.relative(this.sourceRoot,n.source));var l=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",t.compareByOriginalPositions);if(l>=0){var r=this._originalMappings[l];return{line:t.getArg(r,"generatedLine",null),column:t.getArg(r,"generatedColumn",null),lastColumn:t.getArg(r,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},l.prototype.allGeneratedPositionsFor=function(e){var n={source:t.getArg(e,"source"),originalLine:t.getArg(e,"line"),originalColumn:1/0};null!=this.sourceRoot&&(n.source=t.relative(this.sourceRoot,n.source));var l=[],r=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",t.compareByOriginalPositions);if(r>=0)for(var a=this._originalMappings[r];a&&a.originalLine===n.originalLine;)l.push({line:t.getArg(a,"generatedLine",null),column:t.getArg(a,"generatedColumn",null),lastColumn:t.getArg(a,"lastGeneratedColumn",null)}),a=this._originalMappings[--r];return l.reverse()},l.GENERATED_ORDER=1,l.ORIGINAL_ORDER=2,l.prototype.eachMapping=function(e,n,r){var a,o=n||null,u=r||l.GENERATED_ORDER;switch(u){case l.GENERATED_ORDER:a=this._generatedMappings;break;case l.ORIGINAL_ORDER:a=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var s=this.sourceRoot;a.map(function(e){var n=e.source;return null!=n&&null!=s&&(n=t.join(s,n)),{source:n,generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:e.name}}).forEach(e,o)},n.SourceMapConsumer=l})},{"./array-set":327,"./base64-vlq":328,"./binary-search":330,"./util":335,amdefine:336}],333:[function(e,n){if("function"!=typeof l)var l=e("amdefine")(n,e);l(function(e,n){function l(e){e||(e={}),this._file=r.getArg(e,"file",null),this._sourceRoot=r.getArg(e,"sourceRoot",null),this._skipValidation=r.getArg(e,"skipValidation",!1),this._sources=new a,this._names=new a,this._mappings=new o,this._sourcesContents=null}var t=e("./base64-vlq"),r=e("./util"),a=e("./array-set").ArraySet,o=e("./mapping-list").MappingList;l.prototype._version=3,l.fromSourceMap=function(e){var n=e.sourceRoot,t=new l({file:e.file,sourceRoot:n});return e.eachMapping(function(e){var l={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(l.source=e.source,null!=n&&(l.source=r.relative(n,l.source)),l.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(l.name=e.name)),t.addMapping(l)}),e.sources.forEach(function(n){var l=e.sourceContentFor(n);null!=l&&t.setSourceContent(n,l)}),t},l.prototype.addMapping=function(e){var n=r.getArg(e,"generated"),l=r.getArg(e,"original",null),t=r.getArg(e,"source",null),a=r.getArg(e,"name",null);this._skipValidation||this._validateMapping(n,l,t,a),null==t||this._sources.has(t)||this._sources.add(t),null==a||this._names.has(a)||this._names.add(a),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:null!=l&&l.line,originalColumn:null!=l&&l.column,source:t,name:a})},l.prototype.setSourceContent=function(e,n){var l=e;null!=this._sourceRoot&&(l=r.relative(this._sourceRoot,l)),null!=n?(this._sourcesContents||(this._sourcesContents={}),this._sourcesContents[r.toSetString(l)]=n):this._sourcesContents&&(delete this._sourcesContents[r.toSetString(l)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},l.prototype.applySourceMap=function(e,n,l){var t=n;if(null==n){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');t=e.file}var o=this._sourceRoot;null!=o&&(t=r.relative(o,t));var u=new a,s=new a;this._mappings.unsortedForEach(function(n){if(n.source===t&&null!=n.originalLine){var a=e.originalPositionFor({line:n.originalLine,column:n.originalColumn});null!=a.source&&(n.source=a.source,null!=l&&(n.source=r.join(l,n.source)),null!=o&&(n.source=r.relative(o,n.source)),n.originalLine=a.line,n.originalColumn=a.column,null!=a.name&&(n.name=a.name))}var i=n.source;null==i||u.has(i)||u.add(i);var c=n.name;null==c||s.has(c)||s.add(c)},this),this._sources=u,this._names=s,e.sources.forEach(function(n){var t=e.sourceContentFor(n);null!=t&&(null!=l&&(n=r.join(l,n)),null!=o&&(n=r.relative(o,n)),this.setSourceContent(n,t))},this)},l.prototype._validateMapping=function(e,n,l,t){if(!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!n&&!l&&!t||e&&"line"in e&&"column"in e&&n&&"line"in n&&"column"in n&&e.line>0&&e.column>=0&&n.line>0&&n.column>=0&&l))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:l,original:n,name:t}))},l.prototype._serializeMappings=function(){for(var e,n=0,l=1,a=0,o=0,u=0,s=0,i="",c=this._mappings.toArray(),d=0,p=c.length;p>d;d++){if(e=c[d],e.generatedLine!==l)for(n=0;e.generatedLine!==l;)i+=";",l++;else if(d>0){if(!r.compareByGeneratedPositions(e,c[d-1]))continue;i+=","}i+=t.encode(e.generatedColumn-n),n=e.generatedColumn,null!=e.source&&(i+=t.encode(this._sources.indexOf(e.source)-s),s=this._sources.indexOf(e.source),i+=t.encode(e.originalLine-1-o),o=e.originalLine-1,i+=t.encode(e.originalColumn-a),a=e.originalColumn,null!=e.name&&(i+=t.encode(this._names.indexOf(e.name)-u),u=this._names.indexOf(e.name)))}return i},l.prototype._generateSourcesContent=function(e,n){return e.map(function(e){if(!this._sourcesContents)return null;null!=n&&(e=r.relative(n,e));var l=r.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,l)?this._sourcesContents[l]:null},this)},l.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},l.prototype.toString=function(){return JSON.stringify(this)},n.SourceMapGenerator=l})},{"./array-set":327,"./base64-vlq":328,"./mapping-list":331,"./util":335,amdefine:336}],334:[function(e,n){if("function"!=typeof l)var l=e("amdefine")(n,e);l(function(e,n){function l(e,n,l,t,r){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==n?null:n,this.source=null==l?null:l,this.name=null==r?null:r,this[u]=!0,null!=t&&this.add(t)}var t=e("./source-map-generator").SourceMapGenerator,r=e("./util"),a=/(\r?\n)/,o=10,u="$$$isSourceNode$$$";l.fromStringWithSourceMap=function(e,n,t){function o(e,n){if(null===e||void 0===e.source)u.add(n);else{var a=t?r.join(t,e.source):e.source;u.add(new l(e.originalLine,e.originalColumn,a,n,e.name))}}var u=new l,s=e.split(a),i=function(){var e=s.shift(),n=s.shift()||"";return e+n},c=1,d=0,p=null;return n.eachMapping(function(e){if(null!==p){if(!(c<e.generatedLine)){var n=s[0],l=n.substr(0,e.generatedColumn-d);return s[0]=n.substr(e.generatedColumn-d),d=e.generatedColumn,o(p,l),void(p=e)}var l="";o(p,i()),c++,d=0}for(;c<e.generatedLine;)u.add(i()),c++;if(d<e.generatedColumn){var n=s[0];u.add(n.substr(0,e.generatedColumn)),s[0]=n.substr(e.generatedColumn),d=e.generatedColumn}p=e},this),s.length>0&&(p&&o(p,i()),u.add(s.join(""))),n.sources.forEach(function(e){var l=n.sourceContentFor(e);null!=l&&(null!=t&&(e=r.join(t,e)),u.setSourceContent(e,l))}),u},l.prototype.add=function(e){if(Array.isArray(e))e.forEach(function(e){this.add(e)},this);else{if(!e[u]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this},l.prototype.prepend=function(e){if(Array.isArray(e))for(var n=e.length-1;n>=0;n--)this.prepend(e[n]);else{if(!e[u]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},l.prototype.walk=function(e){for(var n,l=0,t=this.children.length;t>l;l++)n=this.children[l],n[u]?n.walk(e):""!==n&&e(n,{source:this.source,line:this.line,column:this.column,name:this.name})},l.prototype.join=function(e){var n,l,t=this.children.length;if(t>0){for(n=[],l=0;t-1>l;l++)n.push(this.children[l]),n.push(e);n.push(this.children[l]),this.children=n}return this},l.prototype.replaceRight=function(e,n){var l=this.children[this.children.length-1];return l[u]?l.replaceRight(e,n):"string"==typeof l?this.children[this.children.length-1]=l.replace(e,n):this.children.push("".replace(e,n)),this},l.prototype.setSourceContent=function(e,n){this.sourceContents[r.toSetString(e)]=n},l.prototype.walkSourceContents=function(e){for(var n=0,l=this.children.length;l>n;n++)this.children[n][u]&&this.children[n].walkSourceContents(e);for(var t=Object.keys(this.sourceContents),n=0,l=t.length;l>n;n++)e(r.fromSetString(t[n]),this.sourceContents[t[n]])},l.prototype.toString=function(){var e="";return this.walk(function(n){e+=n}),e},l.prototype.toStringWithSourceMap=function(e){var n={code:"",line:1,column:0},l=new t(e),r=!1,a=null,u=null,s=null,i=null;return this.walk(function(e,t){n.code+=e,null!==t.source&&null!==t.line&&null!==t.column?((a!==t.source||u!==t.line||s!==t.column||i!==t.name)&&l.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:n.line,column:n.column},name:t.name}),a=t.source,u=t.line,s=t.column,i=t.name,r=!0):r&&(l.addMapping({generated:{line:n.line,column:n.column}}),a=null,r=!1);for(var c=0,d=e.length;d>c;c++)e.charCodeAt(c)===o?(n.line++,n.column=0,c+1===d?(a=null,r=!1):r&&l.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:n.line,column:n.column},name:t.name})):n.column++}),this.walkSourceContents(function(e,n){l.setSourceContent(e,n)}),{code:n.code,map:l}},n.SourceNode=l})},{"./source-map-generator":333,"./util":335,amdefine:336}],335:[function(e,n){if("function"!=typeof l)var l=e("amdefine")(n,e);l(function(e,n){function l(e,n,l){if(n in e)return e[n];if(3===arguments.length)return l;throw new Error('"'+n+'" is a required argument.')}function t(e){var n=e.match(f);return n?{scheme:n[1],auth:n[2],host:n[3],port:n[4],path:n[5]}:null}function r(e){var n="";return e.scheme&&(n+=e.scheme+":"),n+="//",e.auth&&(n+=e.auth+"@"),e.host&&(n+=e.host),e.port&&(n+=":"+e.port),e.path&&(n+=e.path),n}function a(e){var n=e,l=t(e);if(l){if(!l.path)return e;n=l.path}for(var a,o="/"===n.charAt(0),u=n.split(/\/+/),s=0,i=u.length-1;i>=0;i--)a=u[i],"."===a?u.splice(i,1):".."===a?s++:s>0&&(""===a?(u.splice(i+1,s),s=0):(u.splice(i,2),s--));return n=u.join("/"),""===n&&(n=o?"/":"."),l?(l.path=n,r(l)):n}function o(e,n){""===e&&(e="."),""===n&&(n=".");var l=t(n),o=t(e);if(o&&(e=o.path||"/"),l&&!l.scheme)return o&&(l.scheme=o.scheme),r(l);if(l||n.match(g))return n;if(o&&!o.host&&!o.path)return o.host=n,r(o);var u="/"===n.charAt(0)?n:a(e.replace(/\/+$/,"")+"/"+n);return o?(o.path=u,r(o)):u}function u(e,n){""===e&&(e="."),e=e.replace(/\/$/,"");var l=t(e);return"/"==n.charAt(0)&&l&&"/"==l.path?n.slice(1):0===n.indexOf(e+"/")?n.substr(e.length+1):n}function s(e){return"$"+e}function i(e){return e.substr(1)}function c(e,n){var l=e||"",t=n||"";return(l>t)-(t>l)}function d(e,n,l){var t;return(t=c(e.source,n.source))?t:(t=e.originalLine-n.originalLine)?t:(t=e.originalColumn-n.originalColumn,t||l?t:(t=c(e.name,n.name))?t:(t=e.generatedLine-n.generatedLine,t?t:e.generatedColumn-n.generatedColumn))}function p(e,n,l){var t;return(t=e.generatedLine-n.generatedLine)?t:(t=e.generatedColumn-n.generatedColumn,t||l?t:(t=c(e.source,n.source))?t:(t=e.originalLine-n.originalLine)?t:(t=e.originalColumn-n.originalColumn,t?t:c(e.name,n.name)))
}n.getArg=l;var f=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,g=/^data:.+\,.+$/;n.urlParse=t,n.urlGenerate=r,n.normalize=a,n.join=o,n.relative=u,n.toSetString=s,n.fromSetString=i,n.compareByOriginalPositions=d,n.compareByGeneratedPositions=p})},{amdefine:336}],336:[function(e,n){(function(l,t){"use strict";function r(n,r){function a(e){var n,l;for(n=0;e[n];n+=1)if(l=e[n],"."===l)e.splice(n,1),n-=1;else if(".."===l){if(1===n&&(".."===e[2]||".."===e[0]))break;n>0&&(e.splice(n-1,2),n-=2)}}function o(e,n){var l;return e&&"."===e.charAt(0)&&n&&(l=n.split("/"),l=l.slice(0,l.length-1),l=l.concat(e.split("/")),a(l),e=l.join("/")),e}function u(e){return function(n){return o(n,e)}}function s(e){function n(n){g[e]=n}return n.fromText=function(){throw new Error("amdefine does not implement load.fromText")},n}function i(e,l,a){var o,u,s,i;if(e)u=g[e]={},s={id:e,uri:t,exports:u},o=d(r,u,s,e);else{if(h)throw new Error("amdefine with no module ID cannot be called more than once per file.");h=!0,u=n.exports,s=n,o=d(r,u,s,n.id)}l&&(l=l.map(function(e){return o(e)})),i="function"==typeof a?a.apply(s.exports,l):a,void 0!==i&&(s.exports=i,e&&(g[e]=s.exports))}function c(e,n,l){Array.isArray(e)?(l=n,n=e,e=void 0):"string"!=typeof e&&(l=e,e=n=void 0),n&&!Array.isArray(n)&&(l=n,n=void 0),n||(n=["require","exports","module"]),e?f[e]=[e,n,l]:i(e,n,l)}var d,p,f={},g={},h=!1,m=e("path");return d=function(e,n,t,r){function a(a,o){return"string"==typeof a?p(e,n,t,a,r):(a=a.map(function(l){return p(e,n,t,l,r)}),void l.nextTick(function(){o.apply(null,a)}))}return a.toUrl=function(e){return 0===e.indexOf(".")?o(e,m.dirname(t.filename)):e},a},r=r||function(){return n.require.apply(n,arguments)},p=function(e,n,l,t,r){var a,c,h=t.indexOf("!"),m=t;if(-1===h){if(t=o(t,r),"require"===t)return d(e,n,l,r);if("exports"===t)return n;if("module"===t)return l;if(g.hasOwnProperty(t))return g[t];if(f[t])return i.apply(null,f[t]),g[t];if(e)return e(m);throw new Error("No module with ID: "+t)}return a=t.substring(0,h),t=t.substring(h+1,t.length),c=p(e,n,l,a,r),t=c.normalize?c.normalize(t,u(r)):o(t,r),g[t]?g[t]:(c.load(t,d(e,n,l,r),s(t),{}),g[t])},c.require=function(e){return g[e]?g[e]:f[e]?(i.apply(null,f[e]),g[e]):void 0},c.amd={},c}n.exports=r}).call(this,e("_process"),"/node_modules/source-map/node_modules/amdefine/amdefine.js")},{_process:148,path:147}],337:[function(e,n){"use strict";n.exports=function(e){return e.replace(/[\s\uFEFF\xA0]+$/g,"")}},{}],338:[function(e,n){n.exports={name:"babel",description:"Turn ES6 code into readable vanilla ES5 with source maps",version:"4.5.4",author:"Sebastian McKenzie <sebmck@gmail.com>",homepage:"https://babeljs.io/",repository:"babel/babel",preferGlobal:!0,main:"lib/babel/api/node.js",browser:{"./lib/babel/api/register/node.js":"./lib/babel/api/register/browser.js"},bin:{"6to5":"./bin/deprecated/6to5","6to5-node":"./bin/deprecated/6to5-node","6to5-runtime":"./bin/deprecated/6to5-runtime",babel:"./bin/babel/index.js","babel-node":"./bin/babel-node","babel-external-helpers":"./bin/babel-external-helpers"},keywords:["harmony","classes","modules","let","const","var","es6","transpile","transpiler","6to5","babel"],scripts:{bench:"make bench",test:"make test"},dependencies:{"acorn-babel":"0.11.1-35","ast-types":"~0.6.1",chalk:"^1.0.0",chokidar:"^0.12.6",commander:"^2.6.0","core-js":"^0.6.1",debug:"^2.1.1","detect-indent":"^3.0.0",estraverse:"^1.9.1",esutils:"^1.1.6","fs-readdir-recursive":"^0.1.0",globals:"^6.2.0","is-integer":"^1.0.4","js-tokens":"0.4.1",leven:"^1.0.1","line-numbers":"0.2.0",lodash:"^3.2.0","output-file-sync":"^1.1.0","path-is-absolute":"^1.0.0","private":"^0.1.6","regenerator-babel":"0.8.13-1",regexpu:"^1.1.1",repeating:"^1.1.2","shebang-regex":"^1.0.0",slash:"^1.0.0","source-map":"^0.1.43","source-map-support":"^0.2.9","source-map-to-comment":"^1.0.0","trim-right":"^1.0.0"},devDependencies:{babel:"4.5.1",browserify:"^8.1.3",chai:"^2.0.0",esvalid:"^1.1.0",istanbul:"^0.3.5",matcha:"^0.6.0",mocha:"^2.1.0",rimraf:"^2.2.8","uglify-js":"^2.4.16"}}},{}],339:[function(e,n){n.exports={"abstract-expression-call":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"PROPERTY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"referenceGet",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"abstract-expression-delete":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"PROPERTY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"referenceDelete",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"abstract-expression-get":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"PROPERTY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"referenceGet",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"abstract-expression-set":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"PROPERTY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"referenceSet",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"apply-constructor":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"args",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instance",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"create",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instance",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"args",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!=",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"object",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"||",right:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"function",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instance",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"array-comprehension-container":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"ArrayExpression",start:null,end:null,loc:null,range:null,elements:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"array-from":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"from",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"array-push":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"push",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"STATEMENT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"async-to-generator":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"fn",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"gen",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"fn",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"NewExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Promise",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"resolve",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"reject",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"callNext",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"step",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"bind",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},{type:"Literal",start:null,end:null,loc:null,range:null,value:"next",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"callThrow",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"step",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"bind",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},{type:"Literal",start:null,end:null,loc:null,range:null,value:"throw",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"FunctionDeclaration",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"step",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arg",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"TryStatement",start:null,end:null,loc:null,range:null,block:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"info",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"gen",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arg",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"info",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},handler:{type:"CatchClause",start:null,end:null,loc:null,range:null,param:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"error",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},guard:null,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"reject",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"error",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},guardedHandlers:[],finalizer:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"info",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"done",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"resolve",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Promise",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"resolve",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"then",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"callNext",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"callThrow",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"callNext",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},bind:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Function",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"bind",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},call:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"CONTEXT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"class-call-check":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instance",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"!",prefix:!0,argument:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instance",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"instanceof",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ThrowStatement",start:null,end:null,loc:null,range:null,argument:{type:"NewExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"TypeError",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Literal",start:null,end:null,loc:null,range:null,value:"Cannot call a class as a function",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"class-super-constructor-call-loose":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"SUPER_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!=",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"SUPER_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"class-super-constructor-call":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"SUPER_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!=",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"SUPER_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"corejs-is-iterator":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"CORE_ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"$for",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"isIterable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"corejs-iterator":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"CORE_ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"$for",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getIterator",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"default-parameter":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VARIABLE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENT_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"DEFAULT_VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENT_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"let",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},defaults:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defaults",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"keys",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getOwnPropertyNames",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defaults",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"Literal",start:null,end:null,loc:null,range:null,value:0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"<",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"keys",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:{type:"UpdateExpression",start:null,end:null,loc:null,range:null,operator:"++",prefix:!1,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"keys",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getOwnPropertyDescriptor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defaults",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"configurable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperty",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"define-property":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperty",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"enumerable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"configurable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"writable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"exports-assign":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"exports-default-assign":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"module",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"exports-module-declaration-loose":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"__esModule",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"exports-module-declaration":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperty",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Literal",start:null,end:null,loc:null,range:null,value:"__esModule",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"extends":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"assign",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"||",right:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"Literal",start:null,end:null,loc:null,range:null,value:1,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"<",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:{type:"UpdateExpression",start:null,end:null,loc:null,range:null,operator:"++",prefix:!1,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"source",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ForInStatement",start:null,end:null,loc:null,range:null,left:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"source",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"hasOwnProperty",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"source",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"source",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"for-of-loose":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"IS_ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"isArray",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"Literal",start:null,end:null,loc:null,range:null,value:0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"IS_ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"iterator",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},test:null,update:null,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"IS_ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:">=",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BreakStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"UpdateExpression",start:null,end:null,loc:null,range:null,operator:"++",prefix:!1,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"done",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BreakStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"for-of":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"iterator",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"STEP_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},test:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"!",prefix:!0,argument:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"STEP_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"done",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:null,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},get:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"get",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"property",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"receiver",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getOwnPropertyDescriptor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"property",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"parent",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getPrototypeOf",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"parent",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"get",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"parent",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"property",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"receiver",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Literal",start:null,end:null,loc:null,range:null,value:"value",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},operator:"in",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"writable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getter",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"get",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getter",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getter",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"receiver",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"has-own":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"hasOwnProperty",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},inherits:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"subClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"function",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ThrowStatement",start:null,end:null,loc:null,range:null,argument:{type:"NewExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"TypeError",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Literal",start:null,end:null,loc:null,range:null,value:"Super expression must either be null or a function, not ",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},operator:"+",right:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"subClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"create",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"constructor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"subClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"enumerable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:!1,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"writable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"configurable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"subClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"__proto__",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"interop-require-wildcard":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"__esModule",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Literal",start:null,end:null,loc:null,range:null,value:"default",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"interop-require":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"__esModule",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Literal",start:null,end:null,loc:null,range:null,value:"default",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"let-scoping-return":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"RETURN",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"object",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"RETURN",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"v",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"named-function":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"FunctionDeclaration",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"GET_OUTER_ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},generator:!1,expression:!1,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"object-destructuring-empty":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ThrowStatement",start:null,end:null,loc:null,range:null,argument:{type:"NewExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"TypeError",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Literal",start:null,end:null,loc:null,range:null,value:"Cannot destructure undefined",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"object-without-properties":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"keys",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ForInStatement",start:null,end:null,loc:null,range:null,left:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"keys",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"indexOf",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:">=",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ContinueStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"!",prefix:!0,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"hasOwnProperty",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ContinueStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"property-method-assignment-wrapper-generator":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"WRAPPER_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"regeneratorRuntime",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"mark",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},generator:!1,expression:!1,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_this",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"regeneratorRuntime",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"wrap",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_ID$",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"context$2$0",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"WhileStatement",start:null,end:null,loc:null,range:null,test:{type:"Literal",start:null,end:null,loc:null,range:null,value:1,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},body:{type:"SwitchStatement",start:null,end:null,loc:null,range:null,discriminant:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"context$2$0",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prev",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"context$2$0",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},cases:[{type:"SwitchCase",start:null,end:null,loc:null,range:null,consequent:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"context$2$0",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"delegateYield",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_this",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Literal",start:null,end:null,loc:null,range:null,value:"t0",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},{type:"Literal",start:null,end:null,loc:null,range:null,value:1,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],test:{type:"Literal",start:null,end:null,loc:null,range:null,value:0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"SwitchCase",start:null,end:null,loc:null,range:null,consequent:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"context$2$0",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"abrupt",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Literal",start:null,end:null,loc:null,range:null,value:"return",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"context$2$0",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"t0",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],test:{type:"Literal",start:null,end:null,loc:null,range:null,value:1,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"SwitchCase",start:null,end:null,loc:null,range:null,consequent:[],test:{type:"Literal",start:null,end:null,loc:null,range:null,value:2,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"SwitchCase",start:null,end:null,loc:null,range:null,consequent:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"context$2$0",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"stop",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],test:{type:"Literal",start:null,end:null,loc:null,range:null,value:"end",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"WRAPPER_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"toString",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"toString",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"WRAPPER_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"property-method-assignment-wrapper":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"WRAPPER_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},generator:!1,expression:!1,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"WRAPPER_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"toString",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"toString",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"WRAPPER_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"prototype-identifier":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"CLASS_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"prototype-properties":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"child",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"staticProps",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instanceProps",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"staticProps",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperties",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"child",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"staticProps",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instanceProps",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperties",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"child",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instanceProps",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"require-assign-key":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VARIABLE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"require",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"MODULE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},require:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"require",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"MODULE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},rest:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LEN",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARRAY_LEN",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"START",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"<",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LEN",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:{type:"UpdateExpression",start:null,end:null,loc:null,range:null,operator:"++",prefix:!1,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARRAY_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"self-contained-helpers-head":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"helpers",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Literal",start:null,end:null,loc:null,range:null,value:"default",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"__esModule",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"self-global":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"global",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"undefined",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"self",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"global",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},set:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"set",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"property",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"receiver",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getOwnPropertyDescriptor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"property",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"parent",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getPrototypeOf",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"parent",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"set",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"parent",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"property",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"receiver",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Literal",start:null,end:null,loc:null,range:null,value:"value",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},operator:"in",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"writable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"setter",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"set",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"setter",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!==",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"setter",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"receiver",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},slice:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"slice",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"sliced-to-array":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"isArray",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"iterator",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"in",right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"ArrayExpression",start:null,end:null,loc:null,range:null,elements:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_iterator",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"iterator",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_step",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},test:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"!",prefix:!0,argument:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_step",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_iterator",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"done",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:null,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"push",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_step",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BreakStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ThrowStatement",start:null,end:null,loc:null,range:null,argument:{type:"NewExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"TypeError",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Literal",start:null,end:null,loc:null,range:null,value:"Invalid attempt to destructure non-iterable instance",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},system:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"System",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"register",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"MODULE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"MODULE_DEPENDENCIES",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"EXPORT_IDENTIFIER",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"setters",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"SETTERS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"execute",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"EXECUTE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"tagged-template-literal-loose":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"tagged-template-literal":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"freeze",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperties",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"freeze",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"tail-call-body":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"AGAIN_ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"LabeledStatement",start:null,end:null,loc:null,range:null,body:{type:"WhileStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"AGAIN_ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"BLOCK",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},label:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"temporal-assert-defined":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"val",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"name",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undef",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"val",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undef",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ThrowStatement",start:null,end:null,loc:null,range:null,argument:{type:"NewExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ReferenceError",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"name",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"+",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:" is not defined - temporal dead zone",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"temporal-undefined":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"test-exports":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"undefined",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"test-module":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"module",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"undefined",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"to-array":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"isArray",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"from",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"to-consumable-array":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"isArray",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"Literal",start:null,end:null,loc:null,range:null,value:0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr2",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"<",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:{type:"UpdateExpression",start:null,end:null,loc:null,range:null,operator:"++",prefix:!1,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr2",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr2",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"from",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"typeof":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"constructor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Literal",start:null,end:null,loc:null,range:null,value:"symbol",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},alternate:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"umd-runner-body":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"factory",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"define",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"function",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"define",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"amd",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!1,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"define",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"AMD_ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"factory",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"COMMON_TEST",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"factory",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"COMMON_ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}}
},{}]},{},[1])(1)});
|
packages/slimkit-plus-feed/admin/components/PayControl.js
|
zhiyicx/thinksns-plus
|
/**
* The file is admin feeds pay-control manage page.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Grid from '@material-ui/core/Grid';
import Card from '@material-ui/core/Card';
import CardContent from '@material-ui/core/CardContent';
import CardActions from '@material-ui/core/CardActions';
import Typography from '@material-ui/core/Typography';
import Dialog from '@material-ui/core/Dialog';
import DialogContent from '@material-ui/core/DialogContent';
import DialogActions from '@material-ui/core/DialogActions';
import Snackbar from '@material-ui/core/Snackbar';
import Button from '@material-ui/core/Button';
import IconButton from '@material-ui/core/IconButton';
import FormControlLabel from '@material-ui/core/FormControlLabel';
import Switch from '@material-ui/core/Switch';
import CircularProgress from '@material-ui/core/CircularProgress';
import TextField from '@material-ui/core/TextField';
import CloseIcon from '@material-ui/icons/Close';
import withStyles from '@material-ui/core/styles/withStyles';
import request, { createRequestURI } from '../utils/request';
const styles = (theme) => ({
root: {
width: '100%',
padding: theme.spacing.unit,
margin: 0
}
});
class PayControl extends Component
{
static propTypes = {
classes: PropTypes.object.isRequired,
};
state = {
snackbar: {
open: false,
message: '',
vertical: 'bottom',
horizontal: 'right',
},
open: false,
textLength: 50,
payItems: '1,5,10',
close: {
open: false,
ing: false
}
};
handleChange = e => {
this.setState({
...this.state,
payItems: e.target.value
});
};
handleTextChange = e => {
this.setState({
...this.state,
textLength: e.target.value
});
};
handleSnackbar(snackbar = {}) {
this.setState({
...this.state,
snackbar: { ...this.state.snackbar, ...snackbar }
});
}
handleSnackbarClose() {
this.handleSnackbar({ open: false, });
}
saveItem () {
const { payItems, textLength } = this.state;
request.patch(createRequestURI('paycontrol'), {
payItems,
textLength
}, {
validataStatus: status => status === 201
}).then( () => {
this.handleSnackbar({
message: '保存成功!',
open: true,
});
}).catch ( () => {
this.handleSnackbar({
message: '保存失败!',
open: true,
});
});
}
render () {
let { open = false, close, snackbar } = this.state;
const { classes } = this.props;
return (
<div>
<Grid container className={classes.root}>
<Grid item xs={12} sm={12}>
<Card>
<CardContent>
<Typography type="headline" component="h2">
动态付费控制
</Typography>
<Typography component="p">
用于控制客户端发送动态是否可以设置付费,关闭付费后,选项和文字收费长度将失效
</Typography>
</CardContent>
<CardActions>
<FormControlLabel
control={
<Switch
color="primary"
checked={open}
onChange={ (event, checked) => !checked ? this.handleSetFalse(checked) : this.handleStatusChange (checked) }
/>
}
label={open ? '已开启' : '已关闭'}
/>
</CardActions>
</Card>
</Grid>
<Grid item xs={12} sm={12}>
<Card >
<CardContent>
<Typography type="headline" component="h2">
付费选项
</Typography>
<Typography component="div">
<p>发布付费动态时的金额选项,最少为0.01元</p>
<p>少于0.01元时会出现意想不到的支付错误,请慎重填写</p>
<p>3个选项,请用半角","隔开</p>
</Typography>
</CardContent>
<CardContent>
<TextField
label="金额选项"
className={classes.textField}
value={this.state.payItems}
onChange={this.handleChange}
margin="normal"
/>
<Button onClick={() => {
this.saveItem();
}}>保存</Button>
</CardContent>
</Card>
</Grid>
<Grid item xs={12} sm={12}>
<Card>
<CardContent>
<Typography type="headline" component="h2">
付费选项
</Typography>
<Typography component="div">
<p>付费文字大于多少个字之后开始收费</p>
<p>内容必须要大于这个长度,才能设置收费</p>
</Typography>
</CardContent>
<CardContent>
<TextField
label="收费文字长度"
className={classes.textField}
value={this.state.textLength}
onChange={this.handleTextChange}
margin="normal"
/>
<Button onClick={() => {
this.saveItem();
}}>保存</Button>
</CardContent>
</Card>
</Grid>
</Grid>
<Dialog open={!! close.open}>
<DialogContent>确定要关闭收费吗吗?</DialogContent>
<DialogActions>
{ close.ing
? <Button disabled>取消</Button>
: <Button onClick={() => this.handleCannel()}>取消</Button>
}
{ close.ing
? <Button disabled><CircularProgress size={14} /></Button>
: <Button color="primary" onClick={() => this.handleStatusChange()}>确定</Button>
}
</DialogActions>
</Dialog>
<Snackbar
anchorOrigin={{ vertical: snackbar.vertical, horizontal: snackbar.horizontal }}
open={!! snackbar.open}
message={snackbar.message}
autoHideDuration={3e3}
onClose={() => this.handleSnackbarClose()}
action={[
<IconButton
key="snackbar.close"
color="inherit"
onClick={() => this.handleSnackbarClose()}
>
<CloseIcon />
</IconButton>
]}
/>
</div>
);
}
handleSetFalse () {
this.setState({
...this.state,
close: {
open: true,
ing: false
}
});
}
handleStatusChange () {
let open = !this.state.open;
if (!open) {
this.setState({
...this.state,
close: {
open: true,
ing: true
}
});
}
request.patch(createRequestURI('paycontrol'), {
open: open
}, {
validataStatus: status => status === 201
}).then( () => {
this.handleCannel();
this.setState({
...this.state,
open: open
});
this.handleSnackbar({
message: '保存成功!',
open: true,
});
}).catch ( () => {
this.handleSnackbar({
message: '保存失败!',
open: true,
});
});
}
handleCannel () {
this.setState({
close: {
open: false,
ing: false
}
});
}
componentDidMount () {
request.get(createRequestURI('paycontrol'), {
validataStatus: status => status === 200
}).then(({ data = {} }) => {
this.setState({
open: data.open,
payItems: data.payItems,
textLength: data.textLength
});
}).catch( () => {
alert('获取配置信息失败');
});
}
}
export default withStyles(styles)(PayControl);
|
ajax/libs/mobx-react/0.1.7/index.js
|
sufuf3/cdnjs
|
(function() {
function mrFactory(mobservable, React) {
var reactComponentId = 1;
var isTracking = false;
// WeakMap<Node, Object>;
var componentByNodeRegistery = typeof WeakMap !== "undefined" ? new WeakMap() : undefined;
var renderReporter = new mobservable._.SimpleEventEmitter();
function reportRendering(component) {
// TODO: Fix in 0.14: React.findDOMNode is deprecated. Please use ReactDOM.findDOMNode from require('react-dom') instead.
var node = React.findDOMNode(component);
if (node)
componentByNodeRegistery.set(node, component);
renderReporter.emit({
event: 'render',
renderTime: component.__renderEnd - component.__renderStart,
totalTime: Date.now() - component.__renderStart,
component: component,
node: node
});
}
var reactiveMixin = {
componentWillMount: function() {
var name = (this.displayName || this.constructor.name || "ReactiveComponent") + reactComponentId++;
var baseRender = this.render;
this.render = function() {
if (isTracking)
this.__renderStart = Date.now();
if (this.__watchDisposer)
this.__watchDisposer();
var hasRendered = false;
var rendering;
this.__watchDisposer = mobservable.observe(function reactiveRender() {
if (!hasRendered) {
hasRendered = true;
rendering = baseRender.call(this);
} else {
React.Component.prototype.forceUpdate.call(this);
}
}, this);
this.$mobservable = this.__watchDisposer.$mobservable;
if (isTracking)
this.__renderEnd = Date.now();
return rendering;
}
},
componentWillUnmount: function() {
if (this.__watchDisposer)
this.__watchDisposer();
delete this.$mobservable;
if (isTracking) {
// TODO: Fix in 0.14: React.findDOMNode is deprecated. Please use ReactDOM.findDOMNode from require('react-dom') instead.
var node = React.findDOMNode(this);
if (node) {
componentByNodeRegistery.delete(node);
renderReporter.emit({
event: 'destroy',
component: this,
node: node
});
}
}
},
componentDidMount: function() {
if (isTracking)
reportRendering(this);
},
componentDidUpdate: function() {
if (isTracking)
reportRendering(this);
},
shouldComponentUpdate: function(nextProps, nextState) {
// update on any state changes (as is the default)
if (this.state !== nextState)
return true;
// update if props are shallowly not equal, inspired by PureRenderMixin
var keys = Object.keys(this.props);
var key;
if (keys.length !== Object.keys(nextProps).length)
return true;
for(var i = keys.length -1; i >= 0, key = keys[i]; i--) {
var newValue = nextProps[key];
if (newValue !== this.props[key]) {
return true;
} else if (newValue && typeof newValue === "object" && !mobservable.isReactive(newValue)) {
/**
* If the newValue is still the same object, but that object is not reactive,
* fallback to the default React behavior: update, because the object *might* have changed.
* If you need the non default behavior, just use the React pure render mixin, as that one
* will work fine with mobservable as well, instead of the default implementation of
* reactiveComponent.
*/
return true;
}
}
return false;
}
}
function patch(target, funcName) {
var base = target[funcName];
var mixinFunc = reactiveMixin[funcName];
target[funcName] = function() {
base && base.apply(this, arguments);
mixinFunc.apply(this, arguments);
}
}
function reactiveComponent(componentClass) {
// If it is function but doesn't seem to be a react class constructor,
// wrap it to a react class automatically
if (typeof componentClass === "function" && !componentClass.prototype.render && !componentClass.isReactClass && !React.Component.isPrototypeOf(componentClass)) {
return reactiveComponent(React.createClass({
displayName: componentClass.name,
render: function() {
return componentClass.call(this, this.props);
}
}));
}
if (!componentClass)
throw new Error("Please pass a valid component to 'reactiveComponent'");
var target = componentClass.prototype || componentClass;
[
"componentWillMount",
"componentWillUnmount",
"componentDidMount",
"componentDidUpdate"
].forEach(function(funcName) {
patch(target, funcName)
});
if (!target.shouldComponentUpdate)
target.shouldComponentUpdate = reactiveMixin.shouldComponentUpdate;
return componentClass;
}
function trackComponents() {
if (typeof WeakMap === "undefined")
throw new Error("tracking components is not supported in this browser");
if (!isTracking)
isTracking = true;
}
return ({
reactiveComponent: reactiveComponent,
renderReporter: renderReporter,
componentByNodeRegistery: componentByNodeRegistery,
trackComponents: trackComponents
});
}
// UMD
if (typeof define === 'function' && define.amd) {
define('mobservable-react', ['mobservable', 'react'], mrFactory);
}
else if (typeof exports === 'object')
module.exports = mrFactory(require('mobservable'), require('react'));
else
this.mobservableReact = mrFactory(this['mobservable'], this['React']);
})();
|
ajax/libs/react-bootstrap/0.20.1/react-bootstrap.js
|
2947721120/cdnjs
|
(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["ReactBootstrap"] = factory(require("react"));
else
root["ReactBootstrap"] = factory(root["React"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_51__) {
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";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var Accordion = _interopRequire(__webpack_require__(1));
var Affix = _interopRequire(__webpack_require__(2));
var AffixMixin = _interopRequire(__webpack_require__(3));
var Alert = _interopRequire(__webpack_require__(4));
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var Badge = _interopRequire(__webpack_require__(6));
var Button = _interopRequire(__webpack_require__(7));
var ButtonGroup = _interopRequire(__webpack_require__(8));
var ButtonToolbar = _interopRequire(__webpack_require__(9));
var CollapsableNav = _interopRequire(__webpack_require__(10));
var Carousel = _interopRequire(__webpack_require__(11));
var CarouselItem = _interopRequire(__webpack_require__(12));
var Col = _interopRequire(__webpack_require__(13));
var CollapsableMixin = _interopRequire(__webpack_require__(14));
var DropdownButton = _interopRequire(__webpack_require__(15));
var DropdownMenu = _interopRequire(__webpack_require__(16));
var DropdownStateMixin = _interopRequire(__webpack_require__(17));
var FadeMixin = _interopRequire(__webpack_require__(18));
var Glyphicon = _interopRequire(__webpack_require__(19));
var Grid = _interopRequire(__webpack_require__(20));
var Input = _interopRequire(__webpack_require__(21));
var Interpolate = _interopRequire(__webpack_require__(22));
var Jumbotron = _interopRequire(__webpack_require__(23));
var Label = _interopRequire(__webpack_require__(24));
var ListGroup = _interopRequire(__webpack_require__(25));
var ListGroupItem = _interopRequire(__webpack_require__(26));
var MenuItem = _interopRequire(__webpack_require__(27));
var Modal = _interopRequire(__webpack_require__(28));
var Nav = _interopRequire(__webpack_require__(29));
var Navbar = _interopRequire(__webpack_require__(30));
var NavItem = _interopRequire(__webpack_require__(31));
var ModalTrigger = _interopRequire(__webpack_require__(32));
var OverlayTrigger = _interopRequire(__webpack_require__(33));
var OverlayMixin = _interopRequire(__webpack_require__(34));
var PageHeader = _interopRequire(__webpack_require__(35));
var Panel = _interopRequire(__webpack_require__(36));
var PanelGroup = _interopRequire(__webpack_require__(37));
var PageItem = _interopRequire(__webpack_require__(38));
var Pager = _interopRequire(__webpack_require__(39));
var Popover = _interopRequire(__webpack_require__(40));
var ProgressBar = _interopRequire(__webpack_require__(41));
var Row = _interopRequire(__webpack_require__(42));
var SplitButton = _interopRequire(__webpack_require__(43));
var SubNav = _interopRequire(__webpack_require__(44));
var TabbedArea = _interopRequire(__webpack_require__(45));
var Table = _interopRequire(__webpack_require__(46));
var TabPane = _interopRequire(__webpack_require__(47));
var Tooltip = _interopRequire(__webpack_require__(48));
var Well = _interopRequire(__webpack_require__(49));
var constants = _interopRequire(__webpack_require__(50));
module.exports = {
Accordion: Accordion,
Affix: Affix,
AffixMixin: AffixMixin,
Alert: Alert,
BootstrapMixin: BootstrapMixin,
Badge: Badge,
Button: Button,
ButtonGroup: ButtonGroup,
ButtonToolbar: ButtonToolbar,
CollapsableNav: CollapsableNav,
Carousel: Carousel,
CarouselItem: CarouselItem,
Col: Col,
CollapsableMixin: CollapsableMixin,
DropdownButton: DropdownButton,
DropdownMenu: DropdownMenu,
DropdownStateMixin: DropdownStateMixin,
FadeMixin: FadeMixin,
Glyphicon: Glyphicon,
Grid: Grid,
Input: Input,
Interpolate: Interpolate,
Jumbotron: Jumbotron,
Label: Label,
ListGroup: ListGroup,
ListGroupItem: ListGroupItem,
MenuItem: MenuItem,
Modal: Modal,
Nav: Nav,
Navbar: Navbar,
NavItem: NavItem,
ModalTrigger: ModalTrigger,
OverlayTrigger: OverlayTrigger,
OverlayMixin: OverlayMixin,
PageHeader: PageHeader,
Panel: Panel,
PanelGroup: PanelGroup,
PageItem: PageItem,
Pager: Pager,
Popover: Popover,
ProgressBar: ProgressBar,
Row: Row,
SplitButton: SplitButton,
SubNav: SubNav,
TabbedArea: TabbedArea,
Table: Table,
TabPane: TabPane,
Tooltip: Tooltip,
Well: Well,
constants: constants
};
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var PanelGroup = _interopRequire(__webpack_require__(37));
var Accordion = React.createClass({
displayName: "Accordion",
render: function render() {
return React.createElement(
PanelGroup,
_extends({}, this.props, { accordion: true }),
this.props.children
);
}
});
module.exports = Accordion;
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var AffixMixin = _interopRequire(__webpack_require__(3));
var domUtils = _interopRequire(__webpack_require__(52));
var Affix = React.createClass({
displayName: "Affix",
statics: {
domUtils: domUtils
},
mixins: [AffixMixin],
render: function render() {
var holderStyle = { top: this.state.affixPositionTop };
return React.createElement(
"div",
_extends({}, this.props, {
className: classSet(this.props.className, this.state.affixClass),
style: holderStyle }),
this.props.children
);
}
});
module.exports = Affix;
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var React = _interopRequire(__webpack_require__(51));
var domUtils = _interopRequire(__webpack_require__(52));
var EventListener = _interopRequire(__webpack_require__(53));
var AffixMixin = {
propTypes: {
offset: React.PropTypes.number,
offsetTop: React.PropTypes.number,
offsetBottom: React.PropTypes.number
},
getInitialState: function getInitialState() {
return {
affixClass: "affix-top"
};
},
getPinnedOffset: function getPinnedOffset(DOMNode) {
if (this.pinnedOffset) {
return this.pinnedOffset;
}
DOMNode.className = DOMNode.className.replace(/affix-top|affix-bottom|affix/, "");
DOMNode.className += DOMNode.className.length ? " affix" : "affix";
this.pinnedOffset = domUtils.getOffset(DOMNode).top - window.pageYOffset;
return this.pinnedOffset;
},
checkPosition: function checkPosition() {
var DOMNode = undefined,
scrollHeight = undefined,
scrollTop = undefined,
position = undefined,
offsetTop = undefined,
offsetBottom = undefined,
affix = undefined,
affixType = undefined,
affixPositionTop = undefined;
// TODO: or not visible
if (!this.isMounted()) {
return;
}
DOMNode = React.findDOMNode(this);
scrollHeight = document.documentElement.offsetHeight;
scrollTop = window.pageYOffset;
position = domUtils.getOffset(DOMNode);
if (this.affixed === "top") {
position.top += scrollTop;
}
offsetTop = this.props.offsetTop != null ? this.props.offsetTop : this.props.offset;
offsetBottom = this.props.offsetBottom != null ? this.props.offsetBottom : this.props.offset;
if (offsetTop == null && offsetBottom == null) {
return;
}
if (offsetTop == null) {
offsetTop = 0;
}
if (offsetBottom == null) {
offsetBottom = 0;
}
if (this.unpin != null && scrollTop + this.unpin <= position.top) {
affix = false;
} else if (offsetBottom != null && position.top + DOMNode.offsetHeight >= scrollHeight - offsetBottom) {
affix = "bottom";
} else if (offsetTop != null && scrollTop <= offsetTop) {
affix = "top";
} else {
affix = false;
}
if (this.affixed === affix) {
return;
}
if (this.unpin != null) {
DOMNode.style.top = "";
}
affixType = "affix" + (affix ? "-" + affix : "");
this.affixed = affix;
this.unpin = affix === "bottom" ? this.getPinnedOffset(DOMNode) : null;
if (affix === "bottom") {
DOMNode.className = DOMNode.className.replace(/affix-top|affix-bottom|affix/, "affix-bottom");
affixPositionTop = scrollHeight - offsetBottom - DOMNode.offsetHeight - domUtils.getOffset(DOMNode).top;
}
this.setState({
affixClass: affixType,
affixPositionTop: affixPositionTop
});
},
checkPositionWithEventLoop: function checkPositionWithEventLoop() {
setTimeout(this.checkPosition, 0);
},
componentDidMount: function componentDidMount() {
this._onWindowScrollListener = EventListener.listen(window, "scroll", this.checkPosition);
this._onDocumentClickListener = EventListener.listen(React.findDOMNode(this).ownerDocument, "click", this.checkPositionWithEventLoop);
},
componentWillUnmount: function componentWillUnmount() {
if (this._onWindowScrollListener) {
this._onWindowScrollListener.remove();
}
if (this._onDocumentClickListener) {
this._onDocumentClickListener.remove();
}
},
componentDidUpdate: function componentDidUpdate(prevProps, prevState) {
if (prevState.affixClass === this.state.affixClass) {
this.checkPositionWithEventLoop();
}
}
};
module.exports = AffixMixin;
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var Alert = React.createClass({
displayName: "Alert",
mixins: [BootstrapMixin],
propTypes: {
onDismiss: React.PropTypes.func,
dismissAfter: React.PropTypes.number
},
getDefaultProps: function getDefaultProps() {
return {
bsClass: "alert",
bsStyle: "info"
};
},
renderDismissButton: function renderDismissButton() {
return React.createElement(
"button",
{
type: "button",
className: "close",
onClick: this.props.onDismiss,
"aria-hidden": "true" },
"×"
);
},
render: function render() {
var classes = this.getBsClassSet();
var isDismissable = !!this.props.onDismiss;
classes["alert-dismissable"] = isDismissable;
return React.createElement(
"div",
_extends({}, this.props, { className: classSet(this.props.className, classes) }),
isDismissable ? this.renderDismissButton() : null,
this.props.children
);
},
componentDidMount: function componentDidMount() {
if (this.props.dismissAfter && this.props.onDismiss) {
this.dismissTimer = setTimeout(this.props.onDismiss, this.props.dismissAfter);
}
},
componentWillUnmount: function componentWillUnmount() {
clearTimeout(this.dismissTimer);
}
});
module.exports = Alert;
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var React = _interopRequire(__webpack_require__(51));
var constants = _interopRequire(__webpack_require__(50));
var BootstrapMixin = {
propTypes: {
bsClass: React.PropTypes.oneOf(Object.keys(constants.CLASSES)),
bsStyle: React.PropTypes.oneOf(Object.keys(constants.STYLES)),
bsSize: React.PropTypes.oneOf(Object.keys(constants.SIZES))
},
getBsClassSet: function getBsClassSet() {
var classes = {};
var bsClass = this.props.bsClass && constants.CLASSES[this.props.bsClass];
if (bsClass) {
classes[bsClass] = true;
var prefix = bsClass + "-";
var bsSize = this.props.bsSize && constants.SIZES[this.props.bsSize];
if (bsSize) {
classes[prefix + bsSize] = true;
}
var bsStyle = this.props.bsStyle && constants.STYLES[this.props.bsStyle];
if (this.props.bsStyle) {
classes[prefix + bsStyle] = true;
}
}
return classes;
},
prefixClass: function prefixClass(subClass) {
return constants.CLASSES[this.props.bsClass] + "-" + subClass;
}
};
module.exports = BootstrapMixin;
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var ValidComponentChildren = _interopRequire(__webpack_require__(54));
var classSet = _interopRequire(__webpack_require__(60));
var Badge = React.createClass({
displayName: "Badge",
propTypes: {
pullRight: React.PropTypes.bool
},
hasContent: function hasContent() {
return ValidComponentChildren.hasValidComponent(this.props.children) || typeof this.props.children === "string" || typeof this.props.children === "number";
},
render: function render() {
var classes = {
"pull-right": this.props.pullRight,
badge: this.hasContent()
};
return React.createElement(
"span",
_extends({}, this.props, {
className: classSet(this.props.className, classes) }),
this.props.children
);
}
});
module.exports = Badge;
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var Button = React.createClass({
displayName: "Button",
mixins: [BootstrapMixin],
propTypes: {
active: React.PropTypes.bool,
disabled: React.PropTypes.bool,
block: React.PropTypes.bool,
navItem: React.PropTypes.bool,
navDropdown: React.PropTypes.bool,
componentClass: React.PropTypes.node,
href: React.PropTypes.string,
target: React.PropTypes.string
},
getDefaultProps: function getDefaultProps() {
return {
bsClass: "button",
bsStyle: "default",
type: "button"
};
},
render: function render() {
var classes = this.props.navDropdown ? {} : this.getBsClassSet();
var renderFuncName = undefined;
classes = _extends({
active: this.props.active,
"btn-block": this.props.block }, classes);
if (this.props.navItem) {
return this.renderNavItem(classes);
}
renderFuncName = this.props.href || this.props.target || this.props.navDropdown ? "renderAnchor" : "renderButton";
return this[renderFuncName](classes);
},
renderAnchor: function renderAnchor(classes) {
var Component = this.props.componentClass || "a";
var href = this.props.href || "#";
classes.disabled = this.props.disabled;
return React.createElement(
Component,
_extends({}, this.props, {
href: href,
className: classSet(this.props.className, classes),
role: "button" }),
this.props.children
);
},
renderButton: function renderButton(classes) {
var Component = this.props.componentClass || "button";
return React.createElement(
Component,
_extends({}, this.props, {
className: classSet(this.props.className, classes) }),
this.props.children
);
},
renderNavItem: function renderNavItem(classes) {
var liClasses = {
active: this.props.active
};
return React.createElement(
"li",
{ className: classSet(liClasses) },
this.renderAnchor(classes)
);
}
});
module.exports = Button;
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var ButtonGroup = React.createClass({
displayName: "ButtonGroup",
mixins: [BootstrapMixin],
propTypes: {
vertical: React.PropTypes.bool,
justified: React.PropTypes.bool
},
getDefaultProps: function getDefaultProps() {
return {
bsClass: "button-group"
};
},
render: function render() {
var classes = this.getBsClassSet();
classes["btn-group"] = !this.props.vertical;
classes["btn-group-vertical"] = this.props.vertical;
classes["btn-group-justified"] = this.props.justified;
return React.createElement(
"div",
_extends({}, this.props, {
className: classSet(this.props.className, classes) }),
this.props.children
);
}
});
module.exports = ButtonGroup;
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var ButtonToolbar = React.createClass({
displayName: "ButtonToolbar",
mixins: [BootstrapMixin],
getDefaultProps: function getDefaultProps() {
return {
bsClass: "button-toolbar"
};
},
render: function render() {
var classes = this.getBsClassSet();
return React.createElement(
"div",
_extends({}, this.props, {
role: "toolbar",
className: classSet(this.props.className, classes) }),
this.props.children
);
}
});
module.exports = ButtonToolbar;
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var _react = __webpack_require__(51);
var React = _interopRequire(_react);
var cloneElement = _react.cloneElement;
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var CollapsableMixin = _interopRequire(__webpack_require__(14));
var classSet = _interopRequire(__webpack_require__(60));
var domUtils = _interopRequire(__webpack_require__(52));
var ValidComponentChildren = _interopRequire(__webpack_require__(54));
var createChainedFunction = _interopRequire(__webpack_require__(55));
var CollapsableNav = React.createClass({
displayName: "CollapsableNav",
mixins: [BootstrapMixin, CollapsableMixin],
propTypes: {
onSelect: React.PropTypes.func,
expanded: React.PropTypes.bool,
eventKey: React.PropTypes.any
},
getCollapsableDOMNode: function getCollapsableDOMNode() {
return this.getDOMNode();
},
getCollapsableDimensionValue: function getCollapsableDimensionValue() {
var height = 0;
var nodes = this.refs;
for (var key in nodes) {
if (nodes.hasOwnProperty(key)) {
var n = nodes[key].getDOMNode(),
h = n.offsetHeight,
computedStyles = domUtils.getComputedStyles(n);
height += h + parseInt(computedStyles.marginTop, 10) + parseInt(computedStyles.marginBottom, 10);
}
}
return height;
},
render: function render() {
/*
* this.props.collapsable is set in NavBar when a eventKey is supplied.
*/
var classes = this.props.collapsable ? this.getCollapsableClassSet() : {};
/*
* prevent duplicating navbar-collapse call if passed as prop. kind of overkill... good cadidate to have check implemented as a util that can
* also be used elsewhere.
*/
if (this.props.className === undefined || this.props.className.split(" ").indexOf("navbar-collapse") === -2) {
classes["navbar-collapse"] = this.props.collapsable;
}
return React.createElement(
"div",
{ eventKey: this.props.eventKey, className: classSet(this.props.className, classes) },
ValidComponentChildren.map(this.props.children, this.props.collapsable ? this.renderCollapsableNavChildren : this.renderChildren)
);
},
getChildActiveProp: function getChildActiveProp(child) {
if (child.props.active) {
return true;
}
if (this.props.activeKey != null) {
if (child.props.eventKey === this.props.activeKey) {
return true;
}
}
if (this.props.activeHref != null) {
if (child.props.href === this.props.activeHref) {
return true;
}
}
return child.props.active;
},
renderChildren: function renderChildren(child, index) {
var key = child.key ? child.key : index;
return cloneElement(child, {
activeKey: this.props.activeKey,
activeHref: this.props.activeHref,
ref: "nocollapse_" + key,
key: key,
navItem: true
});
},
renderCollapsableNavChildren: function renderCollapsableNavChildren(child, index) {
var key = child.key ? child.key : index;
return cloneElement(child, {
active: this.getChildActiveProp(child),
activeKey: this.props.activeKey,
activeHref: this.props.activeHref,
onSelect: createChainedFunction(child.props.onSelect, this.props.onSelect),
ref: "collapsable_" + key,
key: key,
navItem: true
});
}
});
module.exports = CollapsableNav;
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 _react = __webpack_require__(51);
var React = _interopRequire(_react);
var cloneElement = _react.cloneElement;
var classSet = _interopRequire(__webpack_require__(60));
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var ValidComponentChildren = _interopRequire(__webpack_require__(54));
var Carousel = React.createClass({
displayName: "Carousel",
mixins: [BootstrapMixin],
propTypes: {
slide: React.PropTypes.bool,
indicators: React.PropTypes.bool,
controls: React.PropTypes.bool,
pauseOnHover: React.PropTypes.bool,
wrap: React.PropTypes.bool,
onSelect: React.PropTypes.func,
onSlideEnd: React.PropTypes.func,
activeIndex: React.PropTypes.number,
defaultActiveIndex: React.PropTypes.number,
direction: React.PropTypes.oneOf(["prev", "next"])
},
getDefaultProps: function getDefaultProps() {
return {
slide: true,
interval: 5000,
pauseOnHover: true,
wrap: true,
indicators: true,
controls: true
};
},
getInitialState: function getInitialState() {
return {
activeIndex: this.props.defaultActiveIndex == null ? 0 : this.props.defaultActiveIndex,
previousActiveIndex: null,
direction: null
};
},
getDirection: function getDirection(prevIndex, index) {
if (prevIndex === index) {
return null;
}
return prevIndex > index ? "prev" : "next";
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
var activeIndex = this.getActiveIndex();
if (nextProps.activeIndex != null && nextProps.activeIndex !== activeIndex) {
clearTimeout(this.timeout);
this.setState({
previousActiveIndex: activeIndex,
direction: nextProps.direction != null ? nextProps.direction : this.getDirection(activeIndex, nextProps.activeIndex)
});
}
},
componentDidMount: function componentDidMount() {
this.waitForNext();
},
componentWillUnmount: function componentWillUnmount() {
clearTimeout(this.timeout);
},
next: function next(e) {
if (e) {
e.preventDefault();
}
var index = this.getActiveIndex() + 1;
var count = ValidComponentChildren.numberOf(this.props.children);
if (index > count - 1) {
if (!this.props.wrap) {
return;
}
index = 0;
}
this.handleSelect(index, "next");
},
prev: function prev(e) {
if (e) {
e.preventDefault();
}
var index = this.getActiveIndex() - 1;
if (index < 0) {
if (!this.props.wrap) {
return;
}
index = ValidComponentChildren.numberOf(this.props.children) - 1;
}
this.handleSelect(index, "prev");
},
pause: function pause() {
this.isPaused = true;
clearTimeout(this.timeout);
},
play: function play() {
this.isPaused = false;
this.waitForNext();
},
waitForNext: function waitForNext() {
if (!this.isPaused && this.props.slide && this.props.interval && this.props.activeIndex == null) {
this.timeout = setTimeout(this.next, this.props.interval);
}
},
handleMouseOver: function handleMouseOver() {
if (this.props.pauseOnHover) {
this.pause();
}
},
handleMouseOut: function handleMouseOut() {
if (this.isPaused) {
this.play();
}
},
render: function render() {
var classes = {
carousel: true,
slide: this.props.slide
};
return React.createElement(
"div",
_extends({}, this.props, {
className: classSet(this.props.className, classes),
onMouseOver: this.handleMouseOver,
onMouseOut: this.handleMouseOut }),
this.props.indicators ? this.renderIndicators() : null,
React.createElement(
"div",
{ className: "carousel-inner", ref: "inner" },
ValidComponentChildren.map(this.props.children, this.renderItem)
),
this.props.controls ? this.renderControls() : null
);
},
renderPrev: function renderPrev() {
return React.createElement(
"a",
{ className: "left carousel-control", href: "#prev", key: 0, onClick: this.prev },
React.createElement("span", { className: "glyphicon glyphicon-chevron-left" })
);
},
renderNext: function renderNext() {
return React.createElement(
"a",
{ className: "right carousel-control", href: "#next", key: 1, onClick: this.next },
React.createElement("span", { className: "glyphicon glyphicon-chevron-right" })
);
},
renderControls: function renderControls() {
if (!this.props.wrap) {
var activeIndex = this.getActiveIndex();
var count = ValidComponentChildren.numberOf(this.props.children);
return [activeIndex !== 0 ? this.renderPrev() : null, activeIndex !== count - 1 ? this.renderNext() : null];
}
return [this.renderPrev(), this.renderNext()];
},
renderIndicator: function renderIndicator(child, index) {
var className = index === this.getActiveIndex() ? "active" : null;
return React.createElement("li", {
key: index,
className: className,
onClick: this.handleSelect.bind(this, index, null) });
},
renderIndicators: function renderIndicators() {
var indicators = [];
ValidComponentChildren.forEach(this.props.children, function (child, index) {
indicators.push(this.renderIndicator(child, index),
// Force whitespace between indicator elements, bootstrap
// requires this for correct spacing of elements.
" ");
}, this);
return React.createElement(
"ol",
{ className: "carousel-indicators" },
indicators
);
},
getActiveIndex: function getActiveIndex() {
return this.props.activeIndex != null ? this.props.activeIndex : this.state.activeIndex;
},
handleItemAnimateOutEnd: function handleItemAnimateOutEnd() {
this.setState({
previousActiveIndex: null,
direction: null
}, function () {
this.waitForNext();
if (this.props.onSlideEnd) {
this.props.onSlideEnd();
}
});
},
renderItem: function renderItem(child, index) {
var activeIndex = this.getActiveIndex();
var isActive = index === activeIndex;
var isPreviousActive = this.state.previousActiveIndex != null && this.state.previousActiveIndex === index && this.props.slide;
return cloneElement(child, {
active: isActive,
ref: child.ref,
key: child.key ? child.key : index,
index: index,
animateOut: isPreviousActive,
animateIn: isActive && this.state.previousActiveIndex != null && this.props.slide,
direction: this.state.direction,
onAnimateOutEnd: isPreviousActive ? this.handleItemAnimateOutEnd : null
});
},
handleSelect: function handleSelect(index, direction) {
clearTimeout(this.timeout);
var previousActiveIndex = this.getActiveIndex();
direction = direction || this.getDirection(previousActiveIndex, index);
if (this.props.onSelect) {
this.props.onSelect(index, direction);
}
if (this.props.activeIndex == null && index !== previousActiveIndex) {
if (this.state.previousActiveIndex != null) {
// If currently animating don't activate the new index.
// TODO: look into queuing this canceled call and
// animating after the current animation has ended.
return;
}
this.setState({
activeIndex: index,
previousActiveIndex: previousActiveIndex,
direction: direction
});
}
}
});
module.exports = Carousel;
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var TransitionEvents = _interopRequire(__webpack_require__(56));
var CarouselItem = React.createClass({
displayName: "CarouselItem",
propTypes: {
direction: React.PropTypes.oneOf(["prev", "next"]),
onAnimateOutEnd: React.PropTypes.func,
active: React.PropTypes.bool,
caption: React.PropTypes.node
},
getInitialState: function getInitialState() {
return {
direction: null
};
},
getDefaultProps: function getDefaultProps() {
return {
animation: true
};
},
handleAnimateOutEnd: function handleAnimateOutEnd() {
if (this.props.onAnimateOutEnd && this.isMounted()) {
this.props.onAnimateOutEnd(this.props.index);
}
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if (this.props.active !== nextProps.active) {
this.setState({
direction: null
});
}
},
componentDidUpdate: function componentDidUpdate(prevProps) {
if (!this.props.active && prevProps.active) {
TransitionEvents.addEndEventListener(React.findDOMNode(this), this.handleAnimateOutEnd);
}
if (this.props.active !== prevProps.active) {
setTimeout(this.startAnimation, 20);
}
},
startAnimation: function startAnimation() {
if (!this.isMounted()) {
return;
}
this.setState({
direction: this.props.direction === "prev" ? "right" : "left"
});
},
render: function render() {
var classes = {
item: true,
active: this.props.active && !this.props.animateIn || this.props.animateOut,
next: this.props.active && this.props.animateIn && this.props.direction === "next",
prev: this.props.active && this.props.animateIn && this.props.direction === "prev"
};
if (this.state.direction && (this.props.animateIn || this.props.animateOut)) {
classes[this.state.direction] = true;
}
return React.createElement(
"div",
_extends({}, this.props, { className: classSet(this.props.className, classes) }),
this.props.children,
this.props.caption ? this.renderCaption() : null
);
},
renderCaption: function renderCaption() {
return React.createElement(
"div",
{ className: "carousel-caption" },
this.props.caption
);
}
});
module.exports = CarouselItem;
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var constants = _interopRequire(__webpack_require__(50));
var Col = React.createClass({
displayName: "Col",
propTypes: {
xs: React.PropTypes.number,
sm: React.PropTypes.number,
md: React.PropTypes.number,
lg: React.PropTypes.number,
xsOffset: React.PropTypes.number,
smOffset: React.PropTypes.number,
mdOffset: React.PropTypes.number,
lgOffset: React.PropTypes.number,
xsPush: React.PropTypes.number,
smPush: React.PropTypes.number,
mdPush: React.PropTypes.number,
lgPush: React.PropTypes.number,
xsPull: React.PropTypes.number,
smPull: React.PropTypes.number,
mdPull: React.PropTypes.number,
lgPull: React.PropTypes.number,
componentClass: React.PropTypes.node.isRequired
},
getDefaultProps: function getDefaultProps() {
return {
componentClass: "div"
};
},
render: function render() {
var ComponentClass = this.props.componentClass;
var classes = {};
Object.keys(constants.SIZES).forEach(function (key) {
var size = constants.SIZES[key];
var prop = size;
var classPart = size + "-";
if (this.props[prop]) {
classes["col-" + classPart + this.props[prop]] = true;
}
prop = size + "Offset";
classPart = size + "-offset-";
if (this.props[prop] >= 0) {
classes["col-" + classPart + this.props[prop]] = true;
}
prop = size + "Push";
classPart = size + "-push-";
if (this.props[prop] >= 0) {
classes["col-" + classPart + this.props[prop]] = true;
}
prop = size + "Pull";
classPart = size + "-pull-";
if (this.props[prop] >= 0) {
classes["col-" + classPart + this.props[prop]] = true;
}
}, this);
return React.createElement(
ComponentClass,
_extends({}, this.props, { className: classSet(this.props.className, classes) }),
this.props.children
);
}
});
module.exports = Col;
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var React = _interopRequire(__webpack_require__(51));
var TransitionEvents = _interopRequire(__webpack_require__(61));
var CollapsableMixin = {
propTypes: {
defaultExpanded: React.PropTypes.bool,
expanded: React.PropTypes.bool
},
getInitialState: function getInitialState() {
var defaultExpanded = this.props.defaultExpanded != null ? this.props.defaultExpanded : this.props.expanded != null ? this.props.expanded : false;
return {
expanded: defaultExpanded,
collapsing: false
};
},
componentWillUpdate: function componentWillUpdate(nextProps, nextState) {
var willExpanded = nextProps.expanded != null ? nextProps.expanded : nextState.expanded;
if (willExpanded === this.isExpanded()) {
return;
}
// if the expanded state is being toggled, ensure node has a dimension value
// this is needed for the animation to work and needs to be set before
// the collapsing class is applied (after collapsing is applied the in class
// is removed and the node's dimension will be wrong)
var node = this.getCollapsableDOMNode();
var dimension = this.dimension();
var value = "0";
if (!willExpanded) {
value = this.getCollapsableDimensionValue();
}
node.style[dimension] = value + "px";
this._afterWillUpdate();
},
componentDidUpdate: function componentDidUpdate(prevProps, prevState) {
// check if expanded is being toggled; if so, set collapsing
this._checkToggleCollapsing(prevProps, prevState);
// check if collapsing was turned on; if so, start animation
this._checkStartAnimation();
},
// helps enable test stubs
_afterWillUpdate: function _afterWillUpdate() {},
_checkStartAnimation: function _checkStartAnimation() {
if (!this.state.collapsing) {
return;
}
var node = this.getCollapsableDOMNode();
var dimension = this.dimension();
var value = this.getCollapsableDimensionValue();
// setting the dimension here starts the transition animation
var result = undefined;
if (this.isExpanded()) {
result = value + "px";
} else {
result = "0px";
}
node.style[dimension] = result;
},
_checkToggleCollapsing: function _checkToggleCollapsing(prevProps, prevState) {
var wasExpanded = prevProps.expanded != null ? prevProps.expanded : prevState.expanded;
var isExpanded = this.isExpanded();
if (wasExpanded !== isExpanded) {
if (wasExpanded) {
this._handleCollapse();
} else {
this._handleExpand();
}
}
},
_handleExpand: function _handleExpand() {
var _this = this;
var node = this.getCollapsableDOMNode();
var dimension = this.dimension();
var complete = function () {
_this._removeEndEventListener(node, complete);
// remove dimension value - this ensures the collapsable item can grow
// in dimension after initial display (such as an image loading)
node.style[dimension] = "";
_this.setState({
collapsing: false
});
};
this._addEndEventListener(node, complete);
this.setState({
collapsing: true
});
},
_handleCollapse: function _handleCollapse() {
var _this = this;
var node = this.getCollapsableDOMNode();
var complete = function () {
_this._removeEndEventListener(node, complete);
_this.setState({
collapsing: false
});
};
this._addEndEventListener(node, complete);
this.setState({
collapsing: true
});
},
// helps enable test stubs
_addEndEventListener: function _addEndEventListener(node, complete) {
TransitionEvents.addEndEventListener(node, complete);
},
// helps enable test stubs
_removeEndEventListener: function _removeEndEventListener(node, complete) {
TransitionEvents.removeEndEventListener(node, complete);
},
dimension: function dimension() {
return typeof this.getCollapsableDimension === "function" ? this.getCollapsableDimension() : "height";
},
isExpanded: function isExpanded() {
return this.props.expanded != null ? this.props.expanded : this.state.expanded;
},
getCollapsableClassSet: function getCollapsableClassSet(className) {
var classes = {};
if (typeof className === "string") {
className.split(" ").forEach(function (subClasses) {
if (subClasses) {
classes[subClasses] = true;
}
});
}
classes.collapsing = this.state.collapsing;
classes.collapse = !this.state.collapsing;
classes["in"] = this.isExpanded() && !this.state.collapsing;
return classes;
}
};
module.exports = CollapsableMixin;
/***/ },
/* 15 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 _react = __webpack_require__(51);
var React = _interopRequire(_react);
var cloneElement = _react.cloneElement;
var classSet = _interopRequire(__webpack_require__(60));
var createChainedFunction = _interopRequire(__webpack_require__(55));
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var DropdownStateMixin = _interopRequire(__webpack_require__(17));
var Button = _interopRequire(__webpack_require__(7));
var ButtonGroup = _interopRequire(__webpack_require__(8));
var DropdownMenu = _interopRequire(__webpack_require__(16));
var ValidComponentChildren = _interopRequire(__webpack_require__(54));
var DropdownButton = React.createClass({
displayName: "DropdownButton",
mixins: [BootstrapMixin, DropdownStateMixin],
propTypes: {
pullRight: React.PropTypes.bool,
dropup: React.PropTypes.bool,
title: React.PropTypes.node,
href: React.PropTypes.string,
onClick: React.PropTypes.func,
onSelect: React.PropTypes.func,
navItem: React.PropTypes.bool,
noCaret: React.PropTypes.bool
},
render: function render() {
var renderMethod = this.props.navItem ? "renderNavItem" : "renderButtonGroup";
var caret = this.props.noCaret ? null : React.createElement("span", { className: "caret" });
return this[renderMethod]([React.createElement(
Button,
_extends({}, this.props, {
ref: "dropdownButton",
className: "dropdown-toggle",
onClick: this.handleDropdownClick,
key: 0,
navDropdown: this.props.navItem,
navItem: null,
title: null,
pullRight: null,
dropup: null }),
this.props.title,
" ",
caret
), React.createElement(
DropdownMenu,
{
ref: "menu",
"aria-labelledby": this.props.id,
pullRight: this.props.pullRight,
key: 1 },
ValidComponentChildren.map(this.props.children, this.renderMenuItem)
)]);
},
renderButtonGroup: function renderButtonGroup(children) {
var groupClasses = {
open: this.state.open,
dropup: this.props.dropup
};
return React.createElement(
ButtonGroup,
{
bsSize: this.props.bsSize,
className: classSet(this.props.className, groupClasses) },
children
);
},
renderNavItem: function renderNavItem(children) {
var classes = {
dropdown: true,
open: this.state.open,
dropup: this.props.dropup
};
return React.createElement(
"li",
{ className: classSet(this.props.className, classes) },
children
);
},
renderMenuItem: function renderMenuItem(child, index) {
// Only handle the option selection if an onSelect prop has been set on the
// component or it's child, this allows a user not to pass an onSelect
// handler and have the browser preform the default action.
var handleOptionSelect = this.props.onSelect || child.props.onSelect ? this.handleOptionSelect : null;
return cloneElement(child, {
// Capture onSelect events
onSelect: createChainedFunction(child.props.onSelect, handleOptionSelect),
key: child.key ? child.key : index
});
},
handleDropdownClick: function handleDropdownClick(e) {
e.preventDefault();
this.setDropdownState(!this.state.open);
},
handleOptionSelect: function handleOptionSelect(key) {
if (this.props.onSelect) {
this.props.onSelect(key);
}
this.setDropdownState(false);
}
});
module.exports = DropdownButton;
/***/ },
/* 16 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 _react = __webpack_require__(51);
var React = _interopRequire(_react);
var cloneElement = _react.cloneElement;
var classSet = _interopRequire(__webpack_require__(60));
var createChainedFunction = _interopRequire(__webpack_require__(55));
var ValidComponentChildren = _interopRequire(__webpack_require__(54));
var DropdownMenu = React.createClass({
displayName: "DropdownMenu",
propTypes: {
pullRight: React.PropTypes.bool,
onSelect: React.PropTypes.func
},
render: function render() {
var classes = {
"dropdown-menu": true,
"dropdown-menu-right": this.props.pullRight
};
return React.createElement(
"ul",
_extends({}, this.props, {
className: classSet(this.props.className, classes),
role: "menu" }),
ValidComponentChildren.map(this.props.children, this.renderMenuItem)
);
},
renderMenuItem: function renderMenuItem(child, index) {
return cloneElement(child, {
// Capture onSelect events
onSelect: createChainedFunction(child.props.onSelect, this.props.onSelect),
// Force special props to be transferred
key: child.key ? child.key : index
});
}
});
module.exports = DropdownMenu;
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var React = _interopRequire(__webpack_require__(51));
var EventListener = _interopRequire(__webpack_require__(53));
/**
* Checks whether a node is within
* a root nodes tree
*
* @param {DOMElement} node
* @param {DOMElement} root
* @returns {boolean}
*/
function isNodeInRoot(node, root) {
while (node) {
if (node === root) {
return true;
}
node = node.parentNode;
}
return false;
}
var DropdownStateMixin = {
getInitialState: function getInitialState() {
return {
open: false
};
},
setDropdownState: function setDropdownState(newState, onStateChangeComplete) {
if (newState) {
this.bindRootCloseHandlers();
} else {
this.unbindRootCloseHandlers();
}
this.setState({
open: newState
}, onStateChangeComplete);
},
handleDocumentKeyUp: function handleDocumentKeyUp(e) {
if (e.keyCode === 27) {
this.setDropdownState(false);
}
},
handleDocumentClick: function handleDocumentClick(e) {
// If the click originated from within this component
// don't do anything.
if (isNodeInRoot(e.target, React.findDOMNode(this))) {
return;
}
this.setDropdownState(false);
},
bindRootCloseHandlers: function bindRootCloseHandlers() {
var doc = React.findDOMNode(this).ownerDocument;
this._onDocumentClickListener = EventListener.listen(doc, "click", this.handleDocumentClick);
this._onDocumentKeyupListener = EventListener.listen(doc, "keyup", this.handleDocumentKeyUp);
},
unbindRootCloseHandlers: function unbindRootCloseHandlers() {
if (this._onDocumentClickListener) {
this._onDocumentClickListener.remove();
}
if (this._onDocumentKeyupListener) {
this._onDocumentKeyupListener.remove();
}
},
componentWillUnmount: function componentWillUnmount() {
this.unbindRootCloseHandlers();
}
};
module.exports = DropdownStateMixin;
/***/ },
/* 18 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var React = _interopRequire(__webpack_require__(51));
// TODO: listen for onTransitionEnd to remove el
function getElementsAndSelf(root, classes) {
var els = root.querySelectorAll("." + classes.join("."));
els = [].map.call(els, function (e) {
return e;
});
for (var i = 0; i < classes.length; i++) {
if (!root.className.match(new RegExp("\\b" + classes[i] + "\\b"))) {
return els;
}
}
els.unshift(root);
return els;
}
module.exports = {
_fadeIn: function _fadeIn() {
var els = undefined;
if (this.isMounted()) {
els = getElementsAndSelf(React.findDOMNode(this), ["fade"]);
if (els.length) {
els.forEach(function (el) {
el.className += " in";
});
}
}
},
_fadeOut: function _fadeOut() {
var els = getElementsAndSelf(this._fadeOutEl, ["fade", "in"]);
if (els.length) {
els.forEach(function (el) {
el.className = el.className.replace(/\bin\b/, "");
});
}
setTimeout(this._handleFadeOutEnd, 300);
},
_handleFadeOutEnd: function _handleFadeOutEnd() {
if (this._fadeOutEl && this._fadeOutEl.parentNode) {
this._fadeOutEl.parentNode.removeChild(this._fadeOutEl);
}
},
componentDidMount: function componentDidMount() {
if (document.querySelectorAll) {
// Firefox needs delay for transition to be triggered
setTimeout(this._fadeIn, 20);
}
},
componentWillUnmount: function componentWillUnmount() {
var els = getElementsAndSelf(React.findDOMNode(this), ["fade"]),
container = this.props.container && React.findDOMNode(this.props.container) || React.findDOMNode(this).ownerDocument.body;
if (els.length) {
this._fadeOutEl = document.createElement("div");
container.appendChild(this._fadeOutEl);
this._fadeOutEl.appendChild(React.findDOMNode(this).cloneNode(true));
// Firefox needs delay for transition to be triggered
setTimeout(this._fadeOut, 20);
}
}
};
/***/ },
/* 19 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var constants = _interopRequire(__webpack_require__(50));
var Glyphicon = React.createClass({
displayName: "Glyphicon",
mixins: [BootstrapMixin],
propTypes: {
glyph: React.PropTypes.oneOf(constants.GLYPHS).isRequired
},
getDefaultProps: function getDefaultProps() {
return {
bsClass: "glyphicon"
};
},
render: function render() {
var classes = this.getBsClassSet();
classes["glyphicon-" + this.props.glyph] = true;
return React.createElement(
"span",
_extends({}, this.props, { className: classSet(this.props.className, classes) }),
this.props.children
);
}
});
module.exports = Glyphicon;
/***/ },
/* 20 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var Grid = React.createClass({
displayName: "Grid",
propTypes: {
fluid: React.PropTypes.bool,
componentClass: React.PropTypes.node.isRequired
},
getDefaultProps: function getDefaultProps() {
return {
componentClass: "div"
};
},
render: function render() {
var ComponentClass = this.props.componentClass;
var className = this.props.fluid ? "container-fluid" : "container";
return React.createElement(
ComponentClass,
_extends({}, this.props, {
className: classSet(this.props.className, className) }),
this.props.children
);
}
});
module.exports = Grid;
/***/ },
/* 21 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var Button = _interopRequire(__webpack_require__(7));
var FormGroup = _interopRequire(__webpack_require__(57));
var Input = React.createClass({
displayName: "Input",
propTypes: {
type: React.PropTypes.string,
label: React.PropTypes.node,
help: React.PropTypes.node,
addonBefore: React.PropTypes.node,
addonAfter: React.PropTypes.node,
buttonBefore: React.PropTypes.node,
buttonAfter: React.PropTypes.node,
bsSize: React.PropTypes.oneOf(["small", "medium", "large"]),
bsStyle: function bsStyle(props) {
if (props.type === "submit") {
// Return early if `type=submit` as the `Button` component
// it transfers these props to has its own propType checks.
return null;
}
return React.PropTypes.oneOf(["success", "warning", "error"]).apply(null, arguments);
},
hasFeedback: React.PropTypes.bool,
groupClassName: React.PropTypes.string,
wrapperClassName: React.PropTypes.string,
labelClassName: React.PropTypes.string,
disabled: React.PropTypes.bool
},
getInputDOMNode: function getInputDOMNode() {
return React.findDOMNode(this.refs.input);
},
getValue: function getValue() {
if (this.props.type === "static") {
return this.props.value;
} else if (this.props.type) {
if (this.props.type === "select" && this.props.multiple) {
return this.getSelectedOptions();
} else {
return this.getInputDOMNode().value;
}
} else {
throw "Cannot use getValue without specifying input type.";
}
},
getChecked: function getChecked() {
return this.getInputDOMNode().checked;
},
getSelectedOptions: function getSelectedOptions() {
var values = [];
Array.prototype.forEach.call(this.getInputDOMNode().getElementsByTagName("option"), function (option) {
if (option.selected) {
var value = option.getAttribute("value") || option.innerHTML;
values.push(value);
}
});
return values;
},
isCheckboxOrRadio: function isCheckboxOrRadio() {
return this.props.type === "radio" || this.props.type === "checkbox";
},
isFile: function isFile() {
return this.props.type === "file";
},
renderInput: function renderInput() {
var input = null;
if (!this.props.type) {
return this.props.children;
}
switch (this.props.type) {
case "select":
input = React.createElement(
"select",
_extends({}, this.props, { className: classSet(this.props.className, "form-control"), ref: "input", key: "input" }),
this.props.children
);
break;
case "textarea":
input = React.createElement("textarea", _extends({}, this.props, { className: classSet(this.props.className, "form-control"), ref: "input", key: "input" }));
break;
case "static":
input = React.createElement(
"p",
_extends({}, this.props, { className: classSet(this.props.className, "form-control-static"), ref: "input", key: "input" }),
this.props.value
);
break;
case "submit":
input = React.createElement(Button, _extends({}, this.props, { componentClass: "input", ref: "input", key: "input" }));
break;
default:
var className = this.isCheckboxOrRadio() || this.isFile() ? "" : "form-control";
input = React.createElement("input", _extends({}, this.props, { className: classSet(this.props.className, className), ref: "input", key: "input" }));
}
return input;
},
renderInputGroup: function renderInputGroup(children) {
var addonBefore = this.props.addonBefore ? React.createElement(
"span",
{ className: "input-group-addon", key: "addonBefore" },
this.props.addonBefore
) : null;
var addonAfter = this.props.addonAfter ? React.createElement(
"span",
{ className: "input-group-addon", key: "addonAfter" },
this.props.addonAfter
) : null;
var buttonBefore = this.props.buttonBefore ? React.createElement(
"span",
{ className: "input-group-btn" },
this.props.buttonBefore
) : null;
var buttonAfter = this.props.buttonAfter ? React.createElement(
"span",
{ className: "input-group-btn" },
this.props.buttonAfter
) : null;
var inputGroupClassName = undefined;
switch (this.props.bsSize) {
case "small":
inputGroupClassName = "input-group-sm";break;
case "large":
inputGroupClassName = "input-group-lg";break;
}
return addonBefore || addonAfter || buttonBefore || buttonAfter ? React.createElement(
"div",
{ className: classSet(inputGroupClassName, "input-group"), key: "input-group" },
addonBefore,
buttonBefore,
children,
addonAfter,
buttonAfter
) : children;
},
renderIcon: function renderIcon() {
var classes = {
glyphicon: true,
"form-control-feedback": true,
"glyphicon-ok": this.props.bsStyle === "success",
"glyphicon-warning-sign": this.props.bsStyle === "warning",
"glyphicon-remove": this.props.bsStyle === "error"
};
return this.props.hasFeedback ? React.createElement("span", { className: classSet(classes), key: "icon" }) : null;
},
renderHelp: function renderHelp() {
return this.props.help ? React.createElement(
"span",
{ className: "help-block", key: "help" },
this.props.help
) : null;
},
renderCheckboxandRadioWrapper: function renderCheckboxandRadioWrapper(children) {
var classes = {
checkbox: this.props.type === "checkbox",
radio: this.props.type === "radio"
};
return React.createElement(
"div",
{ className: classSet(classes), key: "checkboxRadioWrapper" },
children
);
},
renderWrapper: function renderWrapper(children) {
return this.props.wrapperClassName ? React.createElement(
"div",
{ className: this.props.wrapperClassName, key: "wrapper" },
children
) : children;
},
renderLabel: function renderLabel(children) {
var classes = {
"control-label": !this.isCheckboxOrRadio()
};
classes[this.props.labelClassName] = this.props.labelClassName;
return this.props.label ? React.createElement(
"label",
{ htmlFor: this.props.id, className: classSet(classes), key: "label" },
children,
this.props.label
) : children;
},
render: function render() {
var children = undefined;
if (this.isCheckboxOrRadio()) {
children = this.renderWrapper([this.renderCheckboxandRadioWrapper(this.renderLabel(this.renderInput())), this.renderHelp()]);
} else {
children = [this.renderLabel(), this.renderWrapper([this.renderInputGroup(this.renderInput()), this.renderIcon(), this.renderHelp()])];
}
return React.createElement(
FormGroup,
this.props,
children
);
}
});
module.exports = Input;
/***/ },
/* 22 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
// https://www.npmjs.org/package/react-interpolate-component
// TODO: Drop this in favor of es6 string interpolation
var React = _interopRequire(__webpack_require__(51));
var ValidComponentChildren = _interopRequire(__webpack_require__(54));
var assign = _interopRequire(__webpack_require__(58));
var REGEXP = /\%\((.+?)\)s/;
var Interpolate = React.createClass({
displayName: "Interpolate",
propTypes: {
format: React.PropTypes.string
},
getDefaultProps: function getDefaultProps() {
return { component: "span" };
},
render: function render() {
var format = ValidComponentChildren.hasValidComponent(this.props.children) || typeof this.props.children === "string" ? this.props.children : this.props.format;
var parent = this.props.component;
var unsafe = this.props.unsafe === true;
var props = assign({}, this.props);
delete props.children;
delete props.format;
delete props.component;
delete props.unsafe;
if (unsafe) {
var content = format.split(REGEXP).reduce(function (memo, match, index) {
var html = undefined;
if (index % 2 === 0) {
html = match;
} else {
html = props[match];
delete props[match];
}
if (React.isValidElement(html)) {
throw new Error("cannot interpolate a React component into unsafe text");
}
memo += html;
return memo;
}, "");
props.dangerouslySetInnerHTML = { __html: content };
return React.createElement(parent, props);
} else {
var kids = format.split(REGEXP).reduce(function (memo, match, index) {
var child = undefined;
if (index % 2 === 0) {
if (match.length === 0) {
return memo;
}
child = match;
} else {
child = props[match];
delete props[match];
}
memo.push(child);
return memo;
}, []);
return React.createElement(parent, props, kids);
}
}
});
module.exports = Interpolate;
/***/ },
/* 23 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var Jumbotron = React.createClass({
displayName: "Jumbotron",
render: function render() {
return React.createElement(
"div",
_extends({}, this.props, { className: classSet(this.props.className, "jumbotron") }),
this.props.children
);
}
});
module.exports = Jumbotron;
/***/ },
/* 24 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var Label = React.createClass({
displayName: "Label",
mixins: [BootstrapMixin],
getDefaultProps: function getDefaultProps() {
return {
bsClass: "label",
bsStyle: "default"
};
},
render: function render() {
var classes = this.getBsClassSet();
return React.createElement(
"span",
_extends({}, this.props, { className: classSet(this.props.className, classes) }),
this.props.children
);
}
});
module.exports = Label;
/***/ },
/* 25 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _inherits = function (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) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var _react = __webpack_require__(51);
var React = _interopRequire(_react);
var cloneElement = _react.cloneElement;
var classSet = _interopRequire(__webpack_require__(60));
var ValidComponentChildren = _interopRequire(__webpack_require__(54));
var ListGroup = (function (_React$Component) {
function ListGroup() {
_classCallCheck(this, ListGroup);
if (_React$Component != null) {
_React$Component.apply(this, arguments);
}
}
_inherits(ListGroup, _React$Component);
_createClass(ListGroup, {
render: {
value: function render() {
var items = ValidComponentChildren.map(this.props.children, function (item, index) {
return cloneElement(item, { key: item.key ? item.key : index });
});
return React.createElement(
"div",
{ className: classSet(this.props.className, "list-group") },
items
);
}
}
});
return ListGroup;
})(React.Component);
ListGroup.propTypes = {
className: React.PropTypes.string
};
module.exports = ListGroup;
/***/ },
/* 26 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 _react = __webpack_require__(51);
var React = _interopRequire(_react);
var cloneElement = _react.cloneElement;
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var classSet = _interopRequire(__webpack_require__(60));
var ListGroupItem = React.createClass({
displayName: "ListGroupItem",
mixins: [BootstrapMixin],
propTypes: {
bsStyle: React.PropTypes.oneOf(["danger", "info", "success", "warning"]),
active: React.PropTypes.any,
disabled: React.PropTypes.any,
header: React.PropTypes.node,
onClick: React.PropTypes.func,
eventKey: React.PropTypes.any,
href: React.PropTypes.string,
target: React.PropTypes.string
},
getDefaultProps: function getDefaultProps() {
return {
bsClass: "list-group-item"
};
},
render: function render() {
var classes = this.getBsClassSet();
classes.active = this.props.active;
classes.disabled = this.props.disabled;
if (this.props.href || this.props.target || this.props.onClick) {
return this.renderAnchor(classes);
} else {
return this.renderSpan(classes);
}
},
renderSpan: function renderSpan(classes) {
return React.createElement(
"span",
_extends({}, this.props, { className: classSet(this.props.className, classes) }),
this.props.header ? this.renderStructuredContent() : this.props.children
);
},
renderAnchor: function renderAnchor(classes) {
return React.createElement(
"a",
_extends({}, this.props, {
className: classSet(this.props.className, classes)
}),
this.props.header ? this.renderStructuredContent() : this.props.children
);
},
renderStructuredContent: function renderStructuredContent() {
var header = undefined;
if (React.isValidElement(this.props.header)) {
header = cloneElement(this.props.header, {
key: "header",
className: classSet(this.props.header.props.className, "list-group-item-heading")
});
} else {
header = React.createElement(
"h4",
{ key: "header", className: "list-group-item-heading" },
this.props.header
);
}
var content = React.createElement(
"p",
{ key: "content", className: "list-group-item-text" },
this.props.children
);
return [header, content];
}
});
module.exports = ListGroupItem;
/***/ },
/* 27 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var MenuItem = React.createClass({
displayName: "MenuItem",
propTypes: {
header: React.PropTypes.bool,
divider: React.PropTypes.bool,
href: React.PropTypes.string,
title: React.PropTypes.string,
target: React.PropTypes.string,
onSelect: React.PropTypes.func,
eventKey: React.PropTypes.any
},
getDefaultProps: function getDefaultProps() {
return {
href: "#"
};
},
handleClick: function handleClick(e) {
if (this.props.onSelect) {
e.preventDefault();
this.props.onSelect(this.props.eventKey, this.props.href, this.props.target);
}
},
renderAnchor: function renderAnchor() {
return React.createElement(
"a",
{ onClick: this.handleClick, href: this.props.href, target: this.props.target, title: this.props.title, tabIndex: "-1" },
this.props.children
);
},
render: function render() {
var classes = {
"dropdown-header": this.props.header,
divider: this.props.divider
};
var children = null;
if (this.props.header) {
children = this.props.children;
} else if (!this.props.divider) {
children = this.renderAnchor();
}
return React.createElement(
"li",
_extends({}, this.props, { role: "presentation", title: null, href: null,
className: classSet(this.props.className, classes) }),
children
);
}
});
module.exports = MenuItem;
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var FadeMixin = _interopRequire(__webpack_require__(18));
var EventListener = _interopRequire(__webpack_require__(53));
// TODO:
// - aria-labelledby
// - Add `modal-body` div if only one child passed in that doesn't already have it
// - Tests
var Modal = React.createClass({
displayName: "Modal",
mixins: [BootstrapMixin, FadeMixin],
propTypes: {
title: React.PropTypes.node,
backdrop: React.PropTypes.oneOf(["static", true, false]),
keyboard: React.PropTypes.bool,
closeButton: React.PropTypes.bool,
animation: React.PropTypes.bool,
onRequestHide: React.PropTypes.func.isRequired
},
getDefaultProps: function getDefaultProps() {
return {
bsClass: "modal",
backdrop: true,
keyboard: true,
animation: true,
closeButton: true
};
},
render: function render() {
var modalStyle = { display: "block" };
var dialogClasses = this.getBsClassSet();
delete dialogClasses.modal;
dialogClasses["modal-dialog"] = true;
var classes = {
modal: true,
fade: this.props.animation,
"in": !this.props.animation || !document.querySelectorAll
};
var modal = React.createElement(
"div",
_extends({}, this.props, {
title: null,
tabIndex: "-1",
role: "dialog",
style: modalStyle,
className: classSet(this.props.className, classes),
onClick: this.props.backdrop === true ? this.handleBackdropClick : null,
ref: "modal" }),
React.createElement(
"div",
{ className: classSet(dialogClasses) },
React.createElement(
"div",
{ className: "modal-content", style: { overflow: "hidden" } },
this.props.title ? this.renderHeader() : null,
this.props.children
)
)
);
return this.props.backdrop ? this.renderBackdrop(modal) : modal;
},
renderBackdrop: function renderBackdrop(modal) {
var classes = {
"modal-backdrop": true,
fade: this.props.animation
};
classes["in"] = !this.props.animation || !document.querySelectorAll;
var onClick = this.props.backdrop === true ? this.handleBackdropClick : null;
return React.createElement(
"div",
null,
React.createElement("div", { className: classSet(classes), ref: "backdrop", onClick: onClick }),
modal
);
},
renderHeader: function renderHeader() {
var closeButton = undefined;
if (this.props.closeButton) {
closeButton = React.createElement(
"button",
{ type: "button", className: "close", "aria-hidden": "true", onClick: this.props.onRequestHide },
"×"
);
}
var style = this.props.bsStyle;
var classes = {
"modal-header": true
};
classes["bg-" + style] = style;
classes["text-" + style] = style;
var className = classSet(classes);
return React.createElement(
"div",
{ className: className },
closeButton,
this.renderTitle()
);
},
renderTitle: function renderTitle() {
return React.isValidElement(this.props.title) ? this.props.title : React.createElement(
"h4",
{ className: "modal-title" },
this.props.title
);
},
iosClickHack: function iosClickHack() {
// IOS only allows click events to be delegated to the document on elements
// it considers 'clickable' - anchors, buttons, etc. We fake a click handler on the
// DOM nodes themselves. Remove if handled by React: https://github.com/facebook/react/issues/1169
React.findDOMNode(this.refs.modal).onclick = function () {};
React.findDOMNode(this.refs.backdrop).onclick = function () {};
},
componentDidMount: function componentDidMount() {
this._onDocumentKeyupListener = EventListener.listen(React.findDOMNode(this).ownerDocument, "keyup", this.handleDocumentKeyUp);
var container = this.props.container && React.findDOMNode(this.props.container) || React.findDOMNode(this).ownerDocument.body;
container.className += container.className.length ? " modal-open" : "modal-open";
if (this.props.backdrop) {
this.iosClickHack();
}
},
componentDidUpdate: function componentDidUpdate(prevProps) {
if (this.props.backdrop && this.props.backdrop !== prevProps.backdrop) {
this.iosClickHack();
}
},
componentWillUnmount: function componentWillUnmount() {
this._onDocumentKeyupListener.remove();
var container = this.props.container && React.findDOMNode(this.props.container) || React.findDOMNode(this).ownerDocument.body;
container.className = container.className.replace(/ ?modal-open/, "");
},
handleBackdropClick: function handleBackdropClick(e) {
if (e.target !== e.currentTarget) {
return;
}
this.props.onRequestHide();
},
handleDocumentKeyUp: function handleDocumentKeyUp(e) {
if (this.props.keyboard && e.keyCode === 27) {
this.props.onRequestHide();
}
}
});
module.exports = Modal;
/***/ },
/* 29 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 _react = __webpack_require__(51);
var React = _interopRequire(_react);
var cloneElement = _react.cloneElement;
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var CollapsableMixin = _interopRequire(__webpack_require__(14));
var classSet = _interopRequire(__webpack_require__(60));
var domUtils = _interopRequire(__webpack_require__(52));
var ValidComponentChildren = _interopRequire(__webpack_require__(54));
var createChainedFunction = _interopRequire(__webpack_require__(55));
var Nav = React.createClass({
displayName: "Nav",
mixins: [BootstrapMixin, CollapsableMixin],
propTypes: {
bsStyle: React.PropTypes.oneOf(["tabs", "pills"]),
stacked: React.PropTypes.bool,
justified: React.PropTypes.bool,
onSelect: React.PropTypes.func,
collapsable: React.PropTypes.bool,
expanded: React.PropTypes.bool,
navbar: React.PropTypes.bool,
eventKey: React.PropTypes.any,
right: React.PropTypes.bool
},
getDefaultProps: function getDefaultProps() {
return {
bsClass: "nav"
};
},
getCollapsableDOMNode: function getCollapsableDOMNode() {
return React.findDOMNode(this);
},
getCollapsableDimensionValue: function getCollapsableDimensionValue() {
var node = React.findDOMNode(this.refs.ul),
height = node.offsetHeight,
computedStyles = domUtils.getComputedStyles(node);
return height + parseInt(computedStyles.marginTop, 10) + parseInt(computedStyles.marginBottom, 10);
},
render: function render() {
var classes = this.props.collapsable ? this.getCollapsableClassSet() : {};
classes["navbar-collapse"] = this.props.collapsable;
if (this.props.navbar && !this.props.collapsable) {
return this.renderUl();
}
return React.createElement(
"nav",
_extends({}, this.props, { className: classSet(this.props.className, classes) }),
this.renderUl()
);
},
renderUl: function renderUl() {
var classes = this.getBsClassSet();
classes["nav-stacked"] = this.props.stacked;
classes["nav-justified"] = this.props.justified;
classes["navbar-nav"] = this.props.navbar;
classes["pull-right"] = this.props.pullRight;
classes["navbar-right"] = this.props.right;
return React.createElement(
"ul",
_extends({}, this.props, { className: classSet(this.props.className, classes), ref: "ul" }),
ValidComponentChildren.map(this.props.children, this.renderNavItem)
);
},
getChildActiveProp: function getChildActiveProp(child) {
if (child.props.active) {
return true;
}
if (this.props.activeKey != null) {
if (child.props.eventKey === this.props.activeKey) {
return true;
}
}
if (this.props.activeHref != null) {
if (child.props.href === this.props.activeHref) {
return true;
}
}
return child.props.active;
},
renderNavItem: function renderNavItem(child, index) {
return cloneElement(child, {
active: this.getChildActiveProp(child),
activeKey: this.props.activeKey,
activeHref: this.props.activeHref,
onSelect: createChainedFunction(child.props.onSelect, this.props.onSelect),
key: child.key ? child.key : index,
navItem: true
});
}
});
module.exports = Nav;
/***/ },
/* 30 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 _react = __webpack_require__(51);
var React = _interopRequire(_react);
var cloneElement = _react.cloneElement;
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var classSet = _interopRequire(__webpack_require__(60));
var ValidComponentChildren = _interopRequire(__webpack_require__(54));
var createChainedFunction = _interopRequire(__webpack_require__(55));
var Navbar = React.createClass({
displayName: "Navbar",
mixins: [BootstrapMixin],
propTypes: {
fixedTop: React.PropTypes.bool,
fixedBottom: React.PropTypes.bool,
staticTop: React.PropTypes.bool,
inverse: React.PropTypes.bool,
fluid: React.PropTypes.bool,
role: React.PropTypes.string,
componentClass: React.PropTypes.node.isRequired,
brand: React.PropTypes.node,
toggleButton: React.PropTypes.node,
toggleNavKey: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.number]),
onToggle: React.PropTypes.func,
navExpanded: React.PropTypes.bool,
defaultNavExpanded: React.PropTypes.bool
},
getDefaultProps: function getDefaultProps() {
return {
bsClass: "navbar",
bsStyle: "default",
role: "navigation",
componentClass: "Nav"
};
},
getInitialState: function getInitialState() {
return {
navExpanded: this.props.defaultNavExpanded
};
},
shouldComponentUpdate: function shouldComponentUpdate() {
// Defer any updates to this component during the `onSelect` handler.
return !this._isChanging;
},
handleToggle: function handleToggle() {
if (this.props.onToggle) {
this._isChanging = true;
this.props.onToggle();
this._isChanging = false;
}
this.setState({
navExpanded: !this.state.navExpanded
});
},
isNavExpanded: function isNavExpanded() {
return this.props.navExpanded != null ? this.props.navExpanded : this.state.navExpanded;
},
render: function render() {
var classes = this.getBsClassSet();
var ComponentClass = this.props.componentClass;
classes["navbar-fixed-top"] = this.props.fixedTop;
classes["navbar-fixed-bottom"] = this.props.fixedBottom;
classes["navbar-static-top"] = this.props.staticTop;
classes["navbar-inverse"] = this.props.inverse;
return React.createElement(
ComponentClass,
_extends({}, this.props, { className: classSet(this.props.className, classes) }),
React.createElement(
"div",
{ className: this.props.fluid ? "container-fluid" : "container" },
this.props.brand || this.props.toggleButton || this.props.toggleNavKey != null ? this.renderHeader() : null,
ValidComponentChildren.map(this.props.children, this.renderChild)
)
);
},
renderChild: function renderChild(child, index) {
return cloneElement(child, {
navbar: true,
collapsable: this.props.toggleNavKey != null && this.props.toggleNavKey === child.props.eventKey,
expanded: this.props.toggleNavKey != null && this.props.toggleNavKey === child.props.eventKey && this.isNavExpanded(),
key: child.key ? child.key : index
});
},
renderHeader: function renderHeader() {
var brand = undefined;
if (this.props.brand) {
if (React.isValidElement(this.props.brand)) {
brand = cloneElement(this.props.brand, {
className: classSet(this.props.brand.props.className, "navbar-brand")
});
} else {
brand = React.createElement(
"span",
{ className: "navbar-brand" },
this.props.brand
);
}
}
return React.createElement(
"div",
{ className: "navbar-header" },
brand,
this.props.toggleButton || this.props.toggleNavKey != null ? this.renderToggleButton() : null
);
},
renderToggleButton: function renderToggleButton() {
var children = undefined;
if (React.isValidElement(this.props.toggleButton)) {
return cloneElement(this.props.toggleButton, {
className: classSet(this.props.toggleButton.props.className, "navbar-toggle"),
onClick: createChainedFunction(this.handleToggle, this.props.toggleButton.props.onClick)
});
}
children = this.props.toggleButton != null ? this.props.toggleButton : [React.createElement(
"span",
{ className: "sr-only", key: 0 },
"Toggle navigation"
), React.createElement("span", { className: "icon-bar", key: 1 }), React.createElement("span", { className: "icon-bar", key: 2 }), React.createElement("span", { className: "icon-bar", key: 3 })];
return React.createElement(
"button",
{ className: "navbar-toggle", type: "button", onClick: this.handleToggle },
children
);
}
});
module.exports = Navbar;
/***/ },
/* 31 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var _objectWithoutProperties = function (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 _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 = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var NavItem = React.createClass({
displayName: "NavItem",
mixins: [BootstrapMixin],
propTypes: {
onSelect: React.PropTypes.func,
active: React.PropTypes.bool,
disabled: React.PropTypes.bool,
href: React.PropTypes.string,
title: React.PropTypes.node,
eventKey: React.PropTypes.any,
target: React.PropTypes.string
},
getDefaultProps: function getDefaultProps() {
return {
href: "#"
};
},
render: function render() {
var _props = this.props;
var disabled = _props.disabled;
var active = _props.active;
var href = _props.href;
var title = _props.title;
var target = _props.target;
var children = _props.children;
var props = _objectWithoutProperties(_props, ["disabled", "active", "href", "title", "target", "children"]);
var classes = {
active: active,
disabled: disabled
};
var linkProps = {
href: href,
title: title,
target: target,
onClick: this.handleClick,
ref: "anchor"
};
if (href === "#") {
linkProps.role = "button";
}
return React.createElement(
"li",
_extends({}, props, { className: classSet(props.className, classes) }),
React.createElement(
"a",
linkProps,
children
)
);
},
handleClick: function handleClick(e) {
if (this.props.onSelect) {
e.preventDefault();
if (!this.props.disabled) {
this.props.onSelect(this.props.eventKey, this.props.href, this.props.target);
}
}
}
});
module.exports = NavItem;
/***/ },
/* 32 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var _react = __webpack_require__(51);
var React = _interopRequire(_react);
var cloneElement = _react.cloneElement;
var OverlayMixin = _interopRequire(__webpack_require__(34));
var createChainedFunction = _interopRequire(__webpack_require__(55));
var ModalTrigger = React.createClass({
displayName: "ModalTrigger",
mixins: [OverlayMixin],
propTypes: {
modal: React.PropTypes.node.isRequired
},
getInitialState: function getInitialState() {
return {
isOverlayShown: false
};
},
show: function show() {
this.setState({
isOverlayShown: true
});
},
hide: function hide() {
this.setState({
isOverlayShown: false
});
},
toggle: function toggle() {
this.setState({
isOverlayShown: !this.state.isOverlayShown
});
},
renderOverlay: function renderOverlay() {
if (!this.state.isOverlayShown) {
return React.createElement("span", null);
}
return cloneElement(this.props.modal, {
onRequestHide: this.hide
});
},
render: function render() {
var child = React.Children.only(this.props.children);
return cloneElement(child, {
onClick: createChainedFunction(child.props.onClick, this.toggle)
});
}
});
module.exports = ModalTrigger;
/***/ },
/* 33 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var _react = __webpack_require__(51);
var React = _interopRequire(_react);
var cloneElement = _react.cloneElement;
var OverlayMixin = _interopRequire(__webpack_require__(34));
var domUtils = _interopRequire(__webpack_require__(52));
var createChainedFunction = _interopRequire(__webpack_require__(55));
var assign = _interopRequire(__webpack_require__(58));
/**
* Check if value one is inside or equal to the of value
*
* @param {string} one
* @param {string|array} of
* @returns {boolean}
*/
function isOneOf(one, of) {
if (Array.isArray(of)) {
return of.indexOf(one) >= 0;
}
return one === of;
}
var OverlayTrigger = React.createClass({
displayName: "OverlayTrigger",
mixins: [OverlayMixin],
propTypes: {
trigger: React.PropTypes.oneOfType([React.PropTypes.oneOf(["manual", "click", "hover", "focus"]), React.PropTypes.arrayOf(React.PropTypes.oneOf(["click", "hover", "focus"]))]),
placement: React.PropTypes.oneOf(["top", "right", "bottom", "left"]),
delay: React.PropTypes.number,
delayShow: React.PropTypes.number,
delayHide: React.PropTypes.number,
defaultOverlayShown: React.PropTypes.bool,
overlay: React.PropTypes.node.isRequired
},
getDefaultProps: function getDefaultProps() {
return {
placement: "right",
trigger: ["hover", "focus"]
};
},
getInitialState: function getInitialState() {
return {
isOverlayShown: this.props.defaultOverlayShown == null ? false : this.props.defaultOverlayShown,
overlayLeft: null,
overlayTop: null
};
},
show: function show() {
this.setState({
isOverlayShown: true
}, function () {
this.updateOverlayPosition();
});
},
hide: function hide() {
this.setState({
isOverlayShown: false
});
},
toggle: function toggle() {
if (this.state.isOverlayShown) {
this.hide();
} else {
this.show();
}
},
renderOverlay: function renderOverlay() {
if (!this.state.isOverlayShown) {
return React.createElement("span", null);
}
return cloneElement(this.props.overlay, {
onRequestHide: this.hide,
placement: this.props.placement,
positionLeft: this.state.overlayLeft,
positionTop: this.state.overlayTop
});
},
render: function render() {
if (this.props.trigger === "manual") {
return React.Children.only(this.props.children);
}
var props = {};
if (isOneOf("click", this.props.trigger)) {
props.onClick = createChainedFunction(this.toggle, this.props.onClick);
}
if (isOneOf("hover", this.props.trigger)) {
props.onMouseOver = createChainedFunction(this.handleDelayedShow, this.props.onMouseOver);
props.onMouseOut = createChainedFunction(this.handleDelayedHide, this.props.onMouseOut);
}
if (isOneOf("focus", this.props.trigger)) {
props.onFocus = createChainedFunction(this.handleDelayedShow, this.props.onFocus);
props.onBlur = createChainedFunction(this.handleDelayedHide, this.props.onBlur);
}
return cloneElement(React.Children.only(this.props.children), props);
},
componentWillUnmount: function componentWillUnmount() {
clearTimeout(this._hoverDelay);
},
componentDidMount: function componentDidMount() {
if (this.props.defaultOverlayShown) {
this.updateOverlayPosition();
}
},
handleDelayedShow: function handleDelayedShow() {
if (this._hoverDelay != null) {
clearTimeout(this._hoverDelay);
this._hoverDelay = null;
return;
}
var delay = this.props.delayShow != null ? this.props.delayShow : this.props.delay;
if (!delay) {
this.show();
return;
}
this._hoverDelay = setTimeout((function () {
this._hoverDelay = null;
this.show();
}).bind(this), delay);
},
handleDelayedHide: function handleDelayedHide() {
if (this._hoverDelay != null) {
clearTimeout(this._hoverDelay);
this._hoverDelay = null;
return;
}
var delay = this.props.delayHide != null ? this.props.delayHide : this.props.delay;
if (!delay) {
this.hide();
return;
}
this._hoverDelay = setTimeout((function () {
this._hoverDelay = null;
this.hide();
}).bind(this), delay);
},
updateOverlayPosition: function updateOverlayPosition() {
if (!this.isMounted()) {
return;
}
var pos = this.calcOverlayPosition();
this.setState({
overlayLeft: pos.left,
overlayTop: pos.top
});
},
calcOverlayPosition: function calcOverlayPosition() {
var childOffset = this.getPosition();
var overlayNode = this.getOverlayDOMNode();
var overlayHeight = overlayNode.offsetHeight;
var overlayWidth = overlayNode.offsetWidth;
switch (this.props.placement) {
case "right":
return {
top: childOffset.top + childOffset.height / 2 - overlayHeight / 2,
left: childOffset.left + childOffset.width
};
case "left":
return {
top: childOffset.top + childOffset.height / 2 - overlayHeight / 2,
left: childOffset.left - overlayWidth
};
case "top":
return {
top: childOffset.top - overlayHeight,
left: childOffset.left + childOffset.width / 2 - overlayWidth / 2
};
case "bottom":
return {
top: childOffset.top + childOffset.height,
left: childOffset.left + childOffset.width / 2 - overlayWidth / 2
};
default:
throw new Error("calcOverlayPosition(): No such placement of \"" + this.props.placement + "\" found.");
}
},
getPosition: function getPosition() {
var node = React.findDOMNode(this);
var container = this.getContainerDOMNode();
var offset = container.tagName === "BODY" ? domUtils.getOffset(node) : domUtils.getPosition(node, container);
return assign({}, offset, {
height: node.offsetHeight,
width: node.offsetWidth
});
}
});
module.exports = OverlayTrigger;
/***/ },
/* 34 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var React = _interopRequire(__webpack_require__(51));
var CustomPropTypes = _interopRequire(__webpack_require__(59));
module.exports = {
propTypes: {
container: CustomPropTypes.mountable
},
componentWillUnmount: function componentWillUnmount() {
this._unrenderOverlay();
if (this._overlayTarget) {
this.getContainerDOMNode().removeChild(this._overlayTarget);
this._overlayTarget = null;
}
},
componentDidUpdate: function componentDidUpdate() {
this._renderOverlay();
},
componentDidMount: function componentDidMount() {
this._renderOverlay();
},
_mountOverlayTarget: function _mountOverlayTarget() {
this._overlayTarget = document.createElement("div");
this.getContainerDOMNode().appendChild(this._overlayTarget);
},
_renderOverlay: function _renderOverlay() {
if (!this._overlayTarget) {
this._mountOverlayTarget();
}
var overlay = this.renderOverlay();
// Save reference to help testing
if (overlay !== null) {
this._overlayInstance = React.render(overlay, this._overlayTarget);
} else {
// Unrender if the component is null for transitions to null
this._unrenderOverlay();
}
},
_unrenderOverlay: function _unrenderOverlay() {
React.unmountComponentAtNode(this._overlayTarget);
this._overlayInstance = null;
},
getOverlayDOMNode: function getOverlayDOMNode() {
if (!this.isMounted()) {
throw new Error("getOverlayDOMNode(): A component must be mounted to have a DOM node.");
}
if (this._overlayInstance) {
return React.findDOMNode(this._overlayInstance);
}
return null;
},
getContainerDOMNode: function getContainerDOMNode() {
return React.findDOMNode(this.props.container || React.findDOMNode(this).ownerDocument.body);
}
};
/***/ },
/* 35 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var PageHeader = React.createClass({
displayName: "PageHeader",
render: function render() {
return React.createElement(
"div",
_extends({}, this.props, { className: classSet(this.props.className, "page-header") }),
React.createElement(
"h1",
null,
this.props.children
)
);
}
});
module.exports = PageHeader;
/***/ },
/* 36 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 _react = __webpack_require__(51);
var React = _interopRequire(_react);
var cloneElement = _react.cloneElement;
var classSet = _interopRequire(__webpack_require__(60));
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var CollapsableMixin = _interopRequire(__webpack_require__(14));
var Panel = React.createClass({
displayName: "Panel",
mixins: [BootstrapMixin, CollapsableMixin],
propTypes: {
collapsable: React.PropTypes.bool,
onSelect: React.PropTypes.func,
header: React.PropTypes.node,
footer: React.PropTypes.node,
eventKey: React.PropTypes.any
},
getDefaultProps: function getDefaultProps() {
return {
bsClass: "panel",
bsStyle: "default"
};
},
handleSelect: function handleSelect(e) {
e.selected = true;
if (this.props.onSelect) {
this.props.onSelect(e, this.props.eventKey);
} else {
e.preventDefault();
}
if (e.selected) {
this.handleToggle();
}
},
handleToggle: function handleToggle() {
this.setState({ expanded: !this.state.expanded });
},
getCollapsableDimensionValue: function getCollapsableDimensionValue() {
return React.findDOMNode(this.refs.panel).scrollHeight;
},
getCollapsableDOMNode: function getCollapsableDOMNode() {
if (!this.isMounted() || !this.refs || !this.refs.panel) {
return null;
}
return React.findDOMNode(this.refs.panel);
},
render: function render() {
var classes = this.getBsClassSet();
return React.createElement(
"div",
_extends({}, this.props, {
className: classSet(this.props.className, classes),
id: this.props.collapsable ? null : this.props.id, onSelect: null }),
this.renderHeading(),
this.props.collapsable ? this.renderCollapsableBody() : this.renderBody(),
this.renderFooter()
);
},
renderCollapsableBody: function renderCollapsableBody() {
var collapseClass = this.prefixClass("collapse");
return React.createElement(
"div",
{
className: classSet(this.getCollapsableClassSet(collapseClass)),
id: this.props.id,
ref: "panel",
"aria-expanded": this.isExpanded() ? "true" : "false" },
this.renderBody()
);
},
renderBody: function renderBody() {
var allChildren = this.props.children;
var bodyElements = [];
var panelBodyChildren = [];
var bodyClass = this.prefixClass("body");
function getProps() {
return { key: bodyElements.length };
}
function addPanelChild(child) {
bodyElements.push(cloneElement(child, getProps()));
}
function addPanelBody(children) {
bodyElements.push(React.createElement(
"div",
_extends({ className: bodyClass }, getProps()),
children
));
}
function maybeRenderPanelBody() {
if (panelBodyChildren.length === 0) {
return;
}
addPanelBody(panelBodyChildren);
panelBodyChildren = [];
}
// Handle edge cases where we should not iterate through children.
if (!Array.isArray(allChildren) || allChildren.length === 0) {
if (this.shouldRenderFill(allChildren)) {
addPanelChild(allChildren);
} else {
addPanelBody(allChildren);
}
} else {
allChildren.forEach((function (child) {
if (this.shouldRenderFill(child)) {
maybeRenderPanelBody();
// Separately add the filled element.
addPanelChild(child);
} else {
panelBodyChildren.push(child);
}
}).bind(this));
maybeRenderPanelBody();
}
return bodyElements;
},
shouldRenderFill: function shouldRenderFill(child) {
return React.isValidElement(child) && child.props.fill != null;
},
renderHeading: function renderHeading() {
var header = this.props.header;
if (!header) {
return null;
}
if (!React.isValidElement(header) || Array.isArray(header)) {
header = this.props.collapsable ? this.renderCollapsableTitle(header) : header;
} else if (this.props.collapsable) {
header = cloneElement(header, {
className: classSet(this.prefixClass("title")),
children: this.renderAnchor(header.props.children)
});
} else {
header = cloneElement(header, {
className: classSet(this.prefixClass("title"))
});
}
return React.createElement(
"div",
{ className: this.prefixClass("heading") },
header
);
},
renderAnchor: function renderAnchor(header) {
return React.createElement(
"a",
{
href: "#" + (this.props.id || ""),
className: this.isExpanded() ? null : "collapsed",
"aria-expanded": this.isExpanded() ? "true" : "false",
onClick: this.handleSelect },
header
);
},
renderCollapsableTitle: function renderCollapsableTitle(header) {
return React.createElement(
"h4",
{ className: this.prefixClass("title") },
this.renderAnchor(header)
);
},
renderFooter: function renderFooter() {
if (!this.props.footer) {
return null;
}
return React.createElement(
"div",
{ className: this.prefixClass("footer") },
this.props.footer
);
}
});
module.exports = Panel;
/***/ },
/* 37 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 _react = __webpack_require__(51);
var React = _interopRequire(_react);
var cloneElement = _react.cloneElement;
var classSet = _interopRequire(__webpack_require__(60));
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var ValidComponentChildren = _interopRequire(__webpack_require__(54));
var PanelGroup = React.createClass({
displayName: "PanelGroup",
mixins: [BootstrapMixin],
propTypes: {
collapsable: React.PropTypes.bool,
activeKey: React.PropTypes.any,
defaultActiveKey: React.PropTypes.any,
onSelect: React.PropTypes.func
},
getDefaultProps: function getDefaultProps() {
return {
bsClass: "panel-group"
};
},
getInitialState: function getInitialState() {
var defaultActiveKey = this.props.defaultActiveKey;
return {
activeKey: defaultActiveKey
};
},
render: function render() {
var classes = this.getBsClassSet();
return React.createElement(
"div",
_extends({}, this.props, { className: classSet(this.props.className, classes), onSelect: null }),
ValidComponentChildren.map(this.props.children, this.renderPanel)
);
},
renderPanel: function renderPanel(child, index) {
var activeKey = this.props.activeKey != null ? this.props.activeKey : this.state.activeKey;
var props = {
bsStyle: child.props.bsStyle || this.props.bsStyle,
key: child.key ? child.key : index,
ref: child.ref
};
if (this.props.accordion) {
props.collapsable = true;
props.expanded = child.props.eventKey === activeKey;
props.onSelect = this.handleSelect;
}
return cloneElement(child, props);
},
shouldComponentUpdate: function shouldComponentUpdate() {
// Defer any updates to this component during the `onSelect` handler.
return !this._isChanging;
},
handleSelect: function handleSelect(e, key) {
e.preventDefault();
if (this.props.onSelect) {
this._isChanging = true;
this.props.onSelect(key);
this._isChanging = false;
}
if (this.state.activeKey === key) {
key = null;
}
this.setState({
activeKey: key
});
}
});
module.exports = PanelGroup;
/***/ },
/* 38 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var PageItem = React.createClass({
displayName: "PageItem",
propTypes: {
href: React.PropTypes.string,
target: React.PropTypes.string,
disabled: React.PropTypes.bool,
previous: React.PropTypes.bool,
next: React.PropTypes.bool,
onSelect: React.PropTypes.func,
eventKey: React.PropTypes.any
},
getDefaultProps: function getDefaultProps() {
return {
href: "#"
};
},
render: function render() {
var classes = {
disabled: this.props.disabled,
previous: this.props.previous,
next: this.props.next
};
return React.createElement(
"li",
_extends({}, this.props, {
className: classSet(this.props.className, classes) }),
React.createElement(
"a",
{
href: this.props.href,
title: this.props.title,
target: this.props.target,
onClick: this.handleSelect,
ref: "anchor" },
this.props.children
)
);
},
handleSelect: function handleSelect(e) {
if (this.props.onSelect) {
e.preventDefault();
if (!this.props.disabled) {
this.props.onSelect(this.props.eventKey, this.props.href, this.props.target);
}
}
}
});
module.exports = PageItem;
/***/ },
/* 39 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 _react = __webpack_require__(51);
var React = _interopRequire(_react);
var cloneElement = _react.cloneElement;
var classSet = _interopRequire(__webpack_require__(60));
var ValidComponentChildren = _interopRequire(__webpack_require__(54));
var createChainedFunction = _interopRequire(__webpack_require__(55));
var Pager = React.createClass({
displayName: "Pager",
propTypes: {
onSelect: React.PropTypes.func
},
render: function render() {
return React.createElement(
"ul",
_extends({}, this.props, {
className: classSet(this.props.className, "pager") }),
ValidComponentChildren.map(this.props.children, this.renderPageItem)
);
},
renderPageItem: function renderPageItem(child, index) {
return cloneElement(child, {
onSelect: createChainedFunction(child.props.onSelect, this.props.onSelect),
key: child.key ? child.key : index
});
}
});
module.exports = Pager;
/***/ },
/* 40 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var _defineProperty = function (obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: 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 = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var Popover = React.createClass({
displayName: "Popover",
mixins: [BootstrapMixin],
propTypes: {
placement: React.PropTypes.oneOf(["top", "right", "bottom", "left"]),
positionLeft: React.PropTypes.number,
positionTop: React.PropTypes.number,
arrowOffsetLeft: React.PropTypes.number,
arrowOffsetTop: React.PropTypes.number,
title: React.PropTypes.node
},
getDefaultProps: function getDefaultProps() {
return {
placement: "right"
};
},
render: function render() {
var _this = this;
var classes = (function () {
var _classes = {
popover: true };
_defineProperty(_classes, _this.props.placement, true);
_defineProperty(_classes, "in", _this.props.positionLeft != null || _this.props.positionTop != null);
return _classes;
})();
var style = {
left: this.props.positionLeft,
top: this.props.positionTop,
display: "block"
};
var arrowStyle = {
left: this.props.arrowOffsetLeft,
top: this.props.arrowOffsetTop
};
return React.createElement(
"div",
_extends({}, this.props, { className: classSet(this.props.className, classes), style: style, title: null }),
React.createElement("div", { className: "arrow", style: arrowStyle }),
this.props.title ? this.renderTitle() : null,
React.createElement(
"div",
{ className: "popover-content" },
this.props.children
)
);
},
renderTitle: function renderTitle() {
return React.createElement(
"h3",
{ className: "popover-title" },
this.props.title
);
}
});
module.exports = Popover;
/***/ },
/* 41 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 _react = __webpack_require__(51);
var React = _interopRequire(_react);
var cloneElement = _react.cloneElement;
var Interpolate = _interopRequire(__webpack_require__(22));
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var classSet = _interopRequire(__webpack_require__(60));
var ValidComponentChildren = _interopRequire(__webpack_require__(54));
var ProgressBar = React.createClass({
displayName: "ProgressBar",
propTypes: {
min: React.PropTypes.number,
now: React.PropTypes.number,
max: React.PropTypes.number,
label: React.PropTypes.node,
srOnly: React.PropTypes.bool,
striped: React.PropTypes.bool,
active: React.PropTypes.bool
},
mixins: [BootstrapMixin],
getDefaultProps: function getDefaultProps() {
return {
bsClass: "progress-bar",
min: 0,
max: 100
};
},
getPercentage: function getPercentage(now, min, max) {
return Math.ceil((now - min) / (max - min) * 100);
},
render: function render() {
var classes = {
progress: true
};
if (this.props.active) {
classes["progress-striped"] = true;
classes.active = true;
} else if (this.props.striped) {
classes["progress-striped"] = true;
}
if (!ValidComponentChildren.hasValidComponent(this.props.children)) {
if (!this.props.isChild) {
return React.createElement(
"div",
_extends({}, this.props, { className: classSet(this.props.className, classes) }),
this.renderProgressBar()
);
} else {
return this.renderProgressBar();
}
} else {
return React.createElement(
"div",
_extends({}, this.props, { className: classSet(this.props.className, classes) }),
ValidComponentChildren.map(this.props.children, this.renderChildBar)
);
}
},
renderChildBar: function renderChildBar(child, index) {
return cloneElement(child, {
isChild: true,
key: child.key ? child.key : index
});
},
renderProgressBar: function renderProgressBar() {
var percentage = this.getPercentage(this.props.now, this.props.min, this.props.max);
var label = undefined;
if (typeof this.props.label === "string") {
label = this.renderLabel(percentage);
} else if (this.props.label) {
label = this.props.label;
}
if (this.props.srOnly) {
label = this.renderScreenReaderOnlyLabel(label);
}
var classes = this.getBsClassSet();
return React.createElement(
"div",
_extends({}, this.props, { className: classSet(this.props.className, classes), role: "progressbar",
style: { width: percentage + "%" },
"aria-valuenow": this.props.now,
"aria-valuemin": this.props.min,
"aria-valuemax": this.props.max }),
label
);
},
renderLabel: function renderLabel(percentage) {
var InterpolateClass = this.props.interpolateClass || Interpolate;
return React.createElement(
InterpolateClass,
{
now: this.props.now,
min: this.props.min,
max: this.props.max,
percent: percentage,
bsStyle: this.props.bsStyle },
this.props.label
);
},
renderScreenReaderOnlyLabel: function renderScreenReaderOnlyLabel(label) {
return React.createElement(
"span",
{ className: "sr-only" },
label
);
}
});
module.exports = ProgressBar;
/***/ },
/* 42 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var Row = React.createClass({
displayName: "Row",
propTypes: {
componentClass: React.PropTypes.node.isRequired
},
getDefaultProps: function getDefaultProps() {
return {
componentClass: "div"
};
},
render: function render() {
var ComponentClass = this.props.componentClass;
return React.createElement(
ComponentClass,
_extends({}, this.props, { className: classSet(this.props.className, "row") }),
this.props.children
);
}
});
module.exports = Row;
/***/ },
/* 43 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var DropdownStateMixin = _interopRequire(__webpack_require__(17));
var Button = _interopRequire(__webpack_require__(7));
var ButtonGroup = _interopRequire(__webpack_require__(8));
var DropdownMenu = _interopRequire(__webpack_require__(16));
var SplitButton = React.createClass({
displayName: "SplitButton",
mixins: [BootstrapMixin, DropdownStateMixin],
propTypes: {
pullRight: React.PropTypes.bool,
title: React.PropTypes.node,
href: React.PropTypes.string,
target: React.PropTypes.string,
dropdownTitle: React.PropTypes.node,
onClick: React.PropTypes.func,
onSelect: React.PropTypes.func,
disabled: React.PropTypes.bool
},
getDefaultProps: function getDefaultProps() {
return {
dropdownTitle: "Toggle dropdown"
};
},
render: function render() {
var groupClasses = {
open: this.state.open,
dropup: this.props.dropup
};
var button = React.createElement(
Button,
_extends({}, this.props, {
ref: "button",
onClick: this.handleButtonClick,
title: null,
id: null }),
this.props.title
);
var dropdownButton = React.createElement(
Button,
_extends({}, this.props, {
ref: "dropdownButton",
className: classSet(this.props.className, "dropdown-toggle"),
onClick: this.handleDropdownClick,
title: null,
href: null,
target: null,
id: null }),
React.createElement(
"span",
{ className: "sr-only" },
this.props.dropdownTitle
),
React.createElement("span", { className: "caret" }),
React.createElement(
"span",
{ style: { letterSpacing: "-.3em" } },
" "
)
);
return React.createElement(
ButtonGroup,
{
bsSize: this.props.bsSize,
className: classSet(groupClasses),
id: this.props.id },
button,
dropdownButton,
React.createElement(
DropdownMenu,
{
ref: "menu",
onSelect: this.handleOptionSelect,
"aria-labelledby": this.props.id,
pullRight: this.props.pullRight },
this.props.children
)
);
},
handleButtonClick: function handleButtonClick(e) {
if (this.state.open) {
this.setDropdownState(false);
}
if (this.props.onClick) {
this.props.onClick(e, this.props.href, this.props.target);
}
},
handleDropdownClick: function handleDropdownClick(e) {
e.preventDefault();
this.setDropdownState(!this.state.open);
},
handleOptionSelect: function handleOptionSelect(key) {
if (this.props.onSelect) {
this.props.onSelect(key);
}
this.setDropdownState(false);
}
});
module.exports = SplitButton;
/***/ },
/* 44 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 _react = __webpack_require__(51);
var React = _interopRequire(_react);
var cloneElement = _react.cloneElement;
var classSet = _interopRequire(__webpack_require__(60));
var ValidComponentChildren = _interopRequire(__webpack_require__(54));
var createChainedFunction = _interopRequire(__webpack_require__(55));
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var SubNav = React.createClass({
displayName: "SubNav",
mixins: [BootstrapMixin],
propTypes: {
onSelect: React.PropTypes.func,
active: React.PropTypes.bool,
disabled: React.PropTypes.bool,
href: React.PropTypes.string,
title: React.PropTypes.string,
text: React.PropTypes.node,
target: React.PropTypes.string
},
getDefaultProps: function getDefaultProps() {
return {
bsClass: "nav"
};
},
handleClick: function handleClick(e) {
if (this.props.onSelect) {
e.preventDefault();
if (!this.props.disabled) {
this.props.onSelect(this.props.eventKey, this.props.href, this.props.target);
}
}
},
isActive: function isActive() {
return this.isChildActive(this);
},
isChildActive: function isChildActive(child) {
var _this = this;
if (child.props.active) {
return true;
}
if (this.props.activeKey != null && this.props.activeKey === child.props.eventKey) {
return true;
}
if (this.props.activeHref != null && this.props.activeHref === child.props.href) {
return true;
}
if (child.props.children) {
var _ret = (function () {
var isActive = false;
ValidComponentChildren.forEach(child.props.children, function (grandchild) {
if (this.isChildActive(grandchild)) {
isActive = true;
}
}, _this);
return {
v: isActive
};
})();
if (typeof _ret === "object") {
return _ret.v;
}
}
return false;
},
getChildActiveProp: function getChildActiveProp(child) {
if (child.props.active) {
return true;
}
if (this.props.activeKey != null) {
if (child.props.eventKey === this.props.activeKey) {
return true;
}
}
if (this.props.activeHref != null) {
if (child.props.href === this.props.activeHref) {
return true;
}
}
return child.props.active;
},
render: function render() {
var classes = {
active: this.isActive(),
disabled: this.props.disabled
};
return React.createElement(
"li",
_extends({}, this.props, { className: classSet(this.props.className, classes) }),
React.createElement(
"a",
{
href: this.props.href,
title: this.props.title,
target: this.props.target,
onClick: this.handleClick,
ref: "anchor" },
this.props.text
),
React.createElement(
"ul",
{ className: "nav" },
ValidComponentChildren.map(this.props.children, this.renderNavItem)
)
);
},
renderNavItem: function renderNavItem(child, index) {
return cloneElement(child, {
active: this.getChildActiveProp(child),
onSelect: createChainedFunction(child.props.onSelect, this.props.onSelect),
key: child.key ? child.key : index
});
}
});
module.exports = SubNav;
/***/ },
/* 45 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 _react = __webpack_require__(51);
var React = _interopRequire(_react);
var cloneElement = _react.cloneElement;
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var ValidComponentChildren = _interopRequire(__webpack_require__(54));
var Nav = _interopRequire(__webpack_require__(29));
var NavItem = _interopRequire(__webpack_require__(31));
function getDefaultActiveKeyFromChildren(children) {
var defaultActiveKey = undefined;
ValidComponentChildren.forEach(children, function (child) {
if (defaultActiveKey == null) {
defaultActiveKey = child.props.eventKey;
}
});
return defaultActiveKey;
}
var TabbedArea = React.createClass({
displayName: "TabbedArea",
mixins: [BootstrapMixin],
propTypes: {
bsStyle: React.PropTypes.oneOf(["tabs", "pills"]),
animation: React.PropTypes.bool,
onSelect: React.PropTypes.func
},
getDefaultProps: function getDefaultProps() {
return {
bsStyle: "tabs",
animation: true
};
},
getInitialState: function getInitialState() {
var defaultActiveKey = this.props.defaultActiveKey != null ? this.props.defaultActiveKey : getDefaultActiveKeyFromChildren(this.props.children);
// TODO: In __DEV__ mode warn via `console.warn` if no `defaultActiveKey` has
// been set by this point, invalid children or missing key properties are likely the cause.
return {
activeKey: defaultActiveKey,
previousActiveKey: null
};
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if (nextProps.activeKey != null && nextProps.activeKey !== this.props.activeKey) {
this.setState({
previousActiveKey: this.props.activeKey
});
}
},
handlePaneAnimateOutEnd: function handlePaneAnimateOutEnd() {
this.setState({
previousActiveKey: null
});
},
render: function render() {
var activeKey = this.props.activeKey != null ? this.props.activeKey : this.state.activeKey;
function renderTabIfSet(child) {
return child.props.tab != null ? this.renderTab(child) : null;
}
var nav = React.createElement(
Nav,
_extends({}, this.props, { activeKey: activeKey, onSelect: this.handleSelect, ref: "tabs" }),
ValidComponentChildren.map(this.props.children, renderTabIfSet, this)
);
return React.createElement(
"div",
null,
nav,
React.createElement(
"div",
{ id: this.props.id, className: "tab-content", ref: "panes" },
ValidComponentChildren.map(this.props.children, this.renderPane)
)
);
},
getActiveKey: function getActiveKey() {
return this.props.activeKey != null ? this.props.activeKey : this.state.activeKey;
},
renderPane: function renderPane(child, index) {
var activeKey = this.getActiveKey();
return cloneElement(child, {
active: child.props.eventKey === activeKey && (this.state.previousActiveKey == null || !this.props.animation),
key: child.key ? child.key : index,
animation: this.props.animation,
onAnimateOutEnd: this.state.previousActiveKey != null && child.props.eventKey === this.state.previousActiveKey ? this.handlePaneAnimateOutEnd : null
});
},
renderTab: function renderTab(child) {
var key = child.props.eventKey;
return React.createElement(
NavItem,
{
ref: "tab" + key,
eventKey: key },
child.props.tab
);
},
shouldComponentUpdate: function shouldComponentUpdate() {
// Defer any updates to this component during the `onSelect` handler.
return !this._isChanging;
},
handleSelect: function handleSelect(key) {
if (this.props.onSelect) {
this._isChanging = true;
this.props.onSelect(key);
this._isChanging = false;
} else if (key !== this.getActiveKey()) {
this.setState({
activeKey: key,
previousActiveKey: this.getActiveKey()
});
}
}
});
module.exports = TabbedArea;
/***/ },
/* 46 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var Table = React.createClass({
displayName: "Table",
propTypes: {
striped: React.PropTypes.bool,
bordered: React.PropTypes.bool,
condensed: React.PropTypes.bool,
hover: React.PropTypes.bool,
responsive: React.PropTypes.bool
},
render: function render() {
var classes = {
table: true,
"table-striped": this.props.striped,
"table-bordered": this.props.bordered,
"table-condensed": this.props.condensed,
"table-hover": this.props.hover
};
var table = React.createElement(
"table",
_extends({}, this.props, { className: classSet(this.props.className, classes) }),
this.props.children
);
return this.props.responsive ? React.createElement(
"div",
{ className: "table-responsive" },
table
) : table;
}
});
module.exports = Table;
/***/ },
/* 47 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var TransitionEvents = _interopRequire(__webpack_require__(56));
var TabPane = React.createClass({
displayName: "TabPane",
getDefaultProps: function getDefaultProps() {
return {
animation: true
};
},
getInitialState: function getInitialState() {
return {
animateIn: false,
animateOut: false
};
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if (this.props.animation) {
if (!this.state.animateIn && nextProps.active && !this.props.active) {
this.setState({
animateIn: true
});
} else if (!this.state.animateOut && !nextProps.active && this.props.active) {
this.setState({
animateOut: true
});
}
}
},
componentDidUpdate: function componentDidUpdate() {
if (this.state.animateIn) {
setTimeout(this.startAnimateIn, 0);
}
if (this.state.animateOut) {
TransitionEvents.addEndEventListener(React.findDOMNode(this), this.stopAnimateOut);
}
},
startAnimateIn: function startAnimateIn() {
if (this.isMounted()) {
this.setState({
animateIn: false
});
}
},
stopAnimateOut: function stopAnimateOut() {
if (this.isMounted()) {
this.setState({
animateOut: false
});
if (typeof this.props.onAnimateOutEnd === "function") {
this.props.onAnimateOutEnd();
}
}
},
render: function render() {
var classes = {
"tab-pane": true,
fade: true,
active: this.props.active || this.state.animateOut,
"in": this.props.active && !this.state.animateIn
};
return React.createElement(
"div",
_extends({}, this.props, { className: classSet(this.props.className, classes) }),
this.props.children
);
}
});
module.exports = TabPane;
/***/ },
/* 48 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var _defineProperty = function (obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: 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 = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var Tooltip = React.createClass({
displayName: "Tooltip",
mixins: [BootstrapMixin],
propTypes: {
placement: React.PropTypes.oneOf(["top", "right", "bottom", "left"]),
positionLeft: React.PropTypes.number,
positionTop: React.PropTypes.number,
arrowOffsetLeft: React.PropTypes.number,
arrowOffsetTop: React.PropTypes.number
},
getDefaultProps: function getDefaultProps() {
return {
placement: "right"
};
},
render: function render() {
var _this = this;
var classes = (function () {
var _classes = {
tooltip: true };
_defineProperty(_classes, _this.props.placement, true);
_defineProperty(_classes, "in", _this.props.positionLeft != null || _this.props.positionTop != null);
return _classes;
})();
var style = {
left: this.props.positionLeft,
top: this.props.positionTop
};
var arrowStyle = {
left: this.props.arrowOffsetLeft,
top: this.props.arrowOffsetTop
};
return React.createElement(
"div",
_extends({}, this.props, { className: classSet(this.props.className, classes), style: style }),
React.createElement("div", { className: "tooltip-arrow", style: arrowStyle }),
React.createElement(
"div",
{ className: "tooltip-inner" },
this.props.children
)
);
}
});
module.exports = Tooltip;
/***/ },
/* 49 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : 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 React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var BootstrapMixin = _interopRequire(__webpack_require__(5));
var Well = React.createClass({
displayName: "Well",
mixins: [BootstrapMixin],
getDefaultProps: function getDefaultProps() {
return {
bsClass: "well"
};
},
render: function render() {
var classes = this.getBsClassSet();
return React.createElement(
"div",
_extends({}, this.props, { className: classSet(this.props.className, classes) }),
this.props.children
);
}
});
module.exports = Well;
/***/ },
/* 50 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
module.exports = {
CLASSES: {
alert: "alert",
button: "btn",
"button-group": "btn-group",
"button-toolbar": "btn-toolbar",
column: "col",
"input-group": "input-group",
form: "form",
glyphicon: "glyphicon",
label: "label",
"list-group-item": "list-group-item",
panel: "panel",
"panel-group": "panel-group",
"progress-bar": "progress-bar",
nav: "nav",
navbar: "navbar",
modal: "modal",
row: "row",
well: "well"
},
STYLES: {
"default": "default",
primary: "primary",
success: "success",
info: "info",
warning: "warning",
danger: "danger",
link: "link",
inline: "inline",
tabs: "tabs",
pills: "pills"
},
SIZES: {
large: "lg",
medium: "md",
small: "sm",
xsmall: "xs"
},
GLYPHS: ["asterisk", "plus", "euro", "eur", "minus", "cloud", "envelope", "pencil", "glass", "music", "search", "heart", "star", "star-empty", "user", "film", "th-large", "th", "th-list", "ok", "remove", "zoom-in", "zoom-out", "off", "signal", "cog", "trash", "home", "file", "time", "road", "download-alt", "download", "upload", "inbox", "play-circle", "repeat", "refresh", "list-alt", "lock", "flag", "headphones", "volume-off", "volume-down", "volume-up", "qrcode", "barcode", "tag", "tags", "book", "bookmark", "print", "camera", "font", "bold", "italic", "text-height", "text-width", "align-left", "align-center", "align-right", "align-justify", "list", "indent-left", "indent-right", "facetime-video", "picture", "map-marker", "adjust", "tint", "edit", "share", "check", "move", "step-backward", "fast-backward", "backward", "play", "pause", "stop", "forward", "fast-forward", "step-forward", "eject", "chevron-left", "chevron-right", "plus-sign", "minus-sign", "remove-sign", "ok-sign", "question-sign", "info-sign", "screenshot", "remove-circle", "ok-circle", "ban-circle", "arrow-left", "arrow-right", "arrow-up", "arrow-down", "share-alt", "resize-full", "resize-small", "exclamation-sign", "gift", "leaf", "fire", "eye-open", "eye-close", "warning-sign", "plane", "calendar", "random", "comment", "magnet", "chevron-up", "chevron-down", "retweet", "shopping-cart", "folder-close", "folder-open", "resize-vertical", "resize-horizontal", "hdd", "bullhorn", "bell", "certificate", "thumbs-up", "thumbs-down", "hand-right", "hand-left", "hand-up", "hand-down", "circle-arrow-right", "circle-arrow-left", "circle-arrow-up", "circle-arrow-down", "globe", "wrench", "tasks", "filter", "briefcase", "fullscreen", "dashboard", "paperclip", "heart-empty", "link", "phone", "pushpin", "usd", "gbp", "sort", "sort-by-alphabet", "sort-by-alphabet-alt", "sort-by-order", "sort-by-order-alt", "sort-by-attributes", "sort-by-attributes-alt", "unchecked", "expand", "collapse-down", "collapse-up", "log-in", "flash", "log-out", "new-window", "record", "save", "open", "saved", "import", "export", "send", "floppy-disk", "floppy-saved", "floppy-remove", "floppy-save", "floppy-open", "credit-card", "transfer", "cutlery", "header", "compressed", "earphone", "phone-alt", "tower", "stats", "sd-video", "hd-video", "subtitles", "sound-stereo", "sound-dolby", "sound-5-1", "sound-6-1", "sound-7-1", "copyright-mark", "registration-mark", "cloud-download", "cloud-upload", "tree-conifer", "tree-deciduous", "cd", "save-file", "open-file", "level-up", "copy", "paste", "alert", "equalizer", "king", "queen", "pawn", "bishop", "knight", "baby-formula", "tent", "blackboard", "bed", "apple", "erase", "hourglass", "lamp", "duplicate", "piggy-bank", "scissors", "bitcoin", "yen", "ruble", "scale", "ice-lolly", "ice-lolly-tasted", "education", "option-horizontal", "option-vertical", "menu-hamburger", "modal-window", "oil", "grain", "sunglasses", "text-size", "text-color", "text-background", "object-align-top", "object-align-bottom", "object-align-horizontal", "object-align-left", "object-align-vertical", "object-align-right", "triangle-right", "triangle-left", "triangle-bottom", "triangle-top", "console", "superscript", "subscript", "menu-left", "menu-right", "menu-down", "menu-up"]
};
/***/ },
/* 51 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __WEBPACK_EXTERNAL_MODULE_51__;
/***/ },
/* 52 */
/***/ function(module, exports, __webpack_require__) {
/**
* Shortcut to compute element style
*
* @param {HTMLElement} elem
* @returns {CssStyle}
*/
"use strict";
function getComputedStyles(elem) {
return elem.ownerDocument.defaultView.getComputedStyle(elem, null);
}
/**
* Get elements offset
*
* TODO: REMOVE JQUERY!
*
* @param {HTMLElement} DOMNode
* @returns {{top: number, left: number}}
*/
function getOffset(DOMNode) {
if (window.jQuery) {
return window.jQuery(DOMNode).offset();
}
var docElem = DOMNode.ownerDocument.documentElement;
var box = { top: 0, left: 0 };
// If we don't have gBCR, just use 0,0 rather than error
// BlackBerry 5, iOS 3 (original iPhone)
if (typeof DOMNode.getBoundingClientRect !== "undefined") {
box = DOMNode.getBoundingClientRect();
}
return {
top: box.top + window.pageYOffset - docElem.clientTop,
left: box.left + window.pageXOffset - docElem.clientLeft
};
}
/**
* Get elements position
*
* TODO: REMOVE JQUERY!
*
* @param {HTMLElement} elem
* @param {HTMLElement?} offsetParent
* @returns {{top: number, left: number}}
*/
function getPosition(elem, offsetParent) {
if (window.jQuery) {
return window.jQuery(elem).position();
}
var offset = undefined,
parentOffset = { top: 0, left: 0 };
// Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
if (getComputedStyles(elem).position === "fixed") {
// We assume that getBoundingClientRect is available when computed position is fixed
offset = elem.getBoundingClientRect();
} else {
if (!offsetParent) {
// Get *real* offsetParent
offsetParent = offsetParentFunc(elem);
}
// Get correct offsets
offset = getOffset(elem);
if (offsetParent.nodeName !== "HTML") {
parentOffset = getOffset(offsetParent);
}
// Add offsetParent borders
parentOffset.top += parseInt(getComputedStyles(offsetParent).borderTopWidth, 10);
parentOffset.left += parseInt(getComputedStyles(offsetParent).borderLeftWidth, 10);
}
// Subtract parent offsets and element margins
return {
top: offset.top - parentOffset.top - parseInt(getComputedStyles(elem).marginTop, 10),
left: offset.left - parentOffset.left - parseInt(getComputedStyles(elem).marginLeft, 10)
};
}
/**
* Get parent element
*
* @param {HTMLElement?} elem
* @returns {HTMLElement}
*/
function offsetParentFunc(elem) {
var docElem = elem.ownerDocument.documentElement;
var offsetParent = elem.offsetParent || docElem;
while (offsetParent && (offsetParent.nodeName !== "HTML" && getComputedStyles(offsetParent).position === "static")) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || docElem;
}
module.exports = {
getComputedStyles: getComputedStyles,
getOffset: getOffset,
getPosition: getPosition,
offsetParent: offsetParentFunc
};
/***/ },
/* 53 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2013-2014 Facebook, Inc.
*
* This file contains a modified version of:
* https://github.com/facebook/react/blob/v0.12.0/src/vendor/stubs/EventListener.js
*
* 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.
*
* TODO: remove in favour of solution provided by:
* https://github.com/facebook/react/issues/285
*/
/**
* Does not take into account specific nature of platform.
*/
"use strict";
var EventListener = {
/**
* Listen to DOM events during the bubble phase.
*
* @param {DOMEventTarget} target DOM element to register listener on.
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
* @param {function} callback Callback function.
* @return {object} Object with a `remove` method.
*/
listen: function listen(target, eventType, callback) {
if (target.addEventListener) {
target.addEventListener(eventType, callback, false);
return {
remove: function remove() {
target.removeEventListener(eventType, callback, false);
}
};
} else if (target.attachEvent) {
target.attachEvent("on" + eventType, callback);
return {
remove: function remove() {
target.detachEvent("on" + eventType, callback);
}
};
}
}
};
module.exports = EventListener;
/***/ },
/* 54 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var React = _interopRequire(__webpack_require__(51));
/**
* Maps children that are typically specified as `props.children`,
* but only iterates over children that are "valid components".
*
* The mapFunction provided index will be normalised to the components mapped,
* so an invalid component would not increase the index.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} mapFunction.
* @param {*} mapContext Context for mapFunction.
* @return {object} Object containing the ordered map of results.
*/
function mapValidComponents(children, func, context) {
var index = 0;
return React.Children.map(children, function (child) {
if (React.isValidElement(child)) {
var lastIndex = index;
index++;
return func.call(context, child, lastIndex);
}
return child;
});
}
/**
* Iterates through children that are typically specified as `props.children`,
* but only iterates over children that are "valid components".
*
* The provided forEachFunc(child, index) will be called for each
* leaf child with the index reflecting the position relative to "valid components".
*
* @param {?*} children Children tree container.
* @param {function(*, int)} forEachFunc.
* @param {*} forEachContext Context for forEachContext.
*/
function forEachValidComponents(children, func, context) {
var index = 0;
return React.Children.forEach(children, function (child) {
if (React.isValidElement(child)) {
func.call(context, child, index);
index++;
}
});
}
/**
* Count the number of "valid components" in the Children container.
*
* @param {?*} children Children tree container.
* @returns {number}
*/
function numberOfValidComponents(children) {
var count = 0;
React.Children.forEach(children, function (child) {
if (React.isValidElement(child)) {
count++;
}
});
return count;
}
/**
* Determine if the Child container has one or more "valid components".
*
* @param {?*} children Children tree container.
* @returns {boolean}
*/
function hasValidComponent(children) {
var hasValid = false;
React.Children.forEach(children, function (child) {
if (!hasValid && React.isValidElement(child)) {
hasValid = true;
}
});
return hasValid;
}
module.exports = {
map: mapValidComponents,
forEach: forEachValidComponents,
numberOf: numberOfValidComponents,
hasValidComponent: hasValidComponent
};
/***/ },
/* 55 */
/***/ function(module, exports, __webpack_require__) {
/**
* Safe chained function
*
* Will only create a new function if needed,
* otherwise will pass back existing functions or null.
*
* @param {function} one
* @param {function} two
* @returns {function|null}
*/
"use strict";
function createChainedFunction(one, two) {
var hasOne = typeof one === "function";
var hasTwo = typeof two === "function";
if (!hasOne && !hasTwo) {
return null;
}
if (!hasOne) {
return two;
}
if (!hasTwo) {
return one;
}
return function chainedFunction() {
one.apply(this, arguments);
two.apply(this, arguments);
};
}
module.exports = createChainedFunction;
/***/ },
/* 56 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2013-2014, Facebook, Inc.
* All rights reserved.
*
* This file contains a modified version of:
* https://github.com/facebook/react/blob/v0.12.0/src/addons/transitions/ReactTransitionEvents.js
*
* This source code is licensed under the BSD-style license found here:
* https://github.com/facebook/react/blob/v0.12.0/LICENSE
* An additional grant of patent rights can be found here:
* https://github.com/facebook/react/blob/v0.12.0/PATENTS
*/
"use strict";
var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
/**
* 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 (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 addEndEventListener(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 removeEndEventListener(node, eventListener) {
if (endEvents.length === 0) {
return;
}
endEvents.forEach(function (endEvent) {
removeEventListener(node, endEvent, eventListener);
});
}
};
module.exports = ReactTransitionEvents;
/***/ },
/* 57 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _inherits = function (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) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var React = _interopRequire(__webpack_require__(51));
var classSet = _interopRequire(__webpack_require__(60));
var FormGroup = (function (_React$Component) {
function FormGroup() {
_classCallCheck(this, FormGroup);
if (_React$Component != null) {
_React$Component.apply(this, arguments);
}
}
_inherits(FormGroup, _React$Component);
_createClass(FormGroup, {
render: {
value: function render() {
var classes = {
"form-group": !this.props.standalone,
"has-feedback": this.props.hasFeedback,
"has-success": this.props.bsStyle === "success",
"has-warning": this.props.bsStyle === "warning",
"has-error": this.props.bsStyle === "error"
};
return React.createElement(
"div",
{ className: classSet(classes, this.props.groupClassName) },
this.props.children
);
}
}
});
return FormGroup;
})(React.Component);
FormGroup.defaultProps = {
standalone: false
};
FormGroup.propTypes = {
standalone: React.PropTypes.bool,
hasFeedback: React.PropTypes.bool,
bsStyle: React.PropTypes.oneOf(["success", "warning", "error"]),
groupClassName: React.PropTypes.string
};
module.exports = FormGroup;
/***/ },
/* 58 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2014, Facebook, Inc.
* All rights reserved.
*
* This file contains an unmodified version of:
* https://github.com/facebook/react/blob/v0.12.0/src/vendor/stubs/Object.assign.js
*
* This source code is licensed under the BSD-style license found here:
* https://github.com/facebook/react/blob/v0.12.0/LICENSE
* An additional grant of patent rights can be found here:
* https://github.com/facebook/react/blob/v0.12.0/PATENTS
*/
// 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;
/***/ },
/* 59 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var ANONYMOUS = "<<anonymous>>";
var CustomPropTypes = {
/**
* Checks whether a prop provides a DOM element
*
* The element can be provided in two forms:
* - Directly passed
* - Or passed an object which has a `getDOMNode` method which will return the required DOM element
*
* @param props
* @param propName
* @param componentName
* @returns {Error|undefined}
*/
mountable: createMountableChecker()
};
/**
* Create chain-able isRequired validator
*
* Largely copied directly from:
* https://github.com/facebook/react/blob/0.11-stable/src/core/ReactPropTypes.js#L94
*/
function createChainableTypeChecker(validate) {
function checkType(isRequired, props, propName, componentName) {
componentName = componentName || ANONYMOUS;
if (props[propName] == null) {
if (isRequired) {
return new Error("Required prop `" + propName + "` was not specified in " + "`" + componentName + "`.");
}
} else {
return validate(props, propName, componentName);
}
}
var chainedCheckType = checkType.bind(null, false);
chainedCheckType.isRequired = checkType.bind(null, true);
return chainedCheckType;
}
function createMountableChecker() {
function validate(props, propName, componentName) {
if (typeof props[propName] !== "object" || typeof props[propName].render !== "function" && props[propName].nodeType !== 1) {
return new Error("Invalid prop `" + propName + "` supplied to " + "`" + componentName + "`, expected a DOM element or an object that has a `render` method");
}
}
return createChainableTypeChecker(validate);
}
module.exports = CustomPropTypes;
/***/ },
/* 60 */
/***/ function(module, exports, __webpack_require__) {
function classNames() {
var classes = '';
var arg;
for (var i = 0; i < arguments.length; i++) {
arg = arguments[i];
if (!arg) {
continue;
}
if ('string' === typeof arg || 'number' === typeof arg) {
classes += ' ' + arg;
} else if (Object.prototype.toString.call(arg) === '[object Array]') {
classes += ' ' + classNames.apply(null, arg);
} else if ('object' === typeof arg) {
for (var key in arg) {
if (!arg.hasOwnProperty(key) || !arg[key]) {
continue;
}
classes += ' ' + key;
}
}
}
return classes.substr(1);
}
// safely export classNames in case the script is included directly on a page
if (typeof module !== 'undefined' && module.exports) {
module.exports = classNames;
}
/***/ },
/* 61 */
/***/ 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.
*
* @providesModule ReactTransitionEvents
*/
'use strict';
var ExecutionEnvironment = __webpack_require__(62);
/**
* 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;
/***/ },
/* 62 */
/***/ 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.
*
* @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;
/***/ }
/******/ ])
});
;
|
files/jquery.handsontable/0.10.3/jquery.handsontable.full.js
|
garrypolley/jsdelivr
|
/**
* Handsontable 0.10.3
* Handsontable is a simple jQuery plugin for editable tables with basic copy-paste compatibility with Excel and Google Docs
*
* Copyright 2012, Marcin Warpechowski
* Licensed under the MIT license.
* http://handsontable.com/
*
* Date: Mon Feb 10 2014 14:15:11 GMT+0100 (CET)
*/
/*jslint white: true, browser: true, plusplus: true, indent: 4, maxerr: 50 */
var Handsontable = { //class namespace
extension: {}, //extenstion namespace
helper: {} //helper namespace
};
(function ($, window, Handsontable) {
"use strict";
//http://stackoverflow.com/questions/3629183/why-doesnt-indexof-work-on-an-array-ie8
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (elt /*, from*/) {
var len = this.length >>> 0;
var from = Number(arguments[1]) || 0;
from = (from < 0)
? Math.ceil(from)
: Math.floor(from);
if (from < 0)
from += len;
for (; from < len; from++) {
if (from in this &&
this[from] === elt)
return from;
}
return -1;
};
}
/**
* Array.filter() shim by Trevor Menagh (https://github.com/trevmex) with some modifications
*/
if (!Array.prototype.filter) {
Array.prototype.filter = function (fun, thisp) {
"use strict";
if (typeof this === "undefined" || this === null) {
throw new TypeError();
}
if (typeof fun !== "function") {
throw new TypeError();
}
thisp = thisp || this;
if (isNodeList(thisp)) {
thisp = convertNodeListToArray(thisp);
}
var len = thisp.length,
res = [],
i,
val;
for (i = 0; i < len; i += 1) {
if (thisp.hasOwnProperty(i)) {
val = thisp[i]; // in case fun mutates this
if (fun.call(thisp, val, i, thisp)) {
res.push(val);
}
}
}
return res;
function isNodeList(object) {
return /NodeList/i.test(object.item);
}
function convertNodeListToArray(nodeList) {
var array = [];
for (var i = 0, len = nodeList.length; i < len; i++){
array[i] = nodeList[i]
}
return array;
}
};
}
/*
* Copyright 2012 The Polymer Authors. All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file.
*/
if (typeof WeakMap === 'undefined') {
(function() {
var defineProperty = Object.defineProperty;
try {
var properDefineProperty = true;
defineProperty(function(){}, 'foo', {});
} catch (e) {
properDefineProperty = false;
}
/*
IE8 does not support Date.now() but IE8 compatibility mode in IE9 and IE10 does.
M$ deserves a high five for this one :)
*/
var counter = +(new Date) % 1e9;
var WeakMap = function() {
this.name = '__st' + (Math.random() * 1e9 >>> 0) + (counter++ + '__');
if(!properDefineProperty){
this._wmCache = [];
}
};
if(properDefineProperty){
WeakMap.prototype = {
set: function(key, value) {
var entry = key[this.name];
if (entry && entry[0] === key)
entry[1] = value;
else
defineProperty(key, this.name, {value: [key, value], writable: true});
},
get: function(key) {
var entry;
return (entry = key[this.name]) && entry[0] === key ?
entry[1] : undefined;
},
'delete': function(key) {
this.set(key, undefined);
}
};
} else {
WeakMap.prototype = {
set: function(key, value) {
if(typeof key == 'undefined' || typeof value == 'undefined') return;
for(var i = 0, len = this._wmCache.length; i < len; i++){
if(this._wmCache[i].key == key){
this._wmCache[i].value = value;
return;
}
}
this._wmCache.push({key: key, value: value});
},
get: function(key) {
if(typeof key == 'undefined') return;
for(var i = 0, len = this._wmCache.length; i < len; i++){
if(this._wmCache[i].key == key){
return this._wmCache[i].value;
}
}
return;
},
'delete': function(key) {
if(typeof key == 'undefined') return;
for(var i = 0, len = this._wmCache.length; i < len; i++){
if(this._wmCache[i].key == key){
Array.prototype.slice.call(this._wmCache, i, 1);
}
}
}
};
}
window.WeakMap = WeakMap;
})();
}
Handsontable.activeGuid = null;
/**
* Handsontable constructor
* @param rootElement The jQuery element in which Handsontable DOM will be inserted
* @param userSettings
* @constructor
*/
Handsontable.Core = function (rootElement, userSettings) {
var priv
, datamap
, grid
, selection
, editorManager
, autofill
, instance = this
, GridSettings = function () {};
Handsontable.helper.extend(GridSettings.prototype, DefaultSettings.prototype); //create grid settings as a copy of default settings
Handsontable.helper.extend(GridSettings.prototype, userSettings); //overwrite defaults with user settings
Handsontable.helper.extend(GridSettings.prototype, expandType(userSettings));
this.rootElement = rootElement;
var $document = $(document.documentElement);
var $body = $(document.body);
this.guid = 'ht_' + Handsontable.helper.randomString(); //this is the namespace for global events
if (!this.rootElement[0].id) {
this.rootElement[0].id = this.guid; //if root element does not have an id, assign a random id
}
priv = {
cellSettings: [],
columnSettings: [],
columnsSettingConflicts: ['data', 'width'],
settings: new GridSettings(), // current settings instance
settingsFromDOM: {},
selStart: new Handsontable.SelectionPoint(),
selEnd: new Handsontable.SelectionPoint(),
isPopulated: null,
scrollable: null,
extensions: {},
firstRun: true
};
grid = {
/**
* Inserts or removes rows and columns
* @param {String} action Possible values: "insert_row", "insert_col", "remove_row", "remove_col"
* @param {Number} index
* @param {Number} amount
* @param {String} [source] Optional. Source of hook runner.
* @param {Boolean} [keepEmptyRows] Optional. Flag for preventing deletion of empty rows.
*/
alter: function (action, index, amount, source, keepEmptyRows) {
var delta;
amount = amount || 1;
switch (action) {
case "insert_row":
delta = datamap.createRow(index, amount);
if (delta) {
if (priv.selStart.exists() && priv.selStart.row() >= index) {
priv.selStart.row(priv.selStart.row() + delta);
selection.transformEnd(delta, 0); //will call render() internally
}
else {
selection.refreshBorders(); //it will call render and prepare methods
}
}
break;
case "insert_col":
delta = datamap.createCol(index, amount);
if (delta) {
if(Handsontable.helper.isArray(instance.getSettings().colHeaders)){
var spliceArray = [index, 0];
spliceArray.length += delta; //inserts empty (undefined) elements at the end of an array
Array.prototype.splice.apply(instance.getSettings().colHeaders, spliceArray); //inserts empty (undefined) elements into the colHeader array
}
if (priv.selStart.exists() && priv.selStart.col() >= index) {
priv.selStart.col(priv.selStart.col() + delta);
selection.transformEnd(0, delta); //will call render() internally
}
else {
selection.refreshBorders(); //it will call render and prepare methods
}
}
break;
case "remove_row":
datamap.removeRow(index, amount);
priv.cellSettings.splice(index, amount);
grid.adjustRowsAndCols();
selection.refreshBorders(); //it will call render and prepare methods
break;
case "remove_col":
datamap.removeCol(index, amount);
for(var row = 0, len = datamap.getAll().length; row < len; row++){
if(row in priv.cellSettings){ //if row hasn't been rendered it wouldn't have cellSettings
priv.cellSettings[row].splice(index, amount);
}
}
if(Handsontable.helper.isArray(instance.getSettings().colHeaders)){
if(typeof index == 'undefined'){
index = -1;
}
instance.getSettings().colHeaders.splice(index, amount);
}
priv.columnSettings.splice(index, amount);
grid.adjustRowsAndCols();
selection.refreshBorders(); //it will call render and prepare methods
break;
default:
throw new Error('There is no such action "' + action + '"');
break;
}
if (!keepEmptyRows) {
grid.adjustRowsAndCols(); //makes sure that we did not add rows that will be removed in next refresh
}
},
/**
* Makes sure there are empty rows at the bottom of the table
*/
adjustRowsAndCols: function () {
var r, rlen, emptyRows = instance.countEmptyRows(true), emptyCols;
//should I add empty rows to data source to meet minRows?
rlen = instance.countRows();
if (rlen < priv.settings.minRows) {
for (r = 0; r < priv.settings.minRows - rlen; r++) {
datamap.createRow(instance.countRows(), 1, true);
}
}
//should I add empty rows to meet minSpareRows?
if (emptyRows < priv.settings.minSpareRows) {
for (; emptyRows < priv.settings.minSpareRows && instance.countRows() < priv.settings.maxRows; emptyRows++) {
datamap.createRow(instance.countRows(), 1, true);
}
}
//count currently empty cols
emptyCols = instance.countEmptyCols(true);
//should I add empty cols to meet minCols?
if (!priv.settings.columns && instance.countCols() < priv.settings.minCols) {
for (; instance.countCols() < priv.settings.minCols; emptyCols++) {
datamap.createCol(instance.countCols(), 1, true);
}
}
//should I add empty cols to meet minSpareCols?
if (!priv.settings.columns && instance.dataType === 'array' && emptyCols < priv.settings.minSpareCols) {
for (; emptyCols < priv.settings.minSpareCols && instance.countCols() < priv.settings.maxCols; emptyCols++) {
datamap.createCol(instance.countCols(), 1, true);
}
}
if (priv.settings.enterBeginsEditing) {
for (; (((priv.settings.minRows || priv.settings.minSpareRows) && instance.countRows() > priv.settings.minRows) && (priv.settings.minSpareRows && emptyRows > priv.settings.minSpareRows)); emptyRows--) {
datamap.removeRow();
}
}
if (priv.settings.enterBeginsEditing && !priv.settings.columns) {
for (; (((priv.settings.minCols || priv.settings.minSpareCols) && instance.countCols() > priv.settings.minCols) && (priv.settings.minSpareCols && emptyCols > priv.settings.minSpareCols)); emptyCols--) {
datamap.removeCol();
}
}
var rowCount = instance.countRows();
var colCount = instance.countCols();
if (rowCount === 0 || colCount === 0) {
selection.deselect();
}
if (priv.selStart.exists()) {
var selectionChanged;
var fromRow = priv.selStart.row();
var fromCol = priv.selStart.col();
var toRow = priv.selEnd.row();
var toCol = priv.selEnd.col();
//if selection is outside, move selection to last row
if (fromRow > rowCount - 1) {
fromRow = rowCount - 1;
selectionChanged = true;
if (toRow > fromRow) {
toRow = fromRow;
}
} else if (toRow > rowCount - 1) {
toRow = rowCount - 1;
selectionChanged = true;
if (fromRow > toRow) {
fromRow = toRow;
}
}
//if selection is outside, move selection to last row
if (fromCol > colCount - 1) {
fromCol = colCount - 1;
selectionChanged = true;
if (toCol > fromCol) {
toCol = fromCol;
}
} else if (toCol > colCount - 1) {
toCol = colCount - 1;
selectionChanged = true;
if (fromCol > toCol) {
fromCol = toCol;
}
}
if (selectionChanged) {
instance.selectCell(fromRow, fromCol, toRow, toCol);
}
}
},
/**
* Populate cells at position with 2d array
* @param {Object} start Start selection position
* @param {Array} input 2d array
* @param {Object} [end] End selection position (only for drag-down mode)
* @param {String} [source="populateFromArray"]
* @param {String} [method="overwrite"]
* @return {Object|undefined} ending td in pasted area (only if any cell was changed)
*/
populateFromArray: function (start, input, end, source, method) {
var r, rlen, c, clen, setData = [], current = {};
rlen = input.length;
if (rlen === 0) {
return false;
}
var repeatCol
, repeatRow
, cmax
, rmax;
// insert data with specified pasteMode method
switch (method) {
case 'shift_down' :
repeatCol = end ? end.col - start.col + 1 : 0;
repeatRow = end ? end.row - start.row + 1 : 0;
input = Handsontable.helper.translateRowsToColumns(input);
for (c = 0, clen = input.length, cmax = Math.max(clen, repeatCol); c < cmax; c++) {
if (c < clen) {
for (r = 0, rlen = input[c].length; r < repeatRow - rlen; r++) {
input[c].push(input[c][r % rlen]);
}
input[c].unshift(start.col + c, start.row, 0);
instance.spliceCol.apply(instance, input[c]);
}
else {
input[c % clen][0] = start.col + c;
instance.spliceCol.apply(instance, input[c % clen]);
}
}
break;
case 'shift_right' :
repeatCol = end ? end.col - start.col + 1 : 0;
repeatRow = end ? end.row - start.row + 1 : 0;
for (r = 0, rlen = input.length, rmax = Math.max(rlen, repeatRow); r < rmax; r++) {
if (r < rlen) {
for (c = 0, clen = input[r].length; c < repeatCol - clen; c++) {
input[r].push(input[r][c % clen]);
}
input[r].unshift(start.row + r, start.col, 0);
instance.spliceRow.apply(instance, input[r]);
}
else {
input[r % rlen][0] = start.row + r;
instance.spliceRow.apply(instance, input[r % rlen]);
}
}
break;
case 'overwrite' :
default:
// overwrite and other not specified options
current.row = start.row;
current.col = start.col;
for (r = 0; r < rlen; r++) {
if ((end && current.row > end.row) || (!priv.settings.minSpareRows && current.row > instance.countRows() - 1) || (current.row >= priv.settings.maxRows)) {
break;
}
current.col = start.col;
clen = input[r] ? input[r].length : 0;
for (c = 0; c < clen; c++) {
if ((end && current.col > end.col) || (!priv.settings.minSpareCols && current.col > instance.countCols() - 1) || (current.col >= priv.settings.maxCols)) {
break;
}
if (!instance.getCellMeta(current.row, current.col).readOnly) {
setData.push([current.row, current.col, input[r][c]]);
}
current.col++;
if (end && c === clen - 1) {
c = -1;
}
}
current.row++;
if (end && r === rlen - 1) {
r = -1;
}
}
instance.setDataAtCell(setData, null, null, source || 'populateFromArray');
break;
}
},
/**
* Returns the top left (TL) and bottom right (BR) selection coordinates
* @param {Object[]} coordsArr
* @returns {Object}
*/
getCornerCoords: function (coordsArr) {
function mapProp(func, array, prop) {
function getProp(el) {
return el[prop];
}
if (Array.prototype.map) {
return func.apply(Math, array.map(getProp));
}
return func.apply(Math, $.map(array, getProp));
}
return {
TL: {
row: mapProp(Math.min, coordsArr, "row"),
col: mapProp(Math.min, coordsArr, "col")
},
BR: {
row: mapProp(Math.max, coordsArr, "row"),
col: mapProp(Math.max, coordsArr, "col")
}
};
},
/**
* Returns array of td objects given start and end coordinates
*/
getCellsAtCoords: function (start, end) {
var corners = grid.getCornerCoords([start, end]);
var r, c, output = [];
for (r = corners.TL.row; r <= corners.BR.row; r++) {
for (c = corners.TL.col; c <= corners.BR.col; c++) {
output.push(instance.view.getCellAtCoords({
row: r,
col: c
}));
}
}
return output;
}
};
this.selection = selection = { //this public assignment is only temporary
inProgress: false,
/**
* Sets inProgress to true. This enables onSelectionEnd and onSelectionEndByProp to function as desired
*/
begin: function () {
instance.selection.inProgress = true;
},
/**
* Sets inProgress to false. Triggers onSelectionEnd and onSelectionEndByProp
*/
finish: function () {
var sel = instance.getSelected();
instance.PluginHooks.run("afterSelectionEnd", sel[0], sel[1], sel[2], sel[3]);
instance.PluginHooks.run("afterSelectionEndByProp", sel[0], instance.colToProp(sel[1]), sel[2], instance.colToProp(sel[3]));
instance.selection.inProgress = false;
},
isInProgress: function () {
return instance.selection.inProgress;
},
/**
* Starts selection range on given td object
* @param {Object} coords
*/
setRangeStart: function (coords) {
priv.selStart.coords(coords);
selection.setRangeEnd(coords);
},
/**
* Ends selection range on given td object
* @param {Object} coords
* @param {Boolean} [scrollToCell=true] If true, viewport will be scrolled to range end
*/
setRangeEnd: function (coords, scrollToCell) {
instance.selection.begin();
priv.selEnd.coords(coords);
if (!priv.settings.multiSelect) {
priv.selStart.coords(coords);
}
//set up current selection
instance.view.wt.selections.current.clear();
instance.view.wt.selections.current.add(priv.selStart.arr());
//set up area selection
instance.view.wt.selections.area.clear();
if (selection.isMultiple()) {
instance.view.wt.selections.area.add(priv.selStart.arr());
instance.view.wt.selections.area.add(priv.selEnd.arr());
}
//set up highlight
if (priv.settings.currentRowClassName || priv.settings.currentColClassName) {
instance.view.wt.selections.highlight.clear();
instance.view.wt.selections.highlight.add(priv.selStart.arr());
instance.view.wt.selections.highlight.add(priv.selEnd.arr());
}
//trigger handlers
instance.PluginHooks.run("afterSelection", priv.selStart.row(), priv.selStart.col(), priv.selEnd.row(), priv.selEnd.col());
instance.PluginHooks.run("afterSelectionByProp", priv.selStart.row(), datamap.colToProp(priv.selStart.col()), priv.selEnd.row(), datamap.colToProp(priv.selEnd.col()));
if (scrollToCell !== false) {
instance.view.scrollViewport(coords);
}
selection.refreshBorders();
},
/**
* Destroys editor, redraws borders around cells, prepares editor
* @param {Boolean} revertOriginal
* @param {Boolean} keepEditor
*/
refreshBorders: function (revertOriginal, keepEditor) {
if (!keepEditor) {
editorManager.destroyEditor(revertOriginal);
}
instance.view.render();
if (selection.isSelected() && !keepEditor) {
editorManager.prepareEditor();
}
},
/**
* Returns information if we have a multiselection
* @return {Boolean}
*/
isMultiple: function () {
return !(priv.selEnd.col() === priv.selStart.col() && priv.selEnd.row() === priv.selStart.row());
},
/**
* Selects cell relative to current cell (if possible)
*/
transformStart: function (rowDelta, colDelta, force) {
if (priv.selStart.row() + rowDelta > instance.countRows() - 1) {
if (force && priv.settings.minSpareRows > 0) {
instance.alter("insert_row", instance.countRows());
}
else if (priv.settings.autoWrapCol) {
rowDelta = 1 - instance.countRows();
colDelta = priv.selStart.col() + colDelta == instance.countCols() - 1 ? 1 - instance.countCols() : 1;
}
}
else if (priv.settings.autoWrapCol && priv.selStart.row() + rowDelta < 0 && priv.selStart.col() + colDelta >= 0) {
rowDelta = instance.countRows() - 1;
colDelta = priv.selStart.col() + colDelta == 0 ? instance.countCols() - 1 : -1;
}
if (priv.selStart.col() + colDelta > instance.countCols() - 1) {
if (force && priv.settings.minSpareCols > 0) {
instance.alter("insert_col", instance.countCols());
}
else if (priv.settings.autoWrapRow) {
rowDelta = priv.selStart.row() + rowDelta == instance.countRows() - 1 ? 1 - instance.countRows() : 1;
colDelta = 1 - instance.countCols();
}
}
else if (priv.settings.autoWrapRow && priv.selStart.col() + colDelta < 0 && priv.selStart.row() + rowDelta >= 0) {
rowDelta = priv.selStart.row() + rowDelta == 0 ? instance.countRows() - 1 : -1;
colDelta = instance.countCols() - 1;
}
var totalRows = instance.countRows();
var totalCols = instance.countCols();
var coords = {
row: priv.selStart.row() + rowDelta,
col: priv.selStart.col() + colDelta
};
if (coords.row < 0) {
coords.row = 0;
}
else if (coords.row > 0 && coords.row >= totalRows) {
coords.row = totalRows - 1;
}
if (coords.col < 0) {
coords.col = 0;
}
else if (coords.col > 0 && coords.col >= totalCols) {
coords.col = totalCols - 1;
}
selection.setRangeStart(coords);
},
/**
* Sets selection end cell relative to current selection end cell (if possible)
*/
transformEnd: function (rowDelta, colDelta) {
if (priv.selEnd.exists()) {
var totalRows = instance.countRows();
var totalCols = instance.countCols();
var coords = {
row: priv.selEnd.row() + rowDelta,
col: priv.selEnd.col() + colDelta
};
if (coords.row < 0) {
coords.row = 0;
}
else if (coords.row > 0 && coords.row >= totalRows) {
coords.row = totalRows - 1;
}
if (coords.col < 0) {
coords.col = 0;
}
else if (coords.col > 0 && coords.col >= totalCols) {
coords.col = totalCols - 1;
}
selection.setRangeEnd(coords);
}
},
/**
* Returns true if currently there is a selection on screen, false otherwise
* @return {Boolean}
*/
isSelected: function () {
return priv.selEnd.exists();
},
/**
* Returns true if coords is within current selection coords
* @return {Boolean}
*/
inInSelection: function (coords) {
if (!selection.isSelected()) {
return false;
}
var sel = grid.getCornerCoords([priv.selStart.coords(), priv.selEnd.coords()]);
return (sel.TL.row <= coords.row && sel.BR.row >= coords.row && sel.TL.col <= coords.col && sel.BR.col >= coords.col);
},
/**
* Deselects all selected cells
*/
deselect: function () {
if (!selection.isSelected()) {
return;
}
instance.selection.inProgress = false; //needed by HT inception
priv.selEnd = new Handsontable.SelectionPoint(); //create new empty point to remove the existing one
instance.view.wt.selections.current.clear();
instance.view.wt.selections.area.clear();
editorManager.destroyEditor();
selection.refreshBorders();
instance.PluginHooks.run('afterDeselect');
},
/**
* Select all cells
*/
selectAll: function () {
if (!priv.settings.multiSelect) {
return;
}
selection.setRangeStart({
row: 0,
col: 0
});
selection.setRangeEnd({
row: instance.countRows() - 1,
col: instance.countCols() - 1
}, false);
},
/**
* Deletes data from selected cells
*/
empty: function () {
if (!selection.isSelected()) {
return;
}
var corners = grid.getCornerCoords([priv.selStart.coords(), priv.selEnd.coords()]);
var r, c, changes = [];
for (r = corners.TL.row; r <= corners.BR.row; r++) {
for (c = corners.TL.col; c <= corners.BR.col; c++) {
if (!instance.getCellMeta(r, c).readOnly) {
changes.push([r, c, '']);
}
}
}
instance.setDataAtCell(changes);
}
};
this.autofill = autofill = { //this public assignment is only temporary
handle: null,
/**
* Create fill handle and fill border objects
*/
init: function () {
if (!autofill.handle) {
autofill.handle = {};
}
else {
autofill.handle.disabled = false;
}
},
/**
* Hide fill handle and fill border permanently
*/
disable: function () {
autofill.handle.disabled = true;
},
/**
* Selects cells down to the last row in the left column, then fills down to that cell
*/
selectAdjacent: function () {
var select, data, r, maxR, c;
if (selection.isMultiple()) {
select = instance.view.wt.selections.area.getCorners();
}
else {
select = instance.view.wt.selections.current.getCorners();
}
data = datamap.getAll();
rows : for (r = select[2] + 1; r < instance.countRows(); r++) {
for (c = select[1]; c <= select[3]; c++) {
if (data[r][c]) {
break rows;
}
}
if (!!data[r][select[1] - 1] || !!data[r][select[3] + 1]) {
maxR = r;
}
}
if (maxR) {
instance.view.wt.selections.fill.clear();
instance.view.wt.selections.fill.add([select[0], select[1]]);
instance.view.wt.selections.fill.add([maxR, select[3]]);
autofill.apply();
}
},
/**
* Apply fill values to the area in fill border, omitting the selection border
*/
apply: function () {
var drag, select, start, end, _data;
autofill.handle.isDragged = 0;
drag = instance.view.wt.selections.fill.getCorners();
if (!drag) {
return;
}
instance.view.wt.selections.fill.clear();
if (selection.isMultiple()) {
select = instance.view.wt.selections.area.getCorners();
}
else {
select = instance.view.wt.selections.current.getCorners();
}
if (drag[0] === select[0] && drag[1] < select[1]) {
start = {
row: drag[0],
col: drag[1]
};
end = {
row: drag[2],
col: select[1] - 1
};
}
else if (drag[0] === select[0] && drag[3] > select[3]) {
start = {
row: drag[0],
col: select[3] + 1
};
end = {
row: drag[2],
col: drag[3]
};
}
else if (drag[0] < select[0] && drag[1] === select[1]) {
start = {
row: drag[0],
col: drag[1]
};
end = {
row: select[0] - 1,
col: drag[3]
};
}
else if (drag[2] > select[2] && drag[1] === select[1]) {
start = {
row: select[2] + 1,
col: drag[1]
};
end = {
row: drag[2],
col: drag[3]
};
}
if (start) {
_data = SheetClip.parse(datamap.getText(priv.selStart.coords(), priv.selEnd.coords()));
instance.PluginHooks.run('beforeAutofill', start, end, _data);
grid.populateFromArray(start, _data, end, 'autofill');
selection.setRangeStart({row: drag[0], col: drag[1]});
selection.setRangeEnd({row: drag[2], col: drag[3]});
}
/*else {
//reset to avoid some range bug
selection.refreshBorders();
}*/
},
/**
* Show fill border
*/
showBorder: function (coords) {
coords.row = coords[0];
coords.col = coords[1];
var corners = grid.getCornerCoords([priv.selStart.coords(), priv.selEnd.coords()]);
if (priv.settings.fillHandle !== 'horizontal' && (corners.BR.row < coords.row || corners.TL.row > coords.row)) {
coords = [coords.row, corners.BR.col];
}
else if (priv.settings.fillHandle !== 'vertical') {
coords = [corners.BR.row, coords.col];
}
else {
return; //wrong direction
}
instance.view.wt.selections.fill.clear();
instance.view.wt.selections.fill.add([priv.selStart.coords().row, priv.selStart.coords().col]);
instance.view.wt.selections.fill.add([priv.selEnd.coords().row, priv.selEnd.coords().col]);
instance.view.wt.selections.fill.add(coords);
instance.view.render();
}
};
this.init = function () {
instance.PluginHooks.run('beforeInit');
this.view = new Handsontable.TableView(this);
editorManager = new Handsontable.EditorManager(instance, priv, selection, datamap);
this.updateSettings(priv.settings, true);
this.parseSettingsFromDOM();
this.forceFullRender = true; //used when data was changed
this.view.render();
if (typeof priv.firstRun === 'object') {
instance.PluginHooks.run('afterChange', priv.firstRun[0], priv.firstRun[1]);
priv.firstRun = false;
}
instance.PluginHooks.run('afterInit');
};
function ValidatorsQueue() { //moved this one level up so it can be used in any function here. Probably this should be moved to a separate file
var resolved = false;
return {
validatorsInQueue: 0,
addValidatorToQueue: function () {
this.validatorsInQueue++;
resolved = false;
},
removeValidatorFormQueue: function () {
this.validatorsInQueue = this.validatorsInQueue - 1 < 0 ? 0 : this.validatorsInQueue - 1;
this.checkIfQueueIsEmpty();
},
onQueueEmpty: function () {
},
checkIfQueueIsEmpty: function () {
if (this.validatorsInQueue == 0 && resolved == false) {
resolved = true;
this.onQueueEmpty();
}
}
};
}
function validateChanges(changes, source, callback) {
var waitingForValidator = new ValidatorsQueue();
waitingForValidator.onQueueEmpty = resolve;
for (var i = changes.length - 1; i >= 0; i--) {
if (changes[i] === null) {
changes.splice(i, 1);
}
else {
var row = changes[i][0];
var col = datamap.propToCol(changes[i][1]);
var logicalCol = instance.runHooksAndReturn('modifyCol', col); //column order may have changes, so we need to translate physical col index (stored in datasource) to logical (displayed to user)
var cellProperties = instance.getCellMeta(row, logicalCol);
if (cellProperties.type === 'numeric' && typeof changes[i][3] === 'string') {
if (changes[i][3].length > 0 && /^-?[\d\s]*\.?\d*$/.test(changes[i][3])) {
changes[i][3] = numeral().unformat(changes[i][3] || '0'); //numeral cannot unformat empty string
}
}
if (instance.getCellValidator(cellProperties)) {
waitingForValidator.addValidatorToQueue();
instance.validateCell(changes[i][3], cellProperties, (function (i, cellProperties) {
return function (result) {
if (typeof result !== 'boolean') {
throw new Error("Validation error: result is not boolean");
}
if (result === false && cellProperties.allowInvalid === false) {
changes.splice(i, 1); // cancel the change
cellProperties.valid = true; // we cancelled the change, so cell value is still valid
--i;
}
waitingForValidator.removeValidatorFormQueue();
}
})(i, cellProperties)
, source);
}
}
}
waitingForValidator.checkIfQueueIsEmpty();
function resolve() {
var beforeChangeResult;
if (changes.length) {
beforeChangeResult = instance.PluginHooks.execute("beforeChange", changes, source);
if (typeof beforeChangeResult === 'function') {
$.when(result).then(function () {
callback(); //called when async validators and async beforeChange are resolved
});
}
else if (beforeChangeResult === false) {
changes.splice(0, changes.length); //invalidate all changes (remove everything from array)
}
}
if (typeof beforeChangeResult !== 'function') {
callback(); //called when async validators are resolved and beforeChange was not async
}
}
}
/**
* Internal function to apply changes. Called after validateChanges
* @param {Array} changes Array in form of [row, prop, oldValue, newValue]
* @param {String} source String that identifies how this change will be described in changes array (useful in onChange callback)
*/
function applyChanges(changes, source) {
var i = changes.length - 1;
if (i < 0) {
return;
}
for (; 0 <= i; i--) {
if (changes[i] === null) {
changes.splice(i, 1);
continue;
}
if (priv.settings.minSpareRows) {
while (changes[i][0] > instance.countRows() - 1) {
datamap.createRow();
}
}
if (instance.dataType === 'array' && priv.settings.minSpareCols) {
while (datamap.propToCol(changes[i][1]) > instance.countCols() - 1) {
datamap.createCol();
}
}
datamap.set(changes[i][0], changes[i][1], changes[i][3]);
}
instance.forceFullRender = true; //used when data was changed
grid.adjustRowsAndCols();
selection.refreshBorders(null, true);
instance.PluginHooks.run('afterChange', changes, source || 'edit');
}
this.validateCell = function (value, cellProperties, callback, source) {
var validator = instance.getCellValidator(cellProperties);
if (Object.prototype.toString.call(validator) === '[object RegExp]') {
validator = (function (validator) {
return function (value, callback) {
callback(validator.test(value));
}
})(validator);
}
if (typeof validator == 'function') {
value = instance.PluginHooks.execute("beforeValidate", value, cellProperties.row, cellProperties.prop, source);
// To provide consistent behaviour, validation should be always asynchronous
setTimeout(function () {
validator.call(cellProperties, value, function (valid) {
cellProperties.valid = valid;
valid = instance.PluginHooks.execute("afterValidate", valid, value, cellProperties.row, cellProperties.prop, source);
callback(valid);
});
});
} else { //resolve callback even if validator function was not found
cellProperties.valid = true;
callback(true);
}
};
function setDataInputToArray(row, prop_or_col, value) {
if (typeof row === "object") { //is it an array of changes
return row;
}
else if ($.isPlainObject(value)) { //backwards compatibility
return value;
}
else {
return [
[row, prop_or_col, value]
];
}
}
/**
* Set data at given cell
* @public
* @param {Number|Array} row or array of changes in format [[row, col, value], ...]
* @param {Number|String} col or source String
* @param {String} value
* @param {String} source String that identifies how this change will be described in changes array (useful in onChange callback)
*/
this.setDataAtCell = function (row, col, value, source) {
var input = setDataInputToArray(row, col, value)
, i
, ilen
, changes = []
, prop;
for (i = 0, ilen = input.length; i < ilen; i++) {
if (typeof input[i] !== 'object') {
throw new Error('Method `setDataAtCell` accepts row number or changes array of arrays as its first parameter');
}
if (typeof input[i][1] !== 'number') {
throw new Error('Method `setDataAtCell` accepts row and column number as its parameters. If you want to use object property name, use method `setDataAtRowProp`');
}
prop = datamap.colToProp(input[i][1]);
changes.push([
input[i][0],
prop,
datamap.get(input[i][0], prop),
input[i][2]
]);
}
if (!source && typeof row === "object") {
source = col;
}
validateChanges(changes, source, function () {
applyChanges(changes, source);
});
};
/**
* Set data at given row property
* @public
* @param {Number|Array} row or array of changes in format [[row, prop, value], ...]
* @param {String} prop or source String
* @param {String} value
* @param {String} source String that identifies how this change will be described in changes array (useful in onChange callback)
*/
this.setDataAtRowProp = function (row, prop, value, source) {
var input = setDataInputToArray(row, prop, value)
, i
, ilen
, changes = [];
for (i = 0, ilen = input.length; i < ilen; i++) {
changes.push([
input[i][0],
input[i][1],
datamap.get(input[i][0], input[i][1]),
input[i][2]
]);
}
if (!source && typeof row === "object") {
source = prop;
}
validateChanges(changes, source, function () {
applyChanges(changes, source);
});
};
/**
* Listen to document body keyboard input
*/
this.listen = function () {
Handsontable.activeGuid = instance.guid;
if (document.activeElement && document.activeElement !== document.body) {
document.activeElement.blur();
}
else if (!document.activeElement) { //IE
document.body.focus();
}
};
/**
* Stop listening to document body keyboard input
*/
this.unlisten = function () {
Handsontable.activeGuid = null;
};
/**
* Returns true if current Handsontable instance is listening on document body keyboard input
*/
this.isListening = function () {
return Handsontable.activeGuid === instance.guid;
};
/**
* Destroys current editor, renders and selects current cell. If revertOriginal != true, edited data is saved
* @param {Boolean} revertOriginal
*/
this.destroyEditor = function (revertOriginal) {
selection.refreshBorders(revertOriginal);
};
/**
* Populate cells at position with 2d array
* @param {Number} row Start row
* @param {Number} col Start column
* @param {Array} input 2d array
* @param {Number=} endRow End row (use when you want to cut input when certain row is reached)
* @param {Number=} endCol End column (use when you want to cut input when certain column is reached)
* @param {String=} [source="populateFromArray"]
* @param {String=} [method="overwrite"]
* @return {Object|undefined} ending td in pasted area (only if any cell was changed)
*/
this.populateFromArray = function (row, col, input, endRow, endCol, source, method) {
if (!(typeof input === 'object' && typeof input[0] === 'object')) {
throw new Error("populateFromArray parameter `input` must be an array of arrays"); //API changed in 0.9-beta2, let's check if you use it correctly
}
return grid.populateFromArray({row: row, col: col}, input, typeof endRow === 'number' ? {row: endRow, col: endCol} : null, source, method);
};
/**
* Adds/removes data from the column
* @param {Number} col Index of column in which do you want to do splice.
* @param {Number} index Index at which to start changing the array. If negative, will begin that many elements from the end
* @param {Number} amount An integer indicating the number of old array elements to remove. If amount is 0, no elements are removed
* param {...*} elements Optional. The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array
*/
this.spliceCol = function (col, index, amount/*, elements... */) {
return datamap.spliceCol.apply(datamap, arguments);
};
/**
* Adds/removes data from the row
* @param {Number} row Index of column in which do you want to do splice.
* @param {Number} index Index at which to start changing the array. If negative, will begin that many elements from the end
* @param {Number} amount An integer indicating the number of old array elements to remove. If amount is 0, no elements are removed
* param {...*} elements Optional. The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array
*/
this.spliceRow = function (row, index, amount/*, elements... */) {
return datamap.spliceRow.apply(datamap, arguments);
};
/**
* Returns the top left (TL) and bottom right (BR) selection coordinates
* @param {Object[]} coordsArr
* @returns {Object}
*/
this.getCornerCoords = function (coordsArr) {
return grid.getCornerCoords(coordsArr);
};
/**
* Returns current selection. Returns undefined if there is no selection.
* @public
* @return {Array} [`startRow`, `startCol`, `endRow`, `endCol`]
*/
this.getSelected = function () { //https://github.com/warpech/jquery-handsontable/issues/44 //cjl
if (selection.isSelected()) {
return [priv.selStart.row(), priv.selStart.col(), priv.selEnd.row(), priv.selEnd.col()];
}
};
/**
* Parse settings from DOM and CSS
* @public
*/
this.parseSettingsFromDOM = function () {
var overflow = this.rootElement.css('overflow');
if (overflow === 'scroll' || overflow === 'auto') {
this.rootElement[0].style.overflow = 'visible';
priv.settingsFromDOM.overflow = overflow;
}
else if (priv.settings.width === void 0 || priv.settings.height === void 0) {
priv.settingsFromDOM.overflow = 'auto';
}
if (priv.settings.width === void 0) {
priv.settingsFromDOM.width = this.rootElement.width();
}
else {
priv.settingsFromDOM.width = void 0;
}
priv.settingsFromDOM.height = void 0;
if (priv.settings.height === void 0) {
if (priv.settingsFromDOM.overflow === 'scroll' || priv.settingsFromDOM.overflow === 'auto') {
//this needs to read only CSS/inline style and not actual height
//so we need to call getComputedStyle on cloned container
var clone = this.rootElement[0].cloneNode(false);
var parent = this.rootElement[0].parentNode;
if (parent) {
clone.removeAttribute('id');
parent.appendChild(clone);
var computedHeight = parseInt(window.getComputedStyle(clone, null).getPropertyValue('height'), 10);
if(isNaN(computedHeight) && clone.currentStyle){
computedHeight = parseInt(clone.currentStyle.height, 10)
}
if (computedHeight > 0) {
priv.settingsFromDOM.height = computedHeight;
}
parent.removeChild(clone);
}
}
}
};
/**
* Render visible data
* @public
*/
this.render = function () {
if (instance.view) {
instance.forceFullRender = true; //used when data was changed
instance.parseSettingsFromDOM();
selection.refreshBorders(null, true);
}
};
/**
* Load data from array
* @public
* @param {Array} data
*/
this.loadData = function (data) {
if (typeof data === 'object' && data !== null) {
if (!(data.push && data.splice)) { //check if data is array. Must use duck-type check so Backbone Collections also pass it
//when data is not an array, attempt to make a single-row array of it
data = [data];
}
}
else if(data === null) {
data = [];
var row;
for (var r = 0, rlen = priv.settings.startRows; r < rlen; r++) {
row = [];
for (var c = 0, clen = priv.settings.startCols; c < clen; c++) {
row.push(null);
}
data.push(row);
}
}
else {
throw new Error("loadData only accepts array of objects or array of arrays (" + typeof data + " given)");
}
priv.isPopulated = false;
GridSettings.prototype.data = data;
if (priv.settings.dataSchema instanceof Array || data[0] instanceof Array) {
instance.dataType = 'array';
}
else if (typeof priv.settings.dataSchema === 'function') {
instance.dataType = 'function';
}
else {
instance.dataType = 'object';
}
datamap = new Handsontable.DataMap(instance, priv, GridSettings);
clearCellSettingCache();
grid.adjustRowsAndCols();
instance.PluginHooks.run('afterLoadData');
if (priv.firstRun) {
priv.firstRun = [null, 'loadData'];
}
else {
instance.PluginHooks.run('afterChange', null, 'loadData');
instance.render();
}
priv.isPopulated = true;
function clearCellSettingCache() {
priv.cellSettings.length = 0;
}
};
/**
* Return the current data object (the same that was passed by `data` configuration option or `loadData` method). Optionally you can provide cell range `r`, `c`, `r2`, `c2` to get only a fragment of grid data
* @public
* @param {Number} r (Optional) From row
* @param {Number} c (Optional) From col
* @param {Number} r2 (Optional) To row
* @param {Number} c2 (Optional) To col
* @return {Array|Object}
*/
this.getData = function (r, c, r2, c2) {
if (typeof r === 'undefined') {
return datamap.getAll();
}
else {
return datamap.getRange({row: r, col: c}, {row: r2, col: c2}, datamap.DESTINATION_RENDERER);
}
};
this.getCopyableData = function (startRow, startCol, endRow, endCol) {
return datamap.getCopyableText({row: startRow, col: startCol}, {row: endRow, col: endCol});
}
/**
* Update settings
* @public
*/
this.updateSettings = function (settings, init) {
var i, clen;
if (typeof settings.rows !== "undefined") {
throw new Error("'rows' setting is no longer supported. do you mean startRows, minRows or maxRows?");
}
if (typeof settings.cols !== "undefined") {
throw new Error("'cols' setting is no longer supported. do you mean startCols, minCols or maxCols?");
}
for (i in settings) {
if (i === 'data') {
continue; //loadData will be triggered later
}
else {
if (instance.PluginHooks.hooks[i] !== void 0 || instance.PluginHooks.legacy[i] !== void 0) {
if (typeof settings[i] === 'function' || Handsontable.helper.isArray(settings[i])) {
instance.PluginHooks.add(i, settings[i]);
}
}
else {
// Update settings
if (!init && settings.hasOwnProperty(i)) {
GridSettings.prototype[i] = settings[i];
}
//launch extensions
if (Handsontable.extension[i]) {
priv.extensions[i] = new Handsontable.extension[i](instance, settings[i]);
}
}
}
}
// Load data or create data map
if (settings.data === void 0 && priv.settings.data === void 0) {
instance.loadData(null); //data source created just now
}
else if (settings.data !== void 0) {
instance.loadData(settings.data); //data source given as option
}
else if (settings.columns !== void 0) {
datamap.createMap();
}
// Init columns constructors configuration
clen = instance.countCols();
//Clear cellSettings cache
priv.cellSettings.length = 0;
if (clen > 0) {
var proto, column;
for (i = 0; i < clen; i++) {
priv.columnSettings[i] = Handsontable.helper.columnFactory(GridSettings, priv.columnsSettingConflicts);
// shortcut for prototype
proto = priv.columnSettings[i].prototype;
// Use settings provided by user
if (GridSettings.prototype.columns) {
column = GridSettings.prototype.columns[i];
Handsontable.helper.extend(proto, column);
Handsontable.helper.extend(proto, expandType(column));
}
}
}
if (typeof settings.fillHandle !== "undefined") {
if (autofill.handle && settings.fillHandle === false) {
autofill.disable();
}
else if (!autofill.handle && settings.fillHandle !== false) {
autofill.init();
}
}
if (typeof settings.className !== "undefined") {
if (GridSettings.prototype.className) {
instance.rootElement.removeClass(GridSettings.prototype.className);
}
if (settings.className) {
instance.rootElement.addClass(settings.className);
}
}
if (!init) {
instance.PluginHooks.run('afterUpdateSettings');
}
grid.adjustRowsAndCols();
if (instance.view && !priv.firstRun) {
instance.forceFullRender = true; //used when data was changed
selection.refreshBorders(null, true);
}
};
this.getValue = function () {
var sel = instance.getSelected();
if (GridSettings.prototype.getValue) {
if (typeof GridSettings.prototype.getValue === 'function') {
return GridSettings.prototype.getValue.call(instance);
}
else if (sel) {
return instance.getData()[sel[0]][GridSettings.prototype.getValue];
}
}
else if (sel) {
return instance.getDataAtCell(sel[0], sel[1]);
}
};
function expandType(obj) {
if (!obj.hasOwnProperty('type')) return; //ignore obj.prototype.type
var type, expandedType = {};
if (typeof obj.type === 'object') {
type = obj.type;
}
else if (typeof obj.type === 'string') {
type = Handsontable.cellTypes[obj.type];
if (type === void 0) {
throw new Error('You declared cell type "' + obj.type + '" as a string that is not mapped to a known object. Cell type must be an object or a string mapped to an object in Handsontable.cellTypes');
}
}
for (var i in type) {
if (type.hasOwnProperty(i) && !obj.hasOwnProperty(i)) {
expandedType[i] = type[i];
}
}
return expandedType;
}
/**
* Returns current settings object
* @return {Object}
*/
this.getSettings = function () {
return priv.settings;
};
/**
* Returns current settingsFromDOM object
* @return {Object}
*/
this.getSettingsFromDOM = function () {
return priv.settingsFromDOM;
};
/**
* Clears grid
* @public
*/
this.clear = function () {
selection.selectAll();
selection.empty();
};
/**
* Inserts or removes rows and columns
* @param {String} action See grid.alter for possible values
* @param {Number} index
* @param {Number} amount
* @param {String} [source] Optional. Source of hook runner.
* @param {Boolean} [keepEmptyRows] Optional. Flag for preventing deletion of empty rows.
* @public
*/
this.alter = function (action, index, amount, source, keepEmptyRows) {
grid.alter(action, index, amount, source, keepEmptyRows);
};
/**
* Returns <td> element corresponding to params row, col
* @param {Number} row
* @param {Number} col
* @public
* @return {Element}
*/
this.getCell = function (row, col) {
return instance.view.getCellAtCoords({row: row, col: col});
};
/**
* Returns property name associated with column number
* @param {Number} col
* @public
* @return {String}
*/
this.colToProp = function (col) {
return datamap.colToProp(col);
};
/**
* Returns column number associated with property name
* @param {String} prop
* @public
* @return {Number}
*/
this.propToCol = function (prop) {
return datamap.propToCol(prop);
};
/**
* Return value at `row`, `col`
* @param {Number} row
* @param {Number} col
* @public
* @return value (mixed data type)
*/
this.getDataAtCell = function (row, col) {
return datamap.get(row, datamap.colToProp(col));
};
/**
* Return value at `row`, `prop`
* @param {Number} row
* @param {String} prop
* @public
* @return value (mixed data type)
*/
this.getDataAtRowProp = function (row, prop) {
return datamap.get(row, prop);
};
/**
* Return value at `col`
* @param {Number} col
* @public
* @return value (mixed data type)
*/
this.getDataAtCol = function (col) {
return [].concat.apply([], datamap.getRange({row: 0, col: col}, {row: priv.settings.data.length - 1, col: col}, datamap.DESTINATION_RENDERER));
};
/**
* Return value at `prop`
* @param {String} prop
* @public
* @return value (mixed data type)
*/
this.getDataAtProp = function (prop) {
return [].concat.apply([], datamap.getRange({row: 0, col: datamap.propToCol(prop)}, {row: priv.settings.data.length - 1, col: datamap.propToCol(prop)}, datamap.DESTINATION_RENDERER));
};
/**
* Return value at `row`
* @param {Number} row
* @public
* @return value (mixed data type)
*/
this.getDataAtRow = function (row) {
return priv.settings.data[row];
};
/**
* Returns cell meta data object corresponding to params row, col
* @param {Number} row
* @param {Number} col
* @public
* @return {Object}
*/
this.getCellMeta = function (row, col) {
var prop = datamap.colToProp(col)
, cellProperties;
row = translateRowIndex(row);
col = translateColIndex(col);
if ("undefined" === typeof priv.columnSettings[col]) {
priv.columnSettings[col] = Handsontable.helper.columnFactory(GridSettings, priv.columnsSettingConflicts);
}
if (!priv.cellSettings[row]) {
priv.cellSettings[row] = [];
}
if (!priv.cellSettings[row][col]) {
priv.cellSettings[row][col] = new priv.columnSettings[col]();
}
cellProperties = priv.cellSettings[row][col]; //retrieve cellProperties from cache
cellProperties.row = row;
cellProperties.col = col;
cellProperties.prop = prop;
cellProperties.instance = instance;
instance.PluginHooks.run('beforeGetCellMeta', row, col, cellProperties);
Handsontable.helper.extend(cellProperties, expandType(cellProperties)); //for `type` added in beforeGetCellMeta
if (cellProperties.cells) {
var settings = cellProperties.cells.call(cellProperties, row, col, prop);
if (settings) {
Handsontable.helper.extend(cellProperties, settings);
Handsontable.helper.extend(cellProperties, expandType(settings)); //for `type` added in cells
}
}
instance.PluginHooks.run('afterGetCellMeta', row, col, cellProperties);
return cellProperties;
/**
* If displayed rows order is different than the order of rows stored in memory (i.e. sorting is applied)
* we need to translate logical (stored) row index to physical (displayed) index.
* @param row - original row index
* @returns {int} translated row index
*/
function translateRowIndex(row){
var getVars = {row: row};
instance.PluginHooks.execute('beforeGet', getVars);
return getVars.row;
}
/**
* If displayed columns order is different than the order of columns stored in memory (i.e. column were moved using manualColumnMove plugin)
* we need to translate logical (stored) column index to physical (displayed) index.
* @param col - original column index
* @returns {int} - translated column index
*/
function translateColIndex(col){
return Handsontable.PluginHooks.execute(instance, 'modifyCol', col); // warning: this must be done after datamap.colToProp
}
};
var rendererLookup = Handsontable.helper.cellMethodLookupFactory('renderer');
this.getCellRenderer = function (row, col) {
var renderer = rendererLookup.call(this, row, col);
return Handsontable.renderers.getRenderer(renderer);
};
this.getCellEditor = Handsontable.helper.cellMethodLookupFactory('editor');
this.getCellValidator = Handsontable.helper.cellMethodLookupFactory('validator');
/**
* Validates all cells using their validator functions and calls callback when finished. Does not render the view
* @param callback
*/
this.validateCells = function (callback) {
var waitingForValidator = new ValidatorsQueue();
waitingForValidator.onQueueEmpty = callback;
var i = instance.countRows() - 1;
while (i >= 0) {
var j = instance.countCols() - 1;
while (j >= 0) {
waitingForValidator.addValidatorToQueue();
instance.validateCell(instance.getDataAtCell(i, j), instance.getCellMeta(i, j), function () {
waitingForValidator.removeValidatorFormQueue();
}, 'validateCells');
j--;
}
i--;
}
waitingForValidator.checkIfQueueIsEmpty();
};
/**
* Return array of row headers (if they are enabled). If param `row` given, return header at given row as string
* @param {Number} row (Optional)
* @return {Array|String}
*/
this.getRowHeader = function (row) {
if (row === void 0) {
var out = [];
for (var i = 0, ilen = instance.countRows(); i < ilen; i++) {
out.push(instance.getRowHeader(i));
}
return out;
}
else if (Object.prototype.toString.call(priv.settings.rowHeaders) === '[object Array]' && priv.settings.rowHeaders[row] !== void 0) {
return priv.settings.rowHeaders[row];
}
else if (typeof priv.settings.rowHeaders === 'function') {
return priv.settings.rowHeaders(row);
}
else if (priv.settings.rowHeaders && typeof priv.settings.rowHeaders !== 'string' && typeof priv.settings.rowHeaders !== 'number') {
return row + 1;
}
else {
return priv.settings.rowHeaders;
}
};
/**
* Returns information of this table is configured to display row headers
* @returns {boolean}
*/
this.hasRowHeaders = function () {
return !!priv.settings.rowHeaders;
};
/**
* Returns information of this table is configured to display column headers
* @returns {boolean}
*/
this.hasColHeaders = function () {
if (priv.settings.colHeaders !== void 0 && priv.settings.colHeaders !== null) { //Polymer has empty value = null
return !!priv.settings.colHeaders;
}
for (var i = 0, ilen = instance.countCols(); i < ilen; i++) {
if (instance.getColHeader(i)) {
return true;
}
}
return false;
};
/**
* Return array of column headers (if they are enabled). If param `col` given, return header at given column as string
* @param {Number} col (Optional)
* @return {Array|String}
*/
this.getColHeader = function (col) {
if (col === void 0) {
var out = [];
for (var i = 0, ilen = instance.countCols(); i < ilen; i++) {
out.push(instance.getColHeader(i));
}
return out;
}
else {
col = Handsontable.PluginHooks.execute(instance, 'modifyCol', col);
if (priv.settings.columns && priv.settings.columns[col] && priv.settings.columns[col].title) {
return priv.settings.columns[col].title;
}
else if (Object.prototype.toString.call(priv.settings.colHeaders) === '[object Array]' && priv.settings.colHeaders[col] !== void 0) {
return priv.settings.colHeaders[col];
}
else if (typeof priv.settings.colHeaders === 'function') {
return priv.settings.colHeaders(col);
}
else if (priv.settings.colHeaders && typeof priv.settings.colHeaders !== 'string' && typeof priv.settings.colHeaders !== 'number') {
return Handsontable.helper.spreadsheetColumnLabel(col);
}
else {
return priv.settings.colHeaders;
}
}
};
/**
* Return column width from settings (no guessing). Private use intended
* @param {Number} col
* @return {Number}
*/
this._getColWidthFromSettings = function (col) {
var cellProperties = instance.getCellMeta(0, col);
var width = cellProperties.width;
if (width === void 0 || width === priv.settings.width) {
width = cellProperties.colWidths;
}
if (width !== void 0 && width !== null) {
switch (typeof width) {
case 'object': //array
width = width[col];
break;
case 'function':
width = width(col);
break;
}
if (typeof width === 'string') {
width = parseInt(width, 10);
}
}
return width;
};
/**
* Return column width
* @param {Number} col
* @return {Number}
*/
this.getColWidth = function (col) {
col = Handsontable.PluginHooks.execute(instance, 'modifyCol', col);
var response = {
width: instance._getColWidthFromSettings(col)
};
if (!response.width) {
response.width = 50;
}
instance.PluginHooks.run('afterGetColWidth', col, response);
return response.width;
};
/**
* Return total number of rows in grid
* @return {Number}
*/
this.countRows = function () {
return priv.settings.data.length;
};
/**
* Return total number of columns in grid
* @return {Number}
*/
this.countCols = function () {
if (instance.dataType === 'object' || instance.dataType === 'function') {
if (priv.settings.columns && priv.settings.columns.length) {
return priv.settings.columns.length;
}
else {
return datamap.colToPropCache.length;
}
}
else if (instance.dataType === 'array') {
if (priv.settings.columns && priv.settings.columns.length) {
return priv.settings.columns.length;
}
else if (priv.settings.data && priv.settings.data[0] && priv.settings.data[0].length) {
return priv.settings.data[0].length;
}
else {
return 0;
}
}
};
/**
* Return index of first visible row
* @return {Number}
*/
this.rowOffset = function () {
return instance.view.wt.getSetting('offsetRow');
};
/**
* Return index of first visible column
* @return {Number}
*/
this.colOffset = function () {
return instance.view.wt.getSetting('offsetColumn');
};
/**
* Return number of visible rows. Returns -1 if table is not visible
* @return {Number}
*/
this.countVisibleRows = function () {
return instance.view.wt.drawn ? instance.view.wt.wtTable.rowStrategy.countVisible() : -1;
};
/**
* Return number of visible columns. Returns -1 if table is not visible
* @return {Number}
*/
this.countVisibleCols = function () {
return instance.view.wt.drawn ? instance.view.wt.wtTable.columnStrategy.countVisible() : -1;
};
/**
* Return number of empty rows
* @return {Boolean} ending If true, will only count empty rows at the end of the data source
*/
this.countEmptyRows = function (ending) {
var i = instance.countRows() - 1
, empty = 0;
while (i >= 0) {
datamap.get(i, 0);
if (instance.isEmptyRow(datamap.getVars.row)) {
empty++;
}
else if (ending) {
break;
}
i--;
}
return empty;
};
/**
* Return number of empty columns
* @return {Boolean} ending If true, will only count empty columns at the end of the data source row
*/
this.countEmptyCols = function (ending) {
if (instance.countRows() < 1) {
return 0;
}
var i = instance.countCols() - 1
, empty = 0;
while (i >= 0) {
if (instance.isEmptyCol(i)) {
empty++;
}
else if (ending) {
break;
}
i--;
}
return empty;
};
/**
* Return true if the row at the given index is empty, false otherwise
* @param {Number} r Row index
* @return {Boolean}
*/
this.isEmptyRow = function (r) {
return priv.settings.isEmptyRow.call(instance, r);
};
/**
* Return true if the column at the given index is empty, false otherwise
* @param {Number} c Column index
* @return {Boolean}
*/
this.isEmptyCol = function (c) {
return priv.settings.isEmptyCol.call(instance, c);
};
/**
* Selects cell on grid. Optionally selects range to another cell
* @param {Number} row
* @param {Number} col
* @param {Number} [endRow]
* @param {Number} [endCol]
* @param {Boolean} [scrollToCell=true] If true, viewport will be scrolled to the selection
* @public
* @return {Boolean}
*/
this.selectCell = function (row, col, endRow, endCol, scrollToCell) {
if (typeof row !== 'number' || row < 0 || row >= instance.countRows()) {
return false;
}
if (typeof col !== 'number' || col < 0 || col >= instance.countCols()) {
return false;
}
if (typeof endRow !== "undefined") {
if (typeof endRow !== 'number' || endRow < 0 || endRow >= instance.countRows()) {
return false;
}
if (typeof endCol !== 'number' || endCol < 0 || endCol >= instance.countCols()) {
return false;
}
}
priv.selStart.coords({row: row, col: col});
if (document.activeElement && document.activeElement !== document.documentElement && document.activeElement !== document.body) {
document.activeElement.blur(); //needed or otherwise prepare won't focus the cell. selectionSpec tests this (should move focus to selected cell)
}
instance.listen();
if (typeof endRow === "undefined") {
selection.setRangeEnd({row: row, col: col}, scrollToCell);
}
else {
selection.setRangeEnd({row: endRow, col: endCol}, scrollToCell);
}
instance.selection.finish();
return true;
};
this.selectCellByProp = function (row, prop, endRow, endProp, scrollToCell) {
arguments[1] = datamap.propToCol(arguments[1]);
if (typeof arguments[3] !== "undefined") {
arguments[3] = datamap.propToCol(arguments[3]);
}
return instance.selectCell.apply(instance, arguments);
};
/**
* Deselects current sell selection on grid
* @public
*/
this.deselectCell = function () {
selection.deselect();
};
/**
* Remove grid from DOM
* @public
*/
this.destroy = function () {
instance.clearTimeouts();
if (instance.view) { //in case HT is destroyed before initialization has finished
instance.view.wt.destroy();
}
instance.rootElement.empty();
instance.rootElement.removeData('handsontable');
instance.rootElement.off('.handsontable');
$(window).off('.' + instance.guid);
$document.off('.' + instance.guid);
$body.off('.' + instance.guid);
instance.PluginHooks.run('afterDestroy');
};
/**
* Returns active editor object
* @returns {Object}
*/
this.getActiveEditor = function(){
return editorManager.getActiveEditor();
};
/**
* Return Handsontable instance
* @public
* @return {Object}
*/
this.getInstance = function () {
return instance.rootElement.data("handsontable");
};
(function () {
// Create new instance of plugin hooks
instance.PluginHooks = new Handsontable.PluginHookClass();
// Upgrade methods to call of global PluginHooks instance
var _run = instance.PluginHooks.run
, _exe = instance.PluginHooks.execute;
instance.PluginHooks.run = function (key, p1, p2, p3, p4, p5) {
_run.call(this, instance, key, p1, p2, p3, p4, p5);
Handsontable.PluginHooks.run(instance, key, p1, p2, p3, p4, p5);
};
instance.PluginHooks.execute = function (key, p1, p2, p3, p4, p5) {
var globalHandlerResult = Handsontable.PluginHooks.execute(instance, key, p1, p2, p3, p4, p5);
var localHandlerResult = _exe.call(this, instance, key, globalHandlerResult, p2, p3, p4, p5);
return typeof localHandlerResult == 'undefined' ? globalHandlerResult : localHandlerResult;
};
// Map old API with new methods
instance.addHook = function () {
instance.PluginHooks.add.apply(instance.PluginHooks, arguments);
};
instance.addHookOnce = function () {
instance.PluginHooks.once.apply(instance.PluginHooks, arguments);
};
instance.removeHook = function () {
instance.PluginHooks.remove.apply(instance.PluginHooks, arguments);
};
instance.runHooks = function () {
instance.PluginHooks.run.apply(instance.PluginHooks, arguments);
};
instance.runHooksAndReturn = function () {
return instance.PluginHooks.execute.apply(instance.PluginHooks, arguments);
};
})();
this.timeouts = {};
/**
* Sets timeout. Purpose of this method is to clear all known timeouts when `destroy` method is called
* @public
*/
this.registerTimeout = function (key, handle, ms) {
clearTimeout(this.timeouts[key]);
this.timeouts[key] = setTimeout(handle, ms || 0);
};
/**
* Clears all known timeouts
* @public
*/
this.clearTimeouts = function () {
for (var key in this.timeouts) {
if (this.timeouts.hasOwnProperty(key)) {
clearTimeout(this.timeouts[key]);
}
}
};
/**
* Handsontable version
*/
this.version = '0.10.3'; //inserted by grunt from package.json
};
var DefaultSettings = function () {};
DefaultSettings.prototype = {
data: void 0,
width: void 0,
height: void 0,
startRows: 5,
startCols: 5,
rowHeaders: null,
colHeaders: null,
minRows: 0,
minCols: 0,
maxRows: Infinity,
maxCols: Infinity,
minSpareRows: 0,
minSpareCols: 0,
multiSelect: true,
fillHandle: true,
fixedRowsTop: 0,
fixedColumnsLeft: 0,
outsideClickDeselects: true,
enterBeginsEditing: true,
enterMoves: {row: 1, col: 0},
tabMoves: {row: 0, col: 1},
autoWrapRow: false,
autoWrapCol: false,
copyRowsLimit: 1000,
copyColsLimit: 1000,
pasteMode: 'overwrite',
currentRowClassName: void 0,
currentColClassName: void 0,
stretchH: 'hybrid',
isEmptyRow: function (r) {
var val;
for (var c = 0, clen = this.countCols(); c < clen; c++) {
val = this.getDataAtCell(r, c);
if (val !== '' && val !== null && typeof val !== 'undefined') {
return false;
}
}
return true;
},
isEmptyCol: function (c) {
var val;
for (var r = 0, rlen = this.countRows(); r < rlen; r++) {
val = this.getDataAtCell(r, c);
if (val !== '' && val !== null && typeof val !== 'undefined') {
return false;
}
}
return true;
},
observeDOMVisibility: true,
allowInvalid: true,
invalidCellClassName: 'htInvalid',
placeholderCellClassName: 'htPlaceholder',
readOnlyCellClassName: 'htDimmed',
fragmentSelection: false,
readOnly: false,
nativeScrollbars: false,
type: 'text',
copyable: true,
debug: false //shows debug overlays in Walkontable
};
Handsontable.DefaultSettings = DefaultSettings;
$.fn.handsontable = function (action) {
var i
, ilen
, args
, output
, userSettings
, $this = this.first() // Use only first element from list
, instance = $this.data('handsontable');
// Init case
if (typeof action !== 'string') {
userSettings = action || {};
if (instance) {
instance.updateSettings(userSettings);
}
else {
instance = new Handsontable.Core($this, userSettings);
$this.data('handsontable', instance);
instance.init();
}
return $this;
}
// Action case
else {
args = [];
if (arguments.length > 1) {
for (i = 1, ilen = arguments.length; i < ilen; i++) {
args.push(arguments[i]);
}
}
if (instance) {
if (typeof instance[action] !== 'undefined') {
output = instance[action].apply(instance, args);
}
else {
throw new Error('Handsontable do not provide action: ' + action);
}
}
return output;
}
};
/**
* Handsontable TableView constructor
* @param {Object} instance
*/
Handsontable.TableView = function (instance) {
var that = this
, $window = $(window)
, $documentElement = $(document.documentElement);
this.instance = instance;
this.settings = instance.getSettings();
this.settingsFromDOM = instance.getSettingsFromDOM();
instance.rootElement.data('originalStyle', instance.rootElement[0].getAttribute('style')); //needed to retrieve original style in jsFiddle link generator in HT examples. may be removed in future versions
// in IE7 getAttribute('style') returns an object instead of a string, but we only support IE8+
instance.rootElement.addClass('handsontable');
var table = document.createElement('TABLE');
table.className = 'htCore';
this.THEAD = document.createElement('THEAD');
table.appendChild(this.THEAD);
this.TBODY = document.createElement('TBODY');
table.appendChild(this.TBODY);
instance.$table = $(table);
instance.rootElement.prepend(instance.$table);
instance.rootElement.on('mousedown.handsontable', function (event) {
if (!that.isTextSelectionAllowed(event.target)) {
clearTextSelection();
event.preventDefault();
window.focus(); //make sure that window that contains HOT is active. Important when HOT is in iframe.
}
});
$documentElement.on('keyup.' + instance.guid, function (event) {
if (instance.selection.isInProgress() && !event.shiftKey) {
instance.selection.finish();
}
});
var isMouseDown;
$documentElement.on('mouseup.' + instance.guid, function (event) {
if (instance.selection.isInProgress() && event.which === 1) { //is left mouse button
instance.selection.finish();
}
isMouseDown = false;
if (instance.autofill.handle && instance.autofill.handle.isDragged) {
if (instance.autofill.handle.isDragged > 1) {
instance.autofill.apply();
}
instance.autofill.handle.isDragged = 0;
}
if (Handsontable.helper.isOutsideInput(document.activeElement)) {
instance.unlisten();
}
});
$documentElement.on('mousedown.' + instance.guid, function (event) {
var next = event.target;
if (next !== that.wt.wtTable.spreader) { //immediate click on "spreader" means click on the right side of vertical scrollbar
while (next !== document.documentElement) {
if (next === null) {
return; //click on something that was a row but now is detached (possibly because your click triggered a rerender)
}
if (next === instance.rootElement[0] || next.nodeName === 'HANDSONTABLE-TABLE') {
return; //click inside container or Web Component (HANDSONTABLE-TABLE is the name of the custom element)
}
next = next.parentNode;
}
}
if (that.settings.outsideClickDeselects) {
instance.deselectCell();
}
else {
instance.destroyEditor();
}
});
instance.rootElement.on('mousedown.handsontable', '.dragdealer', function () {
instance.destroyEditor();
});
instance.$table.on('selectstart', function (event) {
if (that.settings.fragmentSelection) {
return;
}
//https://github.com/warpech/jquery-handsontable/issues/160
//selectstart is IE only event. Prevent text from being selected when performing drag down in IE8
event.preventDefault();
});
var clearTextSelection = function () {
//http://stackoverflow.com/questions/3169786/clear-text-selection-with-javascript
if (window.getSelection) {
if (window.getSelection().empty) { // Chrome
window.getSelection().empty();
} else if (window.getSelection().removeAllRanges) { // Firefox
window.getSelection().removeAllRanges();
}
} else if (document.selection) { // IE?
document.selection.empty();
}
};
var walkontableConfig = {
debug: function () {
return that.settings.debug;
},
table: table,
stretchH: this.settings.stretchH,
data: instance.getDataAtCell,
totalRows: instance.countRows,
totalColumns: instance.countCols,
nativeScrollbars: this.settings.nativeScrollbars,
offsetRow: 0,
offsetColumn: 0,
width: this.getWidth(),
height: this.getHeight(),
fixedColumnsLeft: function () {
return that.settings.fixedColumnsLeft;
},
fixedRowsTop: function () {
return that.settings.fixedRowsTop;
},
rowHeaders: function () {
return instance.hasRowHeaders() ? [function (index, TH) {
that.appendRowHeader(index, TH);
}] : []
},
columnHeaders: function () {
return instance.hasColHeaders() ? [function (index, TH) {
that.appendColHeader(index, TH);
}] : []
},
columnWidth: instance.getColWidth,
cellRenderer: function (row, col, TD) {
var prop = that.instance.colToProp(col)
, cellProperties = that.instance.getCellMeta(row, col)
, renderer = that.instance.getCellRenderer(cellProperties);
var value = that.instance.getDataAtRowProp(row, prop);
renderer(that.instance, TD, row, col, prop, value, cellProperties);
that.instance.PluginHooks.run('afterRenderer', TD, row, col, prop, value, cellProperties);
},
selections: {
current: {
className: 'current',
border: {
width: 2,
color: '#5292F7',
style: 'solid',
cornerVisible: function () {
return that.settings.fillHandle && !that.isCellEdited() && !instance.selection.isMultiple()
}
}
},
area: {
className: 'area',
border: {
width: 1,
color: '#89AFF9',
style: 'solid',
cornerVisible: function () {
return that.settings.fillHandle && !that.isCellEdited() && instance.selection.isMultiple()
}
}
},
highlight: {
highlightRowClassName: that.settings.currentRowClassName,
highlightColumnClassName: that.settings.currentColClassName
},
fill: {
className: 'fill',
border: {
width: 1,
color: 'red',
style: 'solid'
}
}
},
hideBorderOnMouseDownOver: function () {
return that.settings.fragmentSelection;
},
onCellMouseDown: function (event, coords, TD) {
instance.listen();
isMouseDown = true;
var coordsObj = {row: coords[0], col: coords[1]};
if (event.button === 2 && instance.selection.inInSelection(coordsObj)) { //right mouse button
//do nothing
}
else if (event.shiftKey) {
instance.selection.setRangeEnd(coordsObj);
}
else {
instance.selection.setRangeStart(coordsObj);
}
instance.PluginHooks.run('afterOnCellMouseDown', event, coords, TD);
},
/*onCellMouseOut: function (/*event, coords, TD* /) {
if (isMouseDown && that.settings.fragmentSelection === 'single') {
clearTextSelection(); //otherwise text selection blinks during multiple cells selection
}
},*/
onCellMouseOver: function (event, coords, TD) {
var coordsObj = {row: coords[0], col: coords[1]};
if (isMouseDown) {
/*if (that.settings.fragmentSelection === 'single') {
clearTextSelection(); //otherwise text selection blinks during multiple cells selection
}*/
instance.selection.setRangeEnd(coordsObj);
}
else if (instance.autofill.handle && instance.autofill.handle.isDragged) {
instance.autofill.handle.isDragged++;
instance.autofill.showBorder(coords);
}
instance.PluginHooks.run('afterOnCellMouseOver', event, coords, TD);
},
onCellCornerMouseDown: function (event) {
instance.autofill.handle.isDragged = 1;
event.preventDefault();
instance.PluginHooks.run('afterOnCellCornerMouseDown', event);
},
onCellCornerDblClick: function () {
instance.autofill.selectAdjacent();
},
beforeDraw: function (force) {
that.beforeRender(force);
},
onDraw: function(force){
that.onDraw(force);
},
onScrollVertically: function () {
instance.runHooks('afterScrollVertically');
},
onScrollHorizontally: function () {
instance.runHooks('afterScrollHorizontally');
}
};
instance.PluginHooks.run('beforeInitWalkontable', walkontableConfig);
this.wt = new Walkontable(walkontableConfig);
$window.on('resize.' + instance.guid, function () {
instance.registerTimeout('resizeTimeout', function () {
instance.parseSettingsFromDOM();
var newWidth = that.getWidth();
var newHeight = that.getHeight();
if (walkontableConfig.width !== newWidth || walkontableConfig.height !== newHeight) {
instance.forceFullRender = true;
that.render();
walkontableConfig.width = newWidth;
walkontableConfig.height = newHeight;
}
}, 60);
});
$(that.wt.wtTable.spreader).on('mousedown.handsontable, contextmenu.handsontable', function (event) {
if (event.target === that.wt.wtTable.spreader && event.which === 3) { //right mouse button exactly on spreader means right clickon the right hand side of vertical scrollbar
event.stopPropagation();
}
});
$documentElement.on('click.' + instance.guid, function () {
if (that.settings.observeDOMVisibility) {
if (that.wt.drawInterrupted) {
that.instance.forceFullRender = true;
that.render();
}
}
});
};
Handsontable.TableView.prototype.isTextSelectionAllowed = function (el) {
if ( Handsontable.helper.isInput(el) ) {
return (true);
}
if (this.settings.fragmentSelection && this.wt.wtDom.isChildOf(el, this.TBODY)) {
return (true);
}
return false;
};
Handsontable.TableView.prototype.isCellEdited = function () {
var activeEditor = this.instance.getActiveEditor();
return activeEditor && activeEditor.isOpened();
};
Handsontable.TableView.prototype.getWidth = function () {
var val = this.settings.width !== void 0 ? this.settings.width : this.settingsFromDOM.width;
return typeof val === 'function' ? val() : val;
};
Handsontable.TableView.prototype.getHeight = function () {
var val = this.settings.height !== void 0 ? this.settings.height : this.settingsFromDOM.height;
return typeof val === 'function' ? val() : val;
};
Handsontable.TableView.prototype.beforeRender = function (force) {
if (force) { //force = did Walkontable decide to do full render
this.instance.PluginHooks.run('beforeRender', this.instance.forceFullRender); //this.instance.forceFullRender = did Handsontable request full render?
this.wt.update('width', this.getWidth());
this.wt.update('height', this.getHeight());
}
};
Handsontable.TableView.prototype.onDraw = function(force){
if (force) { //force = did Walkontable decide to do full render
this.instance.PluginHooks.run('afterRender', this.instance.forceFullRender); //this.instance.forceFullRender = did Handsontable request full render?
}
};
Handsontable.TableView.prototype.render = function () {
this.wt.draw(!this.instance.forceFullRender);
this.instance.forceFullRender = false;
this.instance.rootElement.triggerHandler('render.handsontable');
};
/**
* Returns td object given coordinates
*/
Handsontable.TableView.prototype.getCellAtCoords = function (coords) {
var td = this.wt.wtTable.getCell([coords.row, coords.col]);
if (td < 0) { //there was an exit code (cell is out of bounds)
return null;
}
else {
return td;
}
};
/**
* Scroll viewport to selection
* @param coords
*/
Handsontable.TableView.prototype.scrollViewport = function (coords) {
this.wt.scrollViewport([coords.row, coords.col]);
};
/**
* Append row header to a TH element
* @param row
* @param TH
*/
Handsontable.TableView.prototype.appendRowHeader = function (row, TH) {
if (row > -1) {
this.wt.wtDom.fastInnerHTML(TH, this.instance.getRowHeader(row));
}
else {
var DIV = document.createElement('DIV');
DIV.className = 'relative';
this.wt.wtDom.fastInnerText(DIV, '\u00A0');
this.wt.wtDom.empty(TH);
TH.appendChild(DIV);
}
};
/**
* Append column header to a TH element
* @param col
* @param TH
*/
Handsontable.TableView.prototype.appendColHeader = function (col, TH) {
var DIV = document.createElement('DIV')
, SPAN = document.createElement('SPAN');
DIV.className = 'relative';
SPAN.className = 'colHeader';
this.wt.wtDom.fastInnerHTML(SPAN, this.instance.getColHeader(col));
DIV.appendChild(SPAN);
this.wt.wtDom.empty(TH);
TH.appendChild(DIV);
this.instance.PluginHooks.run('afterGetColHeader', col, TH);
};
/**
* Given a element's left position relative to the viewport, returns maximum element width until the right edge of the viewport (before scrollbar)
* @param {Number} left
* @return {Number}
*/
Handsontable.TableView.prototype.maximumVisibleElementWidth = function (left) {
var rootWidth = this.wt.wtViewport.getWorkspaceWidth();
if(this.settings.nativeScrollbars) {
return rootWidth;
}
return rootWidth - left;
};
/**
* Given a element's top position relative to the viewport, returns maximum element height until the bottom edge of the viewport (before scrollbar)
* @param {Number} top
* @return {Number}
*/
Handsontable.TableView.prototype.maximumVisibleElementHeight = function (top) {
var rootHeight = this.wt.wtViewport.getWorkspaceHeight();
if(this.settings.nativeScrollbars) {
return rootHeight;
}
return rootHeight - top;
};
/**
* Utility to register editors and common namespace for keeping reference to all editor classes
*/
(function (Handsontable) {
'use strict';
function RegisteredEditor(editorClass) {
var clazz, instances;
instances = {};
clazz = editorClass;
this.getInstance = function (hotInstance) {
if (!(hotInstance.guid in instances)) {
instances[hotInstance.guid] = new clazz(hotInstance);
}
return instances[hotInstance.guid];
}
}
var registeredEditorNames = {};
var registeredEditorClasses = new WeakMap();
Handsontable.editors = {
/**
* Registers editor under given name
* @param {String} editorName
* @param {Function} editorClass
*/
registerEditor: function (editorName, editorClass) {
var editor = new RegisteredEditor(editorClass);
if (typeof editorName === "string") {
registeredEditorNames[editorName] = editor;
}
registeredEditorClasses.set(editorClass, editor);
},
/**
* Returns instance (singleton) of editor class
* @param {String|Function} editorName/editorClass
* @returns {Function} editorClass
*/
getEditor: function (editorName, hotInstance) {
var editor;
if (typeof editorName == 'function') {
if (!(registeredEditorClasses.get(editorName))) {
this.registerEditor(null, editorName);
}
editor = registeredEditorClasses.get(editorName);
}
else if (typeof editorName == 'string') {
editor = registeredEditorNames[editorName];
}
else {
throw Error('Only strings and functions can be passed as "editor" parameter ');
}
if (!editor) {
throw Error('No editor registered under name "' + editorName + '"');
}
return editor.getInstance(hotInstance);
}
};
})(Handsontable);
(function(Handsontable){
'use strict';
Handsontable.EditorManager = function(instance, priv, selection){
var that = this;
var $document = $(document);
var keyCodes = Handsontable.helper.keyCode;
var activeEditor;
var init = function () {
function onKeyDown(event) {
if (!instance.isListening()) {
return;
}
if (priv.settings.beforeOnKeyDown) { // HOT in HOT Plugin
priv.settings.beforeOnKeyDown.call(instance, event);
}
instance.PluginHooks.run('beforeKeyDown', event);
if (!event.isImmediatePropagationStopped()) {
priv.lastKeyCode = event.keyCode;
if (selection.isSelected()) {
var ctrlDown = (event.ctrlKey || event.metaKey) && !event.altKey; //catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
if (!activeEditor.isWaiting()) {
if (!Handsontable.helper.isMetaKey(event.keyCode) && !ctrlDown) {
that.openEditor('');
event.stopPropagation(); //required by HandsontableEditor
return;
}
}
var rangeModifier = event.shiftKey ? selection.setRangeEnd : selection.setRangeStart;
switch (event.keyCode) {
case keyCodes.A:
if (ctrlDown) {
selection.selectAll(); //select all cells
event.preventDefault();
event.stopPropagation();
break;
}
case keyCodes.ARROW_UP:
if (that.isEditorOpened() && !activeEditor.isWaiting()){
that.closeEditorAndSaveChanges(ctrlDown);
}
moveSelectionUp(event.shiftKey);
event.preventDefault();
event.stopPropagation(); //required by HandsontableEditor
break;
case keyCodes.ARROW_DOWN:
if (that.isEditorOpened() && !activeEditor.isWaiting()){
that.closeEditorAndSaveChanges(ctrlDown);
}
moveSelectionDown(event.shiftKey);
event.preventDefault();
event.stopPropagation(); //required by HandsontableEditor
break;
case keyCodes.ARROW_RIGHT:
if(that.isEditorOpened() && !activeEditor.isWaiting()){
that.closeEditorAndSaveChanges(ctrlDown);
}
moveSelectionRight(event.shiftKey);
event.preventDefault();
event.stopPropagation(); //required by HandsontableEditor
break;
case keyCodes.ARROW_LEFT:
if(that.isEditorOpened() && !activeEditor.isWaiting()){
that.closeEditorAndSaveChanges(ctrlDown);
}
moveSelectionLeft(event.shiftKey);
event.preventDefault();
event.stopPropagation(); //required by HandsontableEditor
break;
case keyCodes.TAB:
var tabMoves = typeof priv.settings.tabMoves === 'function' ? priv.settings.tabMoves(event) : priv.settings.tabMoves;
if (event.shiftKey) {
selection.transformStart(-tabMoves.row, -tabMoves.col); //move selection left
}
else {
selection.transformStart(tabMoves.row, tabMoves.col, true); //move selection right (add a new column if needed)
}
event.preventDefault();
event.stopPropagation(); //required by HandsontableEditor
break;
case keyCodes.BACKSPACE:
case keyCodes.DELETE:
selection.empty(event);
that.prepareEditor();
event.preventDefault();
break;
case keyCodes.F2: /* F2 */
that.openEditor();
event.preventDefault(); //prevent Opera from opening Go to Page dialog
break;
case keyCodes.ENTER: /* return/enter */
if(that.isEditorOpened()){
if (activeEditor.state !== Handsontable.EditorState.WAITING){
that.closeEditorAndSaveChanges(ctrlDown);
}
moveSelectionAfterEnter(event.shiftKey);
} else {
if (instance.getSettings().enterBeginsEditing){
that.openEditor();
} else {
moveSelectionAfterEnter(event.shiftKey);
}
}
event.preventDefault(); //don't add newline to field
event.stopImmediatePropagation(); //required by HandsontableEditor
break;
case keyCodes.ESCAPE:
if(that.isEditorOpened()){
that.closeEditorAndRestoreOriginalValue(ctrlDown);
}
event.preventDefault();
break;
case keyCodes.HOME:
if (event.ctrlKey || event.metaKey) {
rangeModifier({row: 0, col: priv.selStart.col()});
}
else {
rangeModifier({row: priv.selStart.row(), col: 0});
}
event.preventDefault(); //don't scroll the window
event.stopPropagation(); //required by HandsontableEditor
break;
case keyCodes.END:
if (event.ctrlKey || event.metaKey) {
rangeModifier({row: instance.countRows() - 1, col: priv.selStart.col()});
}
else {
rangeModifier({row: priv.selStart.row(), col: instance.countCols() - 1});
}
event.preventDefault(); //don't scroll the window
event.stopPropagation(); //required by HandsontableEditor
break;
case keyCodes.PAGE_UP:
selection.transformStart(-instance.countVisibleRows(), 0);
instance.view.wt.scrollVertical(-instance.countVisibleRows());
instance.view.render();
event.preventDefault(); //don't page up the window
event.stopPropagation(); //required by HandsontableEditor
break;
case keyCodes.PAGE_DOWN:
selection.transformStart(instance.countVisibleRows(), 0);
instance.view.wt.scrollVertical(instance.countVisibleRows());
instance.view.render();
event.preventDefault(); //don't page down the window
event.stopPropagation(); //required by HandsontableEditor
break;
default:
break;
}
}
}
}
$document.on('keydown.handsontable.' + instance.guid, onKeyDown);
function onDblClick() {
// that.instance.destroyEditor();
that.openEditor();
}
instance.view.wt.update('onCellDblClick', onDblClick);
instance.addHook('afterDestroy', function(){
$document.off('keydown.handsontable.' + instance.guid);
});
function moveSelectionAfterEnter(shiftKey){
var enterMoves = typeof priv.settings.enterMoves === 'function' ? priv.settings.enterMoves(event) : priv.settings.enterMoves;
if (shiftKey) {
selection.transformStart(-enterMoves.row, -enterMoves.col); //move selection up
}
else {
selection.transformStart(enterMoves.row, enterMoves.col, true); //move selection down (add a new row if needed)
}
}
function moveSelectionUp(shiftKey){
if (shiftKey) {
selection.transformEnd(-1, 0);
}
else {
selection.transformStart(-1, 0);
}
}
function moveSelectionDown(shiftKey){
if (shiftKey) {
selection.transformEnd(1, 0); //expanding selection down with shift
}
else {
selection.transformStart(1, 0); //move selection down
}
}
function moveSelectionRight(shiftKey){
if (shiftKey) {
selection.transformEnd(0, 1);
}
else {
selection.transformStart(0, 1);
}
}
function moveSelectionLeft(shiftKey){
if (shiftKey) {
selection.transformEnd(0, -1);
}
else {
selection.transformStart(0, -1);
}
}
};
/**
* Destroy current editor, if exists
* @param {Boolean} revertOriginal
*/
this.destroyEditor = function (revertOriginal) {
this.closeEditor(revertOriginal);
};
this.getActiveEditor = function () {
return activeEditor;
};
/**
* Prepare text input to be displayed at given grid cell
*/
this.prepareEditor = function () {
if (activeEditor && activeEditor.isWaiting()){
this.closeEditor(false, false, function(dataSaved){
if(dataSaved){
that.prepareEditor();
}
});
return;
}
var row = priv.selStart.row();
var col = priv.selStart.col();
var prop = instance.colToProp(col);
var td = instance.getCell(row, col);
var originalValue = instance.getDataAtCell(row, col);
var cellProperties = instance.getCellMeta(row, col);
var editorClass = instance.getCellEditor(cellProperties);
activeEditor = Handsontable.editors.getEditor(editorClass, instance);
activeEditor.prepare(row, col, prop, td, originalValue, cellProperties);
};
this.isEditorOpened = function () {
return activeEditor.isOpened();
};
this.openEditor = function (initialValue) {
activeEditor.beginEditing(initialValue);
};
this.closeEditor = function (restoreOriginalValue, ctrlDown, callback) {
if (!activeEditor){
if(callback) {
callback(false);
}
}
else {
activeEditor.finishEditing(restoreOriginalValue, ctrlDown, callback);
}
};
this.closeEditorAndSaveChanges = function(ctrlDown){
return this.closeEditor(false, ctrlDown);
};
this.closeEditorAndRestoreOriginalValue = function(ctrlDown){
return this.closeEditor(true, ctrlDown);
};
init();
};
})(Handsontable);
/**
* Utility to register renderers and common namespace for keeping reference to all renderers classes
*/
(function (Handsontable) {
'use strict';
var registeredRenderers = {};
Handsontable.renderers = {
/**
* Registers renderer under given name
* @param {String} rendererName
* @param {Function} rendererFunction
*/
registerRenderer: function (rendererName, rendererFunction) {
registeredRenderers[rendererName] = rendererFunction
},
/**
* @param {String|Function} rendererName/rendererFunction
* @returns {Function} rendererFunction
*/
getRenderer: function (rendererName) {
if (typeof rendererName == 'function'){
return rendererName;
}
if (typeof rendererName != 'string'){
throw Error('Only strings and functions can be passed as "renderer" parameter ');
}
if (!(rendererName in registeredRenderers)) {
throw Error('No editor registered under name "' + rendererName + '"');
}
return registeredRenderers[rendererName];
}
};
})(Handsontable);
/**
* DOM helper optimized for maximum performance
* It is recommended for Handsontable plugins and renderers, because it is much faster than jQuery
* @type {WalkonableDom}
*/
Handsontable.Dom = new WalkontableDom();
/**
* Returns true if keyCode represents a printable character
* @param {Number} keyCode
* @return {Boolean}
*/
Handsontable.helper.isPrintableChar = function (keyCode) {
return ((keyCode == 32) || //space
(keyCode >= 48 && keyCode <= 57) || //0-9
(keyCode >= 96 && keyCode <= 111) || //numpad
(keyCode >= 186 && keyCode <= 192) || //;=,-./`
(keyCode >= 219 && keyCode <= 222) || //[]{}\|"'
keyCode >= 226 || //special chars (229 for Asian chars)
(keyCode >= 65 && keyCode <= 90)); //a-z
};
Handsontable.helper.isMetaKey = function (keyCode) {
var keyCodes = Handsontable.helper.keyCode;
var metaKeys = [
keyCodes.ARROW_DOWN,
keyCodes.ARROW_UP,
keyCodes.ARROW_LEFT,
keyCodes.ARROW_RIGHT,
keyCodes.HOME,
keyCodes.END,
keyCodes.DELETE,
keyCodes.BACKSPACE,
keyCodes.F1,
keyCodes.F2,
keyCodes.F3,
keyCodes.F4,
keyCodes.F5,
keyCodes.F6,
keyCodes.F7,
keyCodes.F8,
keyCodes.F9,
keyCodes.F10,
keyCodes.F11,
keyCodes.F12,
keyCodes.TAB,
keyCodes.PAGE_DOWN,
keyCodes.PAGE_UP,
keyCodes.ENTER,
keyCodes.ESCAPE,
keyCodes.SHIFT,
keyCodes.CAPS_LOCK,
keyCodes.ALT
];
return metaKeys.indexOf(keyCode) != -1;
};
Handsontable.helper.isCtrlKey = function (keyCode) {
var keys = Handsontable.helper.keyCode;
return [keys.CONTROL_LEFT, 224, keys.COMMAND_LEFT, keys.COMMAND_RIGHT].indexOf(keyCode) != -1;
};
/**
* Converts a value to string
* @param value
* @return {String}
*/
Handsontable.helper.stringify = function (value) {
switch (typeof value) {
case 'string':
case 'number':
return value + '';
break;
case 'object':
if (value === null) {
return '';
}
else {
return value.toString();
}
break;
case 'undefined':
return '';
break;
default:
return value.toString();
}
};
/**
* Generates spreadsheet-like column names: A, B, C, ..., Z, AA, AB, etc
* @param index
* @returns {String}
*/
Handsontable.helper.spreadsheetColumnLabel = function (index) {
var dividend = index + 1;
var columnLabel = '';
var modulo;
while (dividend > 0) {
modulo = (dividend - 1) % 26;
columnLabel = String.fromCharCode(65 + modulo) + columnLabel;
dividend = parseInt((dividend - modulo) / 26, 10);
}
return columnLabel;
};
/**
* Checks if value of n is a numeric one
* http://jsperf.com/isnan-vs-isnumeric/4
* @param n
* @returns {boolean}
*/
Handsontable.helper.isNumeric = function (n) {
var t = typeof n;
return t == 'number' ? !isNaN(n) && isFinite(n) :
t == 'string' ? !n.length ? false :
n.length == 1 ? /\d/.test(n) :
/^\s*[+-]?\s*(?:(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?)|(?:0x[a-f\d]+))\s*$/i.test(n) :
t == 'object' ? !!n && typeof n.valueOf() == "number" && !(n instanceof Date) : false;
};
Handsontable.helper.isArray = function (obj) {
return Object.prototype.toString.call(obj).match(/array/i) !== null;
};
/**
* Checks if child is a descendant of given parent node
* http://stackoverflow.com/questions/2234979/how-to-check-in-javascript-if-one-element-is-a-child-of-another
* @param parent
* @param child
* @returns {boolean}
*/
Handsontable.helper.isDescendant = function (parent, child) {
var node = child.parentNode;
while (node != null) {
if (node == parent) {
return true;
}
node = node.parentNode;
}
return false;
};
/**
* Generates a random hex string. Used as namespace for Handsontable instance events.
* @return {String} - 16 character random string: "92b1bfc74ec4"
*/
Handsontable.helper.randomString = function () {
return walkontableRandomString();
};
/**
* Inherit without without calling parent constructor, and setting `Child.prototype.constructor` to `Child` instead of `Parent`.
* Creates temporary dummy function to call it as constructor.
* Described in ticket: https://github.com/warpech/jquery-handsontable/pull/516
* @param {Object} Child child class
* @param {Object} Parent parent class
* @return {Object} extended Child
*/
Handsontable.helper.inherit = function (Child, Parent) {
Parent.prototype.constructor = Parent;
Child.prototype = new Parent();
Child.prototype.constructor = Child;
return Child;
};
/**
* Perform shallow extend of a target object with extension's own properties
* @param {Object} target An object that will receive the new properties
* @param {Object} extension An object containing additional properties to merge into the target
*/
Handsontable.helper.extend = function (target, extension) {
for (var i in extension) {
if (extension.hasOwnProperty(i)) {
target[i] = extension[i];
}
}
};
Handsontable.helper.getPrototypeOf = function (obj) {
var prototype;
if(typeof obj.__proto__ == "object"){
prototype = obj.__proto__;
} else {
var oldConstructor,
constructor = obj.constructor;
if (typeof obj.constructor == "function") {
oldConstructor = constructor;
if (delete obj.constructor){
constructor = obj.constructor; // get real constructor
obj.constructor = oldConstructor; // restore constructor
}
}
prototype = constructor ? constructor.prototype : null; // needed for IE
}
return prototype;
};
/**
* Factory for columns constructors.
* @param {Object} GridSettings
* @param {Array} conflictList
* @return {Object} ColumnSettings
*/
Handsontable.helper.columnFactory = function (GridSettings, conflictList) {
function ColumnSettings () {}
Handsontable.helper.inherit(ColumnSettings, GridSettings);
// Clear conflict settings
for (var i = 0, len = conflictList.length; i < len; i++) {
ColumnSettings.prototype[conflictList[i]] = void 0;
}
return ColumnSettings;
};
Handsontable.helper.translateRowsToColumns = function (input) {
var i
, ilen
, j
, jlen
, output = []
, olen = 0;
for (i = 0, ilen = input.length; i < ilen; i++) {
for (j = 0, jlen = input[i].length; j < jlen; j++) {
if (j == olen) {
output.push([]);
olen++;
}
output[j].push(input[i][j])
}
}
return output;
};
Handsontable.helper.to2dArray = function (arr) {
var i = 0
, ilen = arr.length;
while (i < ilen) {
arr[i] = [arr[i]];
i++;
}
};
Handsontable.helper.extendArray = function (arr, extension) {
var i = 0
, ilen = extension.length;
while (i < ilen) {
arr.push(extension[i]);
i++;
}
};
/**
* Determines if the given DOM element is an input field.
* Notice: By 'input' we mean input, textarea and select nodes
* @param element - DOM element
* @returns {boolean}
*/
Handsontable.helper.isInput = function (element) {
var inputs = ['INPUT', 'SELECT', 'TEXTAREA'];
return inputs.indexOf(element.nodeName) > -1;
}
/**
* Determines if the given DOM element is an input field placed OUTSIDE of HOT.
* Notice: By 'input' we mean input, textarea and select nodes
* @param element - DOM element
* @returns {boolean}
*/
Handsontable.helper.isOutsideInput = function (element) {
return Handsontable.helper.isInput(element) && element.className.indexOf('handsontableInput') == -1;
};
Handsontable.helper.keyCode = {
MOUSE_LEFT: 1,
MOUSE_RIGHT: 3,
MOUSE_MIDDLE: 2,
BACKSPACE: 8,
COMMA: 188,
DELETE: 46,
END: 35,
ENTER: 13,
ESCAPE: 27,
CONTROL_LEFT: 91,
COMMAND_LEFT: 17,
COMMAND_RIGHT: 93,
ALT: 18,
HOME: 36,
PAGE_DOWN: 34,
PAGE_UP: 33,
PERIOD: 190,
SPACE: 32,
SHIFT: 16,
CAPS_LOCK: 20,
TAB: 9,
ARROW_RIGHT: 39,
ARROW_LEFT: 37,
ARROW_UP: 38,
ARROW_DOWN: 40,
F1: 112,
F2: 113,
F3: 114,
F4: 115,
F5: 116,
F6: 117,
F7: 118,
F8: 119,
F9: 120,
F10: 121,
F11: 122,
F12: 123,
A: 65,
X: 88,
C: 67,
V: 86
};
/**
* Determines whether given object is a plain Object.
* Note: String and Array are not plain Objects
* @param {*} obj
* @returns {boolean}
*/
Handsontable.helper.isObject = function (obj) {
return Object.prototype.toString.call(obj) == '[object Object]';
};
/**
* Determines whether given object is an Array.
* Note: String is not an Array
* @param {*} obj
* @returns {boolean}
*/
Handsontable.helper.isArray = function(obj){
return Array.isArray ? Array.isArray(obj) : Object.prototype.toString.call(obj) == '[object Array]';
};
Handsontable.helper.pivot = function (arr) {
var pivotedArr = [];
if(!arr || arr.length == 0 || !arr[0] || arr[0].length == 0){
return pivotedArr;
}
var rowCount = arr.length;
var colCount = arr[0].length;
for(var i = 0; i < rowCount; i++){
for(var j = 0; j < colCount; j++){
if(!pivotedArr[j]){
pivotedArr[j] = [];
}
pivotedArr[j][i] = arr[i][j];
}
}
return pivotedArr;
};
Handsontable.helper.proxy = function (fun, context) {
return function () {
return fun.apply(context, arguments);
};
};
/**
* Factory that produces a function for searching methods (or any properties) which could be defined directly in
* table configuration or implicitly, within cell type definition.
*
* For example: renderer can be defined explicitly using "renderer" property in column configuration or it can be
* defined implicitly using "type" property.
*
* Methods/properties defined explicitly always takes precedence over those defined through "type".
*
* If the method/property is not found in an object, searching is continued recursively through prototype chain, until
* it reaches the Object.prototype.
*
*
* @param methodName {String} name of the method/property to search (i.e. 'renderer', 'validator', 'copyable')
* @param allowUndefined {Boolean} [optional] if false, the search is continued if methodName has not been found in cell "type"
* @returns {Function}
*/
Handsontable.helper.cellMethodLookupFactory = function (methodName, allowUndefined) {
allowUndefined = typeof allowUndefined == 'undefined' ? true : allowUndefined;
return function cellMethodLookup (row, col) {
return (function getMethodFromProperties(properties) {
if (!properties){
return; //method not found
}
else if (properties.hasOwnProperty(methodName) && properties[methodName]) { //check if it is own and is not empty
return properties[methodName]; //method defined directly
} else if (properties.hasOwnProperty('type') && properties.type) { //check if it is own and is not empty
var type;
if(typeof properties.type != 'string' ){
throw new Error('Cell type must be a string ');
}
type = translateTypeNameToObject(properties.type);
if (type.hasOwnProperty(methodName)) {
return type[methodName]; //method defined in type.
} else if (allowUndefined) {
return; //method does not defined in type (eg. validator), returns undefined
}
}
return getMethodFromProperties(Handsontable.helper.getPrototypeOf(properties));
})(typeof row == 'number' ? this.getCellMeta(row, col) : row);
};
function translateTypeNameToObject(typeName) {
var type = Handsontable.cellTypes[typeName];
if(typeof type == 'undefined'){
throw new Error('You declared cell type "' + typeName + '" as a string that is not mapped to a known object. Cell type must be an object or a string mapped to an object in Handsontable.cellTypes');
}
return type;
}
};
Handsontable.SelectionPoint = function () {
this._row = null; //private use intended
this._col = null;
};
Handsontable.SelectionPoint.prototype.exists = function () {
return (this._row !== null);
};
Handsontable.SelectionPoint.prototype.row = function (val) {
if (val !== void 0) {
this._row = val;
}
return this._row;
};
Handsontable.SelectionPoint.prototype.col = function (val) {
if (val !== void 0) {
this._col = val;
}
return this._col;
};
Handsontable.SelectionPoint.prototype.coords = function (coords) {
if (coords !== void 0) {
this._row = coords.row;
this._col = coords.col;
}
return {
row: this._row,
col: this._col
}
};
Handsontable.SelectionPoint.prototype.arr = function (arr) {
if (arr !== void 0) {
this._row = arr[0];
this._col = arr[1];
}
return [this._row, this._col]
};
(function (Handsontable) {
'use strict';
/**
* Utility class that gets and saves data from/to the data source using mapping of columns numbers to object property names
* TODO refactor arguments of methods getRange, getText to be numbers (not objects)
* TODO remove priv, GridSettings from object constructor
*
* @param instance
* @param priv
* @param GridSettings
* @constructor
*/
Handsontable.DataMap = function (instance, priv, GridSettings) {
this.instance = instance;
this.priv = priv;
this.GridSettings = GridSettings;
this.dataSource = this.instance.getSettings().data;
if (this.dataSource[0]) {
this.duckSchema = this.recursiveDuckSchema(this.dataSource[0]);
}
else {
this.duckSchema = {};
}
this.createMap();
this.getVars = {}; //used by modifier
this.setVars = {}; //used by modifier
};
Handsontable.DataMap.prototype.DESTINATION_RENDERER = 1;
Handsontable.DataMap.prototype.DESTINATION_CLIPBOARD_GENERATOR = 2;
Handsontable.DataMap.prototype.recursiveDuckSchema = function (obj) {
var schema;
if ($.isPlainObject(obj)) {
schema = {};
for (var i in obj) {
if (obj.hasOwnProperty(i)) {
if ($.isPlainObject(obj[i])) {
schema[i] = this.recursiveDuckSchema(obj[i]);
}
else {
schema[i] = null;
}
}
}
}
else {
schema = [];
}
return schema;
};
Handsontable.DataMap.prototype.recursiveDuckColumns = function (schema, lastCol, parent) {
var prop, i;
if (typeof lastCol === 'undefined') {
lastCol = 0;
parent = '';
}
if ($.isPlainObject(schema)) {
for (i in schema) {
if (schema.hasOwnProperty(i)) {
if (schema[i] === null) {
prop = parent + i;
this.colToPropCache.push(prop);
this.propToColCache[prop] = lastCol;
lastCol++;
}
else {
lastCol = this.recursiveDuckColumns(schema[i], lastCol, i + '.');
}
}
}
}
return lastCol;
};
Handsontable.DataMap.prototype.createMap = function () {
if (typeof this.getSchema() === "undefined") {
throw new Error("trying to create `columns` definition but you didnt' provide `schema` nor `data`");
}
var i, ilen, schema = this.getSchema();
this.colToPropCache = [];
this.propToColCache = {};
var columns = this.instance.getSettings().columns;
if (columns) {
for (i = 0, ilen = columns.length; i < ilen; i++) {
this.colToPropCache[i] = columns[i].data;
this.propToColCache[columns[i].data] = i;
}
}
else {
this.recursiveDuckColumns(schema);
}
};
Handsontable.DataMap.prototype.colToProp = function (col) {
col = Handsontable.PluginHooks.execute(this.instance, 'modifyCol', col);
if (this.colToPropCache && typeof this.colToPropCache[col] !== 'undefined') {
return this.colToPropCache[col];
}
else {
return col;
}
};
Handsontable.DataMap.prototype.propToCol = function (prop) {
var col;
if (typeof this.propToColCache[prop] !== 'undefined') {
col = this.propToColCache[prop];
}
else {
col = prop;
}
col = Handsontable.PluginHooks.execute(this.instance, 'modifyCol', col);
return col;
};
Handsontable.DataMap.prototype.getSchema = function () {
var schema = this.instance.getSettings().dataSchema;
if (schema) {
if (typeof schema === 'function') {
return schema();
}
return schema;
}
return this.duckSchema;
};
/**
* Creates row at the bottom of the data array
* @param {Number} [index] Optional. Index of the row before which the new row will be inserted
*/
Handsontable.DataMap.prototype.createRow = function (index, amount, createdAutomatically) {
var row
, colCount = this.instance.countCols()
, numberOfCreatedRows = 0
, currentIndex;
if (!amount) {
amount = 1;
}
if (typeof index !== 'number' || index >= this.instance.countRows()) {
index = this.instance.countRows();
}
currentIndex = index;
var maxRows = this.instance.getSettings().maxRows;
while (numberOfCreatedRows < amount && this.instance.countRows() < maxRows) {
if (this.instance.dataType === 'array') {
row = [];
for (var c = 0; c < colCount; c++) {
row.push(null);
}
}
else if (this.instance.dataType === 'function') {
row = this.instance.getSettings().dataSchema(index);
}
else {
row = $.extend(true, {}, this.getSchema());
}
if (index === this.instance.countRows()) {
this.dataSource.push(row);
}
else {
this.dataSource.splice(index, 0, row);
}
numberOfCreatedRows++;
currentIndex++;
}
this.instance.PluginHooks.run('afterCreateRow', index, numberOfCreatedRows, createdAutomatically);
this.instance.forceFullRender = true; //used when data was changed
return numberOfCreatedRows;
};
/**
* Creates col at the right of the data array
* @param {Number} [index] Optional. Index of the column before which the new column will be inserted
* * @param {Number} [amount] Optional.
*/
Handsontable.DataMap.prototype.createCol = function (index, amount, createdAutomatically) {
if (this.instance.dataType === 'object' || this.instance.getSettings().columns) {
throw new Error("Cannot create new column. When data source in an object, " +
"you can only have as much columns as defined in first data row, data schema or in the 'columns' setting." +
"If you want to be able to add new columns, you have to use array datasource.");
}
var rlen = this.instance.countRows()
, data = this.dataSource
, constructor
, numberOfCreatedCols = 0
, currentIndex;
if (!amount) {
amount = 1;
}
currentIndex = index;
var maxCols = this.instance.getSettings().maxCols;
while (numberOfCreatedCols < amount && this.instance.countCols() < maxCols) {
constructor = Handsontable.helper.columnFactory(this.GridSettings, this.priv.columnsSettingConflicts);
if (typeof index !== 'number' || index >= this.instance.countCols()) {
for (var r = 0; r < rlen; r++) {
if (typeof data[r] === 'undefined') {
data[r] = [];
}
data[r].push(null);
}
// Add new column constructor
this.priv.columnSettings.push(constructor);
}
else {
for (var r = 0; r < rlen; r++) {
data[r].splice(currentIndex, 0, null);
}
// Add new column constructor at given index
this.priv.columnSettings.splice(currentIndex, 0, constructor);
}
numberOfCreatedCols++;
currentIndex++;
}
this.instance.PluginHooks.run('afterCreateCol', index, numberOfCreatedCols, createdAutomatically);
this.instance.forceFullRender = true; //used when data was changed
return numberOfCreatedCols;
};
/**
* Removes row from the data array
* @param {Number} [index] Optional. Index of the row to be removed. If not provided, the last row will be removed
* @param {Number} [amount] Optional. Amount of the rows to be removed. If not provided, one row will be removed
*/
Handsontable.DataMap.prototype.removeRow = function (index, amount) {
if (!amount) {
amount = 1;
}
if (typeof index !== 'number') {
index = -amount;
}
index = (this.instance.countRows() + index) % this.instance.countRows();
// We have to map the physical row ids to logical and than perform removing with (possibly) new row id
var logicRows = this.physicalRowsToLogical(index, amount);
var actionWasNotCancelled = this.instance.PluginHooks.execute('beforeRemoveRow', index, amount);
if (actionWasNotCancelled === false) {
return;
}
var data = this.dataSource;
var newData = data.filter(function (row, index) {
return logicRows.indexOf(index) == -1;
});
data.length = 0;
Array.prototype.push.apply(data, newData);
this.instance.PluginHooks.run('afterRemoveRow', index, amount);
this.instance.forceFullRender = true; //used when data was changed
};
/**
* Removes column from the data array
* @param {Number} [index] Optional. Index of the column to be removed. If not provided, the last column will be removed
* @param {Number} [amount] Optional. Amount of the columns to be removed. If not provided, one column will be removed
*/
Handsontable.DataMap.prototype.removeCol = function (index, amount) {
if (this.instance.dataType === 'object' || this.instance.getSettings().columns) {
throw new Error("cannot remove column with object data source or columns option specified");
}
if (!amount) {
amount = 1;
}
if (typeof index !== 'number') {
index = -amount;
}
index = (this.instance.countCols() + index) % this.instance.countCols();
var actionWasNotCancelled = this.instance.PluginHooks.execute('beforeRemoveCol', index, amount);
if (actionWasNotCancelled === false) {
return;
}
var data = this.dataSource;
for (var r = 0, rlen = this.instance.countRows(); r < rlen; r++) {
data[r].splice(index, amount);
}
this.priv.columnSettings.splice(index, amount);
this.instance.PluginHooks.run('afterRemoveCol', index, amount);
this.instance.forceFullRender = true; //used when data was changed
};
/**
* Add / removes data from the column
* @param {Number} col Index of column in which do you want to do splice.
* @param {Number} index Index at which to start changing the array. If negative, will begin that many elements from the end
* @param {Number} amount An integer indicating the number of old array elements to remove. If amount is 0, no elements are removed
* param {...*} elements Optional. The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array
*/
Handsontable.DataMap.prototype.spliceCol = function (col, index, amount/*, elements...*/) {
var elements = 4 <= arguments.length ? [].slice.call(arguments, 3) : [];
var colData = this.instance.getDataAtCol(col);
var removed = colData.slice(index, index + amount);
var after = colData.slice(index + amount);
Handsontable.helper.extendArray(elements, after);
var i = 0;
while (i < amount) {
elements.push(null); //add null in place of removed elements
i++;
}
Handsontable.helper.to2dArray(elements);
this.instance.populateFromArray(index, col, elements, null, null, 'spliceCol');
return removed;
};
/**
* Add / removes data from the row
* @param {Number} row Index of row in which do you want to do splice.
* @param {Number} index Index at which to start changing the array. If negative, will begin that many elements from the end
* @param {Number} amount An integer indicating the number of old array elements to remove. If amount is 0, no elements are removed
* param {...*} elements Optional. The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array
*/
Handsontable.DataMap.prototype.spliceRow = function (row, index, amount/*, elements...*/) {
var elements = 4 <= arguments.length ? [].slice.call(arguments, 3) : [];
var rowData = this.instance.getDataAtRow(row);
var removed = rowData.slice(index, index + amount);
var after = rowData.slice(index + amount);
Handsontable.helper.extendArray(elements, after);
var i = 0;
while (i < amount) {
elements.push(null); //add null in place of removed elements
i++;
}
this.instance.populateFromArray(row, index, [elements], null, null, 'spliceRow');
return removed;
};
/**
* Returns single value from the data array
* @param {Number} row
* @param {Number} prop
*/
Handsontable.DataMap.prototype.get = function (row, prop) {
this.getVars.row = row;
this.getVars.prop = prop;
this.instance.PluginHooks.run('beforeGet', this.getVars);
if (typeof this.getVars.prop === 'string' && this.getVars.prop.indexOf('.') > -1) {
var sliced = this.getVars.prop.split(".");
var out = this.dataSource[this.getVars.row];
if (!out) {
return null;
}
for (var i = 0, ilen = sliced.length; i < ilen; i++) {
out = out[sliced[i]];
if (typeof out === 'undefined') {
return null;
}
}
return out;
}
else if (typeof this.getVars.prop === 'function') {
/**
* allows for interacting with complex structures, for example
* d3/jQuery getter/setter properties:
*
* {columns: [{
* data: function(row, value){
* if(arguments.length === 1){
* return row.property();
* }
* row.property(value);
* }
* }]}
*/
return this.getVars.prop(this.dataSource.slice(
this.getVars.row,
this.getVars.row + 1
)[0]);
}
else {
return this.dataSource[this.getVars.row] ? this.dataSource[this.getVars.row][this.getVars.prop] : null;
}
};
var copyableLookup = Handsontable.helper.cellMethodLookupFactory('copyable', false);
/**
* Returns single value from the data array (intended for clipboard copy to an external application)
* @param {Number} row
* @param {Number} prop
* @return {String}
*/
Handsontable.DataMap.prototype.getCopyable = function (row, prop) {
if (copyableLookup.call(this.instance, row, this.propToCol(prop))) {
return this.get(row, prop);
}
return '';
};
/**
* Saves single value to the data array
* @param {Number} row
* @param {Number} prop
* @param {String} value
* @param {String} [source] Optional. Source of hook runner.
*/
Handsontable.DataMap.prototype.set = function (row, prop, value, source) {
this.setVars.row = row;
this.setVars.prop = prop;
this.setVars.value = value;
this.instance.PluginHooks.run('beforeSet', this.setVars, source || "datamapGet");
if (typeof this.setVars.prop === 'string' && this.setVars.prop.indexOf('.') > -1) {
var sliced = this.setVars.prop.split(".");
var out = this.dataSource[this.setVars.row];
for (var i = 0, ilen = sliced.length - 1; i < ilen; i++) {
out = out[sliced[i]];
}
out[sliced[i]] = this.setVars.value;
}
else if (typeof this.setVars.prop === 'function') {
/* see the `function` handler in `get` */
this.setVars.prop(this.dataSource.slice(
this.setVars.row,
this.setVars.row + 1
)[0], this.setVars.value);
}
else {
this.dataSource[this.setVars.row][this.setVars.prop] = this.setVars.value;
}
};
/**
* This ridiculous piece of code maps rows Id that are present in table data to those displayed for user.
* The trick is, the physical row id (stored in settings.data) is not necessary the same
* as the logical (displayed) row id (e.g. when sorting is applied).
*/
Handsontable.DataMap.prototype.physicalRowsToLogical = function (index, amount) {
var totalRows = this.instance.countRows();
var physicRow = (totalRows + index) % totalRows;
var logicRows = [];
var rowsToRemove = amount;
while (physicRow < totalRows && rowsToRemove) {
this.get(physicRow, 0); //this performs an actual mapping and saves the result to getVars
logicRows.push(this.getVars.row);
rowsToRemove--;
physicRow++;
}
return logicRows;
};
/**
* Clears the data array
*/
Handsontable.DataMap.prototype.clear = function () {
for (var r = 0; r < this.instance.countRows(); r++) {
for (var c = 0; c < this.instance.countCols(); c++) {
this.set(r, this.colToProp(c), '');
}
}
};
/**
* Returns the data array
* @return {Array}
*/
Handsontable.DataMap.prototype.getAll = function () {
return this.dataSource;
};
/**
* Returns data range as array
* @param {Object} start Start selection position
* @param {Object} end End selection position
* @param {Number} destination Destination of datamap.get
* @return {Array}
*/
Handsontable.DataMap.prototype.getRange = function (start, end, destination) {
var r, rlen, c, clen, output = [], row;
var getFn = destination === this.DESTINATION_CLIPBOARD_GENERATOR ? this.getCopyable : this.get;
rlen = Math.max(start.row, end.row);
clen = Math.max(start.col, end.col);
for (r = Math.min(start.row, end.row); r <= rlen; r++) {
row = [];
for (c = Math.min(start.col, end.col); c <= clen; c++) {
row.push(getFn.call(this, r, this.colToProp(c)));
}
output.push(row);
}
return output;
};
/**
* Return data as text (tab separated columns)
* @param {Object} start (Optional) Start selection position
* @param {Object} end (Optional) End selection position
* @return {String}
*/
Handsontable.DataMap.prototype.getText = function (start, end) {
return SheetClip.stringify(this.getRange(start, end, this.DESTINATION_RENDERER));
};
/**
* Return data as copyable text (tab separated columns intended for clipboard copy to an external application)
* @param {Object} start (Optional) Start selection position
* @param {Object} end (Optional) End selection position
* @return {String}
*/
Handsontable.DataMap.prototype.getCopyableText = function (start, end) {
return SheetClip.stringify(this.getRange(start, end, this.DESTINATION_CLIPBOARD_GENERATOR));
};
})(Handsontable);
(function (Handsontable) {
'use strict';
/*
Adds appropriate CSS class to table cell, based on cellProperties
*/
Handsontable.renderers.cellDecorator = function (instance, TD, row, col, prop, value, cellProperties) {
if (cellProperties.readOnly) {
instance.view.wt.wtDom.addClass(TD, cellProperties.readOnlyCellClassName);
}
if (cellProperties.valid === false && cellProperties.invalidCellClassName) {
instance.view.wt.wtDom.addClass(TD, cellProperties.invalidCellClassName);
}
if (!value && cellProperties.placeholder) {
instance.view.wt.wtDom.addClass(TD, cellProperties.placeholderCellClassName);
}
}
})(Handsontable);
/**
* Default text renderer
* @param {Object} instance Handsontable instance
* @param {Element} TD Table cell where to render
* @param {Number} row
* @param {Number} col
* @param {String|Number} prop Row object property name
* @param value Value to render (remember to escape unsafe HTML before inserting to DOM!)
* @param {Object} cellProperties Cell properites (shared by cell renderer and editor)
*/
(function (Handsontable) {
'use strict';
var TextRenderer = function (instance, TD, row, col, prop, value, cellProperties) {
Handsontable.renderers.cellDecorator.apply(this, arguments);
if (!value && cellProperties.placeholder) {
value = cellProperties.placeholder;
}
var escaped = Handsontable.helper.stringify(value);
if (cellProperties.rendererTemplate) {
instance.view.wt.wtDom.empty(TD);
var TEMPLATE = document.createElement('TEMPLATE');
TEMPLATE.setAttribute('bind', '{{}}');
TEMPLATE.innerHTML = cellProperties.rendererTemplate;
HTMLTemplateElement.decorate(TEMPLATE);
TEMPLATE.model = instance.getDataAtRow(row);
TD.appendChild(TEMPLATE);
}
else {
instance.view.wt.wtDom.fastInnerText(TD, escaped); //this is faster than innerHTML. See: https://github.com/warpech/jquery-handsontable/wiki/JavaScript-&-DOM-performance-tips
}
};
//Handsontable.TextRenderer = TextRenderer; //Left for backward compatibility
Handsontable.renderers.TextRenderer = TextRenderer;
Handsontable.renderers.registerRenderer('text', TextRenderer);
})(Handsontable);
(function (Handsontable) {
var clonableWRAPPER = document.createElement('DIV');
clonableWRAPPER.className = 'htAutocompleteWrapper';
var clonableARROW = document.createElement('DIV');
clonableARROW.className = 'htAutocompleteArrow';
clonableARROW.appendChild(document.createTextNode('\u25BC'));
//this is faster than innerHTML. See: https://github.com/warpech/jquery-handsontable/wiki/JavaScript-&-DOM-performance-tips
var wrapTdContentWithWrapper = function(TD, WRAPPER){
WRAPPER.innerHTML = TD.innerHTML;
Handsontable.Dom.empty(TD);
TD.appendChild(WRAPPER);
};
/**
* Autocomplete renderer
* @param {Object} instance Handsontable instance
* @param {Element} TD Table cell where to render
* @param {Number} row
* @param {Number} col
* @param {String|Number} prop Row object property name
* @param value Value to render (remember to escape unsafe HTML before inserting to DOM!)
* @param {Object} cellProperties Cell properites (shared by cell renderer and editor)
*/
var AutocompleteRenderer = function (instance, TD, row, col, prop, value, cellProperties) {
var WRAPPER = clonableWRAPPER.cloneNode(true); //this is faster than createElement
var ARROW = clonableARROW.cloneNode(true); //this is faster than createElement
Handsontable.renderers.TextRenderer(instance, TD, row, col, prop, value, cellProperties);
TD.appendChild(ARROW);
Handsontable.Dom.addClass(TD, 'htAutocomplete');
if (!TD.firstChild) { //http://jsperf.com/empty-node-if-needed
//otherwise empty fields appear borderless in demo/renderers.html (IE)
TD.appendChild(document.createTextNode('\u00A0')); //\u00A0 equals for a text node
//this is faster than innerHTML. See: https://github.com/warpech/jquery-handsontable/wiki/JavaScript-&-DOM-performance-tips
}
if (!instance.acArrowListener) {
//not very elegant but easy and fast
instance.acArrowListener = function () {
instance.view.wt.getSetting('onCellDblClick');
};
instance.rootElement.on('mousedown', '.htAutocompleteArrow', instance.acArrowListener); //this way we don't bind event listener to each arrow. We rely on propagation instead
}
};
Handsontable.AutocompleteRenderer = AutocompleteRenderer;
Handsontable.renderers.AutocompleteRenderer = AutocompleteRenderer;
Handsontable.renderers.registerRenderer('autocomplete', AutocompleteRenderer);
})(Handsontable);
/**
* Checkbox renderer
* @param {Object} instance Handsontable instance
* @param {Element} TD Table cell where to render
* @param {Number} row
* @param {Number} col
* @param {String|Number} prop Row object property name
* @param value Value to render (remember to escape unsafe HTML before inserting to DOM!)
* @param {Object} cellProperties Cell properites (shared by cell renderer and editor)
*/
(function (Handsontable) {
'use strict';
var clonableINPUT = document.createElement('INPUT');
clonableINPUT.className = 'htCheckboxRendererInput';
clonableINPUT.type = 'checkbox';
clonableINPUT.setAttribute('autocomplete', 'off');
var CheckboxRenderer = function (instance, TD, row, col, prop, value, cellProperties) {
if (typeof cellProperties.checkedTemplate === "undefined") {
cellProperties.checkedTemplate = true;
}
if (typeof cellProperties.uncheckedTemplate === "undefined") {
cellProperties.uncheckedTemplate = false;
}
instance.view.wt.wtDom.empty(TD); //TODO identify under what circumstances this line can be removed
var INPUT = clonableINPUT.cloneNode(false); //this is faster than createElement
if (value === cellProperties.checkedTemplate || value === Handsontable.helper.stringify(cellProperties.checkedTemplate)) {
INPUT.checked = true;
TD.appendChild(INPUT);
}
else if (value === cellProperties.uncheckedTemplate || value === Handsontable.helper.stringify(cellProperties.uncheckedTemplate)) {
TD.appendChild(INPUT);
}
else if (value === null) { //default value
INPUT.className += ' noValue';
TD.appendChild(INPUT);
}
else {
instance.view.wt.wtDom.fastInnerText(TD, '#bad value#'); //this is faster than innerHTML. See: https://github.com/warpech/jquery-handsontable/wiki/JavaScript-&-DOM-performance-tips
}
var $input = $(INPUT);
if (cellProperties.readOnly) {
$input.on('click', function (event) {
event.preventDefault();
});
}
else {
$input.on('mousedown', function (event) {
event.stopPropagation(); //otherwise can confuse cell mousedown handler
});
$input.on('mouseup', function (event) {
event.stopPropagation(); //otherwise can confuse cell dblclick handler
});
$input.on('change', function(){
if (this.checked) {
instance.setDataAtRowProp(row, prop, cellProperties.checkedTemplate);
}
else {
instance.setDataAtRowProp(row, prop, cellProperties.uncheckedTemplate);
}
});
}
if(!instance.CheckboxRenderer || !instance.CheckboxRenderer.beforeKeyDownHookBound){
instance.CheckboxRenderer = {
beforeKeyDownHookBound : true
};
instance.addHook('beforeKeyDown', function(event){
if(event.keyCode == Handsontable.helper.keyCode.SPACE){
var selection = instance.getSelected();
var cell, checkbox, cellProperties;
var selStart = {
row: Math.min(selection[0], selection[2]),
col: Math.min(selection[1], selection[3])
};
var selEnd = {
row: Math.max(selection[0], selection[2]),
col: Math.max(selection[1], selection[3])
};
for(var row = selStart.row; row <= selEnd.row; row++ ){
for(var col = selEnd.col; col <= selEnd.col; col++){
cell = instance.getCell(row, col);
cellProperties = instance.getCellMeta(row, col);
checkbox = cell.querySelectorAll('input[type=checkbox]');
if(checkbox.length > 0 && !cellProperties.readOnly){
if(!event.isImmediatePropagationStopped()){
event.stopImmediatePropagation();
event.preventDefault();
}
for(var i = 0, len = checkbox.length; i < len; i++){
checkbox[i].checked = !checkbox[i].checked;
$(checkbox[i]).trigger('change');
}
}
}
}
}
});
}
};
Handsontable.CheckboxRenderer = CheckboxRenderer;
Handsontable.renderers.CheckboxRenderer = CheckboxRenderer;
Handsontable.renderers.registerRenderer('checkbox', CheckboxRenderer);
})(Handsontable);
/**
* Numeric cell renderer
* @param {Object} instance Handsontable instance
* @param {Element} TD Table cell where to render
* @param {Number} row
* @param {Number} col
* @param {String|Number} prop Row object property name
* @param value Value to render (remember to escape unsafe HTML before inserting to DOM!)
* @param {Object} cellProperties Cell properites (shared by cell renderer and editor)
*/
(function (Handsontable) {
'use strict';
var NumericRenderer = function (instance, TD, row, col, prop, value, cellProperties) {
if (Handsontable.helper.isNumeric(value)) {
if (typeof cellProperties.language !== 'undefined') {
numeral.language(cellProperties.language)
}
value = numeral(value).format(cellProperties.format || '0'); //docs: http://numeraljs.com/
instance.view.wt.wtDom.addClass(TD, 'htNumeric');
}
Handsontable.renderers.TextRenderer(instance, TD, row, col, prop, value, cellProperties);
};
Handsontable.NumericRenderer = NumericRenderer; //Left for backward compatibility with versions prior 0.10.0
Handsontable.renderers.NumericRenderer = NumericRenderer;
Handsontable.renderers.registerRenderer('numeric', NumericRenderer);
})(Handsontable);
(function(Handosntable){
'use strict';
var PasswordRenderer = function (instance, TD, row, col, prop, value, cellProperties) {
Handsontable.renderers.TextRenderer.apply(this, arguments);
value = TD.innerHTML;
var hash;
var hashLength = cellProperties.hashLength || value.length;
var hashSymbol = cellProperties.hashSymbol || '*';
for( hash = ''; hash.split(hashSymbol).length - 1 < hashLength; hash += hashSymbol);
instance.view.wt.wtDom.fastInnerHTML(TD, hash);
};
Handosntable.PasswordRenderer = PasswordRenderer;
Handosntable.renderers.PasswordRenderer = PasswordRenderer;
Handosntable.renderers.registerRenderer('password', PasswordRenderer);
})(Handsontable);
(function (Handsontable) {
function HtmlRenderer(instance, TD, row, col, prop, value, cellProperties){
Handsontable.renderers.cellDecorator.apply(this, arguments);
Handsontable.Dom.fastInnerHTML(TD, value);
}
Handsontable.renderers.registerRenderer('html', HtmlRenderer);
Handsontable.renderers.HtmlRenderer = HtmlRenderer;
})(Handsontable);
(function (Handsontable) {
'use strict';
Handsontable.EditorState = {
VIRGIN: 'STATE_VIRGIN', //before editing
EDITING: 'STATE_EDITING',
WAITING: 'STATE_WAITING', //waiting for async validation
FINISHED: 'STATE_FINISHED'
};
function BaseEditor(instance) {
this.instance = instance;
this.state = Handsontable.EditorState.VIRGIN;
this._opened = false;
this._closeCallback = null;
this.init();
}
BaseEditor.prototype._fireCallbacks = function(result) {
if(this._closeCallback){
this._closeCallback(result);
this._closeCallback = null;
}
}
BaseEditor.prototype.init = function(){};
BaseEditor.prototype.getValue = function(){
throw Error('Editor getValue() method unimplemented');
};
BaseEditor.prototype.setValue = function(newValue){
throw Error('Editor setValue() method unimplemented');
};
BaseEditor.prototype.open = function(){
throw Error('Editor open() method unimplemented');
};
BaseEditor.prototype.close = function(){
throw Error('Editor close() method unimplemented');
};
BaseEditor.prototype.prepare = function(row, col, prop, td, originalValue, cellProperties){
this.TD = td;
this.row = row;
this.col = col;
this.prop = prop;
this.originalValue = originalValue;
this.cellProperties = cellProperties;
this.state = Handsontable.EditorState.VIRGIN;
};
BaseEditor.prototype.extend = function(){
var baseClass = this.constructor;
function Editor(){
baseClass.apply(this, arguments);
}
function inherit(Child, Parent){
function Bridge() {
}
Bridge.prototype = Parent.prototype;
Child.prototype = new Bridge();
Child.prototype.constructor = Child;
return Child;
}
return inherit(Editor, baseClass);
};
BaseEditor.prototype.saveValue = function (val, ctrlDown) {
if (ctrlDown) { //if ctrl+enter and multiple cells selected, behave like Excel (finish editing and apply to all cells)
var sel = this.instance.getSelected();
this.instance.populateFromArray(sel[0], sel[1], val, sel[2], sel[3], 'edit');
}
else {
this.instance.populateFromArray(this.row, this.col, val, null, null, 'edit');
}
};
BaseEditor.prototype.beginEditing = function(initialValue){
if (this.state != Handsontable.EditorState.VIRGIN) {
return;
}
if (this.cellProperties.readOnly) {
return;
}
this.instance.view.scrollViewport({row: this.row, col: this.col});
this.instance.view.render();
this.state = Handsontable.EditorState.EDITING;
initialValue = typeof initialValue == 'string' ? initialValue : this.originalValue;
this.setValue(Handsontable.helper.stringify(initialValue));
this.open();
this._opened = true;
this.focus();
this.instance.view.render(); //only rerender the selections (FillHandle should disappear when beginediting is triggered)
};
BaseEditor.prototype.finishEditing = function (restoreOriginalValue, ctrlDown, callback) {
if (callback) {
var previousCloseCallback = this._closeCallback;
this._closeCallback = function (result) {
if(previousCloseCallback){
previousCloseCallback(result);
}
callback(result);
};
}
if (this.isWaiting()) {
return;
}
if (this.state == Handsontable.EditorState.VIRGIN) {
var that = this;
setTimeout(function () {
that._fireCallbacks(true);
});
return;
}
if (this.state == Handsontable.EditorState.EDITING) {
if (restoreOriginalValue) {
this.cancelChanges();
return;
}
var val = [
[String.prototype.trim.call(this.getValue())] //String.prototype.trim is defined in Walkontable polyfill.js
];
this.state = Handsontable.EditorState.WAITING;
this.saveValue(val, ctrlDown);
if(this.instance.getCellValidator(this.cellProperties)){
var that = this;
this.instance.addHookOnce('afterValidate', function (result) {
that.state = Handsontable.EditorState.FINISHED;
that.discardEditor(result);
});
} else {
this.state = Handsontable.EditorState.FINISHED;
this.discardEditor(true);
}
}
};
BaseEditor.prototype.cancelChanges = function () {
this.state = Handsontable.EditorState.FINISHED;
this.discardEditor();
};
BaseEditor.prototype.discardEditor = function (result) {
if (this.state !== Handsontable.EditorState.FINISHED) {
return;
}
if (result === false && this.cellProperties.allowInvalid !== true) { //validator was defined and failed
this.instance.selectCell(this.row, this.col);
this.focus();
this.state = Handsontable.EditorState.EDITING;
this._fireCallbacks(false);
}
else {
this.close();
this._opened = false;
this.state = Handsontable.EditorState.VIRGIN;
this._fireCallbacks(true);
}
};
BaseEditor.prototype.isOpened = function(){
return this._opened;
};
BaseEditor.prototype.isWaiting = function () {
return this.state === Handsontable.EditorState.WAITING;
};
Handsontable.editors.BaseEditor = BaseEditor;
})(Handsontable);
(function(Handsontable){
var TextEditor = Handsontable.editors.BaseEditor.prototype.extend();
TextEditor.prototype.init = function(){
this.createElements();
this.bindEvents();
};
TextEditor.prototype.getValue = function(){
return this.TEXTAREA.value
};
TextEditor.prototype.setValue = function(newValue){
this.TEXTAREA.value = newValue;
};
var onBeforeKeyDown = function onBeforeKeyDown(event){
var instance = this;
var that = instance.getActiveEditor();
var keyCodes = Handsontable.helper.keyCode;
var ctrlDown = (event.ctrlKey || event.metaKey) && !event.altKey; //catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
//Process only events that have been fired in the editor
if (event.target !== that.TEXTAREA || event.isImmediatePropagationStopped()){
return;
}
if (event.keyCode === 17 || event.keyCode === 224 || event.keyCode === 91 || event.keyCode === 93) {
//when CTRL or its equivalent is pressed and cell is edited, don't prepare selectable text in textarea
event.stopImmediatePropagation();
return;
}
switch (event.keyCode) {
case keyCodes.ARROW_RIGHT:
if (that.wtDom.getCaretPosition(that.TEXTAREA) !== that.TEXTAREA.value.length) {
event.stopImmediatePropagation();
}
break;
case keyCodes.ARROW_LEFT: /* arrow left */
if (that.wtDom.getCaretPosition(that.TEXTAREA) !== 0) {
event.stopImmediatePropagation();
}
break;
case keyCodes.ENTER:
var selected = that.instance.getSelected();
var isMultipleSelection = !(selected[0] === selected[2] && selected[1] === selected[3]);
if ((ctrlDown && !isMultipleSelection) || event.altKey) { //if ctrl+enter or alt+enter, add new line
if(that.isOpened()){
that.setValue(that.getValue() + '\n');
that.focus();
} else {
that.beginEditing(that.originalValue + '\n')
}
event.stopImmediatePropagation();
}
event.preventDefault(); //don't add newline to field
break;
case keyCodes.A:
case keyCodes.X:
case keyCodes.C:
case keyCodes.V:
if(ctrlDown){
event.stopImmediatePropagation(); //CTRL+A, CTRL+C, CTRL+V, CTRL+X should only work locally when cell is edited (not in table context)
break;
}
case keyCodes.BACKSPACE:
case keyCodes.DELETE:
case keyCodes.HOME:
case keyCodes.END:
event.stopImmediatePropagation(); //backspace, delete, home, end should only work locally when cell is edited (not in table context)
break;
}
};
TextEditor.prototype.open = function(){
this.refreshDimensions(); //need it instantly, to prevent https://github.com/warpech/jquery-handsontable/issues/348
this.instance.addHook('beforeKeyDown', onBeforeKeyDown);
};
TextEditor.prototype.close = function(){
this.textareaParentStyle.display = 'none';
if (document.activeElement === this.TEXTAREA) {
this.instance.listen(); //don't refocus the table if user focused some cell outside of HT on purpose
}
this.instance.removeHook('beforeKeyDown', onBeforeKeyDown);
};
TextEditor.prototype.focus = function(){
this.TEXTAREA.focus();
this.wtDom.setCaretPosition(this.TEXTAREA, this.TEXTAREA.value.length);
};
TextEditor.prototype.createElements = function () {
this.$body = $(document.body);
this.wtDom = new WalkontableDom();
this.TEXTAREA = document.createElement('TEXTAREA');
this.$textarea = $(this.TEXTAREA);
this.wtDom.addClass(this.TEXTAREA, 'handsontableInput');
this.textareaStyle = this.TEXTAREA.style;
this.textareaStyle.width = 0;
this.textareaStyle.height = 0;
this.TEXTAREA_PARENT = document.createElement('DIV');
this.wtDom.addClass(this.TEXTAREA_PARENT, 'handsontableInputHolder');
this.textareaParentStyle = this.TEXTAREA_PARENT.style;
this.textareaParentStyle.top = 0;
this.textareaParentStyle.left = 0;
this.textareaParentStyle.display = 'none';
this.TEXTAREA_PARENT.appendChild(this.TEXTAREA);
this.instance.rootElement[0].appendChild(this.TEXTAREA_PARENT);
var that = this;
Handsontable.PluginHooks.add('afterRender', function () {
that.instance.registerTimeout('refresh_editor_dimensions', function () {
that.refreshDimensions();
}, 0);
});
};
TextEditor.prototype.refreshDimensions = function () {
if (this.state !== Handsontable.EditorState.EDITING) {
return;
}
///start prepare textarea position
this.TD = this.instance.getCell(this.row, this.col);
if (!this.TD) {
//TD is outside of the viewport. Otherwise throws exception when scrolling the table while a cell is edited
return;
}
var $td = $(this.TD); //because old td may have been scrolled out with scrollViewport
var currentOffset = this.wtDom.offset(this.TD);
var containerOffset = this.wtDom.offset(this.instance.rootElement[0]);
var scrollTop = this.instance.rootElement.scrollTop();
var scrollLeft = this.instance.rootElement.scrollLeft();
var editTop = currentOffset.top - containerOffset.top + scrollTop - 1;
var editLeft = currentOffset.left - containerOffset.left + scrollLeft - 1;
var settings = this.instance.getSettings();
var rowHeadersCount = settings.rowHeaders === false ? 0 : 1;
var colHeadersCount = settings.colHeaders === false ? 0 : 1;
if (editTop < 0) {
editTop = 0;
}
if (editLeft < 0) {
editLeft = 0;
}
if (rowHeadersCount > 0 && parseInt($td.css('border-top-width'), 10) > 0) {
editTop += 1;
}
if (colHeadersCount > 0 && parseInt($td.css('border-left-width'), 10) > 0) {
editLeft += 1;
}
this.textareaParentStyle.top = editTop + 'px';
this.textareaParentStyle.left = editLeft + 'px';
///end prepare textarea position
var width = $td.width()
, maxWidth = this.instance.view.maximumVisibleElementWidth(editLeft) - 10 //10 is TEXTAREAs border and padding
, height = $td.outerHeight() - 4
, maxHeight = this.instance.view.maximumVisibleElementHeight(editTop) - 5; //10 is TEXTAREAs border and padding
if (parseInt($td.css('border-top-width'), 10) > 0) {
height -= 1;
}
if (parseInt($td.css('border-left-width'), 10) > 0) {
if (rowHeadersCount > 0) {
width -= 1;
}
}
//in future may change to pure JS http://stackoverflow.com/questions/454202/creating-a-textarea-with-auto-resize
this.$textarea.autoResize({
minHeight: Math.min(height, maxHeight),
maxHeight: maxHeight, //TEXTAREA should never be wider than visible part of the viewport (should not cover the scrollbar)
minWidth: Math.min(width, maxWidth),
maxWidth: maxWidth, //TEXTAREA should never be wider than visible part of the viewport (should not cover the scrollbar)
animate: false,
extraSpace: 0
});
this.textareaParentStyle.display = 'block';
};
TextEditor.prototype.bindEvents = function () {
this.$textarea.on('cut.editor', function (event) {
event.stopPropagation();
});
this.$textarea.on('paste.editor', function (event) {
event.stopPropagation();
});
};
Handsontable.editors.TextEditor = TextEditor;
Handsontable.editors.registerEditor('text', Handsontable.editors.TextEditor);
})(Handsontable);
(function(Handsontable){
//Blank editor, because all the work is done by renderer
var CheckboxEditor = Handsontable.editors.BaseEditor.prototype.extend();
CheckboxEditor.prototype.beginEditing = function () {
this.saveValue([
[!this.originalValue]
]);
};
CheckboxEditor.prototype.finishEditing = function () {};
CheckboxEditor.prototype.init = function () {};
CheckboxEditor.prototype.open = function () {};
CheckboxEditor.prototype.close = function () {};
CheckboxEditor.prototype.getValue = function () {};
CheckboxEditor.prototype.setValue = function () {};
CheckboxEditor.prototype.focus = function () {};
Handsontable.editors.CheckboxEditor = CheckboxEditor;
Handsontable.editors.registerEditor('checkbox', CheckboxEditor);
})(Handsontable);
(function (Handsontable) {
var DateEditor = Handsontable.editors.TextEditor.prototype.extend();
DateEditor.prototype.init = function () {
if (!$.datepicker) {
throw new Error("jQuery UI Datepicker dependency not found. Did you forget to include jquery-ui.custom.js or its substitute?");
}
Handsontable.editors.TextEditor.prototype.init.apply(this, arguments);
this.isCellEdited = false;
var that = this;
this.instance.addHook('afterDestroy', function () {
that.destroyElements();
})
};
DateEditor.prototype.createElements = function () {
Handsontable.editors.TextEditor.prototype.createElements.apply(this, arguments);
this.datePicker = document.createElement('DIV');
this.instance.view.wt.wtDom.addClass(this.datePicker, 'htDatepickerHolder');
this.datePickerStyle = this.datePicker.style;
this.datePickerStyle.position = 'absolute';
this.datePickerStyle.top = 0;
this.datePickerStyle.left = 0;
this.datePickerStyle.zIndex = 99;
document.body.appendChild(this.datePicker);
this.$datePicker = $(this.datePicker);
var that = this;
var defaultOptions = {
dateFormat: "yy-mm-dd",
showButtonPanel: true,
changeMonth: true,
changeYear: true,
onSelect: function (dateStr) {
that.setValue(dateStr);
that.finishEditing(false);
}
};
this.$datePicker.datepicker(defaultOptions);
/**
* Prevent recognizing clicking on jQuery Datepicker as clicking outside of table
*/
this.$datePicker.on('mousedown', function (event) {
event.stopPropagation();
});
this.hideDatepicker();
};
DateEditor.prototype.destroyElements = function () {
this.$datePicker.datepicker('destroy');
this.$datePicker.remove();
};
DateEditor.prototype.beginEditing = function (row, col, prop, useOriginalValue, suffix) {
Handsontable.editors.TextEditor.prototype.beginEditing.apply(this, arguments);
this.showDatepicker();
};
DateEditor.prototype.finishEditing = function (isCancelled, ctrlDown) {
this.hideDatepicker();
Handsontable.editors.TextEditor.prototype.finishEditing.apply(this, arguments);
};
DateEditor.prototype.showDatepicker = function () {
var $td = $(this.TD);
var offset = $td.offset();
this.datePickerStyle.top = (offset.top + $td.height()) + 'px';
this.datePickerStyle.left = offset.left + 'px';
var dateOptions = {
defaultDate: this.originalValue || void 0
};
$.extend(dateOptions, this.cellProperties);
this.$datePicker.datepicker("option", dateOptions);
if (this.originalValue) {
this.$datePicker.datepicker("setDate", this.originalValue);
}
this.datePickerStyle.display = 'block';
};
DateEditor.prototype.hideDatepicker = function () {
this.datePickerStyle.display = 'none';
};
Handsontable.editors.DateEditor = DateEditor;
Handsontable.editors.registerEditor('date', DateEditor);
})(Handsontable);
/**
* This is inception. Using Handsontable as Handsontable editor
*/
(function (Handsontable) {
"use strict";
var HandsontableEditor = Handsontable.editors.TextEditor.prototype.extend();
HandsontableEditor.prototype.createElements = function () {
Handsontable.editors.TextEditor.prototype.createElements.apply(this, arguments);
var DIV = document.createElement('DIV');
DIV.className = 'handsontableEditor';
this.TEXTAREA_PARENT.appendChild(DIV);
this.$htContainer = $(DIV);
this.$htContainer.handsontable();
};
HandsontableEditor.prototype.prepare = function (td, row, col, prop, value, cellProperties) {
Handsontable.editors.TextEditor.prototype.prepare.apply(this, arguments);
var parent = this;
var options = {
startRows: 0,
startCols: 0,
minRows: 0,
minCols: 0,
className: 'listbox',
copyPaste: false,
cells: function () {
return {
readOnly: true
}
},
fillHandle: false,
afterOnCellMouseDown: function () {
var value = this.getValue();
if (value !== void 0) { //if the value is undefined then it means we don't want to set the value
parent.setValue(value);
}
parent.instance.destroyEditor();
},
beforeOnKeyDown: function (event) {
var instance = this;
switch (event.keyCode) {
case Handsontable.helper.keyCode.ESCAPE:
parent.instance.destroyEditor(true);
event.stopImmediatePropagation();
event.preventDefault();
break;
case Handsontable.helper.keyCode.ENTER: //enter
var sel = instance.getSelected();
var value = this.getDataAtCell(sel[0], sel[1]);
if (value !== void 0) { //if the value is undefined then it means we don't want to set the value
parent.setValue(value);
}
parent.instance.destroyEditor();
break;
case Handsontable.helper.keyCode.ARROW_UP:
if (instance.getSelected() && instance.getSelected()[0] == 0 && !parent.cellProperties.strict){
instance.deselectCell();
parent.instance.listen();
parent.focus();
event.preventDefault();
event.stopImmediatePropagation();
}
break;
}
}
};
if (this.cellProperties.handsontable) {
options = $.extend(options, cellProperties.handsontable);
}
this.$htContainer.handsontable('destroy');
this.$htContainer.handsontable(options);
};
var onBeforeKeyDown = function (event) {
if (event.isImmediatePropagationStopped()) {
return;
}
var editor = this.getActiveEditor();
var innerHOT = editor.$htContainer.handsontable('getInstance');
if (event.keyCode == Handsontable.helper.keyCode.ARROW_DOWN) {
if (!innerHOT.getSelected()){
innerHOT.selectCell(0, 0);
} else {
var selectedRow = innerHOT.getSelected()[0];
var rowToSelect = selectedRow < innerHOT.countRows() - 1 ? selectedRow + 1 : selectedRow;
innerHOT.selectCell(rowToSelect, 0);
}
event.preventDefault();
event.stopImmediatePropagation();
}
};
HandsontableEditor.prototype.open = function () {
this.instance.addHook('beforeKeyDown', onBeforeKeyDown);
Handsontable.editors.TextEditor.prototype.open.apply(this, arguments);
this.$htContainer.handsontable('render');
if (this.cellProperties.strict) {
this.$htContainer.handsontable('selectCell', 0, 0);
this.$textarea[0].style.visibility = 'hidden';
} else {
this.$htContainer.handsontable('deselectCell');
this.$textarea[0].style.visibility = 'visible';
}
this.wtDom.setCaretPosition(this.$textarea[0], 0, this.$textarea[0].value.length);
};
HandsontableEditor.prototype.close = function () {
this.instance.removeHook('beforeKeyDown', onBeforeKeyDown);
this.instance.listen();
Handsontable.editors.TextEditor.prototype.close.apply(this, arguments);
};
HandsontableEditor.prototype.focus = function () {
this.instance.listen();
Handsontable.editors.TextEditor.prototype.focus.apply(this, arguments);
};
HandsontableEditor.prototype.beginEditing = function (initialValue) {
var onBeginEditing = this.instance.getSettings().onBeginEditing;
if (onBeginEditing && onBeginEditing() === false) {
return;
}
Handsontable.editors.TextEditor.prototype.beginEditing.apply(this, arguments);
};
HandsontableEditor.prototype.finishEditing = function (isCancelled, ctrlDown) {
if (this.$htContainer.handsontable('isListening')) { //if focus is still in the HOT editor
this.instance.listen(); //return the focus to the parent HOT instance
}
if (this.$htContainer.handsontable('getSelected')) {
var value = this.$htContainer.handsontable('getInstance').getValue();
if (value !== void 0) { //if the value is undefined then it means we don't want to set the value
this.setValue(value);
}
}
return Handsontable.editors.TextEditor.prototype.finishEditing.apply(this, arguments);
};
Handsontable.editors.HandsontableEditor = HandsontableEditor;
Handsontable.editors.registerEditor('handsontable', HandsontableEditor);
})(Handsontable);
(function (Handsontable) {
var AutocompleteEditor = Handsontable.editors.HandsontableEditor.prototype.extend();
AutocompleteEditor.prototype.init = function () {
Handsontable.editors.HandsontableEditor.prototype.init.apply(this, arguments);
this.query = null;
};
AutocompleteEditor.prototype.createElements = function(){
Handsontable.editors.HandsontableEditor.prototype.createElements.apply(this, arguments);
this.$htContainer.addClass('autocompleteEditor');
};
AutocompleteEditor.prototype.bindEvents = function(){
var that = this;
this.$textarea.on('keydown.autocompleteEditor', function(event){
if(!Handsontable.helper.isMetaKey(event.keyCode) || [Handsontable.helper.keyCode.BACKSPACE, Handsontable.helper.keyCode.DELETE].indexOf(event.keyCode) != -1){
setTimeout(function () {
that.queryChoices(that.$textarea.val());
});
} else if (event.keyCode == Handsontable.helper.keyCode.ENTER && that.cellProperties.strict !== true){
that.$htContainer.handsontable('deselectCell');
}
});
this.$htContainer.on('mouseenter', function () {
that.$htContainer.handsontable('deselectCell');
});
this.$htContainer.on('mouseleave', function () {
that.queryChoices(that.query);
});
Handsontable.editors.HandsontableEditor.prototype.bindEvents.apply(this, arguments);
};
AutocompleteEditor.prototype.beginEditing = function () {
Handsontable.editors.HandsontableEditor.prototype.beginEditing.apply(this, arguments);
var that = this;
setTimeout(function () {
that.queryChoices(that.TEXTAREA.value);
});
var hot = this.$htContainer.handsontable('getInstance');
hot.updateSettings({
'colWidths': [this.wtDom.outerWidth(this.TEXTAREA) - 2],
afterRenderer: function (TD, row, col, prop, value) {
var caseSensitive = this.getCellMeta(row, col).filteringCaseSensitive === true;
var indexOfMatch = caseSensitive ? value.indexOf(that.query) : value.toLowerCase().indexOf(that.query.toLowerCase());
if(indexOfMatch != -1){
var match = value.substr(indexOfMatch, that.query.length);
TD.innerHTML = value.replace(match, '<strong>' + match + '</strong>');
}
}
});
};
var onBeforeKeyDownInner;
AutocompleteEditor.prototype.open = function () {
var parent = this;
onBeforeKeyDownInner = function (event) {
var instance = this;
if (event.keyCode == Handsontable.helper.keyCode.ARROW_UP){
if (instance.getSelected() && instance.getSelected()[0] == 0){
if(!parent.cellProperties.strict){
instance.deselectCell();
}
parent.instance.listen();
parent.focus();
event.preventDefault();
event.stopImmediatePropagation();
}
}
};
this.$htContainer.handsontable('getInstance').addHook('beforeKeyDown', onBeforeKeyDownInner);
Handsontable.editors.HandsontableEditor.prototype.open.apply(this, arguments);
this.$textarea[0].style.visibility = 'visible';
parent.focus();
};
AutocompleteEditor.prototype.close = function () {
this.$htContainer.handsontable('getInstance').removeHook('beforeKeyDown', onBeforeKeyDownInner);
Handsontable.editors.HandsontableEditor.prototype.close.apply(this, arguments);
};
AutocompleteEditor.prototype.queryChoices = function(query){
this.query = query;
if (typeof this.cellProperties.source == 'function'){
var that = this;
this.cellProperties.source(query, function(choices){
that.updateChoicesList(choices)
});
} else if (Handsontable.helper.isArray(this.cellProperties.source)) {
var choices;
if(!query || this.cellProperties.filter === false){
choices = this.cellProperties.source;
} else {
var filteringCaseSensitive = this.cellProperties.filteringCaseSensitive === true;
var lowerCaseQuery = query.toLowerCase();
choices = this.cellProperties.source.filter(function(choice){
if (filteringCaseSensitive) {
return choice.indexOf(query) != -1;
} else {
return choice.toLowerCase().indexOf(lowerCaseQuery) != -1;
}
});
}
this.updateChoicesList(choices)
} else {
this.updateChoicesList([]);
}
};
function findItemIndexToHighlight(items, value){
var bestMatch = {};
var valueLength = value.length;
var currentItem;
var indexOfValue;
var charsLeft;
for(var i = 0, len = items.length; i < len; i++){
currentItem = items[i];
if(valueLength > 0){
indexOfValue = currentItem.indexOf(value)
} else {
indexOfValue = currentItem === value ? 0 : -1;
}
if(indexOfValue == -1) continue;
charsLeft = currentItem.length - indexOfValue - valueLength;
if( typeof bestMatch.indexOfValue == 'undefined'
|| bestMatch.indexOfValue > indexOfValue
|| ( bestMatch.indexOfValue == indexOfValue && bestMatch.charsLeft > charsLeft ) ){
bestMatch.indexOfValue = indexOfValue;
bestMatch.charsLeft = charsLeft;
bestMatch.index = i;
}
}
return bestMatch.index;
}
AutocompleteEditor.prototype.updateChoicesList = function (choices) {
this.$htContainer.handsontable('loadData', Handsontable.helper.pivot([choices]));
var value = this.getValue();
var rowToHighlight;
if(this.cellProperties.strict === true){
rowToHighlight = findItemIndexToHighlight(choices, value);
if ( typeof rowToHighlight == 'undefined' && this.cellProperties.allowInvalid === false){
rowToHighlight = 0;
}
}
if(typeof rowToHighlight == 'undefined'){
this.$htContainer.handsontable('deselectCell');
} else {
this.$htContainer.handsontable('selectCell', rowToHighlight, 0);
}
this.focus();
};
Handsontable.editors.AutocompleteEditor = AutocompleteEditor;
Handsontable.editors.registerEditor('autocomplete', AutocompleteEditor);
})(Handsontable);
(function(Handsontable){
var PasswordEditor = Handsontable.editors.TextEditor.prototype.extend();
var wtDom = new WalkontableDom();
PasswordEditor.prototype.createElements = function () {
Handsontable.editors.TextEditor.prototype.createElements.apply(this, arguments);
this.TEXTAREA = document.createElement('input');
this.TEXTAREA.setAttribute('type', 'password');
this.TEXTAREA.className = 'handsontableInput';
this.textareaStyle = this.TEXTAREA.style;
this.textareaStyle.width = 0;
this.textareaStyle.height = 0;
this.$textarea = $(this.TEXTAREA);
wtDom.empty(this.TEXTAREA_PARENT);
this.TEXTAREA_PARENT.appendChild(this.TEXTAREA);
};
Handsontable.editors.PasswordEditor = PasswordEditor;
Handsontable.editors.registerEditor('password', PasswordEditor);
})(Handsontable);
(function (Handsontable) {
var SelectEditor = Handsontable.editors.BaseEditor.prototype.extend();
SelectEditor.prototype.init = function(){
this.select = $('<select />')
.addClass('htSelectEditor')
.hide();
this.instance.rootElement.append(this.select);
};
SelectEditor.prototype.prepare = function(){
Handsontable.editors.BaseEditor.prototype.prepare.apply(this, arguments);
var selectOptions = this.cellProperties.selectOptions;
var options;
if (typeof selectOptions == 'function'){
options = this.prepareOptions(selectOptions(this.row, this.col, this.prop))
} else {
options = this.prepareOptions(selectOptions);
}
var optionElements = [];
for (var option in options){
if (options.hasOwnProperty(option)){
var optionElement = $('<option />');
optionElement.val(option);
optionElement.html(options[option]);
optionElements.push(optionElement);
}
}
this.select.empty();
this.select.append(optionElements);
};
SelectEditor.prototype.prepareOptions = function(optionsToPrepare){
var preparedOptions = {};
if (Handsontable.helper.isArray(optionsToPrepare)){
for(var i = 0, len = optionsToPrepare.length; i < len; i++){
preparedOptions[optionsToPrepare[i]] = optionsToPrepare[i];
}
}
else if (typeof optionsToPrepare == 'object') {
preparedOptions = optionsToPrepare;
}
return preparedOptions;
};
SelectEditor.prototype.getValue = function () {
return this.select.val();
};
SelectEditor.prototype.setValue = function (value) {
this.select.val(value);
};
var onBeforeKeyDown = function (event) {
var instance = this;
var editor = instance.getActiveEditor();
switch (event.keyCode){
case Handsontable.helper.keyCode.ARROW_UP:
var previousOption = editor.select.find('option:selected').prev();
if (previousOption.length == 1){
previousOption.prop('selected', true);
}
event.stopImmediatePropagation();
event.preventDefault();
break;
case Handsontable.helper.keyCode.ARROW_DOWN:
var nextOption = editor.select.find('option:selected').next();
if (nextOption.length == 1){
nextOption.prop('selected', true);
}
event.stopImmediatePropagation();
event.preventDefault();
break;
}
};
SelectEditor.prototype.open = function () {
this.select.css({
height: $(this.TD).height(),
'min-width' : $(this.TD).outerWidth()
});
this.select.show();
this.select.offset($(this.TD).offset());
this.instance.addHook('beforeKeyDown', onBeforeKeyDown);
};
SelectEditor.prototype.close = function () {
this.select.hide();
this.instance.removeHook('beforeKeyDown', onBeforeKeyDown);
};
SelectEditor.prototype.focus = function () {
this.select.focus();
};
Handsontable.editors.SelectEditor = SelectEditor;
Handsontable.editors.registerEditor('select', SelectEditor);
})(Handsontable);
(function (Handsontable) {
var DropdownEditor = Handsontable.editors.AutocompleteEditor.prototype.extend();
DropdownEditor.prototype.prepare = function () {
Handsontable.editors.AutocompleteEditor.prototype.prepare.apply(this, arguments);
this.cellProperties.filter = false;
this.cellProperties.strict = true;
};
Handsontable.editors.DropdownEditor = DropdownEditor;
Handsontable.editors.registerEditor('dropdown', DropdownEditor);
})(Handsontable);
/**
* Numeric cell validator
* @param {*} value - Value of edited cell
* @param {*} callback - Callback called with validation result
*/
Handsontable.NumericValidator = function (value, callback) {
if (value === null) {
value = '';
}
callback(/^-?\d*\.?\d*$/.test(value));
};
/**
* Function responsible for validation of autocomplete value
* @param {*} value - Value of edited cell
* @param {*} calback - Callback called with validation result
*/
var process = function (value, callback) {
var originalVal = value;
var lowercaseVal = typeof originalVal === 'string' ? originalVal.toLowerCase() : null;
return function (source) {
var found = false;
for (var s = 0, slen = source.length; s < slen; s++) {
if (originalVal === source[s]) {
found = true; //perfect match
break;
}
else if (lowercaseVal === source[s].toLowerCase()) {
// changes[i][3] = source[s]; //good match, fix the case << TODO?
found = true;
break;
}
}
callback(found);
}
};
/**
* Autocomplete cell validator
* @param {*} value - Value of edited cell
* @param {*} calback - Callback called with validation result
*/
Handsontable.AutocompleteValidator = function (value, callback) {
if (this.strict && this.source) {
typeof this.source === 'function' ? this.source(value, process(value, callback)) : process(value, callback)(this.source);
} else {
callback(true);
}
};
/**
* Cell type is just a shortcut for setting bunch of cellProperties (used in getCellMeta)
*/
Handsontable.AutocompleteCell = {
editor: Handsontable.editors.AutocompleteEditor,
renderer: Handsontable.renderers.AutocompleteRenderer,
validator: Handsontable.AutocompleteValidator
};
Handsontable.CheckboxCell = {
editor: Handsontable.editors.CheckboxEditor,
renderer: Handsontable.renderers.CheckboxRenderer
};
Handsontable.TextCell = {
editor: Handsontable.editors.TextEditor,
renderer: Handsontable.renderers.TextRenderer
};
Handsontable.NumericCell = {
editor: Handsontable.editors.TextEditor,
renderer: Handsontable.renderers.NumericRenderer,
validator: Handsontable.NumericValidator,
dataType: 'number'
};
Handsontable.DateCell = {
editor: Handsontable.editors.DateEditor,
renderer: Handsontable.renderers.AutocompleteRenderer //displays small gray arrow on right side of the cell
};
Handsontable.HandsontableCell = {
editor: Handsontable.editors.HandsontableEditor,
renderer: Handsontable.renderers.AutocompleteRenderer //displays small gray arrow on right side of the cell
};
Handsontable.PasswordCell = {
editor: Handsontable.editors.PasswordEditor,
renderer: Handsontable.renderers.PasswordRenderer,
copyable: false
};
Handsontable.DropdownCell = {
editor: Handsontable.editors.DropdownEditor,
renderer: Handsontable.renderers.AutocompleteRenderer, //displays small gray arrow on right side of the cell
validator: Handsontable.AutocompleteValidator
};
//here setup the friendly aliases that are used by cellProperties.type
Handsontable.cellTypes = {
text: Handsontable.TextCell,
date: Handsontable.DateCell,
numeric: Handsontable.NumericCell,
checkbox: Handsontable.CheckboxCell,
autocomplete: Handsontable.AutocompleteCell,
handsontable: Handsontable.HandsontableCell,
password: Handsontable.PasswordCell,
dropdown: Handsontable.DropdownCell
};
//here setup the friendly aliases that are used by cellProperties.renderer and cellProperties.editor
Handsontable.cellLookup = {
validator: {
numeric: Handsontable.NumericValidator,
autocomplete: Handsontable.AutocompleteValidator
}
};
/*
* jQuery.fn.autoResize 1.1+
* --
* https://github.com/warpech/jQuery.fn.autoResize
*
* This fork differs from others in a way that it autoresizes textarea in 2-dimensions (horizontally and vertically).
* It was originally forked from alexbardas's repo but maybe should be merged with dpashkevich's repo in future.
*
* originally forked from:
* https://github.com/jamespadolsey/jQuery.fn.autoResize
* which is now located here:
* https://github.com/alexbardas/jQuery.fn.autoResize
* though the mostly maintained for is here:
* https://github.com/dpashkevich/jQuery.fn.autoResize/network
*
* --
* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details. */
(function($){
autoResize.defaults = {
onResize: function(){},
animate: {
duration: 200,
complete: function(){}
},
extraSpace: 50,
minHeight: 'original',
maxHeight: 500,
minWidth: 'original',
maxWidth: 500
};
autoResize.cloneCSSProperties = [
'lineHeight', 'textDecoration', 'letterSpacing',
'fontSize', 'fontFamily', 'fontStyle', 'fontWeight',
'textTransform', 'textAlign', 'direction', 'wordSpacing', 'fontSizeAdjust',
'padding'
];
autoResize.cloneCSSValues = {
position: 'absolute',
top: -9999,
left: -9999,
opacity: 0,
overflow: 'hidden',
overflowX: 'hidden',
overflowY: 'hidden',
border: '1px solid black',
padding: '0.49em' //this must be about the width of caps W character
};
autoResize.resizableFilterSelector = 'textarea,input:not(input[type]),input[type=text],input[type=password]';
autoResize.AutoResizer = AutoResizer;
$.fn.autoResize = autoResize;
function autoResize(config) {
this.filter(autoResize.resizableFilterSelector).each(function(){
new AutoResizer( $(this), config );
});
return this;
}
function AutoResizer(el, config) {
if(this.clones) return;
this.config = $.extend({}, autoResize.defaults, config);
this.el = el;
this.nodeName = el[0].nodeName.toLowerCase();
this.previousScrollTop = null;
if (config.maxWidth === 'original') config.maxWidth = el.width();
if (config.minWidth === 'original') config.minWidth = el.width();
if (config.maxHeight === 'original') config.maxHeight = el.height();
if (config.minHeight === 'original') config.minHeight = el.height();
if (this.nodeName === 'textarea') {
el.css({
resize: 'none',
overflowY: 'none'
});
}
el.data('AutoResizer', this);
this.createClone();
this.injectClone();
this.bind();
}
AutoResizer.prototype = {
bind: function() {
var check = $.proxy(function(){
this.check();
return true;
}, this);
this.unbind();
this.el
.bind('keyup.autoResize', check)
//.bind('keydown.autoResize', check)
.bind('change.autoResize', check);
this.check(null, true);
},
unbind: function() {
this.el.unbind('.autoResize');
},
createClone: function() {
var el = this.el,
self = this,
config = this.config;
this.clones = $();
if (config.minHeight !== 'original' || config.maxHeight !== 'original') {
this.hClone = el.clone().height('auto');
this.clones = this.clones.add(this.hClone);
}
if (config.minWidth !== 'original' || config.maxWidth !== 'original') {
this.wClone = $('<div/>').width('auto').css({
whiteSpace: 'nowrap',
'float': 'left'
});
this.clones = this.clones.add(this.wClone);
}
$.each(autoResize.cloneCSSProperties, function(i, p){
self.clones.css(p, el.css(p));
});
this.clones
.removeAttr('name')
.removeAttr('id')
.attr('tabIndex', -1)
.css(autoResize.cloneCSSValues)
.css('overflowY', 'scroll');
},
check: function(e, immediate) {
var config = this.config,
wClone = this.wClone,
hClone = this.hClone,
el = this.el,
value = el.val();
if (wClone) {
wClone.text(value);
// Calculate new width + whether to change
var cloneWidth = wClone.outerWidth(),
newWidth = (cloneWidth + config.extraSpace) >= config.minWidth ?
cloneWidth + config.extraSpace : config.minWidth,
currentWidth = el.width();
newWidth = Math.min(newWidth, config.maxWidth);
if (
(newWidth < currentWidth && newWidth >= config.minWidth) ||
(newWidth >= config.minWidth && newWidth <= config.maxWidth)
) {
config.onResize.call(el);
el.scrollLeft(0);
config.animate && !immediate ?
el.stop(1,1).animate({
width: newWidth
}, config.animate)
: el.width(newWidth);
}
}
if (hClone) {
if (newWidth) {
hClone.width(newWidth);
}
hClone.height(0).val(value).scrollTop(10000);
var scrollTop = hClone[0].scrollTop + config.extraSpace;
// Don't do anything if scrollTop hasen't changed:
if (this.previousScrollTop === scrollTop) {
return;
}
this.previousScrollTop = scrollTop;
if (scrollTop >= config.maxHeight) {
scrollTop = config.maxHeight;
}
if (scrollTop < config.minHeight) {
scrollTop = config.minHeight;
}
if(scrollTop == config.maxHeight && newWidth == config.maxWidth) {
el.css('overflowY', 'scroll');
}
else {
el.css('overflowY', 'hidden');
}
config.onResize.call(el);
// Either animate or directly apply height:
config.animate && !immediate ?
el.stop(1,1).animate({
height: scrollTop
}, config.animate)
: el.height(scrollTop);
}
},
destroy: function() {
this.unbind();
this.el.removeData('AutoResizer');
this.clones.remove();
delete this.el;
delete this.hClone;
delete this.wClone;
delete this.clones;
},
injectClone: function() {
(
autoResize.cloneContainer ||
(autoResize.cloneContainer = $('<arclones/>').appendTo('body'))
).empty().append(this.clones); //this should be refactored so that a node is never cloned more than once
}
};
})(jQuery);
/**
* SheetClip - Spreadsheet Clipboard Parser
* version 0.2
*
* This tiny library transforms JavaScript arrays to strings that are pasteable by LibreOffice, OpenOffice,
* Google Docs and Microsoft Excel.
*
* Copyright 2012, Marcin Warpechowski
* Licensed under the MIT license.
* http://github.com/warpech/sheetclip/
*/
/*jslint white: true*/
(function (global) {
"use strict";
function countQuotes(str) {
return str.split('"').length - 1;
}
global.SheetClip = {
parse: function (str) {
var r, rlen, rows, arr = [], a = 0, c, clen, multiline, last;
rows = str.split('\n');
if (rows.length > 1 && rows[rows.length - 1] === '') {
rows.pop();
}
for (r = 0, rlen = rows.length; r < rlen; r += 1) {
rows[r] = rows[r].split('\t');
for (c = 0, clen = rows[r].length; c < clen; c += 1) {
if (!arr[a]) {
arr[a] = [];
}
if (multiline && c === 0) {
last = arr[a].length - 1;
arr[a][last] = arr[a][last] + '\n' + rows[r][0];
if (multiline && (countQuotes(rows[r][0]) & 1)) { //& 1 is a bitwise way of performing mod 2
multiline = false;
arr[a][last] = arr[a][last].substring(0, arr[a][last].length - 1).replace(/""/g, '"');
}
}
else {
if (c === clen - 1 && rows[r][c].indexOf('"') === 0) {
arr[a].push(rows[r][c].substring(1).replace(/""/g, '"'));
multiline = true;
}
else {
arr[a].push(rows[r][c].replace(/""/g, '"'));
multiline = false;
}
}
}
if (!multiline) {
a += 1;
}
}
return arr;
},
stringify: function (arr) {
var r, rlen, c, clen, str = '', val;
for (r = 0, rlen = arr.length; r < rlen; r += 1) {
for (c = 0, clen = arr[r].length; c < clen; c += 1) {
if (c > 0) {
str += '\t';
}
val = arr[r][c];
if (typeof val === 'string') {
if (val.indexOf('\n') > -1) {
str += '"' + val.replace(/"/g, '""') + '"';
}
else {
str += val;
}
}
else if (val === null || val === void 0) { //void 0 resolves to undefined
str += '';
}
else {
str += val;
}
}
str += '\n';
}
return str;
}
};
}(window));
/**
* CopyPaste.js
* Creates a textarea that stays hidden on the page and gets focused when user presses CTRL while not having a form input focused
* In future we may implement a better driver when better APIs are available
* @constructor
*/
var CopyPaste = (function () {
var instance;
return {
getInstance: function () {
if (!instance) {
instance = new CopyPasteClass();
} else if (instance.hasBeenDestroyed()){
instance.init();
}
instance.refCounter++;
return instance;
}
};
})();
function CopyPasteClass() {
this.refCounter = 0;
this.init();
}
CopyPasteClass.prototype.init = function () {
var that = this
, style
, parent;
this.copyCallbacks = [];
this.cutCallbacks = [];
this.pasteCallbacks = [];
this.listenerElement = document.documentElement;
parent = document.body;
if (document.getElementById('CopyPasteDiv')) {
this.elDiv = document.getElementById('CopyPasteDiv');
this.elTextarea = this.elDiv.firstChild;
}
else {
this.elDiv = document.createElement('DIV');
this.elDiv.id = 'CopyPasteDiv';
style = this.elDiv.style;
style.position = 'fixed';
style.top = 0;
style.left = 0;
parent.appendChild(this.elDiv);
this.elTextarea = document.createElement('TEXTAREA');
this.elTextarea.className = 'copyPaste';
style = this.elTextarea.style;
style.width = '1px';
style.height = '1px';
this.elDiv.appendChild(this.elTextarea);
if (typeof style.opacity !== 'undefined') {
style.opacity = 0;
}
else {
/*@cc_on @if (@_jscript)
if(typeof style.filter === 'string') {
style.filter = 'alpha(opacity=0)';
}
@end @*/
}
}
this.keydownListener = function (event) {
var isCtrlDown = false;
if (event.metaKey) { //mac
isCtrlDown = true;
}
else if (event.ctrlKey && navigator.userAgent.indexOf('Mac') === -1) { //pc
isCtrlDown = true;
}
if (isCtrlDown) {
if (document.activeElement !== that.elTextarea && (that.getSelectionText() != '' || ['INPUT', 'SELECT', 'TEXTAREA'].indexOf(document.activeElement.nodeName) != -1)) {
return; //this is needed by fragmentSelection in Handsontable. Ignore copypaste.js behavior if fragment of cell text is selected
}
that.selectNodeText(that.elTextarea);
setTimeout(function () {
that.selectNodeText(that.elTextarea);
}, 0);
}
/* 67 = c
* 86 = v
* 88 = x
*/
if (isCtrlDown && (event.keyCode === 67 || event.keyCode === 86 || event.keyCode === 88)) {
// that.selectNodeText(that.elTextarea);
if (event.keyCode === 88) { //works in all browsers, incl. Opera < 12.12
setTimeout(function () {
that.triggerCut(event);
}, 0);
}
else if (event.keyCode === 86) {
setTimeout(function () {
that.triggerPaste(event);
}, 0);
}
}
}
this._bindEvent(this.listenerElement, 'keydown', this.keydownListener);
};
//http://jsperf.com/textara-selection
//http://stackoverflow.com/questions/1502385/how-can-i-make-this-code-work-in-ie
CopyPasteClass.prototype.selectNodeText = function (el) {
el.select();
};
//http://stackoverflow.com/questions/5379120/get-the-highlighted-selected-text
CopyPasteClass.prototype.getSelectionText = function () {
var text = "";
if (window.getSelection) {
text = window.getSelection().toString();
} else if (document.selection && document.selection.type != "Control") {
text = document.selection.createRange().text;
}
return text;
};
CopyPasteClass.prototype.copyable = function (str) {
if (typeof str !== 'string' && str.toString === void 0) {
throw new Error('copyable requires string parameter');
}
this.elTextarea.value = str;
};
/*CopyPasteClass.prototype.onCopy = function (fn) {
this.copyCallbacks.push(fn);
};*/
CopyPasteClass.prototype.onCut = function (fn) {
this.cutCallbacks.push(fn);
};
CopyPasteClass.prototype.onPaste = function (fn) {
this.pasteCallbacks.push(fn);
};
CopyPasteClass.prototype.removeCallback = function (fn) {
var i, ilen;
for (i = 0, ilen = this.copyCallbacks.length; i < ilen; i++) {
if (this.copyCallbacks[i] === fn) {
this.copyCallbacks.splice(i, 1);
return true;
}
}
for (i = 0, ilen = this.cutCallbacks.length; i < ilen; i++) {
if (this.cutCallbacks[i] === fn) {
this.cutCallbacks.splice(i, 1);
return true;
}
}
for (i = 0, ilen = this.pasteCallbacks.length; i < ilen; i++) {
if (this.pasteCallbacks[i] === fn) {
this.pasteCallbacks.splice(i, 1);
return true;
}
}
return false;
};
CopyPasteClass.prototype.triggerCut = function (event) {
var that = this;
if (that.cutCallbacks) {
setTimeout(function () {
for (var i = 0, ilen = that.cutCallbacks.length; i < ilen; i++) {
that.cutCallbacks[i](event);
}
}, 50);
}
};
CopyPasteClass.prototype.triggerPaste = function (event, str) {
var that = this;
if (that.pasteCallbacks) {
setTimeout(function () {
var val = (str || that.elTextarea.value).replace(/\n$/, ''); //remove trailing newline
for (var i = 0, ilen = that.pasteCallbacks.length; i < ilen; i++) {
that.pasteCallbacks[i](val, event);
}
}, 50);
}
};
CopyPasteClass.prototype.destroy = function () {
if(!this.hasBeenDestroyed() && --this.refCounter == 0){
if (this.elDiv && this.elDiv.parentNode) {
this.elDiv.parentNode.removeChild(this.elDiv);
}
this._unbindEvent(this.listenerElement, 'keydown', this.keydownListener);
}
};
CopyPasteClass.prototype.hasBeenDestroyed = function () {
return !this.refCounter;
};
//old version used this:
// - http://net.tutsplus.com/tutorials/javascript-ajax/javascript-from-null-cross-browser-event-binding/
// - http://stackoverflow.com/questions/4643249/cross-browser-event-object-normalization
//but that cannot work with jQuery.trigger
CopyPasteClass.prototype._bindEvent = (function () {
if (window.jQuery) { //if jQuery exists, use jQuery event (for compatibility with $.trigger and $.triggerHandler, which can only trigger jQuery events - and we use that in tests)
return function (elem, type, cb) {
$(elem).on(type + '.copypaste', cb);
};
}
else {
return function (elem, type, cb) {
elem.addEventListener(type, cb, false); //sorry, IE8 will only work with jQuery
};
}
})();
CopyPasteClass.prototype._unbindEvent = (function () {
if (window.jQuery) { //if jQuery exists, use jQuery event (for compatibility with $.trigger and $.triggerHandler, which can only trigger jQuery events - and we use that in tests)
return function (elem, type, cb) {
$(elem).off(type + '.copypaste', cb);
};
}
else {
return function (elem, type, cb) {
elem.removeEventListener(type, cb, false); //sorry, IE8 will only work with jQuery
};
}
})();
// json-patch-duplex.js 0.3.6
// (c) 2013 Joachim Wester
// MIT license
var jsonpatch;
(function (jsonpatch) {
var objOps = {
add: function (obj, key) {
obj[key] = this.value;
return true;
},
remove: function (obj, key) {
delete obj[key];
return true;
},
replace: function (obj, key) {
obj[key] = this.value;
return true;
},
move: function (obj, key, tree) {
var temp = { op: "_get", path: this.from };
apply(tree, [temp]);
apply(tree, [
{ op: "remove", path: this.from }
]);
apply(tree, [
{ op: "add", path: this.path, value: temp.value }
]);
return true;
},
copy: function (obj, key, tree) {
var temp = { op: "_get", path: this.from };
apply(tree, [temp]);
apply(tree, [
{ op: "add", path: this.path, value: temp.value }
]);
return true;
},
test: function (obj, key) {
return (JSON.stringify(obj[key]) === JSON.stringify(this.value));
},
_get: function (obj, key) {
this.value = obj[key];
}
};
var arrOps = {
add: function (arr, i) {
arr.splice(i, 0, this.value);
return true;
},
remove: function (arr, i) {
arr.splice(i, 1);
return true;
},
replace: function (arr, i) {
arr[i] = this.value;
return true;
},
move: objOps.move,
copy: objOps.copy,
test: objOps.test,
_get: objOps._get
};
var observeOps = {
add: function (patches, path) {
var patch = {
op: "add",
path: path + escapePathComponent(this.name),
value: this.object[this.name]
};
patches.push(patch);
},
'delete': function (patches, path) {
var patch = {
op: "remove",
path: path + escapePathComponent(this.name)
};
patches.push(patch);
},
update: function (patches, path) {
var patch = {
op: "replace",
path: path + escapePathComponent(this.name),
value: this.object[this.name]
};
patches.push(patch);
}
};
function escapePathComponent(str) {
if (str.indexOf('/') === -1 && str.indexOf('~') === -1)
return str;
return str.replace(/~/g, '~0').replace(/\//g, '~1');
}
function _getPathRecursive(root, obj) {
var found;
for (var key in root) {
if (root.hasOwnProperty(key)) {
if (root[key] === obj) {
return escapePathComponent(key) + '/';
} else if (typeof root[key] === 'object') {
found = _getPathRecursive(root[key], obj);
if (found != '') {
return escapePathComponent(key) + '/' + found;
}
}
}
}
return '';
}
function getPath(root, obj) {
if (root === obj) {
return '/';
}
var path = _getPathRecursive(root, obj);
if (path === '') {
throw new Error("Object not found in root");
}
return '/' + path;
}
var beforeDict = [];
jsonpatch.intervals;
var Mirror = (function () {
function Mirror(obj) {
this.observers = [];
this.obj = obj;
}
return Mirror;
})();
var ObserverInfo = (function () {
function ObserverInfo(callback, observer) {
this.callback = callback;
this.observer = observer;
}
return ObserverInfo;
})();
function getMirror(obj) {
for (var i = 0, ilen = beforeDict.length; i < ilen; i++) {
if (beforeDict[i].obj === obj) {
return beforeDict[i];
}
}
}
function getObserverFromMirror(mirror, callback) {
for (var j = 0, jlen = mirror.observers.length; j < jlen; j++) {
if (mirror.observers[j].callback === callback) {
return mirror.observers[j].observer;
}
}
}
function removeObserverFromMirror(mirror, observer) {
for (var j = 0, jlen = mirror.observers.length; j < jlen; j++) {
if (mirror.observers[j].observer === observer) {
mirror.observers.splice(j, 1);
return;
}
}
}
function unobserve(root, observer) {
generate(observer);
if (Object.observe) {
_unobserve(observer, root);
} else {
clearTimeout(observer.next);
}
var mirror = getMirror(root);
removeObserverFromMirror(mirror, observer);
}
jsonpatch.unobserve = unobserve;
function observe(obj, callback) {
var patches = [];
var root = obj;
var observer;
var mirror = getMirror(obj);
if (!mirror) {
mirror = new Mirror(obj);
beforeDict.push(mirror);
} else {
observer = getObserverFromMirror(mirror, callback);
}
if (observer) {
return observer;
}
if (Object.observe) {
observer = function (arr) {
//This "refresh" is needed to begin observing new object properties
_unobserve(observer, obj);
_observe(observer, obj);
var a = 0, alen = arr.length;
while (a < alen) {
if (!(arr[a].name === 'length' && _isArray(arr[a].object)) && !(arr[a].name === '__Jasmine_been_here_before__')) {
var type = arr[a].type;
switch (type) {
case 'new':
type = 'add';
break;
case 'deleted':
type = 'delete';
break;
case 'updated':
type = 'update';
break;
}
observeOps[type].call(arr[a], patches, getPath(root, arr[a].object));
}
a++;
}
if (patches) {
if (callback) {
callback(patches);
}
}
observer.patches = patches;
patches = [];
};
} else {
observer = {};
mirror.value = JSON.parse(JSON.stringify(obj));
if (callback) {
//callbacks.push(callback); this has no purpose
observer.callback = callback;
observer.next = null;
var intervals = this.intervals || [100, 1000, 10000, 60000];
var currentInterval = 0;
var dirtyCheck = function () {
generate(observer);
};
var fastCheck = function () {
clearTimeout(observer.next);
observer.next = setTimeout(function () {
dirtyCheck();
currentInterval = 0;
observer.next = setTimeout(slowCheck, intervals[currentInterval++]);
}, 0);
};
var slowCheck = function () {
dirtyCheck();
if (currentInterval == intervals.length)
currentInterval = intervals.length - 1;
observer.next = setTimeout(slowCheck, intervals[currentInterval++]);
};
if (typeof window !== 'undefined') {
if (window.addEventListener) {
window.addEventListener('mousedown', fastCheck);
window.addEventListener('mouseup', fastCheck);
window.addEventListener('keydown', fastCheck);
} else {
window.attachEvent('onmousedown', fastCheck);
window.attachEvent('onmouseup', fastCheck);
window.attachEvent('onkeydown', fastCheck);
}
}
observer.next = setTimeout(slowCheck, intervals[currentInterval++]);
}
}
observer.patches = patches;
observer.object = obj;
mirror.observers.push(new ObserverInfo(callback, observer));
return _observe(observer, obj);
}
jsonpatch.observe = observe;
/// Listen to changes on an object tree, accumulate patches
function _observe(observer, obj) {
if (Object.observe) {
Object.observe(obj, observer);
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
var v = obj[key];
if (v && typeof (v) === "object") {
_observe(observer, v);
}
}
}
}
return observer;
}
function _unobserve(observer, obj) {
if (Object.observe) {
Object.unobserve(obj, observer);
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
var v = obj[key];
if (v && typeof (v) === "object") {
_unobserve(observer, v);
}
}
}
}
return observer;
}
function generate(observer) {
if (Object.observe) {
Object.deliverChangeRecords(observer);
} else {
var mirror;
for (var i = 0, ilen = beforeDict.length; i < ilen; i++) {
if (beforeDict[i].obj === observer.object) {
mirror = beforeDict[i];
break;
}
}
_generate(mirror.value, observer.object, observer.patches, "");
}
var temp = observer.patches;
if (temp.length > 0) {
observer.patches = [];
if (observer.callback) {
observer.callback(temp);
}
}
return temp;
}
jsonpatch.generate = generate;
var _objectKeys;
if (Object.keys) {
_objectKeys = Object.keys;
} else {
_objectKeys = function (obj) {
var keys = [];
for (var o in obj) {
if (obj.hasOwnProperty(o)) {
keys.push(o);
}
}
return keys;
};
}
// Dirty check if obj is different from mirror, generate patches and update mirror
function _generate(mirror, obj, patches, path) {
var newKeys = _objectKeys(obj);
var oldKeys = _objectKeys(mirror);
var changed = false;
var deleted = false;
for (var t = oldKeys.length - 1; t >= 0; t--) {
var key = oldKeys[t];
var oldVal = mirror[key];
if (obj.hasOwnProperty(key)) {
var newVal = obj[key];
if (oldVal instanceof Object) {
_generate(oldVal, newVal, patches, path + "/" + escapePathComponent(key));
} else {
if (oldVal != newVal) {
changed = true;
patches.push({ op: "replace", path: path + "/" + escapePathComponent(key), value: newVal });
mirror[key] = newVal;
}
}
} else {
patches.push({ op: "remove", path: path + "/" + escapePathComponent(key) });
delete mirror[key];
deleted = true;
}
}
if (!deleted && newKeys.length == oldKeys.length) {
return;
}
for (var t = 0; t < newKeys.length; t++) {
var key = newKeys[t];
if (!mirror.hasOwnProperty(key)) {
patches.push({ op: "add", path: path + "/" + escapePathComponent(key), value: obj[key] });
mirror[key] = JSON.parse(JSON.stringify(obj[key]));
}
}
}
var _isArray;
if (Array.isArray) {
_isArray = Array.isArray;
} else {
_isArray = function (obj) {
return obj.push && typeof obj.length === 'number';
};
}
/// Apply a json-patch operation on an object tree
function apply(tree, patches) {
var result = false, p = 0, plen = patches.length, patch;
while (p < plen) {
patch = patches[p];
// Find the object
var keys = patch.path.split('/');
var obj = tree;
var t = 1;
var len = keys.length;
while (true) {
if (_isArray(obj)) {
var index = parseInt(keys[t], 10);
t++;
if (t >= len) {
result = arrOps[patch.op].call(patch, obj, index, tree);
break;
}
obj = obj[index];
} else {
var key = keys[t];
if (key.indexOf('~') != -1)
key = key.replace(/~1/g, '/').replace(/~0/g, '~');
t++;
if (t >= len) {
result = objOps[patch.op].call(patch, obj, key, tree);
break;
}
obj = obj[key];
}
}
p++;
}
return result;
}
jsonpatch.apply = apply;
})(jsonpatch || (jsonpatch = {}));
if (typeof exports !== "undefined") {
exports.apply = jsonpatch.apply;
exports.observe = jsonpatch.observe;
exports.unobserve = jsonpatch.unobserve;
exports.generate = jsonpatch.generate;
}
Handsontable.PluginHookClass = (function () {
var Hooks = function () {
return {
// Hooks
beforeInitWalkontable: [],
beforeInit: [],
beforeRender: [],
beforeChange: [],
beforeRemoveCol: [],
beforeRemoveRow: [],
beforeValidate: [],
beforeGet: [],
beforeSet: [],
beforeGetCellMeta: [],
beforeAutofill: [],
beforeKeyDown: [],
beforeColumnSort: [],
afterInit : [],
afterLoadData : [],
afterUpdateSettings: [],
afterRender : [],
afterRenderer : [],
afterChange : [],
afterValidate: [],
afterGetCellMeta: [],
afterGetColHeader: [],
afterGetColWidth: [],
afterDestroy: [],
afterRemoveRow: [],
afterCreateRow: [],
afterRemoveCol: [],
afterCreateCol: [],
afterColumnResize: [],
afterColumnMove: [],
afterColumnSort: [],
afterDeselect: [],
afterSelection: [],
afterSelectionByProp: [],
afterSelectionEnd: [],
afterSelectionEndByProp: [],
afterCopyLimit: [],
afterOnCellMouseDown: [],
afterOnCellMouseOver: [],
afterOnCellCornerMouseDown: [],
afterScrollVertically: [],
afterScrollHorizontally: [],
// Modifiers
modifyCol: []
}
};
var legacy = {
onBeforeChange: "beforeChange",
onChange: "afterChange",
onCreateRow: "afterCreateRow",
onCreateCol: "afterCreateCol",
onSelection: "afterSelection",
onCopyLimit: "afterCopyLimit",
onSelectionEnd: "afterSelectionEnd",
onSelectionByProp: "afterSelectionByProp",
onSelectionEndByProp: "afterSelectionEndByProp"
};
function PluginHookClass() {
this.hooks = Hooks();
this.legacy = legacy;
}
PluginHookClass.prototype.add = function (key, fn) {
//if fn is array, run this for all the array items
if (Handsontable.helper.isArray(fn)) {
for (var i = 0, len = fn.length; i < len; i++) {
this.add(key, fn[i]);
}
}
else {
// provide support for old versions of HOT
if (key in legacy) {
key = legacy[key];
}
if (typeof this.hooks[key] === "undefined") {
this.hooks[key] = [];
}
if (this.hooks[key].indexOf(fn) == -1) {
this.hooks[key].push(fn); //only add a hook if it has not already be added (adding the same hook twice is now silently ignored)
}
}
return this;
};
PluginHookClass.prototype.once = function(key, fn){
if(Handsontable.helper.isArray(fn)){
for(var i = 0, len = fn.length; i < len; i++){
fn[i].runOnce = true;
this.add(key, fn[i]);
}
} else {
fn.runOnce = true;
this.add(key, fn);
}
};
PluginHookClass.prototype.remove = function (key, fn) {
var status = false;
// provide support for old versions of HOT
if (key in legacy) {
key = legacy[key];
}
if (typeof this.hooks[key] !== 'undefined') {
for (var i = 0, leni = this.hooks[key].length; i < leni; i++) {
if (this.hooks[key][i] == fn) {
delete this.hooks[key][i].runOnce;
this.hooks[key].splice(i, 1);
status = true;
break;
}
}
}
return status;
};
PluginHookClass.prototype.run = function (instance, key, p1, p2, p3, p4, p5) {
// provide support for old versions of HOT
if (key in legacy) {
key = legacy[key];
}
//performance considerations - http://jsperf.com/call-vs-apply-for-a-plugin-architecture
if (typeof this.hooks[key] !== 'undefined') {
//Make a copy of handler array
var handlers = Array.prototype.slice.call(this.hooks[key]);
for (var i = 0, leni = handlers.length; i < leni; i++) {
handlers[i].call(instance, p1, p2, p3, p4, p5);
if(handlers[i].runOnce){
this.remove(key, handlers[i]);
}
}
}
};
PluginHookClass.prototype.execute = function (instance, key, p1, p2, p3, p4, p5) {
var res, handlers;
// provide support for old versions of HOT
if (key in legacy) {
key = legacy[key];
}
//performance considerations - http://jsperf.com/call-vs-apply-for-a-plugin-architecture
if (typeof this.hooks[key] !== 'undefined') {
handlers = Array.prototype.slice.call(this.hooks[key]);
for (var i = 0, leni = handlers.length; i < leni; i++) {
res = handlers[i].call(instance, p1, p2, p3, p4, p5);
if (res !== void 0) {
p1 = res;
}
if(handlers[i].runOnce){
this.remove(key, handlers[i]);
}
if(res === false){ //if any handler returned false
return false; //event has been cancelled and further execution of handler queue is being aborted
}
}
}
return p1;
};
return PluginHookClass;
})();
Handsontable.PluginHooks = new Handsontable.PluginHookClass();
(function (Handsontable) {
function HandsontableAutoColumnSize() {
var plugin = this
, sampleCount = 5; //number of samples to take of each value length
this.beforeInit = function () {
var instance = this;
instance.autoColumnWidths = [];
if (instance.getSettings().autoColumnSize !== false) {
if (!instance.autoColumnSizeTmp) {
instance.autoColumnSizeTmp = {
table: null,
tableStyle: null,
theadTh: null,
tbody: null,
container: null,
containerStyle: null,
determineBeforeNextRender: true
};
instance.addHook('beforeRender', htAutoColumnSize.determineIfChanged);
instance.addHook('afterGetColWidth', htAutoColumnSize.getColWidth);
instance.addHook('afterDestroy', htAutoColumnSize.afterDestroy);
instance.determineColumnWidth = plugin.determineColumnWidth;
}
} else {
if (instance.autoColumnSizeTmp) {
instance.removeHook('beforeRender', htAutoColumnSize.determineIfChanged);
instance.removeHook('afterGetColWidth', htAutoColumnSize.getColWidth);
instance.removeHook('afterDestroy', htAutoColumnSize.afterDestroy);
delete instance.determineColumnWidth;
plugin.afterDestroy.call(instance);
}
}
};
this.determineIfChanged = function (force) {
if (force) {
htAutoColumnSize.determineColumnsWidth.apply(this, arguments);
}
};
this.determineColumnWidth = function (col) {
var instance = this
, tmp = instance.autoColumnSizeTmp;
if (!tmp.container) {
createTmpContainer.call(tmp, instance);
}
tmp.container.className = instance.rootElement[0].className + ' htAutoColumnSize';
tmp.table.className = instance.$table[0].className;
var rows = instance.countRows();
var samples = {};
var maxLen = 0;
for (var r = 0; r < rows; r++) {
var value = Handsontable.helper.stringify(instance.getDataAtCell(r, col));
var len = value.length;
if (len > maxLen) {
maxLen = len;
}
if (!samples[len]) {
samples[len] = {
needed: sampleCount,
strings: []
};
}
if (samples[len].needed) {
samples[len].strings.push({value: value, row: r});
samples[len].needed--;
}
}
var settings = instance.getSettings();
if (settings.colHeaders) {
instance.view.appendColHeader(col, tmp.theadTh); //TH innerHTML
}
instance.view.wt.wtDom.empty(tmp.tbody);
for (var i in samples) {
if (samples.hasOwnProperty(i)) {
for (var j = 0, jlen = samples[i].strings.length; j < jlen; j++) {
var row = samples[i].strings[j].row;
var cellProperties = instance.getCellMeta(row, col);
cellProperties.col = col;
cellProperties.row = row;
var renderer = instance.getCellRenderer(cellProperties);
var tr = document.createElement('tr');
var td = document.createElement('td');
renderer(instance, td, row, col, instance.colToProp(col), samples[i].strings[j].value, cellProperties);
r++;
tr.appendChild(td);
tmp.tbody.appendChild(tr);
}
}
}
var parent = instance.rootElement[0].parentNode;
parent.appendChild(tmp.container);
var width = instance.view.wt.wtDom.outerWidth(tmp.table);
parent.removeChild(tmp.container);
if (!settings.nativeScrollbars) { //with native scrollbars a cell size can safely exceed the width of the viewport
var maxWidth = instance.view.wt.wtViewport.getViewportWidth() - 2; //2 is some overhead for cell border
if (width > maxWidth) {
width = maxWidth;
}
}
return width;
};
this.determineColumnsWidth = function () {
var instance = this;
var settings = this.getSettings();
if (settings.autoColumnSize || !settings.colWidths) {
var cols = this.countCols();
for (var c = 0; c < cols; c++) {
if (!instance._getColWidthFromSettings(c)) {
this.autoColumnWidths[c] = plugin.determineColumnWidth.call(instance, c);
}
}
}
};
this.getColWidth = function (col, response) {
if (this.autoColumnWidths[col] && this.autoColumnWidths[col] > response.width) {
response.width = this.autoColumnWidths[col];
}
};
this.afterDestroy = function () {
var instance = this;
if (instance.autoColumnSizeTmp && instance.autoColumnSizeTmp.container && instance.autoColumnSizeTmp.container.parentNode) {
instance.autoColumnSizeTmp.container.parentNode.removeChild(instance.autoColumnSizeTmp.container);
}
instance.autoColumnSizeTmp = null;
};
function createTmpContainer(instance) {
var d = document
, tmp = this;
tmp.table = d.createElement('table');
tmp.theadTh = d.createElement('th');
tmp.table.appendChild(d.createElement('thead')).appendChild(d.createElement('tr')).appendChild(tmp.theadTh);
tmp.tableStyle = tmp.table.style;
tmp.tableStyle.tableLayout = 'auto';
tmp.tableStyle.width = 'auto';
tmp.tbody = d.createElement('tbody');
tmp.table.appendChild(tmp.tbody);
tmp.container = d.createElement('div');
tmp.container.className = instance.rootElement[0].className + ' hidden';
tmp.containerStyle = tmp.container.style;
tmp.container.appendChild(tmp.table);
}
}
var htAutoColumnSize = new HandsontableAutoColumnSize();
Handsontable.PluginHooks.add('beforeInit', htAutoColumnSize.beforeInit);
Handsontable.PluginHooks.add('afterUpdateSettings', htAutoColumnSize.beforeInit);
})(Handsontable);
/**
* This plugin sorts the view by a column (but does not sort the data source!)
* @constructor
*/
function HandsontableColumnSorting() {
var plugin = this;
this.init = function (source) {
var instance = this;
var sortingSettings = instance.getSettings().columnSorting;
var sortingColumn, sortingOrder;
instance.sortingEnabled = !!(sortingSettings);
if (instance.sortingEnabled) {
instance.sortIndex = [];
var loadedSortingState = loadSortingState.call(instance);
if (typeof loadedSortingState != 'undefined') {
sortingColumn = loadedSortingState.sortColumn;
sortingOrder = loadedSortingState.sortOrder;
} else {
sortingColumn = sortingSettings.column;
sortingOrder = sortingSettings.sortOrder;
}
plugin.sortByColumn.call(instance, sortingColumn, sortingOrder);
instance.sort = function(){
var args = Array.prototype.slice.call(arguments);
return plugin.sortByColumn.apply(instance, args)
};
if (typeof instance.getSettings().observeChanges == 'undefined'){
enableObserveChangesPlugin.call(instance);
}
if (source == 'afterInit') {
bindColumnSortingAfterClick.call(instance);
instance.addHook('afterCreateRow', plugin.afterCreateRow);
instance.addHook('afterRemoveRow', plugin.afterRemoveRow);
instance.addHook('afterLoadData', plugin.init);
}
} else {
delete instance.sort;
instance.removeHook('afterCreateRow', plugin.afterCreateRow);
instance.removeHook('afterRemoveRow', plugin.afterRemoveRow);
instance.removeHook('afterLoadData', plugin.init);
}
};
this.setSortingColumn = function (col, order) {
var instance = this;
if (typeof col == 'undefined') {
delete instance.sortColumn;
delete instance.sortOrder;
return;
} else if (instance.sortColumn === col && typeof order == 'undefined') {
instance.sortOrder = !instance.sortOrder;
} else {
instance.sortOrder = typeof order != 'undefined' ? order : true;
}
instance.sortColumn = col;
};
this.sortByColumn = function (col, order) {
var instance = this;
plugin.setSortingColumn.call(instance, col, order);
if(typeof instance.sortColumn == 'undefined'){
return;
}
instance.PluginHooks.run('beforeColumnSort', instance.sortColumn, instance.sortOrder);
plugin.sort.call(instance);
instance.render();
saveSortingState.call(instance);
instance.PluginHooks.run('afterColumnSort', instance.sortColumn, instance.sortOrder);
};
var saveSortingState = function () {
var instance = this;
var sortingState = {};
if (typeof instance.sortColumn != 'undefined') {
sortingState.sortColumn = instance.sortColumn;
}
if (typeof instance.sortOrder != 'undefined') {
sortingState.sortOrder = instance.sortOrder;
}
if (sortingState.hasOwnProperty('sortColumn') || sortingState.hasOwnProperty('sortOrder')) {
instance.PluginHooks.run('persistentStateSave', 'columnSorting', sortingState);
}
};
var loadSortingState = function () {
var instance = this;
var storedState = {};
instance.PluginHooks.run('persistentStateLoad', 'columnSorting', storedState);
return storedState.value;
};
var bindColumnSortingAfterClick = function () {
var instance = this;
instance.rootElement.on('click.handsontable', '.columnSorting', function (e) {
if (instance.view.wt.wtDom.hasClass(e.target, 'columnSorting')) {
var col = getColumn(e.target);
plugin.sortByColumn.call(instance, col);
}
});
function countRowHeaders() {
var THs = instance.view.TBODY.querySelector('tr').querySelectorAll('th');
return THs.length;
}
function getColumn(target) {
var TH = instance.view.wt.wtDom.closest(target, 'TH');
return instance.view.wt.wtDom.index(TH) - countRowHeaders();
}
};
function enableObserveChangesPlugin () {
var instance = this;
instance.registerTimeout('enableObserveChanges', function(){
instance.updateSettings({
observeChanges: true
});
}, 0);
}
function defaultSort(sortOrder) {
return function (a, b) {
if (a[1] === b[1]) {
return 0;
}
if (a[1] === null) {
return 1;
}
if (b[1] === null) {
return -1;
}
if (a[1] < b[1]) return sortOrder ? -1 : 1;
if (a[1] > b[1]) return sortOrder ? 1 : -1;
return 0;
}
}
function dateSort(sortOrder) {
return function (a, b) {
if (a[1] === b[1]) {
return 0;
}
if (a[1] === null) {
return 1;
}
if (b[1] === null) {
return -1;
}
var aDate = new Date(a[1]);
var bDate = new Date(b[1]);
if (aDate < bDate) return sortOrder ? -1 : 1;
if (aDate > bDate) return sortOrder ? 1 : -1;
return 0;
}
}
this.sort = function () {
var instance = this;
if (typeof instance.sortOrder == 'undefined') {
return;
}
instance.sortingEnabled = false; //this is required by translateRow plugin hook
instance.sortIndex.length = 0;
var colOffset = this.colOffset();
for (var i = 0, ilen = this.countRows() - instance.getSettings()['minSpareRows']; i < ilen; i++) {
this.sortIndex.push([i, instance.getDataAtCell(i, this.sortColumn + colOffset)]);
}
var colMeta = instance.getCellMeta(0, instance.sortColumn);
var sortFunction;
switch (colMeta.type) {
case 'date':
sortFunction = dateSort;
break;
default:
sortFunction = defaultSort;
}
this.sortIndex.sort(sortFunction(instance.sortOrder));
//Append spareRows
for(var i = this.sortIndex.length; i < instance.countRows(); i++){
this.sortIndex.push([i, instance.getDataAtCell(i, this.sortColumn + colOffset)]);
}
instance.sortingEnabled = true; //this is required by translateRow plugin hook
};
this.translateRow = function (row) {
var instance = this;
if (instance.sortingEnabled && instance.sortIndex && instance.sortIndex.length && instance.sortIndex[row]) {
return instance.sortIndex[row][0];
}
return row;
};
this.onBeforeGetSet = function (getVars) {
var instance = this;
getVars.row = plugin.translateRow.call(instance, getVars.row);
};
this.untranslateRow = function (row) {
var instance = this;
if (instance.sortingEnabled && instance.sortIndex && instance.sortIndex.length) {
for (var i = 0; i < instance.sortIndex.length; i++) {
if (instance.sortIndex[i][0] == row) {
return i;
}
}
}
};
this.getColHeader = function (col, TH) {
if (this.getSettings().columnSorting) {
this.view.wt.wtDom.addClass(TH.querySelector('.colHeader'), 'columnSorting');
}
};
function isSorted(instance){
return typeof instance.sortColumn != 'undefined';
}
this.afterCreateRow = function(index, amount){
var instance = this;
if(!isSorted(instance)){
return;
}
for(var i = 0; i < instance.sortIndex.length; i++){
if (instance.sortIndex[i][0] >= index){
instance.sortIndex[i][0] += amount;
}
}
for(var i=0; i < amount; i++){
instance.sortIndex.splice(index+i, 0, [index+i, instance.getData()[index+i][instance.sortColumn + instance.colOffset()]]);
}
saveSortingState.call(instance);
};
this.afterRemoveRow = function(index, amount){
var instance = this;
if(!isSorted(instance)){
return;
}
var physicalRemovedIndex = plugin.translateRow.call(instance, index);
instance.sortIndex.splice(index, amount);
for(var i = 0; i < instance.sortIndex.length; i++){
if (instance.sortIndex[i][0] > physicalRemovedIndex){
instance.sortIndex[i][0] -= amount;
}
}
saveSortingState.call(instance);
};
this.afterChangeSort = function (changes/*, source*/) {
var instance = this;
var sortColumnChanged = false;
var selection = {};
if (!changes) {
return;
}
for (var i = 0; i < changes.length; i++) {
if (changes[i][1] == instance.sortColumn) {
sortColumnChanged = true;
selection.row = plugin.translateRow.call(instance, changes[i][0]);
selection.col = changes[i][1];
break;
}
}
if (sortColumnChanged) {
setTimeout(function () {
plugin.sort.call(instance);
instance.render();
instance.selectCell(plugin.untranslateRow.call(instance, selection.row), selection.col);
}, 0);
}
};
}
var htSortColumn = new HandsontableColumnSorting();
Handsontable.PluginHooks.add('afterInit', function () {
htSortColumn.init.call(this, 'afterInit')
});
Handsontable.PluginHooks.add('afterUpdateSettings', function () {
htSortColumn.init.call(this, 'afterUpdateSettings')
});
Handsontable.PluginHooks.add('beforeGet', htSortColumn.onBeforeGetSet);
Handsontable.PluginHooks.add('beforeSet', htSortColumn.onBeforeGetSet);
Handsontable.PluginHooks.add('afterGetColHeader', htSortColumn.getColHeader);
(function (Handsontable) {
'use strict';
function ContextMenu(instance, customOptions){
this.instance = instance;
var contextMenu = this;
this.menu = createMenu();
this.enabled = true;
this.bindMouseEvents();
this.bindTableEvents();
this.instance.addHook('afterDestroy', function () {
contextMenu.destroy();
});
this.defaultOptions = {
items: {
'row_above': {
name: 'Insert row above',
callback: function(key, selection){
this.alter("insert_row", selection.start.row());
},
disabled: function () {
return this.countRows() >= this.getSettings().maxRows;
}
},
'row_below': {
name: 'Insert row below',
callback: function(key, selection){
this.alter("insert_row", selection.end.row() + 1);
},
disabled: function () {
return this.countRows() >= this.getSettings().maxRows;
}
},
"hsep1": ContextMenu.SEPARATOR,
'col_left': {
name: 'Insert column on the left',
callback: function(key, selection){
this.alter("insert_col", selection.start.col());
},
disabled: function () {
return this.countCols() >= this.getSettings().maxCols;
}
},
'col_right': {
name: 'Insert column on the right',
callback: function(key, selection){
this.alter("insert_col", selection.end.col() + 1);
},
disabled: function () {
return this.countCols() >= this.getSettings().maxCols;
}
},
"hsep2": ContextMenu.SEPARATOR,
'remove_row': {
name: 'Remove row',
callback: function(key, selection){
var amount = selection.end.row() - selection.start.row() + 1;
this.alter("remove_row", selection.start.row(), amount);
}
},
'remove_col': {
name: 'Remove column',
callback: function(key, selection){
var amount = selection.end.col() - selection.start.col() + 1;
this.alter("remove_col", selection.start.col(), amount);
}
},
"hsep3": ContextMenu.SEPARATOR,
'undo': {
name: 'Undo',
callback: function(){
this.undo();
},
disabled: function () {
return this.undoRedo && !this.undoRedo.isUndoAvailable();
}
},
'redo': {
name: 'Redo',
callback: function(){
this.redo();
},
disabled: function () {
return this.undoRedo && !this.undoRedo.isRedoAvailable();
}
}
}
};
this.options = {};
Handsontable.helper.extend(this.options, this.defaultOptions);
this.updateOptions(customOptions);
function createMenu(){
var menu = $('body > .htContextMenu')[0];
if(!menu){
menu = document.createElement('DIV');
Handsontable.Dom.addClass(menu, 'htContextMenu');
document.getElementsByTagName('body')[0].appendChild(menu);
}
return menu;
}
}
ContextMenu.prototype.bindMouseEvents = function (){
function contextMenuOpenListener(event){
event.preventDefault();
if(event.target.nodeName != 'TD' && !(Handsontable.Dom.hasClass(event.target, 'current') && Handsontable.Dom.hasClass(event.target, 'wtBorder'))){
return;
}
this.show(event.pageY, event.pageX);
$(document).on('mousedown.htContextMenu', Handsontable.helper.proxy(ContextMenu.prototype.close, this));
}
this.instance.rootElement.on('contextmenu.htContextMenu', Handsontable.helper.proxy(contextMenuOpenListener, this));
};
ContextMenu.prototype.bindTableEvents = function () {
var that = this;
this._afterScrollCallback = function () {
that.close();
};
this.instance.addHook('afterScrollVertically', this._afterScrollCallback);
this.instance.addHook('afterScrollHorizontally', this._afterScrollCallback);
};
ContextMenu.prototype.unbindTableEvents = function () {
var that = this;
if(this._afterScrollCallback){
this.instance.removeHook('afterScrollVertically', this._afterScrollCallback);
this.instance.removeHook('afterScrollHorizontally', this._afterScrollCallback);
this._afterScrollCallback = null;
}
};
ContextMenu.prototype.performAction = function (){
var hot = $(this.menu).handsontable('getInstance');
var selectedItemIndex = hot.getSelected()[0];
var selectedItem = hot.getData()[selectedItemIndex];
if (selectedItem.disabled === true || (typeof selectedItem.disabled == 'function' && selectedItem.disabled.call(this.instance) === true)){
return;
}
if(typeof selectedItem.callback != 'function'){
return;
}
var corners = this.instance.getSelected();
var normalizedSelection = ContextMenu.utils.normalizeSelection(corners);
selectedItem.callback.call(this.instance, selectedItem.key, normalizedSelection);
};
ContextMenu.prototype.unbindMouseEvents = function () {
this.instance.rootElement.off('contextmenu.htContextMenu');
$(document).off('mousedown.htContextMenu');
};
ContextMenu.prototype.show = function(top, left){
this.menu.style.display = 'block';
$(this.menu)
.off('mousedown.htContextMenu')
.on('mousedown.htContextMenu', Handsontable.helper.proxy(this.performAction, this));
$(this.menu).handsontable({
data: ContextMenu.utils.convertItemsToArray(this.getItems()),
colHeaders: false,
colWidths: [160],
readOnly: true,
copyPaste: false,
columns: [
{
data: 'name',
renderer: Handsontable.helper.proxy(this.renderer, this)
}
],
beforeKeyDown: Handsontable.helper.proxy(this.onBeforeKeyDown, this)
});
this.bindTableEvents();
this.setMenuPosition(top, left);
$(this.menu).handsontable('listen');
};
ContextMenu.prototype.close = function () {
this.hide();
$(document).off('mousedown.htContextMenu');
this.unbindTableEvents();
this.instance.listen();
};
ContextMenu.prototype.hide = function(){
this.menu.style.display = 'none';
$(this.menu).handsontable('destroy');
};
ContextMenu.prototype.renderer = function(instance, TD, row, col, prop, value, cellProperties){
var contextMenu = this;
var item = instance.getData()[row];
var wrapper = document.createElement('DIV');
Handsontable.Dom.empty(TD);
TD.appendChild(wrapper);
if(itemIsSeparator(item)){
Handsontable.Dom.addClass(TD, 'htSeparator');
} else {
Handsontable.Dom.fastInnerText(wrapper, value);
}
if (itemIsDisabled(item, contextMenu.instance)){
Handsontable.Dom.addClass(TD, 'htDisabled');
$(wrapper).on('mouseenter', function () {
instance.deselectCell();
});
} else {
Handsontable.Dom.removeClass(TD, 'htDisabled');
$(wrapper).on('mouseenter', function () {
instance.selectCell(row, col);
});
}
function itemIsSeparator(item){
return new RegExp(ContextMenu.SEPARATOR, 'i').test(item.name);
}
function itemIsDisabled(item, instance){
return item.disabled === true || (typeof item.disabled == 'function' && item.disabled.call(contextMenu.instance) === true);
}
};
ContextMenu.prototype.onBeforeKeyDown = function (event) {
var contextMenu = this;
var instance = $(contextMenu.menu).handsontable('getInstance');
var selection = instance.getSelected();
switch(event.keyCode){
case Handsontable.helper.keyCode.ESCAPE:
contextMenu.close();
event.preventDefault();
event.stopImmediatePropagation();
break;
case Handsontable.helper.keyCode.ENTER:
if(instance.getSelected()){
contextMenu.performAction();
contextMenu.close();
}
break;
case Handsontable.helper.keyCode.ARROW_DOWN:
if(!selection){
selectFirstCell(instance);
} else {
selectNextCell(selection[0], selection[1], instance);
}
event.preventDefault();
event.stopImmediatePropagation();
break;
case Handsontable.helper.keyCode.ARROW_UP:
if(!selection){
selectLastCell(instance);
} else {
selectPrevCell(selection[0], selection[1], instance);
}
event.preventDefault();
event.stopImmediatePropagation();
break;
}
function selectFirstCell(instance) {
var firstCell = instance.getCell(0, 0);
if(ContextMenu.utils.isSeparator(firstCell) || ContextMenu.utils.isDisabled(firstCell)){
selectNextCell(0, 0, instance);
} else {
instance.selectCell(0, 0);
}
}
function selectLastCell(instance) {
var lastRow = instance.countRows() - 1;
var lastCell = instance.getCell(lastRow, 0);
if(ContextMenu.utils.isSeparator(lastCell) || ContextMenu.utils.isDisabled(lastCell)){
selectPrevCell(lastRow, 0, instance);
} else {
instance.selectCell(lastRow, 0);
}
}
function selectNextCell(row, col, instance){
var nextRow = row + 1;
var nextCell = nextRow < instance.countRows() ? instance.getCell(nextRow, col) : null;
if(!nextCell){
return;
}
if(ContextMenu.utils.isSeparator(nextCell) || ContextMenu.utils.isDisabled(nextCell)){
selectNextCell(nextRow, col, instance);
} else {
instance.selectCell(nextRow, col);
}
}
function selectPrevCell(row, col, instance) {
var prevRow = row - 1;
var prevCell = prevRow >= 0 ? instance.getCell(prevRow, col) : null;
if (!prevCell) {
return;
}
if(ContextMenu.utils.isSeparator(prevCell) || ContextMenu.utils.isDisabled(prevCell)){
selectPrevCell(prevRow, col, instance);
} else {
instance.selectCell(prevRow, col);
}
}
};
ContextMenu.prototype.getItems = function () {
var items = {};
function Item(rawItem){
if(typeof rawItem == 'string'){
this.name = rawItem;
} else {
Handsontable.helper.extend(this, rawItem);
}
}
Item.prototype = this.options;
for(var itemName in this.options.items){
if(this.options.items.hasOwnProperty(itemName) && (!this.itemsFilter || this.itemsFilter.indexOf(itemName) != -1)){
items[itemName] = new Item(this.options.items[itemName]);
}
}
return items;
};
ContextMenu.prototype.updateOptions = function(newOptions){
newOptions = newOptions || {};
if(newOptions.items){
for(var itemName in newOptions.items){
var item = {};
if(newOptions.items.hasOwnProperty(itemName)) {
if(this.defaultOptions.items.hasOwnProperty(itemName)
&& Handsontable.helper.isObject(newOptions.items[itemName])){
Handsontable.helper.extend(item, this.defaultOptions.items[itemName]);
Handsontable.helper.extend(item, newOptions.items[itemName]);
newOptions.items[itemName] = item;
}
}
}
}
Handsontable.helper.extend(this.options, newOptions);
};
ContextMenu.prototype.setMenuPosition = function (cursorY, cursorX) {
var cursor = {
top: cursorY,
topRelative: cursorY - document.documentElement.scrollTop,
left: cursorX,
leftRelative:cursorX - document.documentElement.scrollLeft
};
if(this.menuFitsBelowCursor(cursor)){
this.positionMenuBelowCursor(cursor);
} else {
this.positionMenuAboveCursor(cursor);
}
if(this.menuFitsOnRightOfCursor(cursor)){
this.positionMenuOnRightOfCursor(cursor);
} else {
this.positionMenuOnLeftOfCursor(cursor);
}
};
ContextMenu.prototype.menuFitsBelowCursor = function (cursor) {
return cursor.topRelative + this.menu.offsetHeight <= document.documentElement.scrollTop + document.documentElement.clientHeight;
};
ContextMenu.prototype.menuFitsOnRightOfCursor = function (cursor) {
return cursor.leftRelative + this.menu.offsetWidth <= document.documentElement.scrollLeft + document.documentElement.clientWidth;
};
ContextMenu.prototype.positionMenuBelowCursor = function (cursor) {
this.menu.style.top = cursor.top + 'px';
};
ContextMenu.prototype.positionMenuAboveCursor = function (cursor) {
this.menu.style.top = (cursor.top - this.menu.offsetHeight) + 'px';
};
ContextMenu.prototype.positionMenuOnRightOfCursor = function (cursor) {
this.menu.style.left = cursor.left + 'px';
};
ContextMenu.prototype.positionMenuOnLeftOfCursor = function (cursor) {
this.menu.style.left = (cursor.left - this.menu.offsetWidth) + 'px';
};
ContextMenu.utils = {};
ContextMenu.utils.convertItemsToArray = function (items) {
var itemArray = [];
var item;
for(var itemName in items){
if(items.hasOwnProperty(itemName)){
if(typeof items[itemName] == 'string'){
item = {name: items[itemName]};
} else if (items[itemName].visible !== false) {
item = items[itemName];
} else {
continue;
}
item.key = itemName;
itemArray.push(item);
}
}
return itemArray;
};
ContextMenu.utils.normalizeSelection = function(corners){
var selection = {
start: new Handsontable.SelectionPoint(),
end: new Handsontable.SelectionPoint()
};
selection.start.row(Math.min(corners[0], corners[2]));
selection.start.col(Math.min(corners[1], corners[3]));
selection.end.row(Math.max(corners[0], corners[2]));
selection.end.col(Math.max(corners[1], corners[3]));
return selection;
};
ContextMenu.utils.isSeparator = function (cell) {
return Handsontable.Dom.hasClass(cell, 'htSeparator');
};
ContextMenu.utils.isDisabled = function (cell) {
return Handsontable.Dom.hasClass(cell, 'htDisabled');
};
ContextMenu.prototype.enable = function () {
if(!this.enabled){
this.enabled = true;
this.bindMouseEvents();
}
};
ContextMenu.prototype.disable = function () {
if(this.enabled){
this.enabled = false;
this.close();
this.unbindMouseEvents();
this.unbindTableEvents();
}
};
ContextMenu.prototype.destroy = function () {
this.close();
this.unbindMouseEvents();
this.unbindTableEvents();
if(!this.isMenuEnabledByOtherHotInstance()){
this.removeMenu();
}
};
ContextMenu.prototype.isMenuEnabledByOtherHotInstance = function () {
var hotContainers = $('.handsontable');
var menuEnabled = false;
for(var i = 0, len = hotContainers.length; i < len; i++){
var instance = $(hotContainers[i]).handsontable('getInstance');
if(instance && instance.getSettings().contextMenu){
menuEnabled = true;
break;
}
}
return menuEnabled;
};
ContextMenu.prototype.removeMenu = function () {
if(this.menu.parentNode){
this.menu.parentNode.removeChild(this.menu);
}
}
ContextMenu.prototype.filterItems = function(itemsToLeave){
this.itemsFilter = itemsToLeave;
};
ContextMenu.SEPARATOR = "---------";
function init(){
var instance = this;
var contextMenuSetting = instance.getSettings().contextMenu;
var customOptions = Handsontable.helper.isObject(contextMenuSetting) ? contextMenuSetting : {};
if(contextMenuSetting){
if(!instance.contextMenu){
instance.contextMenu = new ContextMenu(instance, customOptions);
}
instance.contextMenu.enable();
if(Handsontable.helper.isArray(contextMenuSetting)){
instance.contextMenu.filterItems(contextMenuSetting);
}
} else if(instance.contextMenu){
instance.contextMenu.destroy();
delete instance.contextMenu;
}
}
Handsontable.PluginHooks.add('afterInit', init);
Handsontable.PluginHooks.add('afterUpdateSettings', init);
Handsontable.ContextMenu = ContextMenu;
})(Handsontable);
/**
* This plugin adds support for legacy features, deprecated APIs, etc.
*/
/**
* Support for old autocomplete syntax
* For old syntax, see: https://github.com/warpech/jquery-handsontable/blob/8c9e701d090ea4620fe08b6a1a048672fadf6c7e/README.md#defining-autocomplete
*/
Handsontable.PluginHooks.add('beforeGetCellMeta', function (row, col, cellProperties) {
//isWritable - deprecated since 0.8.0
cellProperties.isWritable = !cellProperties.readOnly;
//autocomplete - deprecated since 0.7.1 (see CHANGELOG.md)
if (cellProperties.autoComplete) {
throw new Error("Support for legacy autocomplete syntax was removed in Handsontable 0.10.0. Please remove the property named 'autoComplete' from your config. For replacement instructions, see wiki page https://github.com/warpech/jquery-handsontable/wiki/Migration-guide-to-0.10.x");
}
});
function HandsontableManualColumnMove() {
var pressed
, startCol
, endCol
, startX
, startOffset;
var ghost = document.createElement('DIV')
, ghostStyle = ghost.style;
ghost.className = 'ghost';
ghostStyle.position = 'absolute';
ghostStyle.top = '25px';
ghostStyle.left = 0;
ghostStyle.width = '10px';
ghostStyle.height = '10px';
ghostStyle.backgroundColor = '#CCC';
ghostStyle.opacity = 0.7;
var saveManualColumnPositions = function () {
var instance = this;
instance.PluginHooks.run('persistentStateSave', 'manualColumnPositions', instance.manualColumnPositions);
};
var loadManualColumnPositions = function () {
var instance = this;
var storedState = {};
instance.PluginHooks.run('persistentStateLoad', 'manualColumnPositions', storedState);
return storedState.value;
};
var bindMoveColEvents = function () {
var instance = this;
instance.rootElement.on('mousemove.manualColumnMove', function (e) {
if (pressed) {
ghostStyle.left = startOffset + e.pageX - startX + 6 + 'px';
if (ghostStyle.display === 'none') {
ghostStyle.display = 'block';
}
}
});
instance.rootElement.on('mouseup.manualColumnMove', function () {
if (pressed) {
if (startCol < endCol) {
endCol--;
}
if (instance.getSettings().rowHeaders) {
startCol--;
endCol--;
}
instance.manualColumnPositions.splice(endCol, 0, instance.manualColumnPositions.splice(startCol, 1)[0]);
$('.manualColumnMover.active').removeClass('active');
pressed = false;
instance.forceFullRender = true;
instance.view.render(); //updates all
ghostStyle.display = 'none';
saveManualColumnPositions.call(instance);
instance.PluginHooks.run('afterColumnMove', startCol, endCol);
}
});
instance.rootElement.on('mousedown.manualColumnMove', '.manualColumnMover', function (e) {
var mover = e.currentTarget;
var TH = instance.view.wt.wtDom.closest(mover, 'TH');
startCol = instance.view.wt.wtDom.index(TH) + instance.colOffset();
endCol = startCol;
pressed = true;
startX = e.pageX;
var TABLE = instance.$table[0];
TABLE.parentNode.appendChild(ghost);
ghostStyle.width = instance.view.wt.wtDom.outerWidth(TH) + 'px';
ghostStyle.height = instance.view.wt.wtDom.outerHeight(TABLE) + 'px';
startOffset = parseInt(instance.view.wt.wtDom.offset(TH).left - instance.view.wt.wtDom.offset(TABLE).left, 10);
ghostStyle.left = startOffset + 6 + 'px';
});
instance.rootElement.on('mouseenter.manualColumnMove', 'td, th', function () {
if (pressed) {
var active = instance.view.THEAD.querySelector('.manualColumnMover.active');
if (active) {
instance.view.wt.wtDom.removeClass(active, 'active');
}
endCol = instance.view.wt.wtDom.index(this) + instance.colOffset();
var THs = instance.view.THEAD.querySelectorAll('th');
var mover = THs[endCol].querySelector('.manualColumnMover');
instance.view.wt.wtDom.addClass(mover, 'active');
}
});
instance.addHook('afterDestroy', unbindMoveColEvents);
};
var unbindMoveColEvents = function(){
var instance = this;
instance.rootElement.off('mouseup.manualColumnMove');
instance.rootElement.off('mousemove.manualColumnMove');
instance.rootElement.off('mousedown.manualColumnMove');
instance.rootElement.off('mouseenter.manualColumnMove');
};
this.beforeInit = function () {
this.manualColumnPositions = [];
};
this.init = function (source) {
var instance = this;
var manualColMoveEnabled = !!(this.getSettings().manualColumnMove);
if (manualColMoveEnabled) {
var initialManualColumnPositions = this.getSettings().manualColumnMove;
var loadedManualColumnPositions = loadManualColumnPositions.call(instance);
if (typeof loadedManualColumnPositions != 'undefined') {
this.manualColumnPositions = loadedManualColumnPositions;
} else if (initialManualColumnPositions instanceof Array) {
this.manualColumnPositions = initialManualColumnPositions;
} else {
this.manualColumnPositions = [];
}
instance.forceFullRender = true;
if (source == 'afterInit') {
bindMoveColEvents.call(this);
if (this.manualColumnPositions.length > 0) {
this.forceFullRender = true;
this.render();
}
}
} else {
unbindMoveColEvents.call(this);
this.manualColumnPositions = [];
}
};
this.modifyCol = function (col) {
//TODO test performance: http://jsperf.com/object-wrapper-vs-primitive/2
if (this.getSettings().manualColumnMove) {
if (typeof this.manualColumnPositions[col] === 'undefined') {
this.manualColumnPositions[col] = col;
}
return this.manualColumnPositions[col];
}
return col;
};
this.getColHeader = function (col, TH) {
if (this.getSettings().manualColumnMove) {
var DIV = document.createElement('DIV');
DIV.className = 'manualColumnMover';
TH.firstChild.appendChild(DIV);
}
};
}
var htManualColumnMove = new HandsontableManualColumnMove();
Handsontable.PluginHooks.add('beforeInit', htManualColumnMove.beforeInit);
Handsontable.PluginHooks.add('afterInit', function () {
htManualColumnMove.init.call(this, 'afterInit')
});
Handsontable.PluginHooks.add('afterUpdateSettings', function () {
htManualColumnMove.init.call(this, 'afterUpdateSettings')
});
Handsontable.PluginHooks.add('afterGetColHeader', htManualColumnMove.getColHeader);
Handsontable.PluginHooks.add('modifyCol', htManualColumnMove.modifyCol);
function HandsontableManualColumnResize() {
var pressed
, currentTH
, currentCol
, currentWidth
, instance
, newSize
, startX
, startWidth
, startOffset
, resizer = document.createElement('DIV')
, handle = document.createElement('DIV')
, line = document.createElement('DIV')
, lineStyle = line.style;
resizer.className = 'manualColumnResizer';
handle.className = 'manualColumnResizerHandle';
resizer.appendChild(handle);
line.className = 'manualColumnResizerLine';
resizer.appendChild(line);
var $document = $(document);
$document.mousemove(function (e) {
if (pressed) {
currentWidth = startWidth + (e.pageX - startX);
newSize = setManualSize(currentCol, currentWidth); //save col width
resizer.style.left = startOffset + currentWidth + 'px';
}
});
$document.mouseup(function () {
if (pressed) {
instance.view.wt.wtDom.removeClass(resizer, 'active');
pressed = false;
if(newSize != startWidth){
instance.forceFullRender = true;
instance.view.render(); //updates all
saveManualColumnWidths.call(instance);
instance.PluginHooks.run('afterColumnResize', currentCol, newSize);
}
refreshResizerPosition.call(instance, currentTH);
}
});
var saveManualColumnWidths = function () {
var instance = this;
instance.PluginHooks.run('persistentStateSave', 'manualColumnWidths', instance.manualColumnWidths);
};
var loadManualColumnWidths = function () {
var instance = this;
var storedState = {};
instance.PluginHooks.run('persistentStateLoad', 'manualColumnWidths', storedState);
return storedState.value;
};
function refreshResizerPosition(TH) {
instance = this;
currentTH = TH;
var col = this.view.wt.wtTable.getCoords(TH)[1]; //getCoords returns array [row, col]
if (col >= 0) { //if not row header
currentCol = col;
var rootOffset = this.view.wt.wtDom.offset(this.rootElement[0]).left;
var thOffset = this.view.wt.wtDom.offset(TH).left;
startOffset = (thOffset - rootOffset) - 6;
resizer.style.left = startOffset + parseInt(this.view.wt.wtDom.outerWidth(TH), 10) + 'px';
this.rootElement[0].appendChild(resizer);
}
}
function refreshLinePosition() {
var instance = this;
startWidth = parseInt(this.view.wt.wtDom.outerWidth(currentTH), 10);
instance.view.wt.wtDom.addClass(resizer, 'active');
lineStyle.height = instance.view.wt.wtDom.outerHeight(instance.$table[0]) + 'px';
pressed = instance;
}
var bindManualColumnWidthEvents = function () {
var instance = this;
var dblclick = 0;
var autoresizeTimeout = null;
this.rootElement.on('mouseenter.handsontable', 'th', function (e) {
if (!pressed) {
refreshResizerPosition.call(instance, e.currentTarget);
}
});
this.rootElement.on('mousedown.handsontable', '.manualColumnResizer', function () {
if (autoresizeTimeout == null) {
autoresizeTimeout = setTimeout(function () {
if (dblclick >= 2) {
newSize = instance.determineColumnWidth.call(instance, currentCol);
setManualSize(currentCol, newSize);
instance.forceFullRender = true;
instance.view.render(); //updates all
instance.PluginHooks.run('afterColumnResize', currentCol, newSize);
}
dblclick = 0;
autoresizeTimeout = null;
}, 500);
}
dblclick++;
});
this.rootElement.on('mousedown.handsontable', '.manualColumnResizer', function (e) {
startX = e.pageX;
refreshLinePosition.call(instance);
newSize = startWidth;
});
};
this.beforeInit = function () {
this.manualColumnWidths = [];
};
this.init = function (source) {
var instance = this;
var manualColumnWidthEnabled = !!(this.getSettings().manualColumnResize);
if (manualColumnWidthEnabled) {
var initialColumnWidths = this.getSettings().manualColumnResize;
var loadedManualColumnWidths = loadManualColumnWidths.call(instance);
if (typeof loadedManualColumnWidths != 'undefined') {
this.manualColumnWidths = loadedManualColumnWidths;
} else if (initialColumnWidths instanceof Array) {
this.manualColumnWidths = initialColumnWidths;
} else {
this.manualColumnWidths = [];
}
if (source == 'afterInit') {
bindManualColumnWidthEvents.call(this);
instance.forceFullRender = true;
instance.render();
}
}
};
var setManualSize = function (col, width) {
width = Math.max(width, 20);
/**
* We need to run col through modifyCol hook, in case the order of displayed columns is different than the order
* in data source. For instance, this order can be modified by manualColumnMove plugin.
*/
col = instance.PluginHooks.execute('modifyCol', col);
instance.manualColumnWidths[col] = width;
return width;
};
this.getColWidth = function (col, response) {
if (this.getSettings().manualColumnResize && this.manualColumnWidths[col]) {
response.width = this.manualColumnWidths[col];
}
};
}
var htManualColumnResize = new HandsontableManualColumnResize();
Handsontable.PluginHooks.add('beforeInit', htManualColumnResize.beforeInit);
Handsontable.PluginHooks.add('afterInit', function () {
htManualColumnResize.init.call(this, 'afterInit')
});
Handsontable.PluginHooks.add('afterUpdateSettings', function () {
htManualColumnResize.init.call(this, 'afterUpdateSettings')
});
Handsontable.PluginHooks.add('afterGetColWidth', htManualColumnResize.getColWidth);
(function HandsontableObserveChanges() {
Handsontable.PluginHooks.add('afterLoadData', init);
Handsontable.PluginHooks.add('afterUpdateSettings', init);
function init() {
var instance = this;
var pluginEnabled = instance.getSettings().observeChanges;
if (pluginEnabled) {
if(instance.observer) {
destroy.call(instance); //destroy observer for old data object
}
createObserver.call(instance);
bindEvents.call(instance);
} else if (!pluginEnabled){
destroy.call(instance);
}
}
function createObserver(){
var instance = this;
instance.observeChangesActive = true;
instance.pauseObservingChanges = function(){
instance.observeChangesActive = false;
};
instance.resumeObservingChanges = function(){
instance.observeChangesActive = true;
};
instance.observedData = instance.getData();
instance.observer = jsonpatch.observe(instance.observedData, function (patches) {
if(instance.observeChangesActive){
runHookForOperation.call(instance, patches);
instance.render();
}
instance.runHooks('afterChangesObserved');
});
}
function runHookForOperation(rawPatches){
var instance = this;
var patches = cleanPatches(rawPatches);
for(var i = 0, len = patches.length; i < len; i++){
var patch = patches[i];
var parsedPath = parsePath(patch.path);
switch(patch.op){
case 'add':
if(isNaN(parsedPath.col)){
instance.runHooks('afterCreateRow', parsedPath.row);
} else {
instance.runHooks('afterCreateCol', parsedPath.col);
}
break;
case 'remove':
if(isNaN(parsedPath.col)){
instance.runHooks('afterRemoveRow', parsedPath.row, 1);
} else {
instance.runHooks('afterRemoveCol', parsedPath.col, 1);
}
break;
case 'replace':
instance.runHooks('afterChange', [parsedPath.row, parsedPath.col, null, patch.value], 'external');
break;
}
}
function cleanPatches(rawPatches){
var patches;
patches = removeLengthRelatedPatches(rawPatches);
patches = removeMultipleAddOrRemoveColPatches(patches);
return patches;
}
/**
* Removing or adding column will produce one patch for each table row.
* This function leaves only one patch for each column add/remove operation
*/
function removeMultipleAddOrRemoveColPatches(rawPatches){
var newOrRemovedColumns = [];
return rawPatches.filter(function(patch){
var parsedPath = parsePath(patch.path);
if(['add', 'remove'].indexOf(patch.op) != -1 && !isNaN(parsedPath.col)){
if(newOrRemovedColumns.indexOf(parsedPath.col) != -1){
return false;
} else {
newOrRemovedColumns.push(parsedPath.col);
}
}
return true;
});
}
/**
* If observeChanges uses native Object.observe method, then it produces patches for length property.
* This function removes them.
*/
function removeLengthRelatedPatches(rawPatches){
return rawPatches.filter(function(patch){
return !/[/]length/ig.test(patch.path);
})
}
function parsePath(path){
var match = path.match(/^\/(\d+)\/?(.*)?$/);
return {
row: parseInt(match[1], 10),
col: /^\d*$/.test(match[2]) ? parseInt(match[2], 10) : match[2]
}
}
}
function destroy(){
var instance = this;
if (instance.observer){
destroyObserver.call(instance);
unbindEvents.call(instance);
}
}
function destroyObserver(){
var instance = this;
jsonpatch.unobserve(instance.observedData, instance.observer);
delete instance.observeChangesActive;
delete instance.pauseObservingChanges;
delete instance.resumeObservingChanges;
}
function bindEvents(){
var instance = this;
instance.addHook('afterDestroy', destroy);
instance.addHook('afterCreateRow', afterTableAlter);
instance.addHook('afterRemoveRow', afterTableAlter);
instance.addHook('afterCreateCol', afterTableAlter);
instance.addHook('afterRemoveCol', afterTableAlter);
instance.addHook('afterChange', function(changes, source){
if(source != 'loadData'){
afterTableAlter.call(this);
}
});
}
function unbindEvents(){
var instance = this;
instance.removeHook('afterDestroy', destroy);
instance.removeHook('afterCreateRow', afterTableAlter);
instance.removeHook('afterRemoveRow', afterTableAlter);
instance.removeHook('afterCreateCol', afterTableAlter);
instance.removeHook('afterRemoveCol', afterTableAlter);
instance.removeHook('afterChange', afterTableAlter);
}
function afterTableAlter(){
var instance = this;
instance.pauseObservingChanges();
instance.addHookOnce('afterChangesObserved', function(){
instance.resumeObservingChanges();
});
}
})();
/*
*
* Plugin enables saving table state
*
* */
function Storage(prefix) {
var savedKeys;
var saveSavedKeys = function () {
window.localStorage[prefix + '__' + 'persistentStateKeys'] = JSON.stringify(savedKeys);
};
var loadSavedKeys = function () {
var keysJSON = window.localStorage[prefix + '__' + 'persistentStateKeys'];
var keys = typeof keysJSON == 'string' ? JSON.parse(keysJSON) : void 0;
savedKeys = keys ? keys : [];
};
var clearSavedKeys = function () {
savedKeys = [];
saveSavedKeys();
};
loadSavedKeys();
this.saveValue = function (key, value) {
window.localStorage[prefix + '_' + key] = JSON.stringify(value);
if (savedKeys.indexOf(key) == -1) {
savedKeys.push(key);
saveSavedKeys();
}
};
this.loadValue = function (key, defaultValue) {
key = typeof key != 'undefined' ? key : defaultValue;
var value = window.localStorage[prefix + '_' + key];
return typeof value == "undefined" ? void 0 : JSON.parse(value);
};
this.reset = function (key) {
window.localStorage.removeItem(prefix + '_' + key);
};
this.resetAll = function () {
for (var index = 0; index < savedKeys.length; index++) {
window.localStorage.removeItem(prefix + '_' + savedKeys[index]);
}
clearSavedKeys();
};
}
(function (StorageClass) {
function HandsontablePersistentState() {
var plugin = this;
this.init = function () {
var instance = this,
pluginSettings = instance.getSettings()['persistentState'];
plugin.enabled = !!(pluginSettings);
if (!plugin.enabled) {
removeHooks.call(instance);
return;
}
if (!instance.storage) {
instance.storage = new StorageClass(instance.rootElement[0].id);
}
instance.resetState = plugin.resetValue;
addHooks.call(instance);
};
this.saveValue = function (key, value) {
var instance = this;
instance.storage.saveValue(key, value);
};
this.loadValue = function (key, saveTo) {
var instance = this;
saveTo.value = instance.storage.loadValue(key);
};
this.resetValue = function (key) {
var instance = this;
if (typeof key != 'undefined') {
instance.storage.reset(key);
} else {
instance.storage.resetAll();
}
};
var hooks = {
'persistentStateSave': plugin.saveValue,
'persistentStateLoad': plugin.loadValue,
'persistentStateReset': plugin.resetValue
};
function addHooks() {
var instance = this;
for (var hookName in hooks) {
if (hooks.hasOwnProperty(hookName) && !hookExists.call(instance, hookName)) {
instance.PluginHooks.add(hookName, hooks[hookName]);
}
}
}
function removeHooks() {
var instance = this;
for (var hookName in hooks) {
if (hooks.hasOwnProperty(hookName) && hookExists.call(instance, hookName)) {
instance.PluginHooks.remove(hookName, hooks[hookName]);
}
}
}
function hookExists(hookName) {
var instance = this;
return instance.PluginHooks.hooks.hasOwnProperty(hookName);
}
}
var htPersistentState = new HandsontablePersistentState();
Handsontable.PluginHooks.add('beforeInit', htPersistentState.init);
Handsontable.PluginHooks.add('afterUpdateSettings', htPersistentState.init);
})(Storage);
/**
* Handsontable UndoRedo class
*/
(function(Handsontable){
Handsontable.UndoRedo = function (instance) {
var plugin = this;
this.instance = instance;
this.doneActions = [];
this.undoneActions = [];
this.ignoreNewActions = false;
instance.addHook("afterChange", function (changes, origin) {
if(changes){
var action = new Handsontable.UndoRedo.ChangeAction(changes);
plugin.done(action);
}
});
instance.addHook("afterCreateRow", function (index, amount, createdAutomatically) {
if (createdAutomatically) {
return;
}
var action = new Handsontable.UndoRedo.CreateRowAction(index, amount);
plugin.done(action);
});
instance.addHook("beforeRemoveRow", function (index, amount) {
var originalData = plugin.instance.getData();
index = ( originalData.length + index ) % originalData.length;
var removedData = originalData.slice(index, index + amount);
var action = new Handsontable.UndoRedo.RemoveRowAction(index, removedData);
plugin.done(action);
});
instance.addHook("afterCreateCol", function (index, amount, createdAutomatically) {
if (createdAutomatically) {
return;
}
var action = new Handsontable.UndoRedo.CreateColumnAction(index, amount);
plugin.done(action);
});
instance.addHook("beforeRemoveCol", function (index, amount) {
var originalData = plugin.instance.getData();
index = ( plugin.instance.countCols() + index ) % plugin.instance.countCols();
var removedData = [];
for (var i = 0, len = originalData.length; i < len; i++) {
removedData[i] = originalData[i].slice(index, index + amount);
}
var headers;
if(Handsontable.helper.isArray(instance.getSettings().colHeaders)){
headers = instance.getSettings().colHeaders.slice(index, index + removedData.length);
}
var action = new Handsontable.UndoRedo.RemoveColumnAction(index, removedData, headers);
plugin.done(action);
});
};
Handsontable.UndoRedo.prototype.done = function (action) {
if (!this.ignoreNewActions) {
this.doneActions.push(action);
this.undoneActions.length = 0;
}
};
/**
* Undo operation from current revision
*/
Handsontable.UndoRedo.prototype.undo = function () {
if (this.isUndoAvailable()) {
var action = this.doneActions.pop();
this.ignoreNewActions = true;
action.undo(this.instance);
this.ignoreNewActions = false;
this.undoneActions.push(action);
}
};
/**
* Redo operation from current revision
*/
Handsontable.UndoRedo.prototype.redo = function () {
if (this.isRedoAvailable()) {
var action = this.undoneActions.pop();
this.ignoreNewActions = true;
action.redo(this.instance);
this.ignoreNewActions = true;
this.doneActions.push(action);
}
};
/**
* Returns true if undo point is available
* @return {Boolean}
*/
Handsontable.UndoRedo.prototype.isUndoAvailable = function () {
return this.doneActions.length > 0;
};
/**
* Returns true if redo point is available
* @return {Boolean}
*/
Handsontable.UndoRedo.prototype.isRedoAvailable = function () {
return this.undoneActions.length > 0;
};
/**
* Clears undo history
*/
Handsontable.UndoRedo.prototype.clear = function () {
this.doneActions.length = 0;
this.undoneActions.length = 0;
};
Handsontable.UndoRedo.Action = function () {
};
Handsontable.UndoRedo.Action.prototype.undo = function () {
};
Handsontable.UndoRedo.Action.prototype.redo = function () {
};
Handsontable.UndoRedo.ChangeAction = function (changes) {
this.changes = changes;
};
Handsontable.helper.inherit(Handsontable.UndoRedo.ChangeAction, Handsontable.UndoRedo.Action);
Handsontable.UndoRedo.ChangeAction.prototype.undo = function (instance) {
var data = $.extend(true, [], this.changes);
for (var i = 0, len = data.length; i < len; i++) {
data[i].splice(3, 1);
}
instance.setDataAtRowProp(data, null, null, 'undo');
};
Handsontable.UndoRedo.ChangeAction.prototype.redo = function (instance) {
var data = $.extend(true, [], this.changes);
for (var i = 0, len = data.length; i < len; i++) {
data[i].splice(2, 1);
}
instance.setDataAtRowProp(data, null, null, 'redo');
};
Handsontable.UndoRedo.CreateRowAction = function (index, amount) {
this.index = index;
this.amount = amount;
};
Handsontable.helper.inherit(Handsontable.UndoRedo.CreateRowAction, Handsontable.UndoRedo.Action);
Handsontable.UndoRedo.CreateRowAction.prototype.undo = function (instance) {
instance.alter('remove_row', this.index, this.amount);
};
Handsontable.UndoRedo.CreateRowAction.prototype.redo = function (instance) {
instance.alter('insert_row', this.index + 1, this.amount);
};
Handsontable.UndoRedo.RemoveRowAction = function (index, data) {
this.index = index;
this.data = data;
};
Handsontable.helper.inherit(Handsontable.UndoRedo.RemoveRowAction, Handsontable.UndoRedo.Action);
Handsontable.UndoRedo.RemoveRowAction.prototype.undo = function (instance) {
var spliceArgs = [this.index, 0];
Array.prototype.push.apply(spliceArgs, this.data);
Array.prototype.splice.apply(instance.getData(), spliceArgs);
instance.render();
};
Handsontable.UndoRedo.RemoveRowAction.prototype.redo = function (instance) {
instance.alter('remove_row', this.index, this.data.length);
};
Handsontable.UndoRedo.CreateColumnAction = function (index, amount) {
this.index = index;
this.amount = amount;
};
Handsontable.helper.inherit(Handsontable.UndoRedo.CreateColumnAction, Handsontable.UndoRedo.Action);
Handsontable.UndoRedo.CreateColumnAction.prototype.undo = function (instance) {
instance.alter('remove_col', this.index, this.amount);
};
Handsontable.UndoRedo.CreateColumnAction.prototype.redo = function (instance) {
instance.alter('insert_col', this.index + 1, this.amount);
};
Handsontable.UndoRedo.RemoveColumnAction = function (index, data, headers) {
this.index = index;
this.data = data;
this.amount = this.data[0].length;
this.headers = headers;
};
Handsontable.helper.inherit(Handsontable.UndoRedo.RemoveColumnAction, Handsontable.UndoRedo.Action);
Handsontable.UndoRedo.RemoveColumnAction.prototype.undo = function (instance) {
var row, spliceArgs;
for (var i = 0, len = instance.getData().length; i < len; i++) {
row = instance.getDataAtRow(i);
spliceArgs = [this.index, 0];
Array.prototype.push.apply(spliceArgs, this.data[i]);
Array.prototype.splice.apply(row, spliceArgs);
}
if(typeof this.headers != 'undefined'){
spliceArgs = [this.index, 0];
Array.prototype.push.apply(spliceArgs, this.headers);
Array.prototype.splice.apply(instance.getSettings().colHeaders, spliceArgs);
}
instance.render();
};
Handsontable.UndoRedo.RemoveColumnAction.prototype.redo = function (instance) {
instance.alter('remove_col', this.index, this.amount);
};
})(Handsontable);
(function(Handsontable){
function init(){
var instance = this;
var pluginEnabled = typeof instance.getSettings().undo == 'undefined' || instance.getSettings().undo;
if(pluginEnabled){
if(!instance.undoRedo){
instance.undoRedo = new Handsontable.UndoRedo(instance);
exposeUndoRedoMethods(instance);
instance.addHook('beforeKeyDown', onBeforeKeyDown);
instance.addHook('afterChange', onAfterChange);
}
} else {
if(instance.undoRedo){
delete instance.undoRedo;
removeExposedUndoRedoMethods(instance);
instance.removeHook('beforeKeyDown', onBeforeKeyDown);
instance.removeHook('afterChange', onAfterChange);
}
}
}
function onBeforeKeyDown(event){
var instance = this;
var ctrlDown = (event.ctrlKey || event.metaKey) && !event.altKey;
if(ctrlDown){
if (event.keyCode === 89 || (event.shiftKey && event.keyCode === 90)) { //CTRL + Y or CTRL + SHIFT + Z
instance.undoRedo.redo();
event.stopImmediatePropagation();
}
else if (event.keyCode === 90) { //CTRL + Z
instance.undoRedo.undo();
event.stopImmediatePropagation();
}
}
}
function onAfterChange(changes, source){
var instance = this;
if (source == 'loadData'){
return instance.undoRedo.clear();
}
}
function exposeUndoRedoMethods(instance){
instance.undo = function(){
return instance.undoRedo.undo();
};
instance.redo = function(){
return instance.undoRedo.redo();
};
instance.isUndoAvailable = function(){
return instance.undoRedo.isUndoAvailable();
};
instance.isRedoAvailable = function(){
return instance.undoRedo.isRedoAvailable();
};
instance.clearUndo = function(){
return instance.undoRedo.clear();
};
}
function removeExposedUndoRedoMethods(instance){
delete instance.undo;
delete instance.redo;
delete instance.isUndoAvailable;
delete instance.isRedoAvailable;
delete instance.clearUndo;
}
Handsontable.PluginHooks.add('afterInit', init);
Handsontable.PluginHooks.add('afterUpdateSettings', init);
})(Handsontable);
/**
* Plugin used to scroll Handsontable by selecting a cell and dragging outside of visible viewport
* @constructor
*/
function DragToScroll() {
this.boundaries = null;
this.callback = null;
}
/**
* @param boundaries {Object} compatible with getBoundingClientRect
*/
DragToScroll.prototype.setBoundaries = function (boundaries) {
this.boundaries = boundaries;
};
/**
* @param callback {Function}
*/
DragToScroll.prototype.setCallback = function (callback) {
this.callback = callback;
};
/**
* Check if mouse position (x, y) is outside of the viewport
* @param x
* @param y
*/
DragToScroll.prototype.check = function (x, y) {
var diffX = 0;
var diffY = 0;
if (y < this.boundaries.top) {
//y is less than top
diffY = y - this.boundaries.top;
}
else if (y > this.boundaries.bottom) {
//y is more than bottom
diffY = y - this.boundaries.bottom;
}
if (x < this.boundaries.left) {
//x is less than left
diffX = x - this.boundaries.left;
}
else if (x > this.boundaries.right) {
//x is more than right
diffX = x - this.boundaries.right;
}
this.callback(diffX, diffY);
};
var listening = false;
var dragToScroll;
var instance;
if (typeof Handsontable !== 'undefined') {
var setupListening = function (instance) {
var scrollHandler = instance.view.wt.wtScrollbars.vertical.scrollHandler; //native scroll
dragToScroll = new DragToScroll();
if (scrollHandler === window) {
//not much we can do currently
return;
}
else if (scrollHandler) {
dragToScroll.setBoundaries(scrollHandler.getBoundingClientRect());
}
else {
dragToScroll.setBoundaries(instance.$table[0].getBoundingClientRect());
}
dragToScroll.setCallback(function (scrollX, scrollY) {
if (scrollX < 0) {
if (scrollHandler) {
scrollHandler.scrollLeft -= 50;
}
else {
instance.view.wt.scrollHorizontal(-1).draw();
}
}
else if (scrollX > 0) {
if (scrollHandler) {
scrollHandler.scrollLeft += 50;
}
else {
instance.view.wt.scrollHorizontal(1).draw();
}
}
if (scrollY < 0) {
if (scrollHandler) {
scrollHandler.scrollTop -= 20;
}
else {
instance.view.wt.scrollVertical(-1).draw();
}
}
else if (scrollY > 0) {
if (scrollHandler) {
scrollHandler.scrollTop += 20;
}
else {
instance.view.wt.scrollVertical(1).draw();
}
}
});
listening = true;
};
Handsontable.PluginHooks.add('afterInit', function () {
$(document).on('mouseup.' + this.guid, function () {
listening = false;
});
$(document).on('mousemove.' + this.guid, function (event) {
if (listening) {
dragToScroll.check(event.clientX, event.clientY);
}
});
});
Handsontable.PluginHooks.add('destroy', function () {
$(document).off('.' + this.guid);
});
Handsontable.PluginHooks.add('afterOnCellMouseDown', function () {
setupListening(this);
});
Handsontable.PluginHooks.add('afterOnCellCornerMouseDown', function () {
setupListening(this);
});
}
(function (Handsontable, CopyPaste, SheetClip) {
function CopyPastePlugin(instance) {
this.copyPasteInstance = CopyPaste.getInstance();
this.copyPasteInstance.onCut(onCut);
this.copyPasteInstance.onPaste(onPaste);
var plugin = this;
instance.addHook('beforeKeyDown', onBeforeKeyDown);
function onCut() {
if (!instance.isListening()) {
return;
}
instance.selection.empty();
}
function onPaste(str) {
if (!instance.isListening() || !instance.selection.isSelected()) {
return;
}
var input = str.replace(/^[\r\n]*/g, '').replace(/[\r\n]*$/g, '') //remove newline from the start and the end of the input
, inputArray = SheetClip.parse(input)
, selected = instance.getSelected()
, coords = instance.getCornerCoords([{row: selected[0], col: selected[1]}, {row: selected[2], col: selected[3]}])
, areaStart = coords.TL
, areaEnd = {
row: Math.max(coords.BR.row, inputArray.length - 1 + coords.TL.row),
col: Math.max(coords.BR.col, inputArray[0].length - 1 + coords.TL.col)
};
instance.PluginHooks.once('afterChange', function (changes, source) {
if (changes && changes.length) {
this.selectCell(areaStart.row, areaStart.col, areaEnd.row, areaEnd.col);
}
});
instance.populateFromArray(areaStart.row, areaStart.col, inputArray, areaEnd.row, areaEnd.col, 'paste', instance.getSettings().pasteMode);
};
function onBeforeKeyDown (event) {
if (Handsontable.helper.isCtrlKey(event.keyCode) && instance.getSelected()) {
//when CTRL is pressed, prepare selectable text in textarea
//http://stackoverflow.com/questions/3902635/how-does-one-capture-a-macs-command-key-via-javascript
plugin.setCopyableText();
event.stopImmediatePropagation();
return;
}
var ctrlDown = (event.ctrlKey || event.metaKey) && !event.altKey; //catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
if (event.keyCode == Handsontable.helper.keyCode.A && ctrlDown) {
setTimeout(Handsontable.helper.proxy(plugin.setCopyableText, plugin));
}
}
this.destroy = function () {
this.copyPasteInstance.removeCallback(onCut);
this.copyPasteInstance.removeCallback(onPaste);
this.copyPasteInstance.destroy();
instance.removeHook('beforeKeyDown', onBeforeKeyDown);
};
instance.addHook('afterDestroy', Handsontable.helper.proxy(this.destroy, this));
this.triggerPaste = Handsontable.helper.proxy(this.copyPasteInstance.triggerPaste, this.copyPasteInstance);
this.triggerCut = Handsontable.helper.proxy(this.copyPasteInstance.triggerCut, this.copyPasteInstance);
/**
* Prepares copyable text in the invisible textarea
*/
this.setCopyableText = function () {
var selection = instance.getSelected();
var settings = instance.getSettings();
var copyRowsLimit = settings.copyRowsLimit;
var copyColsLimit = settings.copyColsLimit;
var startRow = Math.min(selection[0], selection[2]);
var startCol = Math.min(selection[1], selection[3]);
var endRow = Math.max(selection[0], selection[2]);
var endCol = Math.max(selection[1], selection[3]);
var finalEndRow = Math.min(endRow, startRow + copyRowsLimit - 1);
var finalEndCol = Math.min(endCol, startCol + copyColsLimit - 1);
instance.copyPaste.copyPasteInstance.copyable(instance.getCopyableData(startRow, startCol, finalEndRow, finalEndCol));
if (endRow !== finalEndRow || endCol !== finalEndCol) {
instance.PluginHooks.run("afterCopyLimit", endRow - startRow + 1, endCol - startCol + 1, copyRowsLimit, copyColsLimit);
}
};
}
function init() {
var instance = this;
var pluginEnabled = instance.getSettings().copyPaste !== false;
if(pluginEnabled && !instance.copyPaste){
instance.copyPaste = new CopyPastePlugin(instance);
} else if (!pluginEnabled && instance.copyPaste) {
instance.copyPaste.destroy();
delete instance.copyPaste;
}
}
Handsontable.PluginHooks.add('afterInit', init);
Handsontable.PluginHooks.add('afterUpdateSettings', init);
})(Handsontable, CopyPaste, SheetClip);
/**
* Creates an overlay over the original Walkontable instance. The overlay renders the clone of the original Walkontable
* and (optionally) implements behavior needed for native horizontal and vertical scrolling
*/
function WalkontableOverlay() {
this.maxOuts = 10; //max outs in one direction (before and after table)
}
/*
Possible optimizations:
[x] don't rerender if scroll delta is smaller than the fragment outside of the viewport
[ ] move .style.top change before .draw()
[ ] put .draw() in requestAnimationFrame
[ ] don't rerender rows that remain visible after the scroll
*/
WalkontableOverlay.prototype.init = function () {
this.TABLE = this.instance.wtTable.TABLE;
this.fixed = this.instance.wtTable.hider;
this.fixedContainer = this.instance.wtTable.holder;
this.fixed.style.position = 'absolute';
this.fixed.style.left = '0';
this.scrollHandler = this.getScrollableElement(this.TABLE);
this.$scrollHandler = $(this.scrollHandler); //in future remove jQuery from here
};
WalkontableOverlay.prototype.makeClone = function (direction) {
var clone = document.createElement('DIV');
clone.className = 'ht_clone_' + direction + ' handsontable';
clone.style.position = 'fixed';
clone.style.overflow = 'hidden';
var table2 = document.createElement('TABLE');
table2.className = this.instance.wtTable.TABLE.className;
clone.appendChild(table2);
this.instance.wtTable.holder.parentNode.appendChild(clone);
return new Walkontable({
cloneSource: this.instance,
cloneOverlay: this,
table: table2
});
};
WalkontableOverlay.prototype.getScrollableElement = function (TABLE) {
var el = TABLE.parentNode;
while (el && el.style) {
if (el.style.overflow !== 'visible' && el.style.overflow !== '') {
return el;
}
if (this instanceof WalkontableHorizontalScrollbarNative && el.style.overflowX !== 'visible' && el.style.overflowX !== '') {
return el;
}
el = el.parentNode;
}
return window;
};
WalkontableOverlay.prototype.prepare = function () {
};
WalkontableOverlay.prototype.onScroll = function (forcePosition) {
this.windowScrollPosition = this.getScrollPosition();
this.readSettings(); //read window scroll position
if (forcePosition) {
this.windowScrollPosition = forcePosition;
}
this.resetFixedPosition(); //may be redundant
};
WalkontableOverlay.prototype.availableSize = function () {
var availableSize;
if (this.windowScrollPosition > this.tableParentOffset /*&& last > -1*/) { //last -1 means that viewport is scrolled behind the table
if (this.instance.wtTable.getLastVisibleRow() === this.total - 1) {
availableSize = this.instance.wtDom.outerHeight(this.TABLE);
}
else {
availableSize = this.windowSize;
}
}
else {
availableSize = this.windowSize - (this.tableParentOffset);
}
return availableSize;
};
WalkontableOverlay.prototype.refresh = function (selectionsOnly) {
var last = this.getLastCell();
this.measureBefore = this.sumCellSizes(0, this.offset);
if (last === -1) { //last -1 means that viewport is scrolled behind the table
this.measureAfter = 0;
}
else {
this.measureAfter = this.sumCellSizes(last, this.total - last);
}
this.applyToDOM();
this.clone && this.clone.draw(selectionsOnly);
};
WalkontableOverlay.prototype.destroy = function () {
this.$scrollHandler.off('.' + this.instance.guid);
$(window).off('.' + this.instance.guid);
$(document).off('.' + this.instance.guid);
};
function WalkontableBorder(instance, settings) {
var style;
//reference to instance
this.instance = instance;
this.settings = settings;
this.wtDom = this.instance.wtDom;
this.main = document.createElement("div");
style = this.main.style;
style.position = 'absolute';
style.top = 0;
style.left = 0;
// style.visibility = 'hidden';
for (var i = 0; i < 5; i++) {
var DIV = document.createElement('DIV');
DIV.className = 'wtBorder ' + (settings.className || '');
style = DIV.style;
style.backgroundColor = settings.border.color;
style.height = settings.border.width + 'px';
style.width = settings.border.width + 'px';
this.main.appendChild(DIV);
}
this.top = this.main.childNodes[0];
this.left = this.main.childNodes[1];
this.bottom = this.main.childNodes[2];
this.right = this.main.childNodes[3];
/*$(this.top).on(sss, function(event) {
event.preventDefault();
event.stopImmediatePropagation();
$(this).hide();
});
$(this.left).on(sss, function(event) {
event.preventDefault();
event.stopImmediatePropagation();
$(this).hide();
});
$(this.bottom).on(sss, function(event) {
event.preventDefault();
event.stopImmediatePropagation();
$(this).hide();
});
$(this.right).on(sss, function(event) {
event.preventDefault();
event.stopImmediatePropagation();
$(this).hide();
});*/
this.topStyle = this.top.style;
this.leftStyle = this.left.style;
this.bottomStyle = this.bottom.style;
this.rightStyle = this.right.style;
this.corner = this.main.childNodes[4];
this.corner.className += ' corner';
this.cornerStyle = this.corner.style;
this.cornerStyle.width = '5px';
this.cornerStyle.height = '5px';
this.cornerStyle.border = '2px solid #FFF';
this.disappear();
if (!instance.wtTable.bordersHolder) {
instance.wtTable.bordersHolder = document.createElement('div');
instance.wtTable.bordersHolder.className = 'htBorders';
instance.wtTable.hider.appendChild(instance.wtTable.bordersHolder);
}
instance.wtTable.bordersHolder.appendChild(this.main);
var down = false;
var $body = $(document.body);
$body.on('mousedown.walkontable.' + instance.guid, function () {
down = true;
});
$body.on('mouseup.walkontable.' + instance.guid, function () {
down = false
});
$(this.main.childNodes).on('mouseenter', function (event) {
if (!down || !instance.getSetting('hideBorderOnMouseDownOver')) {
return;
}
event.preventDefault();
event.stopImmediatePropagation();
var bounds = this.getBoundingClientRect();
var $this = $(this);
$this.hide();
var isOutside = function (event) {
if (event.clientY < Math.floor(bounds.top)) {
return true;
}
if (event.clientY > Math.ceil(bounds.top + bounds.height)) {
return true;
}
if (event.clientX < Math.floor(bounds.left)) {
return true;
}
if (event.clientX > Math.ceil(bounds.left + bounds.width)) {
return true;
}
};
$body.on('mousemove.border.' + instance.guid, function (event) {
if (isOutside(event)) {
$body.off('mousemove.border.' + instance.guid);
$this.show();
}
});
});
}
/**
* Show border around one or many cells
* @param {Array} corners
*/
WalkontableBorder.prototype.appear = function (corners) {
var isMultiple, fromTD, toTD, fromOffset, toOffset, containerOffset, top, minTop, left, minLeft, height, width;
if (this.disabled) {
return;
}
var instance = this.instance
, fromRow
, fromColumn
, toRow
, toColumn
, hideTop = false
, hideLeft = false
, hideBottom = false
, hideRight = false
, i
, ilen
, s;
if (!instance.wtTable.isRowInViewport(corners[0])) {
hideTop = true;
}
if (!instance.wtTable.isRowInViewport(corners[2])) {
hideBottom = true;
}
ilen = instance.wtTable.rowStrategy.countVisible();
for (i = 0; i < ilen; i++) {
s = instance.wtTable.rowFilter.visibleToSource(i);
if (s >= corners[0] && s <= corners[2]) {
fromRow = s;
break;
}
}
for (i = ilen - 1; i >= 0; i--) {
s = instance.wtTable.rowFilter.visibleToSource(i);
if (s >= corners[0] && s <= corners[2]) {
toRow = s;
break;
}
}
if (hideTop && hideBottom) {
hideLeft = true;
hideRight = true;
}
else {
if (!instance.wtTable.isColumnInViewport(corners[1])) {
hideLeft = true;
}
if (!instance.wtTable.isColumnInViewport(corners[3])) {
hideRight = true;
}
ilen = instance.wtTable.columnStrategy.countVisible();
for (i = 0; i < ilen; i++) {
s = instance.wtTable.columnFilter.visibleToSource(i);
if (s >= corners[1] && s <= corners[3]) {
fromColumn = s;
break;
}
}
for (i = ilen - 1; i >= 0; i--) {
s = instance.wtTable.columnFilter.visibleToSource(i);
if (s >= corners[1] && s <= corners[3]) {
toColumn = s;
break;
}
}
}
if (fromRow !== void 0 && fromColumn !== void 0) {
isMultiple = (fromRow !== toRow || fromColumn !== toColumn);
fromTD = instance.wtTable.getCell([fromRow, fromColumn]);
toTD = isMultiple ? instance.wtTable.getCell([toRow, toColumn]) : fromTD;
fromOffset = this.wtDom.offset(fromTD);
toOffset = isMultiple ? this.wtDom.offset(toTD) : fromOffset;
containerOffset = this.wtDom.offset(instance.wtTable.TABLE);
minTop = fromOffset.top;
height = toOffset.top + this.wtDom.outerHeight(toTD) - minTop;
minLeft = fromOffset.left;
width = toOffset.left + this.wtDom.outerWidth(toTD) - minLeft;
top = minTop - containerOffset.top - 1;
left = minLeft - containerOffset.left - 1;
var style = this.wtDom.getComputedStyle(fromTD);
if (parseInt(style['borderTopWidth'], 10) > 0) {
top += 1;
height = height > 0 ? height - 1 : 0;
}
if (parseInt(style['borderLeftWidth'], 10) > 0) {
left += 1;
width = width > 0 ? width - 1 : 0;
}
}
else {
this.disappear();
return;
}
if (hideTop) {
this.topStyle.display = 'none';
}
else {
this.topStyle.top = top + 'px';
this.topStyle.left = left + 'px';
this.topStyle.width = width + 'px';
this.topStyle.display = 'block';
}
if (hideLeft) {
this.leftStyle.display = 'none';
}
else {
this.leftStyle.top = top + 'px';
this.leftStyle.left = left + 'px';
this.leftStyle.height = height + 'px';
this.leftStyle.display = 'block';
}
var delta = Math.floor(this.settings.border.width / 2);
if (hideBottom) {
this.bottomStyle.display = 'none';
}
else {
this.bottomStyle.top = top + height - delta + 'px';
this.bottomStyle.left = left + 'px';
this.bottomStyle.width = width + 'px';
this.bottomStyle.display = 'block';
}
if (hideRight) {
this.rightStyle.display = 'none';
}
else {
this.rightStyle.top = top + 'px';
this.rightStyle.left = left + width - delta + 'px';
this.rightStyle.height = height + 1 + 'px';
this.rightStyle.display = 'block';
}
if (hideBottom || hideRight || !this.hasSetting(this.settings.border.cornerVisible)) {
this.cornerStyle.display = 'none';
}
else {
this.cornerStyle.top = top + height - 4 + 'px';
this.cornerStyle.left = left + width - 4 + 'px';
this.cornerStyle.display = 'block';
}
};
/**
* Hide border
*/
WalkontableBorder.prototype.disappear = function () {
this.topStyle.display = 'none';
this.leftStyle.display = 'none';
this.bottomStyle.display = 'none';
this.rightStyle.display = 'none';
this.cornerStyle.display = 'none';
};
WalkontableBorder.prototype.hasSetting = function (setting) {
if (typeof setting === 'function') {
return setting();
}
return !!setting;
};
/**
* WalkontableCellFilter
* @constructor
*/
function WalkontableCellFilter() {
this.offset = 0;
this.total = 0;
this.fixedCount = 0;
}
WalkontableCellFilter.prototype.source = function (n) {
return n;
};
WalkontableCellFilter.prototype.offsetted = function (n) {
return n + this.offset;
};
WalkontableCellFilter.prototype.unOffsetted = function (n) {
return n - this.offset;
};
WalkontableCellFilter.prototype.fixed = function (n) {
if (n < this.fixedCount) {
return n - this.offset;
}
else {
return n;
}
};
WalkontableCellFilter.prototype.unFixed = function (n) {
if (n < this.fixedCount) {
return n + this.offset;
}
else {
return n;
}
};
WalkontableCellFilter.prototype.visibleToSource = function (n) {
return this.source(this.offsetted(this.fixed(n)));
};
WalkontableCellFilter.prototype.sourceToVisible = function (n) {
return this.source(this.unOffsetted(this.unFixed(n)));
};
/**
* WalkontableCellStrategy
* @constructor
*/
function WalkontableCellStrategy(instance) {
this.instance = instance;
}
WalkontableCellStrategy.prototype.getSize = function (index) {
return this.cellSizes[index];
};
WalkontableCellStrategy.prototype.getContainerSize = function (proposedSize) {
return typeof this.containerSizeFn === 'function' ? this.containerSizeFn(proposedSize) : this.containerSizeFn;
};
WalkontableCellStrategy.prototype.countVisible = function () {
return this.cellCount;
};
WalkontableCellStrategy.prototype.isLastIncomplete = function () {
if(this.instance.getSetting('nativeScrollbars')){
var nativeScrollbar = this.instance.cloneFrom ? this.instance.cloneFrom.wtScrollbars.vertical : this.instance.wtScrollbars.vertical;
return this.remainingSize > nativeScrollbar.sumCellSizes(nativeScrollbar.offset, nativeScrollbar.offset + nativeScrollbar.curOuts + 1);
} else {
return this.remainingSize > 0;
}
};
/**
* WalkontableClassNameList
* @constructor
*/
function WalkontableClassNameCache() {
this.cache = [];
}
WalkontableClassNameCache.prototype.add = function (r, c, cls) {
if (!this.cache[r]) {
this.cache[r] = [];
}
if (!this.cache[r][c]) {
this.cache[r][c] = [];
}
this.cache[r][c][cls] = true;
};
WalkontableClassNameCache.prototype.test = function (r, c, cls) {
return (this.cache[r] && this.cache[r][c] && this.cache[r][c][cls]);
};
/**
* WalkontableColumnFilter
* @constructor
*/
function WalkontableColumnFilter() {
this.countTH = 0;
}
WalkontableColumnFilter.prototype = new WalkontableCellFilter();
WalkontableColumnFilter.prototype.readSettings = function (instance) {
this.offset = instance.wtSettings.settings.offsetColumn;
this.total = instance.getSetting('totalColumns');
this.fixedCount = instance.getSetting('fixedColumnsLeft');
this.countTH = instance.getSetting('rowHeaders').length;
};
WalkontableColumnFilter.prototype.offsettedTH = function (n) {
return n - this.countTH;
};
WalkontableColumnFilter.prototype.unOffsettedTH = function (n) {
return n + this.countTH;
};
WalkontableColumnFilter.prototype.visibleRowHeadedColumnToSourceColumn = function (n) {
return this.visibleToSource(this.offsettedTH(n));
};
WalkontableColumnFilter.prototype.sourceColumnToVisibleRowHeadedColumn = function (n) {
return this.unOffsettedTH(this.sourceToVisible(n));
};
/**
* WalkontableColumnStrategy
* @param containerSizeFn
* @param sizeAtIndex
* @param strategy - all, last, none
* @constructor
*/
function WalkontableColumnStrategy(instance, containerSizeFn, sizeAtIndex, strategy) {
var size
, i = 0;
WalkontableCellStrategy.apply(this, arguments);
this.containerSizeFn = containerSizeFn;
this.cellSizesSum = 0;
this.cellSizes = [];
this.cellStretch = [];
this.cellCount = 0;
this.remainingSize = 0;
this.strategy = strategy;
//step 1 - determine cells that fit containerSize and cache their widths
while (true) {
size = sizeAtIndex(i);
if (size === void 0) {
break; //total columns exceeded
}
if (this.cellSizesSum >= this.getContainerSize(this.cellSizesSum + size)) {
break; //total width exceeded
}
this.cellSizes.push(size);
this.cellSizesSum += size;
this.cellCount++;
i++;
}
var containerSize = this.getContainerSize(this.cellSizesSum);
this.remainingSize = this.cellSizesSum - containerSize;
//negative value means the last cell is fully visible and there is some space left for stretching
//positive value means the last cell is not fully visible
}
WalkontableColumnStrategy.prototype = new WalkontableCellStrategy();
WalkontableColumnStrategy.prototype.getSize = function (index) {
return this.cellSizes[index] + (this.cellStretch[index] || 0);
};
WalkontableColumnStrategy.prototype.stretch = function () {
//step 2 - apply stretching strategy
var containerSize = this.getContainerSize(this.cellSizesSum)
, i = 0;
this.remainingSize = this.cellSizesSum - containerSize;
this.cellStretch.length = 0; //clear previous stretch
if (this.strategy === 'all') {
if (this.remainingSize < 0) {
var ratio = containerSize / this.cellSizesSum;
var newSize;
while (i < this.cellCount - 1) { //"i < this.cellCount - 1" is needed because last cellSize is adjusted after the loop
newSize = Math.floor(ratio * this.cellSizes[i]);
this.remainingSize += newSize - this.cellSizes[i];
this.cellStretch[i] = newSize - this.cellSizes[i];
i++;
}
this.cellStretch[this.cellCount - 1] = -this.remainingSize;
this.remainingSize = 0;
}
}
else if (this.strategy === 'last') {
if (this.remainingSize < 0 && containerSize !== Infinity) { //Infinity is with native scroll when the table is wider than the viewport (TODO: test)
this.cellStretch[this.cellCount - 1] = -this.remainingSize;
this.remainingSize = 0;
}
}
};
function Walkontable(settings) {
var that = this,
originalHeaders = [];
this.guid = 'wt_' + walkontableRandomString(); //this is the namespace for global events
//bootstrap from settings
this.wtDom = new WalkontableDom();
if (settings.cloneSource) {
this.cloneSource = settings.cloneSource;
this.cloneOverlay = settings.cloneOverlay;
this.wtSettings = settings.cloneSource.wtSettings;
this.wtTable = new WalkontableTable(this, settings.table);
this.wtScroll = new WalkontableScroll(this);
this.wtViewport = settings.cloneSource.wtViewport;
}
else {
this.wtSettings = new WalkontableSettings(this, settings);
this.wtTable = new WalkontableTable(this, settings.table);
this.wtScroll = new WalkontableScroll(this);
this.wtViewport = new WalkontableViewport(this);
this.wtScrollbars = new WalkontableScrollbars(this);
this.wtWheel = new WalkontableWheel(this);
this.wtEvent = new WalkontableEvent(this);
}
//find original headers
if (this.wtTable.THEAD.childNodes.length && this.wtTable.THEAD.childNodes[0].childNodes.length) {
for (var c = 0, clen = this.wtTable.THEAD.childNodes[0].childNodes.length; c < clen; c++) {
originalHeaders.push(this.wtTable.THEAD.childNodes[0].childNodes[c].innerHTML);
}
if (!this.getSetting('columnHeaders').length) {
this.update('columnHeaders', [function (column, TH) {
that.wtDom.fastInnerText(TH, originalHeaders[column]);
}]);
}
}
//initialize selections
this.selections = {};
var selectionsSettings = this.getSetting('selections');
if (selectionsSettings) {
for (var i in selectionsSettings) {
if (selectionsSettings.hasOwnProperty(i)) {
this.selections[i] = new WalkontableSelection(this, selectionsSettings[i]);
}
}
}
this.drawn = false;
this.drawInterrupted = false;
//at this point the cached row heights may be invalid, but it is better not to reset the cache, which could cause scrollbar jumping when there are multiline cells outside of the rendered part of the table
/*if (window.Handsontable) {
Handsontable.PluginHooks.add('beforeChange', function () {
if (that.rowHeightCache) {
that.rowHeightCache.length = 0;
}
});
}*/
}
Walkontable.prototype.draw = function (selectionsOnly) {
this.drawInterrupted = false;
if (!selectionsOnly && !this.wtDom.isVisible(this.wtTable.TABLE)) {
this.drawInterrupted = true; //draw interrupted because TABLE is not visible
return;
}
this.getSetting('beforeDraw', !selectionsOnly);
selectionsOnly = selectionsOnly && this.getSetting('offsetRow') === this.lastOffsetRow && this.getSetting('offsetColumn') === this.lastOffsetColumn;
if (this.drawn) { //fix offsets that might have changed
this.scrollVertical(0);
this.scrollHorizontal(0);
}
this.lastOffsetRow = this.getSetting('offsetRow');
this.lastOffsetColumn = this.getSetting('offsetColumn');
this.wtTable.draw(selectionsOnly);
if (!this.cloneSource) {
this.getSetting('onDraw', !selectionsOnly);
}
return this;
};
Walkontable.prototype.update = function (settings, value) {
return this.wtSettings.update(settings, value);
};
Walkontable.prototype.scrollVertical = function (delta) {
var result = this.wtScroll.scrollVertical(delta);
this.getSetting('onScrollVertically');
return result;
};
Walkontable.prototype.scrollHorizontal = function (delta) {
var result = this.wtScroll.scrollHorizontal(delta);
this.getSetting('onScrollHorizontally');
return result;
};
Walkontable.prototype.scrollViewport = function (coords) {
this.wtScroll.scrollViewport(coords);
return this;
};
Walkontable.prototype.getViewport = function () {
return [
this.wtTable.rowFilter.visibleToSource(0),
this.wtTable.columnFilter.visibleToSource(0),
this.wtTable.getLastVisibleRow(),
this.wtTable.getLastVisibleColumn()
];
};
Walkontable.prototype.getSetting = function (key, param1, param2, param3) {
return this.wtSettings.getSetting(key, param1, param2, param3);
};
Walkontable.prototype.hasSetting = function (key) {
return this.wtSettings.has(key);
};
Walkontable.prototype.destroy = function () {
$(document.body).off('.' + this.guid);
this.wtScrollbars.destroy();
clearTimeout(this.wheelTimeout);
this.wtEvent && this.wtEvent.destroy();
};
/**
* A overlay that renders ALL available rows & columns positioned on top of the original Walkontable instance and all other overlays.
* Used for debugging purposes to see if the other overlays (that render only part of the rows & columns) are positioned correctly
* @param instance
* @constructor
*/
function WalkontableDebugOverlay(instance) {
this.instance = instance;
this.init();
this.clone = this.makeClone('debug');
this.clone.wtTable.holder.style.opacity = 0.4;
this.clone.wtTable.holder.style.textShadow = '0 0 2px #ff0000';
var that = this;
var lastTimeout;
var lastX = 0;
var lastY = 0;
var overlayContainer = that.clone.wtTable.holder.parentNode;
$(document.body).on('mousemove.' + this.instance.guid, function (event) {
if (!that.instance.wtTable.holder.parentNode) {
return; //removed from DOM
}
if ((event.clientX - lastX > -5 && event.clientX - lastX < 5) && (event.clientY - lastY > -5 && event.clientY - lastY < 5)) {
return; //ignore minor mouse movement
}
lastX = event.clientX;
lastY = event.clientY;
WalkontableDom.prototype.addClass(overlayContainer, 'wtDebugHidden');
WalkontableDom.prototype.removeClass(overlayContainer, 'wtDebugVisible');
clearTimeout(lastTimeout);
lastTimeout = setTimeout(function () {
WalkontableDom.prototype.removeClass(overlayContainer, 'wtDebugHidden');
WalkontableDom.prototype.addClass(overlayContainer, 'wtDebugVisible');
}, 1000);
});
}
WalkontableDebugOverlay.prototype = new WalkontableOverlay();
WalkontableDebugOverlay.prototype.resetFixedPosition = function () {
if (!this.instance.wtTable.holder.parentNode) {
return; //removed from DOM
}
var elem = this.clone.wtTable.holder.parentNode;
var box = this.instance.wtTable.holder.getBoundingClientRect();
elem.style.top = Math.ceil(box.top, 10) + 'px';
elem.style.left = Math.ceil(box.left, 10) + 'px';
};
WalkontableDebugOverlay.prototype.prepare = function () {
};
WalkontableDebugOverlay.prototype.refresh = function (selectionsOnly) {
this.clone && this.clone.draw(selectionsOnly);
};
WalkontableDebugOverlay.prototype.getScrollPosition = function () {
};
WalkontableDebugOverlay.prototype.getLastCell = function () {
};
WalkontableDebugOverlay.prototype.applyToDOM = function () {
};
WalkontableDebugOverlay.prototype.scrollTo = function () {
};
WalkontableDebugOverlay.prototype.readWindowSize = function () {
};
WalkontableDebugOverlay.prototype.readSettings = function () {
};
function WalkontableDom() {
}
//goes up the DOM tree (including given element) until it finds an element that matches the nodeName
WalkontableDom.prototype.closest = function (elem, nodeNames, until) {
while (elem != null && elem !== until) {
if (elem.nodeType === 1 && nodeNames.indexOf(elem.nodeName) > -1) {
return elem;
}
elem = elem.parentNode;
}
return null;
};
//goes up the DOM tree and checks if element is child of another element
WalkontableDom.prototype.isChildOf = function (child, parent) {
var node = child.parentNode;
while (node != null) {
if (node == parent) {
return true;
}
node = node.parentNode;
}
return false;
};
/**
* Counts index of element within its parent
* WARNING: for performance reasons, assumes there are only element nodes (no text nodes). This is true for Walkotnable
* Otherwise would need to check for nodeType or use previousElementSibling
* @see http://jsperf.com/sibling-index/10
* @param {Element} elem
* @return {Number}
*/
WalkontableDom.prototype.index = function (elem) {
var i = 0;
while (elem = elem.previousSibling) {
++i
}
return i;
};
if (document.documentElement.classList) {
// HTML5 classList API
WalkontableDom.prototype.hasClass = function (ele, cls) {
return ele.classList.contains(cls);
};
WalkontableDom.prototype.addClass = function (ele, cls) {
ele.classList.add(cls);
};
WalkontableDom.prototype.removeClass = function (ele, cls) {
ele.classList.remove(cls);
};
}
else {
//http://snipplr.com/view/3561/addclass-removeclass-hasclass/
WalkontableDom.prototype.hasClass = function (ele, cls) {
return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
};
WalkontableDom.prototype.addClass = function (ele, cls) {
if (!this.hasClass(ele, cls)) ele.className += " " + cls;
};
WalkontableDom.prototype.removeClass = function (ele, cls) {
if (this.hasClass(ele, cls)) { //is this really needed?
var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
ele.className = ele.className.replace(reg, ' ').trim(); //String.prototype.trim is defined in polyfill.js
}
};
}
/*//http://net.tutsplus.com/tutorials/javascript-ajax/javascript-from-null-cross-browser-event-binding/
WalkontableDom.prototype.addEvent = (function () {
var that = this;
if (document.addEventListener) {
return function (elem, type, cb) {
if ((elem && !elem.length) || elem === window) {
elem.addEventListener(type, cb, false);
}
else if (elem && elem.length) {
var len = elem.length;
for (var i = 0; i < len; i++) {
that.addEvent(elem[i], type, cb);
}
}
};
}
else {
return function (elem, type, cb) {
if ((elem && !elem.length) || elem === window) {
elem.attachEvent('on' + type, function () {
//normalize
//http://stackoverflow.com/questions/4643249/cross-browser-event-object-normalization
var e = window['event'];
e.target = e.srcElement;
//e.offsetX = e.layerX;
//e.offsetY = e.layerY;
e.relatedTarget = e.relatedTarget || e.type == 'mouseover' ? e.fromElement : e.toElement;
if (e.target.nodeType === 3) e.target = e.target.parentNode; //Safari bug
return cb.call(elem, e)
});
}
else if (elem.length) {
var len = elem.length;
for (var i = 0; i < len; i++) {
that.addEvent(elem[i], type, cb);
}
}
};
}
})();
WalkontableDom.prototype.triggerEvent = function (element, eventName, target) {
var event;
if (document.createEvent) {
event = document.createEvent("MouseEvents");
event.initEvent(eventName, true, true);
} else {
event = document.createEventObject();
event.eventType = eventName;
}
event.eventName = eventName;
event.target = target;
if (document.createEvent) {
target.dispatchEvent(event);
} else {
target.fireEvent("on" + event.eventType, event);
}
};*/
WalkontableDom.prototype.removeTextNodes = function (elem, parent) {
if (elem.nodeType === 3) {
parent.removeChild(elem); //bye text nodes!
}
else if (['TABLE', 'THEAD', 'TBODY', 'TFOOT', 'TR'].indexOf(elem.nodeName) > -1) {
var childs = elem.childNodes;
for (var i = childs.length - 1; i >= 0; i--) {
this.removeTextNodes(childs[i], elem);
}
}
};
/**
* Remove childs function
* WARNING - this doesn't unload events and data attached by jQuery
* http://jsperf.com/jquery-html-vs-empty-vs-innerhtml/9
* http://jsperf.com/jquery-html-vs-empty-vs-innerhtml/11 - no siginificant improvement with Chrome remove() method
* @param element
* @returns {void}
*/
//
WalkontableDom.prototype.empty = function (element) {
var child;
while (child = element.lastChild) {
element.removeChild(child);
}
};
WalkontableDom.prototype.HTML_CHARACTERS = /(<(.*)>|&(.*);)/;
/**
* Insert content into element trying avoid innerHTML method.
* @return {void}
*/
WalkontableDom.prototype.fastInnerHTML = function (element, content) {
if (this.HTML_CHARACTERS.test(content)) {
element.innerHTML = content;
}
else {
this.fastInnerText(element, content);
}
};
/**
* Insert text content into element
* @return {void}
*/
if (document.createTextNode('test').textContent) { //STANDARDS
WalkontableDom.prototype.fastInnerText = function (element, content) {
var child = element.firstChild;
if (child && child.nodeType === 3 && child.nextSibling === null) {
//fast lane - replace existing text node
//http://jsperf.com/replace-text-vs-reuse
child.textContent = content;
}
else {
//slow lane - empty element and insert a text node
this.empty(element);
element.appendChild(document.createTextNode(content));
}
};
}
else { //IE8
WalkontableDom.prototype.fastInnerText = function (element, content) {
var child = element.firstChild;
if (child && child.nodeType === 3 && child.nextSibling === null) {
//fast lane - replace existing text node
//http://jsperf.com/replace-text-vs-reuse
child.data = content;
}
else {
//slow lane - empty element and insert a text node
this.empty(element);
element.appendChild(document.createTextNode(content));
}
};
}
/**
* Returns true/false depending if element has offset parent
* @param elem
* @returns {boolean}
*/
/*if (document.createTextNode('test').textContent) { //STANDARDS
WalkontableDom.prototype.hasOffsetParent = function (elem) {
return !!elem.offsetParent;
}
}
else {
WalkontableDom.prototype.hasOffsetParent = function (elem) {
try {
if (!elem.offsetParent) {
return false;
}
}
catch (e) {
return false; //IE8 throws "Unspecified error" when offsetParent is not found - we catch it here
}
return true;
}
}*/
/**
* Returns true if element is attached to the DOM and visible, false otherwise
* @param elem
* @returns {boolean}
*/
WalkontableDom.prototype.isVisible = function (elem) {
//fast method according to benchmarks, but requires layout so slow in our case
/*
if (!WalkontableDom.prototype.hasOffsetParent(elem)) {
return false; //fixes problem with UI Bootstrap <tabs> directive
}
// if (elem.offsetWidth > 0 || (elem.parentNode && elem.parentNode.offsetWidth > 0)) { //IE10 was mistaken here
if (elem.offsetWidth > 0) {
return true;
}
*/
//slow method
var next = elem;
while (next !== document.documentElement) { //until <html> reached
if (next === null) { //parent detached from DOM
return false;
}
else if (next.nodeType === 11) { //nodeType == 1 -> DOCUMENT_FRAGMENT_NODE
if (next.host) { //this is Web Components Shadow DOM
//see: http://w3c.github.io/webcomponents/spec/shadow/#encapsulation
//according to spec, should be if (next.ownerDocument !== window.document), but that doesn't work yet
if (next.host.impl) { //Chrome 33.0.1723.0 canary (2013-11-29) Web Platform features disabled
return WalkontableDom.prototype.isVisible(next.host.impl);
}
else if (next.host) { //Chrome 33.0.1723.0 canary (2013-11-29) Web Platform features enabled
return WalkontableDom.prototype.isVisible(next.host);
}
else {
throw new Error("Lost in Web Components world");
}
}
else {
return false; //this is a node detached from document in IE8
}
}
else if (next.style.display === 'none') {
return false;
}
next = next.parentNode;
}
return true;
};
/**
* Returns elements top and left offset relative to the document. In our usage case compatible with jQuery but 2x faster
* @param {HTMLElement} elem
* @return {Object}
*/
WalkontableDom.prototype.offset = function (elem) {
if (this.hasCaptionProblem() && elem.firstChild && elem.firstChild.nodeName === 'CAPTION') {
//fixes problem with Firefox ignoring <caption> in TABLE offset (see also WalkontableDom.prototype.outerHeight)
//http://jsperf.com/offset-vs-getboundingclientrect/8
var box = elem.getBoundingClientRect();
return {
top: box.top + (window.pageYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0),
left: box.left + (window.pageXOffset || document.documentElement.scrollLeft) - (document.documentElement.clientLeft || 0)
};
}
var offsetLeft = elem.offsetLeft
, offsetTop = elem.offsetTop
, lastElem = elem;
while (elem = elem.offsetParent) {
if (elem === document.body) { //from my observation, document.body always has scrollLeft/scrollTop == 0
break;
}
offsetLeft += elem.offsetLeft;
offsetTop += elem.offsetTop;
lastElem = elem;
}
if (lastElem && lastElem.style.position === 'fixed') { //slow - http://jsperf.com/offset-vs-getboundingclientrect/6
//if(lastElem !== document.body) { //faster but does gives false positive in Firefox
offsetLeft += window.pageXOffset || document.documentElement.scrollLeft;
offsetTop += window.pageYOffset || document.documentElement.scrollTop;
}
return {
left: offsetLeft,
top: offsetTop
};
};
WalkontableDom.prototype.getComputedStyle = function (elem) {
return elem.currentStyle || document.defaultView.getComputedStyle(elem);
};
WalkontableDom.prototype.outerWidth = function (elem) {
return elem.offsetWidth;
};
WalkontableDom.prototype.outerHeight = function (elem) {
if (this.hasCaptionProblem() && elem.firstChild && elem.firstChild.nodeName === 'CAPTION') {
//fixes problem with Firefox ignoring <caption> in TABLE.offsetHeight
//jQuery (1.10.1) still has this unsolved
//may be better to just switch to getBoundingClientRect
//http://bililite.com/blog/2009/03/27/finding-the-size-of-a-table/
//http://lists.w3.org/Archives/Public/www-style/2009Oct/0089.html
//http://bugs.jquery.com/ticket/2196
//http://lists.w3.org/Archives/Public/www-style/2009Oct/0140.html#start140
return elem.offsetHeight + elem.firstChild.offsetHeight;
}
else {
return elem.offsetHeight;
}
};
(function () {
var hasCaptionProblem;
function detectCaptionProblem() {
var TABLE = document.createElement('TABLE');
TABLE.style.borderSpacing = 0;
TABLE.style.borderWidth = 0;
TABLE.style.padding = 0;
var TBODY = document.createElement('TBODY');
TABLE.appendChild(TBODY);
TBODY.appendChild(document.createElement('TR'));
TBODY.firstChild.appendChild(document.createElement('TD'));
TBODY.firstChild.firstChild.innerHTML = '<tr><td>t<br>t</td></tr>';
var CAPTION = document.createElement('CAPTION');
CAPTION.innerHTML = 'c<br>c<br>c<br>c';
CAPTION.style.padding = 0;
CAPTION.style.margin = 0;
TABLE.insertBefore(CAPTION, TBODY);
document.body.appendChild(TABLE);
hasCaptionProblem = (TABLE.offsetHeight < 2 * TABLE.lastChild.offsetHeight); //boolean
document.body.removeChild(TABLE);
}
WalkontableDom.prototype.hasCaptionProblem = function () {
if (hasCaptionProblem === void 0) {
detectCaptionProblem();
}
return hasCaptionProblem;
};
/**
* Returns caret position in text input
* @author http://stackoverflow.com/questions/263743/how-to-get-caret-position-in-textarea
* @return {Number}
*/
WalkontableDom.prototype.getCaretPosition = function (el) {
if (el.selectionStart) {
return el.selectionStart;
}
else if (document.selection) { //IE8
el.focus();
var r = document.selection.createRange();
if (r == null) {
return 0;
}
var re = el.createTextRange(),
rc = re.duplicate();
re.moveToBookmark(r.getBookmark());
rc.setEndPoint('EndToStart', re);
return rc.text.length;
}
return 0;
};
/**
* Sets caret position in text input
* @author http://blog.vishalon.net/index.php/javascript-getting-and-setting-caret-position-in-textarea/
* @param {Element} el
* @param {Number} pos
* @param {Number} endPos
*/
WalkontableDom.prototype.setCaretPosition = function (el, pos, endPos) {
if (endPos === void 0) {
endPos = pos;
}
if (el.setSelectionRange) {
el.focus();
el.setSelectionRange(pos, endPos);
}
else if (el.createTextRange) { //IE8
var range = el.createTextRange();
range.collapse(true);
range.moveEnd('character', endPos);
range.moveStart('character', pos);
range.select();
}
};
var cachedScrollbarWidth;
//http://stackoverflow.com/questions/986937/how-can-i-get-the-browsers-scrollbar-sizes
function walkontableCalculateScrollbarWidth() {
var inner = document.createElement('p');
inner.style.width = "100%";
inner.style.height = "200px";
var outer = document.createElement('div');
outer.style.position = "absolute";
outer.style.top = "0px";
outer.style.left = "0px";
outer.style.visibility = "hidden";
outer.style.width = "200px";
outer.style.height = "150px";
outer.style.overflow = "hidden";
outer.appendChild(inner);
(document.body || document.documentElement).appendChild(outer);
var w1 = inner.offsetWidth;
outer.style.overflow = 'scroll';
var w2 = inner.offsetWidth;
if (w1 == w2) w2 = outer.clientWidth;
(document.body || document.documentElement).removeChild(outer);
return (w1 - w2);
}
/**
* Returns the computed width of the native browser scroll bar
* @return {Number} width
*/
WalkontableDom.prototype.getScrollbarWidth = function () {
if (cachedScrollbarWidth === void 0) {
cachedScrollbarWidth = walkontableCalculateScrollbarWidth();
}
return cachedScrollbarWidth;
}
})();
function WalkontableEvent(instance) {
var that = this;
//reference to instance
this.instance = instance;
this.wtDom = this.instance.wtDom;
var dblClickOrigin = [null, null];
var dblClickTimeout = [null, null];
var onMouseDown = function (event) {
var cell = that.parentCell(event.target);
if (that.wtDom.hasClass(event.target, 'corner')) {
that.instance.getSetting('onCellCornerMouseDown', event, event.target);
}
else if (cell.TD && cell.TD.nodeName === 'TD') {
if (that.instance.hasSetting('onCellMouseDown')) {
that.instance.getSetting('onCellMouseDown', event, cell.coords, cell.TD);
}
}
if (event.button !== 2) { //if not right mouse button
if (cell.TD && cell.TD.nodeName === 'TD') {
dblClickOrigin[0] = cell.TD;
clearTimeout(dblClickTimeout[0]);
dblClickTimeout[0] = setTimeout(function () {
dblClickOrigin[0] = null;
}, 1000);
}
}
};
var lastMouseOver;
var onMouseOver = function (event) {
if (that.instance.hasSetting('onCellMouseOver')) {
var TABLE = that.instance.wtTable.TABLE;
var TD = that.wtDom.closest(event.target, ['TD', 'TH'], TABLE);
if (TD && TD !== lastMouseOver && that.wtDom.isChildOf(TD, TABLE)) {
lastMouseOver = TD;
if (TD.nodeName === 'TD') {
that.instance.getSetting('onCellMouseOver', event, that.instance.wtTable.getCoords(TD), TD);
}
}
}
};
/* var lastMouseOut;
var onMouseOut = function (event) {
if (that.instance.hasSetting('onCellMouseOut')) {
var TABLE = that.instance.wtTable.TABLE;
var TD = that.wtDom.closest(event.target, ['TD', 'TH'], TABLE);
if (TD && TD !== lastMouseOut && that.wtDom.isChildOf(TD, TABLE)) {
lastMouseOut = TD;
if (TD.nodeName === 'TD') {
that.instance.getSetting('onCellMouseOut', event, that.instance.wtTable.getCoords(TD), TD);
}
}
}
};*/
var onMouseUp = function (event) {
if (event.button !== 2) { //if not right mouse button
var cell = that.parentCell(event.target);
if (cell.TD === dblClickOrigin[0] && cell.TD === dblClickOrigin[1]) {
if (that.wtDom.hasClass(event.target, 'corner')) {
that.instance.getSetting('onCellCornerDblClick', event, cell.coords, cell.TD);
}
else if (cell.TD) {
that.instance.getSetting('onCellDblClick', event, cell.coords, cell.TD);
}
dblClickOrigin[0] = null;
dblClickOrigin[1] = null;
}
else if (cell.TD === dblClickOrigin[0]) {
dblClickOrigin[1] = cell.TD;
clearTimeout(dblClickTimeout[1]);
dblClickTimeout[1] = setTimeout(function () {
dblClickOrigin[1] = null;
}, 500);
}
}
};
$(this.instance.wtTable.holder).on('mousedown', onMouseDown);
$(this.instance.wtTable.TABLE).on('mouseover', onMouseOver);
// $(this.instance.wtTable.TABLE).on('mouseout', onMouseOut);
$(this.instance.wtTable.holder).on('mouseup', onMouseUp);
}
WalkontableEvent.prototype.parentCell = function (elem) {
var cell = {};
var TABLE = this.instance.wtTable.TABLE;
var TD = this.wtDom.closest(elem, ['TD', 'TH'], TABLE);
if (TD && this.wtDom.isChildOf(TD, TABLE)) {
cell.coords = this.instance.wtTable.getCoords(TD);
cell.TD = TD;
}
else if (this.wtDom.hasClass(elem, 'wtBorder') && this.wtDom.hasClass(elem, 'current')) {
cell.coords = this.instance.selections.current.selected[0];
cell.TD = this.instance.wtTable.getCell(cell.coords);
}
return cell;
};
WalkontableEvent.prototype.destroy = function () {
clearTimeout(this.dblClickTimeout0);
clearTimeout(this.dblClickTimeout1);
};
function walkontableRangesIntersect() {
var from = arguments[0];
var to = arguments[1];
for (var i = 1, ilen = arguments.length / 2; i < ilen; i++) {
if (from <= arguments[2 * i + 1] && to >= arguments[2 * i]) {
return true;
}
}
return false;
}
/**
* Generates a random hex string. Used as namespace for Walkontable instance events.
* @return {String} - 16 character random string: "92b1bfc74ec4"
*/
function walkontableRandomString() {
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return s4() + s4() + s4() + s4();
}
/**
* http://notes.jetienne.com/2011/05/18/cancelRequestAnimFrame-for-paul-irish-requestAnimFrame.html
*/
window.requestAnimFrame = (function () {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function (/* function */ callback, /* DOMElement */ element) {
return window.setTimeout(callback, 1000 / 60);
};
})();
window.cancelRequestAnimFrame = (function () {
return window.cancelAnimationFrame ||
window.webkitCancelRequestAnimationFrame ||
window.mozCancelRequestAnimationFrame ||
window.oCancelRequestAnimationFrame ||
window.msCancelRequestAnimationFrame ||
clearTimeout
})();
//http://snipplr.com/view/13523/
//modified for speed
//http://jsperf.com/getcomputedstyle-vs-style-vs-css/8
if (!window.getComputedStyle) {
(function () {
var elem;
var styleObj = {
getPropertyValue: function getPropertyValue(prop) {
if (prop == 'float') prop = 'styleFloat';
return elem.currentStyle[prop.toUpperCase()] || null;
}
};
window.getComputedStyle = function (el) {
elem = el;
return styleObj;
}
})();
}
/**
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim
*/
if (!String.prototype.trim) {
var trimRegex = /^\s+|\s+$/g;
String.prototype.trim = function () {
return this.replace(trimRegex, '');
};
}
/**
* WalkontableRowFilter
* @constructor
*/
function WalkontableRowFilter() {
}
WalkontableRowFilter.prototype = new WalkontableCellFilter();
WalkontableRowFilter.prototype.readSettings = function (instance) {
if (instance.cloneOverlay instanceof WalkontableDebugOverlay) {
this.offset = 0;
}
else {
this.offset = instance.wtSettings.settings.offsetRow;
}
this.total = instance.getSetting('totalRows');
this.fixedCount = instance.getSetting('fixedRowsTop');
};
/**
* WalkontableRowStrategy
* @param containerSizeFn
* @param sizeAtIndex
* @constructor
*/
function WalkontableRowStrategy(instance, containerSizeFn, sizeAtIndex) {
WalkontableCellStrategy.apply(this, arguments);
this.containerSizeFn = containerSizeFn;
this.sizeAtIndex = sizeAtIndex;
this.cellSizesSum = 0;
this.cellSizes = [];
this.cellCount = 0;
this.remainingSize = -Infinity;
}
WalkontableRowStrategy.prototype = new WalkontableCellStrategy();
WalkontableRowStrategy.prototype.add = function (i, TD, reverse) {
if (!this.isLastIncomplete() && this.remainingSize != 0) {
var size = this.sizeAtIndex(i, TD);
if (size === void 0) {
return false; //total rows exceeded
}
var containerSize = this.getContainerSize(this.cellSizesSum + size);
if (reverse) {
this.cellSizes.unshift(size);
}
else {
this.cellSizes.push(size);
}
this.cellSizesSum += size;
this.cellCount++;
this.remainingSize = this.cellSizesSum - containerSize;
if (reverse && this.isLastIncomplete()) { //something is outside of the screen, maybe even some full rows?
return false;
}
return true;
}
return false;
};
WalkontableRowStrategy.prototype.remove = function () {
var size = this.cellSizes.pop();
this.cellSizesSum -= size;
this.cellCount--;
this.remainingSize -= size;
};
WalkontableRowStrategy.prototype.removeOutstanding = function () {
while (this.cellCount > 0 && this.cellSizes[this.cellCount - 1] < this.remainingSize) { //this row is completely off screen!
this.remove();
}
};
function WalkontableScroll(instance) {
this.instance = instance;
}
WalkontableScroll.prototype.scrollVertical = function (delta) {
if (!this.instance.drawn) {
throw new Error('scrollVertical can only be called after table was drawn to DOM');
}
var instance = this.instance
, newOffset
, offset = instance.getSetting('offsetRow')
, fixedCount = instance.getSetting('fixedRowsTop')
, total = instance.getSetting('totalRows')
, maxSize = instance.wtViewport.getViewportHeight();
if (total > 0) {
newOffset = this.scrollLogicVertical(delta, offset, total, fixedCount, maxSize, function (row) {
if (row - offset < fixedCount && row - offset >= 0) {
return instance.getSetting('rowHeight', row - offset);
}
else {
return instance.getSetting('rowHeight', row);
}
}, function (isReverse) {
instance.wtTable.verticalRenderReverse = isReverse;
});
}
else {
newOffset = 0;
}
if (newOffset !== offset) {
this.instance.wtScrollbars.vertical.scrollTo(newOffset);
}
return instance;
};
WalkontableScroll.prototype.scrollHorizontal = function (delta) {
if (!this.instance.drawn) {
throw new Error('scrollHorizontal can only be called after table was drawn to DOM');
}
var instance = this.instance
, newOffset
, offset = instance.getSetting('offsetColumn')
, fixedCount = instance.getSetting('fixedColumnsLeft')
, total = instance.getSetting('totalColumns')
, maxSize = instance.wtViewport.getViewportWidth();
if (total > 0) {
newOffset = this.scrollLogicHorizontal(delta, offset, total, fixedCount, maxSize, function (col) {
if (col - offset < fixedCount && col - offset >= 0) {
return instance.getSetting('columnWidth', col - offset);
}
else {
return instance.getSetting('columnWidth', col);
}
});
}
else {
newOffset = 0;
}
if (newOffset !== offset) {
this.instance.wtScrollbars.horizontal.scrollTo(newOffset);
}
return instance;
};
WalkontableScroll.prototype.scrollLogicVertical = function (delta, offset, total, fixedCount, maxSize, cellSizeFn, setReverseRenderFn) {
var newOffset = offset + delta;
if (newOffset >= total - fixedCount) {
newOffset = total - fixedCount - 1;
setReverseRenderFn(true);
}
if (newOffset < 0) {
newOffset = 0;
}
return newOffset;
};
WalkontableScroll.prototype.scrollLogicHorizontal = function (delta, offset, total, fixedCount, maxSize, cellSizeFn) {
var newOffset = offset + delta
, sum = 0
, col;
if (newOffset > fixedCount) {
if (newOffset >= total - fixedCount) {
newOffset = total - fixedCount - 1;
}
col = newOffset;
while (sum < maxSize && col < total) {
sum += cellSizeFn(col);
col++;
}
if (sum < maxSize) {
while (newOffset > 0) {
//if sum still less than available width, we cannot scroll that far (must move offset to the left)
sum += cellSizeFn(newOffset - 1);
if (sum < maxSize) {
newOffset--;
}
else {
break;
}
}
}
}
else if (newOffset < 0) {
newOffset = 0;
}
return newOffset;
};
/**
* Scrolls viewport to a cell by minimum number of cells
*/
WalkontableScroll.prototype.scrollViewport = function (coords) {
if (!this.instance.drawn) {
return;
}
var offsetRow = this.instance.getSetting('offsetRow')
, offsetColumn = this.instance.getSetting('offsetColumn')
, lastVisibleRow = this.instance.wtTable.getLastVisibleRow()
, totalRows = this.instance.getSetting('totalRows')
, totalColumns = this.instance.getSetting('totalColumns')
, fixedRowsTop = this.instance.getSetting('fixedRowsTop')
, fixedColumnsLeft = this.instance.getSetting('fixedColumnsLeft');
if (this.instance.getSetting('nativeScrollbars')) {
var TD = this.instance.wtTable.getCell(coords);
if (typeof TD === 'object') {
var offset = WalkontableDom.prototype.offset(TD);
var outerWidth = WalkontableDom.prototype.outerWidth(TD);
var outerHeight = WalkontableDom.prototype.outerHeight(TD);
var scrollX = this.instance.wtScrollbars.horizontal.getScrollPosition();
var scrollY = this.instance.wtScrollbars.vertical.getScrollPosition();
var clientWidth = WalkontableDom.prototype.outerWidth(this.instance.wtScrollbars.horizontal.scrollHandler);
var clientHeight = WalkontableDom.prototype.outerHeight(this.instance.wtScrollbars.vertical.scrollHandler);
if (this.instance.wtScrollbars.horizontal.scrollHandler !== window) {
offset.left = offset.left - WalkontableDom.prototype.offset(this.instance.wtScrollbars.horizontal.scrollHandler).left;
}
if (this.instance.wtScrollbars.vertical.scrollHandler !== window) {
offset.top = offset.top - WalkontableDom.prototype.offset(this.instance.wtScrollbars.vertical.scrollHandler).top;
}
clientWidth -= 20;
clientHeight -= 20;
if (outerWidth < clientWidth) {
if (offset.left < scrollX) {
this.instance.wtScrollbars.horizontal.setScrollPosition(offset.left);
}
else if (offset.left + outerWidth > scrollX + clientWidth) {
this.instance.wtScrollbars.horizontal.setScrollPosition(offset.left - clientWidth + outerWidth);
}
}
if (outerHeight < clientHeight) {
if (offset.top < scrollY) {
this.instance.wtScrollbars.vertical.setScrollPosition(offset.top);
}
else if (offset.top + outerHeight > scrollY + clientHeight) {
this.instance.wtScrollbars.vertical.setScrollPosition(offset.top - clientHeight + outerHeight);
}
}
return;
}
}
if (coords[0] < 0 || coords[0] > totalRows - 1) {
throw new Error('row ' + coords[0] + ' does not exist');
}
else if (coords[1] < 0 || coords[1] > totalColumns - 1) {
throw new Error('column ' + coords[1] + ' does not exist');
}
if (coords[0] > lastVisibleRow) {
// this.scrollVertical(coords[0] - lastVisibleRow + 1);
this.scrollVertical(coords[0] - fixedRowsTop - offsetRow);
this.instance.wtTable.verticalRenderReverse = true;
}
else if (coords[0] === lastVisibleRow && this.instance.wtTable.rowStrategy.isLastIncomplete()) {
// this.scrollVertical(coords[0] - lastVisibleRow + 1);
this.scrollVertical(coords[0] - fixedRowsTop - offsetRow);
this.instance.wtTable.verticalRenderReverse = true;
}
else if (coords[0] - fixedRowsTop < offsetRow) {
this.scrollVertical(coords[0] - fixedRowsTop - offsetRow);
}
else {
this.scrollVertical(0); //Craig's issue: remove row from the last scroll page should scroll viewport a row up if needed
}
if (this.instance.wtTable.isColumnBeforeViewport(coords[1])) {
//scroll left
this.instance.wtScrollbars.horizontal.scrollTo(coords[1] - fixedColumnsLeft);
}
else if (this.instance.wtTable.isColumnAfterViewport(coords[1]) || (this.instance.wtTable.getLastVisibleColumn() === coords[1] && !this.instance.wtTable.isLastColumnFullyVisible())) {
//scroll right
var sum = 0;
for (var i = 0; i < fixedColumnsLeft; i++) {
sum += this.instance.getSetting('columnWidth', i);
}
var scrollTo = coords[1];
sum += this.instance.getSetting('columnWidth', scrollTo);
var available = this.instance.wtViewport.getViewportWidth();
if (sum < available) {
var next = this.instance.getSetting('columnWidth', scrollTo - 1);
while (sum + next <= available && scrollTo >= fixedColumnsLeft) {
scrollTo--;
sum += next;
next = this.instance.getSetting('columnWidth', scrollTo - 1);
}
}
this.instance.wtScrollbars.horizontal.scrollTo(scrollTo - fixedColumnsLeft);
}
/*else {
//no scroll
}*/
return this.instance;
};
function WalkontableScrollbar() {
}
WalkontableScrollbar.prototype.init = function () {
var that = this;
//reference to instance
this.$table = $(this.instance.wtTable.TABLE);
//create elements
this.slider = document.createElement('DIV');
this.sliderStyle = this.slider.style;
this.sliderStyle.position = 'absolute';
this.sliderStyle.top = '0';
this.sliderStyle.left = '0';
this.sliderStyle.display = 'none';
this.slider.className = 'dragdealer ' + this.type;
this.handle = document.createElement('DIV');
this.handleStyle = this.handle.style;
this.handle.className = 'handle';
this.slider.appendChild(this.handle);
this.container = this.instance.wtTable.holder;
this.container.appendChild(this.slider);
var firstRun = true;
this.dragTimeout = null;
var dragDelta;
var dragRender = function () {
that.onScroll(dragDelta);
};
this.dragdealer = new Dragdealer(this.slider, {
vertical: (this.type === 'vertical'),
horizontal: (this.type === 'horizontal'),
slide: false,
speed: 100,
animationCallback: function (x, y) {
if (firstRun) {
firstRun = false;
return;
}
that.skipRefresh = true;
dragDelta = that.type === 'vertical' ? y : x;
if (that.dragTimeout === null) {
that.dragTimeout = setInterval(dragRender, 100);
dragRender();
}
},
callback: function (x, y) {
that.skipRefresh = false;
clearInterval(that.dragTimeout);
that.dragTimeout = null;
dragDelta = that.type === 'vertical' ? y : x;
that.onScroll(dragDelta);
}
});
this.skipRefresh = false;
};
WalkontableScrollbar.prototype.onScroll = function (delta) {
if (this.instance.drawn) {
this.readSettings();
if (this.total > this.visibleCount) {
var newOffset = Math.round(this.handlePosition * this.total / this.sliderSize);
if (delta === 1) {
if (this.type === 'vertical') {
this.instance.scrollVertical(Infinity).draw();
}
else {
this.instance.scrollHorizontal(Infinity).draw();
}
}
else if (newOffset !== this.offset) { //is new offset different than old offset
if (this.type === 'vertical') {
this.instance.scrollVertical(newOffset - this.offset).draw();
}
else {
this.instance.scrollHorizontal(newOffset - this.offset).draw();
}
}
else {
this.refresh();
}
}
}
};
/**
* Returns what part of the scroller should the handle take
* @param viewportCount {Number} number of visible rows or columns
* @param totalCount {Number} total number of rows or columns
* @return {Number} 0..1
*/
WalkontableScrollbar.prototype.getHandleSizeRatio = function (viewportCount, totalCount) {
if (!totalCount || viewportCount > totalCount || viewportCount == totalCount) {
return 1;
}
return 1 / totalCount;
};
WalkontableScrollbar.prototype.prepare = function () {
if (this.skipRefresh) {
return;
}
var ratio = this.getHandleSizeRatio(this.visibleCount, this.total);
if (((ratio === 1 || isNaN(ratio)) && this.scrollMode === 'auto') || this.scrollMode === 'none') {
//isNaN is needed because ratio equals NaN when totalRows/totalColumns equals 0
this.visible = false;
}
else {
this.visible = true;
}
};
WalkontableScrollbar.prototype.refresh = function () {
if (this.skipRefresh) {
return;
}
else if (!this.visible) {
this.sliderStyle.display = 'none';
return;
}
var ratio
, sliderSize
, handleSize
, handlePosition
, visibleCount = this.visibleCount
, tableWidth = this.instance.wtViewport.getWorkspaceWidth()
, tableHeight = this.instance.wtViewport.getWorkspaceHeight();
if (tableWidth === Infinity) {
tableWidth = this.instance.wtViewport.getWorkspaceActualWidth();
}
if (tableHeight === Infinity) {
tableHeight = this.instance.wtViewport.getWorkspaceActualHeight();
}
if (this.type === 'vertical') {
if (this.instance.wtTable.rowStrategy.isLastIncomplete()) {
visibleCount--;
}
sliderSize = tableHeight - 2; //2 is sliders border-width
this.sliderStyle.top = this.instance.wtDom.offset(this.$table[0]).top - this.instance.wtDom.offset(this.container).top + 'px';
this.sliderStyle.left = tableWidth - 1 + 'px'; //1 is sliders border-width
this.sliderStyle.height = Math.max(sliderSize, 0) + 'px';
}
else { //horizontal
sliderSize = tableWidth - 2; //2 is sliders border-width
this.sliderStyle.left = this.instance.wtDom.offset(this.$table[0]).left - this.instance.wtDom.offset(this.container).left + 'px';
this.sliderStyle.top = tableHeight - 1 + 'px'; //1 is sliders border-width
this.sliderStyle.width = Math.max(sliderSize, 0) + 'px';
}
ratio = this.getHandleSizeRatio(visibleCount, this.total);
handleSize = Math.round(sliderSize * ratio);
if (handleSize < 10) {
handleSize = 15;
}
handlePosition = Math.floor(sliderSize * (this.offset / this.total));
if (handleSize + handlePosition > sliderSize) {
handlePosition = sliderSize - handleSize;
}
if (this.type === 'vertical') {
this.handleStyle.height = handleSize + 'px';
this.handleStyle.top = handlePosition + 'px';
}
else { //horizontal
this.handleStyle.width = handleSize + 'px';
this.handleStyle.left = handlePosition + 'px';
}
this.sliderStyle.display = 'block';
};
WalkontableScrollbar.prototype.destroy = function () {
clearInterval(this.dragdealer.interval);
};
///
var WalkontableVerticalScrollbar = function (instance) {
this.instance = instance;
this.type = 'vertical';
this.init();
};
WalkontableVerticalScrollbar.prototype = new WalkontableScrollbar();
WalkontableVerticalScrollbar.prototype.scrollTo = function (cell) {
this.instance.update('offsetRow', cell);
};
WalkontableVerticalScrollbar.prototype.readSettings = function () {
this.scrollMode = this.instance.getSetting('scrollV');
this.offset = this.instance.getSetting('offsetRow');
this.total = this.instance.getSetting('totalRows');
this.visibleCount = this.instance.wtTable.rowStrategy.countVisible();
if(this.visibleCount > 1 && this.instance.wtTable.rowStrategy.isLastIncomplete()) {
this.visibleCount--;
}
this.handlePosition = parseInt(this.handleStyle.top, 10);
this.sliderSize = parseInt(this.sliderStyle.height, 10);
this.fixedCount = this.instance.getSetting('fixedRowsTop');
};
///
var WalkontableHorizontalScrollbar = function (instance) {
this.instance = instance;
this.type = 'horizontal';
this.init();
};
WalkontableHorizontalScrollbar.prototype = new WalkontableScrollbar();
WalkontableHorizontalScrollbar.prototype.scrollTo = function (cell) {
this.instance.update('offsetColumn', cell);
};
WalkontableHorizontalScrollbar.prototype.readSettings = function () {
this.scrollMode = this.instance.getSetting('scrollH');
this.offset = this.instance.getSetting('offsetColumn');
this.total = this.instance.getSetting('totalColumns');
this.visibleCount = this.instance.wtTable.columnStrategy.countVisible();
if(this.visibleCount > 1 && this.instance.wtTable.columnStrategy.isLastIncomplete()) {
this.visibleCount--;
}
this.handlePosition = parseInt(this.handleStyle.left, 10);
this.sliderSize = parseInt(this.sliderStyle.width, 10);
this.fixedCount = this.instance.getSetting('fixedColumnsLeft');
};
WalkontableHorizontalScrollbar.prototype.getHandleSizeRatio = function (viewportCount, totalCount) {
if (!totalCount || viewportCount > totalCount || viewportCount == totalCount) {
return 1;
}
return viewportCount / totalCount;
};
function WalkontableCornerScrollbarNative(instance) {
this.instance = instance;
this.init();
this.clone = this.makeClone('corner');
}
WalkontableCornerScrollbarNative.prototype = new WalkontableOverlay();
WalkontableCornerScrollbarNative.prototype.resetFixedPosition = function () {
if (!this.instance.wtTable.holder.parentNode) {
return; //removed from DOM
}
var elem = this.clone.wtTable.holder.parentNode;
var box;
if (this.scrollHandler === window) {
box = this.instance.wtTable.hider.getBoundingClientRect();
var top = Math.ceil(box.top, 10);
var bottom = Math.ceil(box.bottom, 10);
if (top < 0 && bottom > 0) {
elem.style.top = '0';
}
else {
elem.style.top = top + 'px';
}
var left = Math.ceil(box.left, 10);
var right = Math.ceil(box.right, 10);
if (left < 0 && right > 0) {
elem.style.left = '0';
}
else {
elem.style.left = left + 'px';
}
}
else {
box = this.scrollHandler.getBoundingClientRect();
elem.style.top = Math.ceil(box.top, 10) + 'px';
elem.style.left = Math.ceil(box.left, 10) + 'px';
}
elem.style.width = WalkontableDom.prototype.outerWidth(this.clone.wtTable.TABLE) + 4 + 'px';
elem.style.height = WalkontableDom.prototype.outerHeight(this.clone.wtTable.TABLE) + 4 + 'px';
};
WalkontableCornerScrollbarNative.prototype.prepare = function () {
};
WalkontableCornerScrollbarNative.prototype.refresh = function (selectionsOnly) {
this.measureBefore = 0;
this.measureAfter = 0;
this.clone && this.clone.draw(selectionsOnly);
};
WalkontableCornerScrollbarNative.prototype.getScrollPosition = function () {
};
WalkontableCornerScrollbarNative.prototype.getLastCell = function () {
};
WalkontableCornerScrollbarNative.prototype.applyToDOM = function () {
};
WalkontableCornerScrollbarNative.prototype.scrollTo = function () {
};
WalkontableCornerScrollbarNative.prototype.readWindowSize = function () {
};
WalkontableCornerScrollbarNative.prototype.readSettings = function () {
};
function WalkontableHorizontalScrollbarNative(instance) {
this.instance = instance;
this.type = 'horizontal';
this.cellSize = 50;
this.init();
this.clone = this.makeClone('left');
}
WalkontableHorizontalScrollbarNative.prototype = new WalkontableOverlay();
//resetFixedPosition (in future merge it with this.refresh?)
WalkontableHorizontalScrollbarNative.prototype.resetFixedPosition = function () {
if (!this.instance.wtTable.holder.parentNode) {
return; //removed from DOM
}
var elem = this.clone.wtTable.holder.parentNode;
var box;
if (this.scrollHandler === window) {
box = this.instance.wtTable.hider.getBoundingClientRect();
var left = Math.ceil(box.left, 10);
var right = Math.ceil(box.right, 10);
if (left < 0 && right > 0) {
elem.style.left = '0';
}
else {
elem.style.left = left + 'px';
}
}
else {
box = this.scrollHandler.getBoundingClientRect();
elem.style.top = Math.ceil(box.top, 10) + 'px';
elem.style.left = Math.ceil(box.left, 10) + 'px';
}
};
//react on movement of the other dimension scrollbar (in future merge it with this.refresh?)
WalkontableHorizontalScrollbarNative.prototype.react = function () {
if (!this.instance.wtTable.holder.parentNode) {
return; //removed from DOM
}
var overlayContainer = this.clone.wtTable.holder.parentNode;
if (this.instance.wtScrollbars.vertical.scrollHandler === window) {
var box = this.instance.wtTable.hider.getBoundingClientRect();
overlayContainer.style.top = Math.ceil(box.top, 10) + 'px';
overlayContainer.style.height = WalkontableDom.prototype.outerHeight(this.clone.wtTable.TABLE) + 'px';
}
else {
this.clone.wtTable.holder.style.top = -(this.instance.wtScrollbars.vertical.windowScrollPosition - this.instance.wtScrollbars.vertical.measureBefore) + 'px';
overlayContainer.style.height = this.instance.wtViewport.getWorkspaceHeight() + 'px'
}
overlayContainer.style.width = WalkontableDom.prototype.outerWidth(this.clone.wtTable.TABLE) + 4 + 'px'; //4 is for the box shadow
};
WalkontableHorizontalScrollbarNative.prototype.prepare = function () {
};
WalkontableHorizontalScrollbarNative.prototype.refresh = function (selectionsOnly) {
this.measureBefore = 0;
this.measureAfter = 0;
this.clone && this.clone.draw(selectionsOnly);
};
WalkontableHorizontalScrollbarNative.prototype.getScrollPosition = function () {
if (this.scrollHandler === window) {
return this.scrollHandler.scrollX;
}
else {
return this.scrollHandler.scrollLeft;
}
};
WalkontableHorizontalScrollbarNative.prototype.setScrollPosition = function (pos) {
this.scrollHandler.scrollLeft = pos;
};
WalkontableHorizontalScrollbarNative.prototype.onScroll = function () {
WalkontableOverlay.prototype.onScroll.apply(this, arguments);
this.instance.getSetting('onScrollHorizontally');
};
WalkontableHorizontalScrollbarNative.prototype.getLastCell = function () {
return this.instance.wtTable.getLastVisibleColumn();
};
//applyToDOM (in future merge it with this.refresh?)
WalkontableHorizontalScrollbarNative.prototype.applyToDOM = function () {
this.fixedContainer.style.paddingLeft = this.measureBefore + 'px';
this.fixedContainer.style.paddingRight = this.measureAfter + 'px';
};
WalkontableHorizontalScrollbarNative.prototype.scrollTo = function (cell) {
this.$scrollHandler.scrollLeft(this.tableParentOffset + cell * this.cellSize);
};
//readWindowSize (in future merge it with this.prepare?)
WalkontableHorizontalScrollbarNative.prototype.readWindowSize = function () {
if (this.scrollHandler === window) {
this.windowSize = document.documentElement.clientWidth;
this.tableParentOffset = this.instance.wtTable.holderOffset.left;
}
else {
this.windowSize = WalkontableDom.prototype.outerWidth(this.scrollHandler);
this.tableParentOffset = 0;
}
this.windowScrollPosition = this.getScrollPosition();
};
//readSettings (in future merge it with this.prepare?)
WalkontableHorizontalScrollbarNative.prototype.readSettings = function () {
this.offset = this.instance.getSetting('offsetColumn');
this.total = this.instance.getSetting('totalColumns');
};
function WalkontableVerticalScrollbarNative(instance) {
this.instance = instance;
this.type = 'vertical';
this.cellSize = 23;
this.init();
this.clone = this.makeClone('top');
}
WalkontableVerticalScrollbarNative.prototype = new WalkontableOverlay();
//resetFixedPosition (in future merge it with this.refresh?)
WalkontableVerticalScrollbarNative.prototype.resetFixedPosition = function () {
if (!this.instance.wtTable.holder.parentNode) {
return; //removed from DOM
}
var elem = this.clone.wtTable.holder.parentNode;
var box;
if (this.scrollHandler === window) {
box = this.instance.wtTable.hider.getBoundingClientRect();
var top = Math.ceil(box.top, 10);
var bottom = Math.ceil(box.bottom, 10);
if (top < 0 && bottom > 0) {
elem.style.top = '0';
}
else {
elem.style.top = top + 'px';
}
}
else {
box = this.instance.wtScrollbars.horizontal.scrollHandler.getBoundingClientRect();
elem.style.top = Math.ceil(box.top, 10) + 'px';
elem.style.left = Math.ceil(box.left, 10) + 'px';
}
if (this.instance.wtScrollbars.horizontal.scrollHandler === window) {
elem.style.width = this.instance.wtViewport.getWorkspaceActualWidth() + 'px';
}
else {
elem.style.width = WalkontableDom.prototype.outerWidth(this.instance.wtTable.holder.parentNode) + 'px';
}
elem.style.height = WalkontableDom.prototype.outerHeight(this.clone.wtTable.TABLE) + 4 + 'px';
};
//react on movement of the other dimension scrollbar (in future merge it with this.refresh?)
WalkontableVerticalScrollbarNative.prototype.react = function () {
if (!this.instance.wtTable.holder.parentNode) {
return; //removed from DOM
}
if (this.instance.wtScrollbars.horizontal.scrollHandler !== window) {
var elem = this.clone.wtTable.holder.parentNode;
elem.firstChild.style.left = -this.instance.wtScrollbars.horizontal.windowScrollPosition + 'px';
}
};
WalkontableVerticalScrollbarNative.prototype.getScrollPosition = function () {
if (this.scrollHandler === window) {
return this.scrollHandler.scrollY;
}
else {
return this.scrollHandler.scrollTop;
}
};
WalkontableVerticalScrollbarNative.prototype.setScrollPosition = function (pos) {
this.scrollHandler.scrollTop = pos;
};
WalkontableVerticalScrollbarNative.prototype.onScroll = function (forcePosition) {
WalkontableOverlay.prototype.onScroll.apply(this, arguments);
var scrollDelta;
var newOffset = 0;
if (1 == 1 || this.windowScrollPosition > this.tableParentOffset) {
scrollDelta = this.windowScrollPosition - this.tableParentOffset;
partialOffset = 0;
if (scrollDelta > 0) {
var sum = 0;
var last;
for (var i = 0; i < this.total; i++) {
last = this.instance.getSetting('rowHeight', i);
sum += last;
if (sum > scrollDelta) {
break;
}
}
if (this.offset > 0) {
partialOffset = (sum - scrollDelta);
}
newOffset = i;
newOffset = Math.min(newOffset, this.total);
}
}
this.curOuts = newOffset > this.maxOuts ? this.maxOuts : newOffset;
newOffset -= this.curOuts;
this.instance.update('offsetRow', newOffset);
this.readSettings(); //read new offset
this.instance.draw();
this.instance.getSetting('onScrollVertically');
};
WalkontableVerticalScrollbarNative.prototype.getLastCell = function () {
return this.instance.getSetting('offsetRow') + this.instance.wtTable.tbodyChildrenLength - 1;
};
var partialOffset = 0;
WalkontableVerticalScrollbarNative.prototype.sumCellSizes = function (from, length) {
var sum = 0;
while (from < length) {
sum += this.instance.getSetting('rowHeight', from);
from++;
}
return sum;
};
//applyToDOM (in future merge it with this.refresh?)
WalkontableVerticalScrollbarNative.prototype.applyToDOM = function () {
var headerSize = this.instance.wtViewport.getColumnHeaderHeight();
this.fixedContainer.style.height = headerSize + this.sumCellSizes(0, this.total) + 4 + 'px'; //+4 is needed, otherwise vertical scroll appears in Chrome (window scroll mode) - maybe because of fill handle in last row or because of box shadow
this.fixed.style.top = this.measureBefore + 'px';
this.fixed.style.bottom = '';
};
WalkontableVerticalScrollbarNative.prototype.scrollTo = function (cell) {
var newY = this.tableParentOffset + cell * this.cellSize;
this.$scrollHandler.scrollTop(newY);
this.onScroll(newY);
};
//readWindowSize (in future merge it with this.prepare?)
WalkontableVerticalScrollbarNative.prototype.readWindowSize = function () {
if (this.scrollHandler === window) {
this.windowSize = document.documentElement.clientHeight;
this.tableParentOffset = this.instance.wtTable.holderOffset.top;
}
else {
//this.windowSize = WalkontableDom.prototype.outerHeight(this.scrollHandler);
this.windowSize = this.scrollHandler.clientHeight; //returns height without DIV scrollbar
this.tableParentOffset = 0;
}
this.windowScrollPosition = this.getScrollPosition();
};
//readSettings (in future merge it with this.prepare?)
WalkontableVerticalScrollbarNative.prototype.readSettings = function () {
this.offset = this.instance.getSetting('offsetRow');
this.total = this.instance.getSetting('totalRows');
};
function WalkontableScrollbars(instance) {
this.instance = instance;
if (instance.getSetting('nativeScrollbars')) {
instance.update('scrollbarWidth', instance.wtDom.getScrollbarWidth());
instance.update('scrollbarHeight', instance.wtDom.getScrollbarWidth());
this.vertical = new WalkontableVerticalScrollbarNative(instance);
this.horizontal = new WalkontableHorizontalScrollbarNative(instance);
this.corner = new WalkontableCornerScrollbarNative(instance);
if (instance.getSetting('debug')) {
this.debug = new WalkontableDebugOverlay(instance);
}
this.registerListeners();
}
else {
this.vertical = new WalkontableVerticalScrollbar(instance);
this.horizontal = new WalkontableHorizontalScrollbar(instance);
}
}
WalkontableScrollbars.prototype.registerListeners = function () {
var that = this;
var oldVerticalScrollPosition
, oldHorizontalScrollPosition
, oldBoxTop
, oldBoxLeft
, oldBoxWidth
, oldBoxHeight;
function refreshAll() {
if (!that.instance.wtTable.holder.parentNode) {
//Walkontable was detached from DOM, but this handler was not removed
that.destroy();
return;
}
that.vertical.windowScrollPosition = that.vertical.getScrollPosition();
that.horizontal.windowScrollPosition = that.horizontal.getScrollPosition();
that.box = that.instance.wtTable.hider.getBoundingClientRect();
if((that.box.width !== oldBoxWidth || that.box.height !== oldBoxHeight) && that.instance.rowHeightCache) {
//that.instance.rowHeightCache.length = 0; //at this point the cached row heights may be invalid, but it is better not to reset the cache, which could cause scrollbar jumping when there are multiline cells outside of the rendered part of the table
oldBoxWidth = that.box.width;
oldBoxHeight = that.box.height;
that.instance.draw();
}
if (that.vertical.windowScrollPosition !== oldVerticalScrollPosition || that.horizontal.windowScrollPosition !== oldHorizontalScrollPosition || that.box.top !== oldBoxTop || that.box.left !== oldBoxLeft) {
that.vertical.onScroll();
that.horizontal.onScroll(); //it's done here to make sure that all onScroll's are executed before changing styles
that.vertical.react();
that.horizontal.react(); //it's done here to make sure that all onScroll's are executed before changing styles
oldVerticalScrollPosition = that.vertical.windowScrollPosition;
oldHorizontalScrollPosition = that.horizontal.windowScrollPosition;
oldBoxTop = that.box.top;
oldBoxLeft = that.box.left;
}
}
var $window = $(window);
this.vertical.$scrollHandler.on('scroll.' + this.instance.guid, refreshAll);
if (this.vertical.scrollHandler !== this.horizontal.scrollHandler) {
this.horizontal.$scrollHandler.on('scroll.' + this.instance.guid, refreshAll);
}
if (this.vertical.scrollHandler !== window && this.horizontal.scrollHandler !== window) {
$window.on('scroll.' + this.instance.guid, refreshAll);
}
$window.on('load.' + this.instance.guid, refreshAll);
$window.on('resize.' + this.instance.guid, refreshAll);
$(document).on('ready.' + this.instance.guid, refreshAll);
setInterval(refreshAll, 100); //Marcin - only idea I have to reposition scrollbars on CSS change of the container (container was moved using some styles after page was loaded)
};
WalkontableScrollbars.prototype.destroy = function () {
this.vertical && this.vertical.destroy();
this.horizontal && this.horizontal.destroy();
};
WalkontableScrollbars.prototype.refresh = function (selectionsOnly) {
this.horizontal && this.horizontal.readSettings();
this.vertical && this.vertical.readSettings();
this.horizontal && this.horizontal.prepare();
this.vertical && this.vertical.prepare();
this.horizontal && this.horizontal.refresh(selectionsOnly);
this.vertical && this.vertical.refresh(selectionsOnly);
this.corner && this.corner.refresh(selectionsOnly);
this.debug && this.debug.refresh(selectionsOnly);
};
function WalkontableSelection(instance, settings) {
this.instance = instance;
this.settings = settings;
this.selected = [];
if (settings.border) {
this.border = new WalkontableBorder(instance, settings);
}
}
WalkontableSelection.prototype.add = function (coords) {
this.selected.push(coords);
};
WalkontableSelection.prototype.clear = function () {
this.selected.length = 0; //http://jsperf.com/clear-arrayxxx
};
/**
* Returns the top left (TL) and bottom right (BR) selection coordinates
* @returns {Object}
*/
WalkontableSelection.prototype.getCorners = function () {
var minRow
, minColumn
, maxRow
, maxColumn
, i
, ilen = this.selected.length;
if (ilen > 0) {
minRow = maxRow = this.selected[0][0];
minColumn = maxColumn = this.selected[0][1];
if (ilen > 1) {
for (i = 1; i < ilen; i++) {
if (this.selected[i][0] < minRow) {
minRow = this.selected[i][0];
}
else if (this.selected[i][0] > maxRow) {
maxRow = this.selected[i][0];
}
if (this.selected[i][1] < minColumn) {
minColumn = this.selected[i][1];
}
else if (this.selected[i][1] > maxColumn) {
maxColumn = this.selected[i][1];
}
}
}
}
return [minRow, minColumn, maxRow, maxColumn];
};
WalkontableSelection.prototype.draw = function () {
var corners, r, c, source_r, source_c;
var visibleRows = this.instance.wtTable.rowStrategy.countVisible()
, visibleColumns = this.instance.wtTable.columnStrategy.countVisible();
if (this.selected.length) {
corners = this.getCorners();
for (r = 0; r < visibleRows; r++) {
for (c = 0; c < visibleColumns; c++) {
source_r = this.instance.wtTable.rowFilter.visibleToSource(r);
source_c = this.instance.wtTable.columnFilter.visibleToSource(c);
if (source_r >= corners[0] && source_r <= corners[2] && source_c >= corners[1] && source_c <= corners[3]) {
//selected cell
this.instance.wtTable.currentCellCache.add(r, c, this.settings.className);
}
else if (source_r >= corners[0] && source_r <= corners[2]) {
//selection is in this row
this.instance.wtTable.currentCellCache.add(r, c, this.settings.highlightRowClassName);
}
else if (source_c >= corners[1] && source_c <= corners[3]) {
//selection is in this column
this.instance.wtTable.currentCellCache.add(r, c, this.settings.highlightColumnClassName);
}
}
}
this.border && this.border.appear(corners); //warning! border.appear modifies corners!
}
else {
this.border && this.border.disappear();
}
};
function WalkontableSettings(instance, settings) {
var that = this;
this.instance = instance;
//default settings. void 0 means it is required, null means it can be empty
this.defaults = {
table: void 0,
debug: false, //shows WalkontableDebugOverlay
//presentation mode
scrollH: 'auto', //values: scroll (always show scrollbar), auto (show scrollbar if table does not fit in the container), none (never show scrollbar)
scrollV: 'auto', //values: see above
nativeScrollbars: false, //values: false (dragdealer), true (native)
stretchH: 'hybrid', //values: hybrid, all, last, none
currentRowClassName: null,
currentColumnClassName: null,
//data source
data: void 0,
offsetRow: 0,
offsetColumn: 0,
fixedColumnsLeft: 0,
fixedRowsTop: 0,
rowHeaders: function () {
return []
}, //this must be array of functions: [function (row, TH) {}]
columnHeaders: function () {
return []
}, //this must be array of functions: [function (column, TH) {}]
totalRows: void 0,
totalColumns: void 0,
width: null,
height: null,
cellRenderer: function (row, column, TD) {
var cellData = that.getSetting('data', row, column);
that.instance.wtDom.fastInnerText(TD, cellData === void 0 || cellData === null ? '' : cellData);
},
columnWidth: 50,
selections: null,
hideBorderOnMouseDownOver: false,
//callbacks
onCellMouseDown: null,
onCellMouseOver: null,
// onCellMouseOut: null,
onCellDblClick: null,
onCellCornerMouseDown: null,
onCellCornerDblClick: null,
beforeDraw: null,
onDraw: null,
onScrollVertically: null,
onScrollHorizontally: null,
//constants
scrollbarWidth: 10,
scrollbarHeight: 10
};
//reference to settings
this.settings = {};
for (var i in this.defaults) {
if (this.defaults.hasOwnProperty(i)) {
if (settings[i] !== void 0) {
this.settings[i] = settings[i];
}
else if (this.defaults[i] === void 0) {
throw new Error('A required setting "' + i + '" was not provided');
}
else {
this.settings[i] = this.defaults[i];
}
}
}
}
/**
* generic methods
*/
WalkontableSettings.prototype.update = function (settings, value) {
if (value === void 0) { //settings is object
for (var i in settings) {
if (settings.hasOwnProperty(i)) {
this.settings[i] = settings[i];
}
}
}
else { //if value is defined then settings is the key
this.settings[settings] = value;
}
return this.instance;
};
WalkontableSettings.prototype.getSetting = function (key, param1, param2, param3) {
if (this[key]) {
return this[key](param1, param2, param3);
}
else {
return this._getSetting(key, param1, param2, param3);
}
};
WalkontableSettings.prototype._getSetting = function (key, param1, param2, param3) {
if (typeof this.settings[key] === 'function') {
return this.settings[key](param1, param2, param3);
}
else if (param1 !== void 0 && Object.prototype.toString.call(this.settings[key]) === '[object Array]') {
return this.settings[key][param1];
}
else {
return this.settings[key];
}
};
WalkontableSettings.prototype.has = function (key) {
return !!this.settings[key]
};
/**
* specific methods
*/
WalkontableSettings.prototype.rowHeight = function (row, TD) {
if (!this.instance.rowHeightCache) {
this.instance.rowHeightCache = []; //hack. This cache is being invalidated in WOT core.js
}
if (this.instance.rowHeightCache[row] === void 0) {
var size = 23; //guess
if (TD) {
size = this.instance.wtDom.outerHeight(TD); //measure
this.instance.rowHeightCache[row] = size; //cache only something we measured
}
return size;
}
else {
return this.instance.rowHeightCache[row];
}
};
function WalkontableTable(instance, table) {
//reference to instance
this.instance = instance;
this.TABLE = table;
this.wtDom = this.instance.wtDom;
this.wtDom.removeTextNodes(this.TABLE);
//wtSpreader
var parent = this.TABLE.parentNode;
if (!parent || parent.nodeType !== 1 || !this.wtDom.hasClass(parent, 'wtHolder')) {
var spreader = document.createElement('DIV');
spreader.className = 'wtSpreader';
if (parent) {
parent.insertBefore(spreader, this.TABLE); //if TABLE is detached (e.g. in Jasmine test), it has no parentNode so we cannot attach holder to it
}
spreader.appendChild(this.TABLE);
}
this.spreader = this.TABLE.parentNode;
//wtHider
parent = this.spreader.parentNode;
if (!parent || parent.nodeType !== 1 || !this.wtDom.hasClass(parent, 'wtHolder')) {
var hider = document.createElement('DIV');
hider.className = 'wtHider';
if (parent) {
parent.insertBefore(hider, this.spreader); //if TABLE is detached (e.g. in Jasmine test), it has no parentNode so we cannot attach holder to it
}
hider.appendChild(this.spreader);
}
this.hider = this.spreader.parentNode;
this.hiderStyle = this.hider.style;
this.hiderStyle.position = 'relative';
//wtHolder
parent = this.hider.parentNode;
if (!parent || parent.nodeType !== 1 || !this.wtDom.hasClass(parent, 'wtHolder')) {
var holder = document.createElement('DIV');
holder.style.position = 'relative';
holder.className = 'wtHolder';
if (parent) {
parent.insertBefore(holder, this.hider); //if TABLE is detached (e.g. in Jasmine test), it has no parentNode so we cannot attach holder to it
}
holder.appendChild(this.hider);
}
this.holder = this.hider.parentNode;
//bootstrap from settings
this.TBODY = this.TABLE.getElementsByTagName('TBODY')[0];
if (!this.TBODY) {
this.TBODY = document.createElement('TBODY');
this.TABLE.appendChild(this.TBODY);
}
this.THEAD = this.TABLE.getElementsByTagName('THEAD')[0];
if (!this.THEAD) {
this.THEAD = document.createElement('THEAD');
this.TABLE.insertBefore(this.THEAD, this.TBODY);
}
this.COLGROUP = this.TABLE.getElementsByTagName('COLGROUP')[0];
if (!this.COLGROUP) {
this.COLGROUP = document.createElement('COLGROUP');
this.TABLE.insertBefore(this.COLGROUP, this.THEAD);
}
if (this.instance.getSetting('columnHeaders').length) {
if (!this.THEAD.childNodes.length) {
var TR = document.createElement('TR');
this.THEAD.appendChild(TR);
}
}
this.colgroupChildrenLength = this.COLGROUP.childNodes.length;
this.theadChildrenLength = this.THEAD.firstChild ? this.THEAD.firstChild.childNodes.length : 0;
this.tbodyChildrenLength = this.TBODY.childNodes.length;
this.oldCellCache = new WalkontableClassNameCache();
this.currentCellCache = new WalkontableClassNameCache();
this.rowFilter = new WalkontableRowFilter();
this.columnFilter = new WalkontableColumnFilter();
this.verticalRenderReverse = false;
}
WalkontableTable.prototype.refreshHiderDimensions = function () {
var height = this.instance.wtViewport.getWorkspaceHeight();
var width = this.instance.wtViewport.getWorkspaceWidth();
var spreaderStyle = this.spreader.style;
if ((height !== Infinity || width !== Infinity) && !this.instance.getSetting('nativeScrollbars')) {
if (height === Infinity) {
height = this.instance.wtViewport.getWorkspaceActualHeight();
}
if (width === Infinity) {
width = this.instance.wtViewport.getWorkspaceActualWidth();
}
this.hiderStyle.overflow = 'hidden';
spreaderStyle.position = 'absolute';
spreaderStyle.top = '0';
spreaderStyle.left = '0';
if (!this.instance.getSetting('nativeScrollbars')) {
spreaderStyle.height = '4000px';
spreaderStyle.width = '4000px';
}
if (height < 0) { //this happens with WalkontableOverlay and causes "Invalid argument" error in IE8
height = 0;
}
this.hiderStyle.height = height + 'px';
this.hiderStyle.width = width + 'px';
}
else {
spreaderStyle.position = 'relative';
spreaderStyle.width = 'auto';
spreaderStyle.height = 'auto';
}
};
WalkontableTable.prototype.refreshStretching = function () {
if (this.instance.cloneSource) {
return;
}
var instance = this.instance
, stretchH = instance.getSetting('stretchH')
, totalRows = instance.getSetting('totalRows')
, totalColumns = instance.getSetting('totalColumns')
, offsetColumn = instance.getSetting('offsetColumn');
var containerWidthFn = function (cacheWidth) {
var viewportWidth = that.instance.wtViewport.getViewportWidth(cacheWidth);
if (viewportWidth < cacheWidth && that.instance.getSetting('nativeScrollbars')) {
return Infinity; //disable stretching when viewport is bigger than sum of the cell widths
}
return viewportWidth;
};
var that = this;
var columnWidthFn = function (i) {
var source_c = that.columnFilter.visibleToSource(i);
if (source_c < totalColumns) {
return instance.getSetting('columnWidth', source_c);
}
};
if (stretchH === 'hybrid') {
if (offsetColumn > 0) {
stretchH = 'last';
}
else {
stretchH = 'none';
}
}
var containerHeightFn = function (cacheHeight) {
if (that.instance.getSetting('nativeScrollbars')) {
if (that.instance.cloneOverlay instanceof WalkontableDebugOverlay) {
return Infinity;
}
else {
return 2 * that.instance.wtViewport.getViewportHeight(cacheHeight);
}
}
return that.instance.wtViewport.getViewportHeight(cacheHeight);
};
var rowHeightFn = function (i, TD) {
if (that.instance.getSetting('nativeScrollbars')) {
return 20;
}
var source_r = that.rowFilter.visibleToSource(i);
if (source_r < totalRows) {
if (that.verticalRenderReverse && i === 0) {
return that.instance.getSetting('rowHeight', source_r, TD) - 1;
}
else {
return that.instance.getSetting('rowHeight', source_r, TD);
}
}
};
this.columnStrategy = new WalkontableColumnStrategy(instance, containerWidthFn, columnWidthFn, stretchH);
this.rowStrategy = new WalkontableRowStrategy(instance, containerHeightFn, rowHeightFn);
};
WalkontableTable.prototype.adjustAvailableNodes = function () {
var displayTds
, rowHeaders = this.instance.getSetting('rowHeaders')
, displayThs = rowHeaders.length
, columnHeaders = this.instance.getSetting('columnHeaders')
, TR
, TD
, c;
//adjust COLGROUP
while (this.colgroupChildrenLength < displayThs) {
this.COLGROUP.appendChild(document.createElement('COL'));
this.colgroupChildrenLength++;
}
this.refreshStretching(); //actually it is wrong position because it assumes rowHeader would be always 50px wide (because we measure before it is filled with text). TODO: debug
if (this.instance.cloneSource && (this.instance.cloneOverlay instanceof WalkontableHorizontalScrollbarNative || this.instance.cloneOverlay instanceof WalkontableCornerScrollbarNative)) {
displayTds = this.instance.getSetting('fixedColumnsLeft');
}
else {
displayTds = this.columnStrategy.cellCount;
}
//adjust COLGROUP
while (this.colgroupChildrenLength < displayTds + displayThs) {
this.COLGROUP.appendChild(document.createElement('COL'));
this.colgroupChildrenLength++;
}
while (this.colgroupChildrenLength > displayTds + displayThs) {
this.COLGROUP.removeChild(this.COLGROUP.lastChild);
this.colgroupChildrenLength--;
}
//adjust THEAD
TR = this.THEAD.firstChild;
if (columnHeaders.length) {
if (!TR) {
TR = document.createElement('TR');
this.THEAD.appendChild(TR);
}
this.theadChildrenLength = TR.childNodes.length;
while (this.theadChildrenLength < displayTds + displayThs) {
TR.appendChild(document.createElement('TH'));
this.theadChildrenLength++;
}
while (this.theadChildrenLength > displayTds + displayThs) {
TR.removeChild(TR.lastChild);
this.theadChildrenLength--;
}
}
else if (TR) {
this.wtDom.empty(TR);
}
//draw COLGROUP
for (c = 0; c < this.colgroupChildrenLength; c++) {
if (c < displayThs) {
this.wtDom.addClass(this.COLGROUP.childNodes[c], 'rowHeader');
}
else {
this.wtDom.removeClass(this.COLGROUP.childNodes[c], 'rowHeader');
}
}
//draw THEAD
if (columnHeaders.length) {
TR = this.THEAD.firstChild;
if (displayThs) {
TD = TR.firstChild; //actually it is TH but let's reuse single variable
for (c = 0; c < displayThs; c++) {
rowHeaders[c](-displayThs + c, TD);
TD = TD.nextSibling;
}
}
}
for (c = 0; c < displayTds; c++) {
if (columnHeaders.length) {
columnHeaders[0](this.columnFilter.visibleToSource(c), TR.childNodes[displayThs + c]);
}
}
};
WalkontableTable.prototype.adjustColumns = function (TR, desiredCount) {
var count = TR.childNodes.length;
while (count < desiredCount) {
var TD = document.createElement('TD');
TR.appendChild(TD);
count++;
}
while (count > desiredCount) {
TR.removeChild(TR.lastChild);
count--;
}
};
WalkontableTable.prototype.draw = function (selectionsOnly) {
if (this.instance.getSetting('nativeScrollbars')) {
this.verticalRenderReverse = false; //this is only supported in dragdealer mode, not in native
}
this.rowFilter.readSettings(this.instance);
this.columnFilter.readSettings(this.instance);
if (!selectionsOnly) {
if (this.instance.getSetting('nativeScrollbars')) {
if (this.instance.cloneSource) {
this.tableOffset = this.instance.cloneSource.wtTable.tableOffset;
}
else {
this.holderOffset = this.wtDom.offset(this.holder);
this.tableOffset = this.wtDom.offset(this.TABLE);
this.instance.wtScrollbars.vertical.readWindowSize();
this.instance.wtScrollbars.horizontal.readWindowSize();
this.instance.wtViewport.resetSettings();
}
}
else {
this.tableOffset = this.wtDom.offset(this.TABLE);
this.instance.wtViewport.resetSettings();
}
this._doDraw();
}
else {
this.instance.wtScrollbars && this.instance.wtScrollbars.refresh(true);
}
this.refreshPositions(selectionsOnly);
if (!selectionsOnly) {
if (this.instance.getSetting('nativeScrollbars')) {
if (!this.instance.cloneSource) {
this.instance.wtScrollbars.vertical.resetFixedPosition();
this.instance.wtScrollbars.horizontal.resetFixedPosition();
this.instance.wtScrollbars.corner.resetFixedPosition();
this.instance.wtScrollbars.debug && this.instance.wtScrollbars.debug.resetFixedPosition();
}
}
}
this.instance.drawn = true;
return this;
};
WalkontableTable.prototype._doDraw = function () {
var r = 0
, source_r
, c
, source_c
, offsetRow = this.instance.getSetting('offsetRow')
, totalRows = this.instance.getSetting('totalRows')
, totalColumns = this.instance.getSetting('totalColumns')
, displayTds
, rowHeaders = this.instance.getSetting('rowHeaders')
, displayThs = rowHeaders.length
, TR
, TD
, TH
, adjusted = false
, workspaceWidth
, mustBeInViewport
, res;
if (this.verticalRenderReverse) {
mustBeInViewport = offsetRow;
}
var noPartial = false;
if (this.verticalRenderReverse) {
if (offsetRow === totalRows - this.rowFilter.fixedCount - 1) {
noPartial = true;
}
else {
this.instance.update('offsetRow', offsetRow + 1); //if we are scrolling reverse
this.rowFilter.readSettings(this.instance);
}
}
if (this.instance.cloneSource) {
this.columnStrategy = this.instance.cloneSource.wtTable.columnStrategy;
this.rowStrategy = this.instance.cloneSource.wtTable.rowStrategy;
}
//draw TBODY
if (totalColumns > 0) {
source_r = this.rowFilter.visibleToSource(r);
var fixedRowsTop = this.instance.getSetting('fixedRowsTop');
var cloneLimit;
if (this.instance.cloneSource) { //must be run after adjustAvailableNodes because otherwise this.rowStrategy is not yet defined
if (this.instance.cloneOverlay instanceof WalkontableVerticalScrollbarNative || this.instance.cloneOverlay instanceof WalkontableCornerScrollbarNative) {
cloneLimit = fixedRowsTop;
}
else if (this.instance.cloneOverlay instanceof WalkontableHorizontalScrollbarNative) {
cloneLimit = this.rowStrategy.countVisible();
}
//else if WalkontableDebugOverlay do nothing. No cloneLimit means render ALL rows
}
this.adjustAvailableNodes();
adjusted = true;
if (this.instance.cloneSource && (this.instance.cloneOverlay instanceof WalkontableHorizontalScrollbarNative || this.instance.cloneOverlay instanceof WalkontableCornerScrollbarNative)) {
displayTds = this.instance.getSetting('fixedColumnsLeft');
}
else {
displayTds = this.columnStrategy.cellCount;
}
if (!this.instance.cloneSource) {
workspaceWidth = this.instance.wtViewport.getWorkspaceWidth();
this.columnStrategy.stretch();
}
for (c = 0; c < displayTds; c++) {
this.COLGROUP.childNodes[c + displayThs].style.width = this.columnStrategy.getSize(c) + 'px';
}
while (source_r < totalRows && source_r >= 0) {
if (r > 1000) {
throw new Error('Security brake: Too much TRs. Please define height for your table, which will enforce scrollbars.');
}
if (cloneLimit !== void 0 && r === cloneLimit) {
break; //we have as much rows as needed for this clone
}
if (r >= this.tbodyChildrenLength || (this.verticalRenderReverse && r >= this.rowFilter.fixedCount)) {
TR = document.createElement('TR');
for (c = 0; c < displayThs; c++) {
TR.appendChild(document.createElement('TH'));
}
if (this.verticalRenderReverse && r >= this.rowFilter.fixedCount) {
this.TBODY.insertBefore(TR, this.TBODY.childNodes[this.rowFilter.fixedCount] || this.TBODY.firstChild);
}
else {
this.TBODY.appendChild(TR);
}
this.tbodyChildrenLength++;
}
else if (r === 0) {
TR = this.TBODY.firstChild;
}
else {
TR = TR.nextSibling; //http://jsperf.com/nextsibling-vs-indexed-childnodes
}
//TH
TH = TR.firstChild;
for (c = 0; c < displayThs; c++) {
//If the number of row headers increased we need to replace TD with TH
if (TH.nodeName == 'TD') {
TD = TH;
TH = document.createElement('TH');
TR.insertBefore(TH, TD);
TR.removeChild(TD);
}
rowHeaders[c](source_r, TH); //actually TH
TH = TH.nextSibling; //http://jsperf.com/nextsibling-vs-indexed-childnodes
}
this.adjustColumns(TR, displayTds + displayThs);
for (c = 0; c < displayTds; c++) {
source_c = this.columnFilter.visibleToSource(c);
if (c === 0) {
TD = TR.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(source_c)];
}
else {
TD = TD.nextSibling; //http://jsperf.com/nextsibling-vs-indexed-childnodes
}
//If the number of headers has been reduced, we need to replace excess TH with TD
if (TD.nodeName == 'TH') {
TH = TD;
TD = document.createElement('TD');
TR.insertBefore(TD, TH);
TR.removeChild(TH);
}
TD.className = '';
TD.removeAttribute('style');
this.instance.getSetting('cellRenderer', source_r, source_c, TD);
}
offsetRow = this.instance.getSetting('offsetRow'); //refresh the value
//after last column is rendered, check if last cell is fully displayed
if (this.verticalRenderReverse && noPartial) {
if (-this.wtDom.outerHeight(TR.firstChild) < this.rowStrategy.remainingSize) {
this.TBODY.removeChild(TR);
this.instance.update('offsetRow', offsetRow + 1);
this.tbodyChildrenLength--;
this.rowFilter.readSettings(this.instance);
break;
}
else if (!this.instance.cloneSource) {
res = this.rowStrategy.add(r, TD, this.verticalRenderReverse);
if (res === false) {
this.rowStrategy.removeOutstanding();
}
}
}
else if (!this.instance.cloneSource) {
res = this.rowStrategy.add(r, TD, this.verticalRenderReverse);
if (res === false) {
if (!this.instance.getSetting('nativeScrollbars')) {
this.rowStrategy.removeOutstanding();
}
}
if (this.rowStrategy.isLastIncomplete()) {
if (this.verticalRenderReverse && !this.isRowInViewport(mustBeInViewport)) {
//we failed because one of the cells was by far too large. Recover by rendering from top
this.verticalRenderReverse = false;
this.instance.update('offsetRow', mustBeInViewport);
this.draw();
return;
}
break;
}
}
if (this.instance.getSetting('nativeScrollbars')) {
if (this.instance.cloneSource) {
TR.style.height = this.instance.getSetting('rowHeight', source_r) + 'px'; //if I have 2 fixed columns with one-line content and the 3rd column has a multiline content, this is the way to make sure that the overlay will has same row height
}
else {
this.instance.getSetting('rowHeight', source_r, TD); //this trick saves rowHeight in rowHeightCache. It is then read in WalkontableVerticalScrollbarNative.prototype.sumCellSizes and reset in Walkontable constructor
}
}
if (this.verticalRenderReverse && r >= this.rowFilter.fixedCount) {
if (offsetRow === 0) {
break;
}
this.instance.update('offsetRow', offsetRow - 1);
this.rowFilter.readSettings(this.instance);
}
else {
r++;
}
source_r = this.rowFilter.visibleToSource(r);
}
}
if (!adjusted) {
this.adjustAvailableNodes();
}
if (!(this.instance.cloneOverlay instanceof WalkontableDebugOverlay)) {
r = this.rowStrategy.countVisible();
while (this.tbodyChildrenLength > r) {
this.TBODY.removeChild(this.TBODY.lastChild);
this.tbodyChildrenLength--;
}
}
this.instance.wtScrollbars && this.instance.wtScrollbars.refresh(false);
if (!this.instance.cloneSource) {
if (workspaceWidth !== this.instance.wtViewport.getWorkspaceWidth()) {
//workspace width changed though to shown/hidden vertical scrollbar. Let's reapply stretching
this.columnStrategy.stretch();
for (c = 0; c < this.columnStrategy.cellCount; c++) {
this.COLGROUP.childNodes[c + displayThs].style.width = this.columnStrategy.getSize(c) + 'px';
}
}
}
this.verticalRenderReverse = false;
};
WalkontableTable.prototype.refreshPositions = function (selectionsOnly) {
this.refreshHiderDimensions();
this.refreshSelections(selectionsOnly);
};
WalkontableTable.prototype.refreshSelections = function (selectionsOnly) {
var vr
, r
, vc
, c
, s
, slen
, classNames = []
, visibleRows = this.rowStrategy.countVisible()
, visibleColumns = this.columnStrategy.countVisible();
this.oldCellCache = this.currentCellCache;
this.currentCellCache = new WalkontableClassNameCache();
if (this.instance.selections) {
for (r in this.instance.selections) {
if (this.instance.selections.hasOwnProperty(r)) {
this.instance.selections[r].draw();
if (this.instance.selections[r].settings.className) {
classNames.push(this.instance.selections[r].settings.className);
}
if (this.instance.selections[r].settings.highlightRowClassName) {
classNames.push(this.instance.selections[r].settings.highlightRowClassName);
}
if (this.instance.selections[r].settings.highlightColumnClassName) {
classNames.push(this.instance.selections[r].settings.highlightColumnClassName);
}
}
}
}
slen = classNames.length;
for (vr = 0; vr < visibleRows; vr++) {
for (vc = 0; vc < visibleColumns; vc++) {
r = this.rowFilter.visibleToSource(vr);
c = this.columnFilter.visibleToSource(vc);
for (s = 0; s < slen; s++) {
if (this.currentCellCache.test(vr, vc, classNames[s])) {
this.wtDom.addClass(this.getCell([r, c]), classNames[s]);
}
else if (selectionsOnly && this.oldCellCache.test(vr, vc, classNames[s])) {
this.wtDom.removeClass(this.getCell([r, c]), classNames[s]);
}
}
}
}
};
/**
* getCell
* @param {Array} coords
* @return {Object} HTMLElement on success or {Number} one of the exit codes on error:
* -1 row before viewport
* -2 row after viewport
* -3 column before viewport
* -4 column after viewport
*
*/
WalkontableTable.prototype.getCell = function (coords) {
if (this.isRowBeforeViewport(coords[0])) {
return -1; //row before viewport
}
else if (this.isRowAfterViewport(coords[0])) {
return -2; //row after viewport
}
else {
if (this.isColumnBeforeViewport(coords[1])) {
return -3; //column before viewport
}
else if (this.isColumnAfterViewport(coords[1])) {
return -4; //column after viewport
}
else {
return this.TBODY.childNodes[this.rowFilter.sourceToVisible(coords[0])].childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(coords[1])];
}
}
};
WalkontableTable.prototype.getCoords = function (TD) {
return [
this.rowFilter.visibleToSource(this.wtDom.index(TD.parentNode)),
this.columnFilter.visibleRowHeadedColumnToSourceColumn(TD.cellIndex)
];
};
//returns -1 if no row is visible
WalkontableTable.prototype.getLastVisibleRow = function () {
return this.rowFilter.visibleToSource(this.rowStrategy.cellCount - 1);
};
//returns -1 if no column is visible
WalkontableTable.prototype.getLastVisibleColumn = function () {
return this.columnFilter.visibleToSource(this.columnStrategy.cellCount - 1);
};
WalkontableTable.prototype.isRowBeforeViewport = function (r) {
return (this.rowFilter.sourceToVisible(r) < this.rowFilter.fixedCount && r >= this.rowFilter.fixedCount);
};
WalkontableTable.prototype.isRowAfterViewport = function (r) {
return (r > this.getLastVisibleRow());
};
WalkontableTable.prototype.isColumnBeforeViewport = function (c) {
return (this.columnFilter.sourceToVisible(c) < this.columnFilter.fixedCount && c >= this.columnFilter.fixedCount);
};
WalkontableTable.prototype.isColumnAfterViewport = function (c) {
return (c > this.getLastVisibleColumn());
};
WalkontableTable.prototype.isRowInViewport = function (r) {
return (!this.isRowBeforeViewport(r) && !this.isRowAfterViewport(r));
};
WalkontableTable.prototype.isColumnInViewport = function (c) {
return (!this.isColumnBeforeViewport(c) && !this.isColumnAfterViewport(c));
};
WalkontableTable.prototype.isLastRowFullyVisible = function () {
return (this.getLastVisibleRow() === this.instance.getSetting('totalRows') - 1 && !this.rowStrategy.isLastIncomplete());
};
WalkontableTable.prototype.isLastColumnFullyVisible = function () {
return (this.getLastVisibleColumn() === this.instance.getSetting('totalColumns') - 1 && !this.columnStrategy.isLastIncomplete());
};
function WalkontableViewport(instance) {
this.instance = instance;
this.resetSettings();
if (this.instance.getSetting('nativeScrollbars')) {
var that = this;
$(window).on('resize', function () {
that.clientHeight = that.getWorkspaceHeight();
});
}
}
/*WalkontableViewport.prototype.isInSightVertical = function () {
//is table outside viewport bottom edge
if (tableTop > windowHeight + scrollTop) {
return -1;
}
//is table outside viewport top edge
else if (scrollTop > tableTop + tableFakeHeight) {
return -2;
}
//table is in viewport but how much exactly?
else {
}
};*/
//used by scrollbar
WalkontableViewport.prototype.getWorkspaceHeight = function (proposedHeight) {
if (this.instance.getSetting('nativeScrollbars')) {
return this.instance.wtScrollbars.vertical.windowSize;
}
var height = this.instance.getSetting('height');
if (height === Infinity || height === void 0 || height === null || height < 1) {
if (this.instance.wtScrollbars.vertical instanceof WalkontableOverlay) {
height = this.instance.wtScrollbars.vertical.availableSize();
}
else {
height = Infinity;
}
}
if (height !== Infinity) {
if (proposedHeight >= height) {
height -= this.instance.getSetting('scrollbarHeight');
}
else if (this.instance.wtScrollbars.horizontal.visible) {
height -= this.instance.getSetting('scrollbarHeight');
}
}
return height;
};
WalkontableViewport.prototype.getWorkspaceWidth = function (proposedWidth) {
var width = this.instance.getSetting('width');
if (width === Infinity || width === void 0 || width === null || width < 1) {
if (this.instance.wtScrollbars.horizontal instanceof WalkontableOverlay) {
width = this.instance.wtScrollbars.horizontal.availableSize();
}
else {
width = Infinity;
}
}
if (width !== Infinity) {
if (proposedWidth >= width) {
width -= this.instance.getSetting('scrollbarWidth');
}
else if (this.instance.wtScrollbars.vertical.visible) {
width -= this.instance.getSetting('scrollbarWidth');
}
}
return width;
};
WalkontableViewport.prototype.getWorkspaceActualHeight = function () {
return this.instance.wtDom.outerHeight(this.instance.wtTable.TABLE);
};
WalkontableViewport.prototype.getWorkspaceActualWidth = function () {
return this.instance.wtDom.outerWidth(this.instance.wtTable.TABLE) || this.instance.wtDom.outerWidth(this.instance.wtTable.TBODY) || this.instance.wtDom.outerWidth(this.instance.wtTable.THEAD); //IE8 reports 0 as <table> offsetWidth;
};
WalkontableViewport.prototype.getColumnHeaderHeight = function () {
if (isNaN(this.columnHeaderHeight)) {
var cellOffset = this.instance.wtDom.offset(this.instance.wtTable.TBODY)
, tableOffset = this.instance.wtTable.tableOffset;
this.columnHeaderHeight = cellOffset.top - tableOffset.top;
}
return this.columnHeaderHeight;
};
WalkontableViewport.prototype.getViewportHeight = function (proposedHeight) {
var containerHeight = this.getWorkspaceHeight(proposedHeight);
if (containerHeight === Infinity) {
return containerHeight;
}
var columnHeaderHeight = this.getColumnHeaderHeight();
if (columnHeaderHeight > 0) {
return containerHeight - columnHeaderHeight;
}
else {
return containerHeight;
}
};
WalkontableViewport.prototype.getRowHeaderWidth = function () {
if (this.instance.cloneSource) {
return this.instance.cloneSource.wtViewport.getRowHeaderWidth();
}
if (isNaN(this.rowHeaderWidth)) {
var rowHeaders = this.instance.getSetting('rowHeaders');
if (rowHeaders.length) {
var TH = this.instance.wtTable.TABLE.querySelector('TH');
this.rowHeaderWidth = 0;
for (var i = 0, ilen = rowHeaders.length; i < ilen; i++) {
if (TH) {
this.rowHeaderWidth += this.instance.wtDom.outerWidth(TH);
TH = TH.nextSibling;
}
else {
this.rowHeaderWidth += 50; //yes this is a cheat but it worked like that before, just taking assumption from CSS instead of measuring. TODO: proper fix
}
}
}
else {
this.rowHeaderWidth = 0;
}
}
return this.rowHeaderWidth;
};
WalkontableViewport.prototype.getViewportWidth = function (proposedWidth) {
var containerWidth = this.getWorkspaceWidth(proposedWidth);
if (containerWidth === Infinity) {
return containerWidth;
}
var rowHeaderWidth = this.getRowHeaderWidth();
if (rowHeaderWidth > 0) {
return containerWidth - rowHeaderWidth;
}
else {
return containerWidth;
}
};
WalkontableViewport.prototype.resetSettings = function () {
this.rowHeaderWidth = NaN;
this.columnHeaderHeight = NaN;
};
function WalkontableWheel(instance) {
if (instance.getSetting('nativeScrollbars')) {
return;
}
//spreader === instance.wtTable.TABLE.parentNode
$(instance.wtTable.spreader).on('mousewheel', function (event, delta, deltaX, deltaY) {
if (!deltaX && !deltaY && delta) { //we are in IE8, see https://github.com/brandonaaron/jquery-mousewheel/issues/53
deltaY = delta;
}
if (!deltaX && !deltaY) { //this happens in IE8 test case
return;
}
if (deltaY > 0 && instance.getSetting('offsetRow') === 0) {
return; //attempt to scroll up when it's already showing first row
}
else if (deltaY < 0 && instance.wtTable.isLastRowFullyVisible()) {
return; //attempt to scroll down when it's already showing last row
}
else if (deltaX < 0 && instance.getSetting('offsetColumn') === 0) {
return; //attempt to scroll left when it's already showing first column
}
else if (deltaX > 0 && instance.wtTable.isLastColumnFullyVisible()) {
return; //attempt to scroll right when it's already showing last column
}
//now we are sure we really want to scroll
clearTimeout(instance.wheelTimeout);
instance.wheelTimeout = setTimeout(function () { //timeout is needed because with fast-wheel scrolling mousewheel event comes dozen times per second
if (deltaY) {
//ceil is needed because jquery-mousewheel reports fractional mousewheel deltas on touchpad scroll
//see http://stackoverflow.com/questions/5527601/normalizing-mousewheel-speed-across-browsers
if (instance.wtScrollbars.vertical.visible) { // if we see scrollbar
instance.scrollVertical(-Math.ceil(deltaY)).draw();
}
}
else if (deltaX) {
if (instance.wtScrollbars.horizontal.visible) { // if we see scrollbar
instance.scrollHorizontal(Math.ceil(deltaX)).draw();
}
}
}, 0);
event.preventDefault();
});
}
/**
* Dragdealer JS v0.9.5 - patched by Walkontable at lines 66, 309-310, 339-340
* http://code.ovidiu.ch/dragdealer-js
*
* Copyright (c) 2010, Ovidiu Chereches
* MIT License
* http://legal.ovidiu.ch/licenses/MIT
*/
/* Cursor */
var Cursor =
{
x: 0, y: 0,
init: function()
{
this.setEvent('mouse');
this.setEvent('touch');
},
setEvent: function(type)
{
var moveHandler = document['on' + type + 'move'] || function(){};
document['on' + type + 'move'] = function(e)
{
moveHandler(e);
Cursor.refresh(e);
}
},
refresh: function(e)
{
if(!e)
{
e = window.event;
}
if(e.type == 'mousemove')
{
this.set(e);
}
else if(e.touches)
{
this.set(e.touches[0]);
}
},
set: function(e)
{
if(e.pageX || e.pageY)
{
this.x = e.pageX;
this.y = e.pageY;
}
else if(document.body && (e.clientX || e.clientY)) //need to check whether body exists, because of IE8 issue (#1084)
{
this.x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
this.y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
}
}
};
Cursor.init();
/* Position */
var Position =
{
get: function(obj)
{
var curtop = 0, curleft = 0; //Walkontable patch. Original (var curleft = curtop = 0;) created curtop in global scope
if(obj.offsetParent)
{
do
{
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
}
while((obj = obj.offsetParent));
}
return [curleft, curtop];
}
};
/* Dragdealer */
var Dragdealer = function(wrapper, options)
{
if(typeof(wrapper) == 'string')
{
wrapper = document.getElementById(wrapper);
}
if(!wrapper)
{
return;
}
var handle = wrapper.getElementsByTagName('div')[0];
if(!handle || handle.className.search(/(^|\s)handle(\s|$)/) == -1)
{
return;
}
this.init(wrapper, handle, options || {});
this.setup();
};
Dragdealer.prototype =
{
init: function(wrapper, handle, options)
{
this.wrapper = wrapper;
this.handle = handle;
this.options = options;
this.disabled = this.getOption('disabled', false);
this.horizontal = this.getOption('horizontal', true);
this.vertical = this.getOption('vertical', false);
this.slide = this.getOption('slide', true);
this.steps = this.getOption('steps', 0);
this.snap = this.getOption('snap', false);
this.loose = this.getOption('loose', false);
this.speed = this.getOption('speed', 10) / 100;
this.xPrecision = this.getOption('xPrecision', 0);
this.yPrecision = this.getOption('yPrecision', 0);
this.callback = options.callback || null;
this.animationCallback = options.animationCallback || null;
this.bounds = {
left: options.left || 0, right: -(options.right || 0),
top: options.top || 0, bottom: -(options.bottom || 0),
x0: 0, x1: 0, xRange: 0,
y0: 0, y1: 0, yRange: 0
};
this.value = {
prev: [-1, -1],
current: [options.x || 0, options.y || 0],
target: [options.x || 0, options.y || 0]
};
this.offset = {
wrapper: [0, 0],
mouse: [0, 0],
prev: [-999999, -999999],
current: [0, 0],
target: [0, 0]
};
this.change = [0, 0];
this.activity = false;
this.dragging = false;
this.tapping = false;
},
getOption: function(name, defaultValue)
{
return this.options[name] !== undefined ? this.options[name] : defaultValue;
},
setup: function()
{
this.setWrapperOffset();
this.setBoundsPadding();
this.setBounds();
this.setSteps();
this.addListeners();
},
setWrapperOffset: function()
{
this.offset.wrapper = Position.get(this.wrapper);
},
setBoundsPadding: function()
{
if(!this.bounds.left && !this.bounds.right)
{
this.bounds.left = Position.get(this.handle)[0] - this.offset.wrapper[0];
this.bounds.right = -this.bounds.left;
}
if(!this.bounds.top && !this.bounds.bottom)
{
this.bounds.top = Position.get(this.handle)[1] - this.offset.wrapper[1];
this.bounds.bottom = -this.bounds.top;
}
},
setBounds: function()
{
this.bounds.x0 = this.bounds.left;
this.bounds.x1 = this.wrapper.offsetWidth + this.bounds.right;
this.bounds.xRange = (this.bounds.x1 - this.bounds.x0) - this.handle.offsetWidth;
this.bounds.y0 = this.bounds.top;
this.bounds.y1 = this.wrapper.offsetHeight + this.bounds.bottom;
this.bounds.yRange = (this.bounds.y1 - this.bounds.y0) - this.handle.offsetHeight;
this.bounds.xStep = 1 / (this.xPrecision || Math.max(this.wrapper.offsetWidth, this.handle.offsetWidth));
this.bounds.yStep = 1 / (this.yPrecision || Math.max(this.wrapper.offsetHeight, this.handle.offsetHeight));
},
setSteps: function()
{
if(this.steps > 1)
{
this.stepRatios = [];
for(var i = 0; i <= this.steps - 1; i++)
{
this.stepRatios[i] = i / (this.steps - 1);
}
}
},
addListeners: function()
{
var self = this;
this.wrapper.onselectstart = function()
{
return false;
}
this.handle.onmousedown = this.handle.ontouchstart = function(e)
{
self.handleDownHandler(e);
};
this.wrapper.onmousedown = this.wrapper.ontouchstart = function(e)
{
self.wrapperDownHandler(e);
};
var mouseUpHandler = document.onmouseup || function(){};
document.onmouseup = function(e)
{
mouseUpHandler(e);
self.documentUpHandler(e);
};
var touchEndHandler = document.ontouchend || function(){};
document.ontouchend = function(e)
{
touchEndHandler(e);
self.documentUpHandler(e);
};
var resizeHandler = window.onresize || function(){};
window.onresize = function(e)
{
resizeHandler(e);
self.documentResizeHandler(e);
};
this.wrapper.onmousemove = function(e)
{
self.activity = true;
}
this.wrapper.onclick = function(e)
{
return !self.activity;
}
this.interval = setInterval(function(){ self.animate() }, 25);
self.animate(false, true);
},
handleDownHandler: function(e)
{
this.activity = false;
Cursor.refresh(e);
this.preventDefaults(e, true);
this.startDrag();
},
wrapperDownHandler: function(e)
{
Cursor.refresh(e);
this.preventDefaults(e, true);
this.startTap();
},
documentUpHandler: function(e)
{
this.stopDrag();
this.stopTap();
},
documentResizeHandler: function(e)
{
this.setWrapperOffset();
this.setBounds();
this.update();
},
enable: function()
{
this.disabled = false;
this.handle.className = this.handle.className.replace(/\s?disabled/g, '');
},
disable: function()
{
this.disabled = true;
this.handle.className += ' disabled';
},
setStep: function(x, y, snap)
{
this.setValue(
this.steps && x > 1 ? (x - 1) / (this.steps - 1) : 0,
this.steps && y > 1 ? (y - 1) / (this.steps - 1) : 0,
snap
);
},
setValue: function(x, y, snap)
{
this.setTargetValue([x, y || 0]);
if(snap)
{
this.groupCopy(this.value.current, this.value.target);
}
},
startTap: function(target)
{
if(this.disabled)
{
return;
}
this.tapping = true;
this.setWrapperOffset();
this.setBounds();
if(target === undefined)
{
target = [
Cursor.x - this.offset.wrapper[0] - (this.handle.offsetWidth / 2),
Cursor.y - this.offset.wrapper[1] - (this.handle.offsetHeight / 2)
];
}
this.setTargetOffset(target);
},
stopTap: function()
{
if(this.disabled || !this.tapping)
{
return;
}
this.tapping = false;
this.setTargetValue(this.value.current);
this.result();
},
startDrag: function()
{
if(this.disabled)
{
return;
}
this.setWrapperOffset();
this.setBounds();
this.offset.mouse = [
Cursor.x - Position.get(this.handle)[0],
Cursor.y - Position.get(this.handle)[1]
];
this.dragging = true;
},
stopDrag: function()
{
if(this.disabled || !this.dragging)
{
return;
}
this.dragging = false;
var target = this.groupClone(this.value.current);
if(this.slide)
{
var ratioChange = this.change;
target[0] += ratioChange[0] * 4;
target[1] += ratioChange[1] * 4;
}
this.setTargetValue(target);
this.result();
},
feedback: function()
{
var value = this.value.current;
if(this.snap && this.steps > 1)
{
value = this.getClosestSteps(value);
}
if(!this.groupCompare(value, this.value.prev))
{
if(typeof(this.animationCallback) == 'function')
{
this.animationCallback(value[0], value[1]);
}
this.groupCopy(this.value.prev, value);
}
},
result: function()
{
if(typeof(this.callback) == 'function')
{
this.callback(this.value.target[0], this.value.target[1]);
}
},
animate: function(direct, first)
{
if(direct && !this.dragging)
{
return;
}
if(this.dragging)
{
var prevTarget = this.groupClone(this.value.target);
var offset = [
Cursor.x - this.offset.wrapper[0] - this.offset.mouse[0],
Cursor.y - this.offset.wrapper[1] - this.offset.mouse[1]
];
this.setTargetOffset(offset, this.loose);
this.change = [
this.value.target[0] - prevTarget[0],
this.value.target[1] - prevTarget[1]
];
}
if(this.dragging || first)
{
this.groupCopy(this.value.current, this.value.target);
}
if(this.dragging || this.glide() || first)
{
this.update();
this.feedback();
}
},
glide: function()
{
var diff = [
this.value.target[0] - this.value.current[0],
this.value.target[1] - this.value.current[1]
];
if(!diff[0] && !diff[1])
{
return false;
}
if(Math.abs(diff[0]) > this.bounds.xStep || Math.abs(diff[1]) > this.bounds.yStep)
{
this.value.current[0] += diff[0] * this.speed;
this.value.current[1] += diff[1] * this.speed;
}
else
{
this.groupCopy(this.value.current, this.value.target);
}
return true;
},
update: function()
{
if(!this.snap)
{
this.offset.current = this.getOffsetsByRatios(this.value.current);
}
else
{
this.offset.current = this.getOffsetsByRatios(
this.getClosestSteps(this.value.current)
);
}
this.show();
},
show: function()
{
if(!this.groupCompare(this.offset.current, this.offset.prev))
{
if(this.horizontal)
{
this.handle.style.left = String(this.offset.current[0]) + 'px';
}
if(this.vertical)
{
this.handle.style.top = String(this.offset.current[1]) + 'px';
}
this.groupCopy(this.offset.prev, this.offset.current);
}
},
setTargetValue: function(value, loose)
{
var target = loose ? this.getLooseValue(value) : this.getProperValue(value);
this.groupCopy(this.value.target, target);
this.offset.target = this.getOffsetsByRatios(target);
},
setTargetOffset: function(offset, loose)
{
var value = this.getRatiosByOffsets(offset);
var target = loose ? this.getLooseValue(value) : this.getProperValue(value);
this.groupCopy(this.value.target, target);
this.offset.target = this.getOffsetsByRatios(target);
},
getLooseValue: function(value)
{
var proper = this.getProperValue(value);
return [
proper[0] + ((value[0] - proper[0]) / 4),
proper[1] + ((value[1] - proper[1]) / 4)
];
},
getProperValue: function(value)
{
var proper = this.groupClone(value);
proper[0] = Math.max(proper[0], 0);
proper[1] = Math.max(proper[1], 0);
proper[0] = Math.min(proper[0], 1);
proper[1] = Math.min(proper[1], 1);
if((!this.dragging && !this.tapping) || this.snap)
{
if(this.steps > 1)
{
proper = this.getClosestSteps(proper);
}
}
return proper;
},
getRatiosByOffsets: function(group)
{
return [
this.getRatioByOffset(group[0], this.bounds.xRange, this.bounds.x0),
this.getRatioByOffset(group[1], this.bounds.yRange, this.bounds.y0)
];
},
getRatioByOffset: function(offset, range, padding)
{
return range ? (offset - padding) / range : 0;
},
getOffsetsByRatios: function(group)
{
return [
this.getOffsetByRatio(group[0], this.bounds.xRange, this.bounds.x0),
this.getOffsetByRatio(group[1], this.bounds.yRange, this.bounds.y0)
];
},
getOffsetByRatio: function(ratio, range, padding)
{
return Math.round(ratio * range) + padding;
},
getClosestSteps: function(group)
{
return [
this.getClosestStep(group[0]),
this.getClosestStep(group[1])
];
},
getClosestStep: function(value)
{
var k = 0;
var min = 1;
for(var i = 0; i <= this.steps - 1; i++)
{
if(Math.abs(this.stepRatios[i] - value) < min)
{
min = Math.abs(this.stepRatios[i] - value);
k = i;
}
}
return this.stepRatios[k];
},
groupCompare: function(a, b)
{
return a[0] == b[0] && a[1] == b[1];
},
groupCopy: function(a, b)
{
a[0] = b[0];
a[1] = b[1];
},
groupClone: function(a)
{
return [a[0], a[1]];
},
preventDefaults: function(e, selection)
{
if(!e)
{
e = window.event;
}
if(e.preventDefault)
{
e.preventDefault();
}
e.returnValue = false;
if(selection && document.selection)
{
document.selection.empty();
}
},
cancelEvent: function(e)
{
if(!e)
{
e = window.event;
}
if(e.stopPropagation)
{
e.stopPropagation();
}
e.cancelBubble = true;
}
};
/*! Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net)
* Licensed under the MIT License (LICENSE.txt).
*
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
* Thanks to: Seamus Leahy for adding deltaX and deltaY
*
* Version: 3.1.3
*
* Requires: 1.2.2+
*/
(function (factory) {
if ( typeof define === 'function' && define.amd ) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS style for Browserify
module.exports = factory;
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'];
var toBind = 'onwheel' in document || document.documentMode >= 9 ? ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'];
var lowestDelta, lowestDeltaXY;
if ( $.event.fixHooks ) {
for ( var i = toFix.length; i; ) {
$.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
}
}
$.event.special.mousewheel = {
setup: function() {
if ( this.addEventListener ) {
for ( var i = toBind.length; i; ) {
this.addEventListener( toBind[--i], handler, false );
}
} else {
this.onmousewheel = handler;
}
},
teardown: function() {
if ( this.removeEventListener ) {
for ( var i = toBind.length; i; ) {
this.removeEventListener( toBind[--i], handler, false );
}
} else {
this.onmousewheel = null;
}
}
};
$.fn.extend({
mousewheel: function(fn) {
return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
},
unmousewheel: function(fn) {
return this.unbind("mousewheel", fn);
}
});
function handler(event) {
var orgEvent = event || window.event,
args = [].slice.call(arguments, 1),
delta = 0,
deltaX = 0,
deltaY = 0,
absDelta = 0,
absDeltaXY = 0,
fn;
event = $.event.fix(orgEvent);
event.type = "mousewheel";
// Old school scrollwheel delta
if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta; }
if ( orgEvent.detail ) { delta = orgEvent.detail * -1; }
// New school wheel delta (wheel event)
if ( orgEvent.deltaY ) {
deltaY = orgEvent.deltaY * -1;
delta = deltaY;
}
if ( orgEvent.deltaX ) {
deltaX = orgEvent.deltaX;
delta = deltaX * -1;
}
// Webkit
if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY; }
if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = orgEvent.wheelDeltaX * -1; }
// Look for lowest delta to normalize the delta values
absDelta = Math.abs(delta);
if ( !lowestDelta || absDelta < lowestDelta ) { lowestDelta = absDelta; }
absDeltaXY = Math.max(Math.abs(deltaY), Math.abs(deltaX));
if ( !lowestDeltaXY || absDeltaXY < lowestDeltaXY ) { lowestDeltaXY = absDeltaXY; }
// Get a whole value for the deltas
fn = delta > 0 ? 'floor' : 'ceil';
delta = Math[fn](delta / lowestDelta);
deltaX = Math[fn](deltaX / lowestDeltaXY);
deltaY = Math[fn](deltaY / lowestDeltaXY);
// Add event and delta to the front of the arguments
args.unshift(event, delta, deltaX, deltaY);
return ($.event.dispatch || $.event.handle).apply(this, args);
}
}));
})(jQuery, window, Handsontable);
// numeral.js
// version : 1.4.7
// author : Adam Draper
// license : MIT
// http://adamwdraper.github.com/Numeral-js/
(function () {
/************************************
Constants
************************************/
var numeral,
VERSION = '1.4.7',
// internal storage for language config files
languages = {},
currentLanguage = 'en',
zeroFormat = null,
// check for nodeJS
hasModule = (typeof module !== 'undefined' && module.exports);
/************************************
Constructors
************************************/
// Numeral prototype object
function Numeral (number) {
this._n = number;
}
/**
* Implementation of toFixed() that treats floats more like decimals
*
* Fixes binary rounding issues (eg. (0.615).toFixed(2) === '0.61') that present
* problems for accounting- and finance-related software.
*/
function toFixed (value, precision, optionals) {
var power = Math.pow(10, precision),
output;
// Multiply up by precision, round accurately, then divide and use native toFixed():
output = (Math.round(value * power) / power).toFixed(precision);
if (optionals) {
var optionalsRegExp = new RegExp('0{1,' + optionals + '}$');
output = output.replace(optionalsRegExp, '');
}
return output;
}
/************************************
Formatting
************************************/
// determine what type of formatting we need to do
function formatNumeral (n, format) {
var output;
// figure out what kind of format we are dealing with
if (format.indexOf('$') > -1) { // currency!!!!!
output = formatCurrency(n, format);
} else if (format.indexOf('%') > -1) { // percentage
output = formatPercentage(n, format);
} else if (format.indexOf(':') > -1) { // time
output = formatTime(n, format);
} else { // plain ol' numbers or bytes
output = formatNumber(n, format);
}
// return string
return output;
}
// revert to number
function unformatNumeral (n, string) {
if (string.indexOf(':') > -1) {
n._n = unformatTime(string);
} else {
if (string === zeroFormat) {
n._n = 0;
} else {
var stringOriginal = string;
if (languages[currentLanguage].delimiters.decimal !== '.') {
string = string.replace(/\./g,'').replace(languages[currentLanguage].delimiters.decimal, '.');
}
// see if abbreviations are there so that we can multiply to the correct number
var thousandRegExp = new RegExp(languages[currentLanguage].abbreviations.thousand + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$'),
millionRegExp = new RegExp(languages[currentLanguage].abbreviations.million + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$'),
billionRegExp = new RegExp(languages[currentLanguage].abbreviations.billion + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$'),
trillionRegExp = new RegExp(languages[currentLanguage].abbreviations.trillion + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$');
// see if bytes are there so that we can multiply to the correct number
var prefixes = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
bytesMultiplier = false;
for (var power = 0; power <= prefixes.length; power++) {
bytesMultiplier = (string.indexOf(prefixes[power]) > -1) ? Math.pow(1024, power + 1) : false;
if (bytesMultiplier) {
break;
}
}
// do some math to create our number
n._n = ((bytesMultiplier) ? bytesMultiplier : 1) * ((stringOriginal.match(thousandRegExp)) ? Math.pow(10, 3) : 1) * ((stringOriginal.match(millionRegExp)) ? Math.pow(10, 6) : 1) * ((stringOriginal.match(billionRegExp)) ? Math.pow(10, 9) : 1) * ((stringOriginal.match(trillionRegExp)) ? Math.pow(10, 12) : 1) * ((string.indexOf('%') > -1) ? 0.01 : 1) * Number(((string.indexOf('(') > -1) ? '-' : '') + string.replace(/[^0-9\.-]+/g, ''));
// round if we are talking about bytes
n._n = (bytesMultiplier) ? Math.ceil(n._n) : n._n;
}
}
return n._n;
}
function formatCurrency (n, format) {
var prependSymbol = (format.indexOf('$') <= 1) ? true : false;
// remove $ for the moment
var space = '';
// check for space before or after currency
if (format.indexOf(' $') > -1) {
space = ' ';
format = format.replace(' $', '');
} else if (format.indexOf('$ ') > -1) {
space = ' ';
format = format.replace('$ ', '');
} else {
format = format.replace('$', '');
}
// format the number
var output = formatNumeral(n, format);
// position the symbol
if (prependSymbol) {
if (output.indexOf('(') > -1 || output.indexOf('-') > -1) {
output = output.split('');
output.splice(1, 0, languages[currentLanguage].currency.symbol + space);
output = output.join('');
} else {
output = languages[currentLanguage].currency.symbol + space + output;
}
} else {
if (output.indexOf(')') > -1) {
output = output.split('');
output.splice(-1, 0, space + languages[currentLanguage].currency.symbol);
output = output.join('');
} else {
output = output + space + languages[currentLanguage].currency.symbol;
}
}
return output;
}
function formatPercentage (n, format) {
var space = '';
// check for space before %
if (format.indexOf(' %') > -1) {
space = ' ';
format = format.replace(' %', '');
} else {
format = format.replace('%', '');
}
n._n = n._n * 100;
var output = formatNumeral(n, format);
if (output.indexOf(')') > -1 ) {
output = output.split('');
output.splice(-1, 0, space + '%');
output = output.join('');
} else {
output = output + space + '%';
}
return output;
}
function formatTime (n, format) {
var hours = Math.floor(n._n/60/60),
minutes = Math.floor((n._n - (hours * 60 * 60))/60),
seconds = Math.round(n._n - (hours * 60 * 60) - (minutes * 60));
return hours + ':' + ((minutes < 10) ? '0' + minutes : minutes) + ':' + ((seconds < 10) ? '0' + seconds : seconds);
}
function unformatTime (string) {
var timeArray = string.split(':'),
seconds = 0;
// turn hours and minutes into seconds and add them all up
if (timeArray.length === 3) {
// hours
seconds = seconds + (Number(timeArray[0]) * 60 * 60);
// minutes
seconds = seconds + (Number(timeArray[1]) * 60);
// seconds
seconds = seconds + Number(timeArray[2]);
} else if (timeArray.lenght === 2) {
// minutes
seconds = seconds + (Number(timeArray[0]) * 60);
// seconds
seconds = seconds + Number(timeArray[1]);
}
return Number(seconds);
}
function formatNumber (n, format) {
var negP = false,
optDec = false,
abbr = '',
bytes = '',
ord = '',
abs = Math.abs(n._n);
// check if number is zero and a custom zero format has been set
if (n._n === 0 && zeroFormat !== null) {
return zeroFormat;
} else {
// see if we should use parentheses for negative number
if (format.indexOf('(') > -1) {
negP = true;
format = format.slice(1, -1);
}
// see if abbreviation is wanted
if (format.indexOf('a') > -1) {
// check for space before abbreviation
if (format.indexOf(' a') > -1) {
abbr = ' ';
format = format.replace(' a', '');
} else {
format = format.replace('a', '');
}
if (abs >= Math.pow(10, 12)) {
// trillion
abbr = abbr + languages[currentLanguage].abbreviations.trillion;
n._n = n._n / Math.pow(10, 12);
} else if (abs < Math.pow(10, 12) && abs >= Math.pow(10, 9)) {
// billion
abbr = abbr + languages[currentLanguage].abbreviations.billion;
n._n = n._n / Math.pow(10, 9);
} else if (abs < Math.pow(10, 9) && abs >= Math.pow(10, 6)) {
// million
abbr = abbr + languages[currentLanguage].abbreviations.million;
n._n = n._n / Math.pow(10, 6);
} else if (abs < Math.pow(10, 6) && abs >= Math.pow(10, 3)) {
// thousand
abbr = abbr + languages[currentLanguage].abbreviations.thousand;
n._n = n._n / Math.pow(10, 3);
}
}
// see if we are formatting bytes
if (format.indexOf('b') > -1) {
// check for space before
if (format.indexOf(' b') > -1) {
bytes = ' ';
format = format.replace(' b', '');
} else {
format = format.replace('b', '');
}
var prefixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
min,
max;
for (var power = 0; power <= prefixes.length; power++) {
min = Math.pow(1024, power);
max = Math.pow(1024, power+1);
if (n._n >= min && n._n < max) {
bytes = bytes + prefixes[power];
if (min > 0) {
n._n = n._n / min;
}
break;
}
}
}
// see if ordinal is wanted
if (format.indexOf('o') > -1) {
// check for space before
if (format.indexOf(' o') > -1) {
ord = ' ';
format = format.replace(' o', '');
} else {
format = format.replace('o', '');
}
ord = ord + languages[currentLanguage].ordinal(n._n);
}
if (format.indexOf('[.]') > -1) {
optDec = true;
format = format.replace('[.]', '.');
}
var w = n._n.toString().split('.')[0],
precision = format.split('.')[1],
thousands = format.indexOf(','),
d = '',
neg = false;
if (precision) {
if (precision.indexOf('[') > -1) {
precision = precision.replace(']', '');
precision = precision.split('[');
d = toFixed(n._n, (precision[0].length + precision[1].length), precision[1].length);
} else {
d = toFixed(n._n, precision.length);
}
w = d.split('.')[0];
if (d.split('.')[1].length) {
d = languages[currentLanguage].delimiters.decimal + d.split('.')[1];
} else {
d = '';
}
if (optDec && Number(d) === 0) {
d = '';
}
} else {
w = toFixed(n._n, null);
}
// format number
if (w.indexOf('-') > -1) {
w = w.slice(1);
neg = true;
}
if (thousands > -1) {
w = w.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1' + languages[currentLanguage].delimiters.thousands);
}
if (format.indexOf('.') === 0) {
w = '';
}
return ((negP && neg) ? '(' : '') + ((!negP && neg) ? '-' : '') + w + d + ((ord) ? ord : '') + ((abbr) ? abbr : '') + ((bytes) ? bytes : '') + ((negP && neg) ? ')' : '');
}
}
/************************************
Top Level Functions
************************************/
numeral = function (input) {
if (numeral.isNumeral(input)) {
input = input.value();
} else if (!Number(input)) {
input = 0;
}
return new Numeral(Number(input));
};
// version number
numeral.version = VERSION;
// compare numeral object
numeral.isNumeral = function (obj) {
return obj instanceof Numeral;
};
// This function will load languages and then set the global language. If
// no arguments are passed in, it will simply return the current global
// language key.
numeral.language = function (key, values) {
if (!key) {
return currentLanguage;
}
if (key && !values) {
currentLanguage = key;
}
if (values || !languages[key]) {
loadLanguage(key, values);
}
return numeral;
};
numeral.language('en', {
delimiters: {
thousands: ',',
decimal: '.'
},
abbreviations: {
thousand: 'k',
million: 'm',
billion: 'b',
trillion: 't'
},
ordinal: function (number) {
var b = number % 10;
return (~~ (number % 100 / 10) === 1) ? 'th' :
(b === 1) ? 'st' :
(b === 2) ? 'nd' :
(b === 3) ? 'rd' : 'th';
},
currency: {
symbol: '$'
}
});
numeral.zeroFormat = function (format) {
if (typeof(format) === 'string') {
zeroFormat = format;
} else {
zeroFormat = null;
}
};
/************************************
Helpers
************************************/
function loadLanguage(key, values) {
languages[key] = values;
}
/************************************
Numeral Prototype
************************************/
numeral.fn = Numeral.prototype = {
clone : function () {
return numeral(this);
},
format : function (inputString) {
return formatNumeral(this, inputString ? inputString : numeral.defaultFormat);
},
unformat : function (inputString) {
return unformatNumeral(this, inputString ? inputString : numeral.defaultFormat);
},
value : function () {
return this._n;
},
valueOf : function () {
return this._n;
},
set : function (value) {
this._n = Number(value);
return this;
},
add : function (value) {
this._n = this._n + Number(value);
return this;
},
subtract : function (value) {
this._n = this._n - Number(value);
return this;
},
multiply : function (value) {
this._n = this._n * Number(value);
return this;
},
divide : function (value) {
this._n = this._n / Number(value);
return this;
},
difference : function (value) {
var difference = this._n - Number(value);
if (difference < 0) {
difference = -difference;
}
return difference;
}
};
/************************************
Exposing Numeral
************************************/
// CommonJS module is defined
if (hasModule) {
module.exports = numeral;
}
/*global ender:false */
if (typeof ender === 'undefined') {
// here, `this` means `window` in the browser, or `global` on the server
// add `numeral` as a global object via a string identifier,
// for Closure Compiler 'advanced' mode
this['numeral'] = numeral;
}
/*global define:false */
if (typeof define === 'function' && define.amd) {
define([], function () {
return numeral;
});
}
}).call(this);
|
src/svg-icons/maps/directions-walk.js
|
ichiohta/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let MapsDirectionsWalk = (props) => (
<SvgIcon {...props}>
<path d="M13.5 5.5c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zM9.8 8.9L7 23h2.1l1.8-8 2.1 2v6h2v-7.5l-2.1-2 .6-3C14.8 12 16.8 13 19 13v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1L6 8.3V13h2V9.6l1.8-.7"/>
</SvgIcon>
);
MapsDirectionsWalk = pure(MapsDirectionsWalk);
MapsDirectionsWalk.displayName = 'MapsDirectionsWalk';
MapsDirectionsWalk.muiName = 'SvgIcon';
export default MapsDirectionsWalk;
|
src/components/sort/mergeSort/MergeSort.js
|
ianroberts131/visual-algorithms
|
import React from 'react';
import { Col } from 'react-bootstrap';
import './mergeSort.css';
class MergeSort extends React.Component {
render() {
const { mergeArrayMain, mergeArrayLeft1, mergeArrayLeft2, mergeArrayLeft3, mergeArrayLeft4, mergeArrayLeft5, mergeArrayLeft6, mergeArrayLeft7, mergeArrayRight1, mergeArrayRight2, mergeArrayRight3, mergeArrayRight4, mergeArrayRight5, mergeArrayRight6, mergeArrayRight7, mergeFinalSort } = this.props.sort;
const { intervalSpeed, speedString } = this.props.speed;
return (
<div className="merge-sort-area">
<Col xs={ 8 } xsOffset={ 2 } className="merge-sort-box-area">
{ mergeArrayMain.map((number, index) => {
var classVar = mergeFinalSort ? "sorted" : "unsorted";
return <Col xs={ 1 } key={ index } className={number > -1 ? `merge-sort-box-level-0 merge-${classVar}` : "merge-sort-box-level-0 merge-hidden"}>{ number }</Col>
})}
</Col>
<Col xs={ 4 } className="merge-sort-box-area level-1-0">
{ mergeArrayLeft1.map((number, index) => {
return <Col xs={ 1 } key={ index } className={number > -1 ? "merge-sort-box-level-1 merge-unsorted" : "merge-sort-box-level-1 merge-hidden"}>{ number }</Col>
})}
</Col>
<Col xs={ 4 } className="merge-sort-box-area level-1-1">
{ mergeArrayRight1.map((number, index) => {
return <Col xs={ 1 } key={ index } className={number > -1 ? "merge-sort-box-level-1 merge-unsorted" : "merge-sort-box-level-1 merge-hidden"}>{ number }</Col>
})}
</Col>
<Col xs={ 2 } className="merge-sort-box-area level-2-0">
{ mergeArrayLeft2.map((number, index) => {
return <Col xs={ 1 } key={ index } className={number > -1 ? "merge-sort-box-level-2 merge-unsorted" : "merge-sort-box-level-2 merge-hidden"}>{ number }</Col>
})}
</Col>
<Col xs={ 2 } className="merge-sort-box-area level-2-1">
{ mergeArrayLeft3.map((number, index) => {
return <Col xs={ 1 } key={ index } className={number > -1 ? "merge-sort-box-level-2 merge-unsorted" : "merge-sort-box-level-2 merge-hidden"}>{ number }</Col>
})}
</Col>
<Col xs={ 2 } className="merge-sort-box-area level-2-2">
{ mergeArrayRight2.map((number, index) => {
return <Col xs={ 1 } key={ index } className={number > -1 ? "merge-sort-box-level-2 merge-unsorted" : "merge-sort-box-level-2 merge-hidden"}>{ number }</Col>
})}
</Col>
<Col xs={ 2 } className="merge-sort-box-area level-2-3">
{ mergeArrayRight3.map((number, index) => {
return <Col xs={ 1 } key={ index } className={number > -1 ? "merge-sort-box-level-2 merge-unsorted" : "merge-sort-box-level-2 merge-hidden"}>{ number }</Col>
})}
</Col>
<Col xs={ 1 } className="merge-sort-box-area level-3-0">
<Col xs={ 1 } className={mergeArrayLeft4 > -1 ? "merge-sort-box-level-3 merge-unsorted" : "merge-sort-box-level-3 merge-hidden"}>{ mergeArrayLeft4 }</Col>
</Col>
<Col xs={ 1 } className="merge-sort-box-area level-3-1">
<Col xs={ 1 } className={mergeArrayLeft5 > -1 ? "merge-sort-box-level-3 merge-unsorted" : "merge-sort-box-level-3 merge-hidden"}>{ mergeArrayLeft5 }</Col>
</Col>
<Col xs={ 1 } className="merge-sort-box-area level-3-2">
<Col xs={ 1 } className={mergeArrayLeft6 > -1 ? "merge-sort-box-level-3 merge-unsorted" : "merge-sort-box-level-3 merge-hidden"}>{ mergeArrayLeft6 }</Col>
</Col>
<Col xs={ 1 } className="merge-sort-box-area level-3-3">
<Col xs={ 1 } className={mergeArrayLeft7 > -1 ? "merge-sort-box-level-3 merge-unsorted" : "merge-sort-box-level-3 merge-hidden"}>{ mergeArrayLeft7 }</Col>
</Col>
<Col xs={ 1 } className="merge-sort-box-area level-3-4">
<Col xs={ 1 } className={mergeArrayRight4 > -1 ? "merge-sort-box-level-3 merge-unsorted" : "merge-sort-box-level-3 merge-hidden"}>{ mergeArrayRight4 }</Col>
</Col>
<Col xs={ 1 } className="merge-sort-box-area level-3-5">
<Col xs={ 1 } className={mergeArrayRight5 > -1 ? "merge-sort-box-level-3 merge-unsorted" : "merge-sort-box-level-3 merge-hidden"}>{ mergeArrayRight5 }</Col>
</Col>
<Col xs={ 1 } className="merge-sort-box-area level-3-6">
<Col xs={ 1 } className={mergeArrayRight6 > -1 ? "merge-sort-box-level-3 merge-unsorted" : "merge-sort-box-level-3 merge-hidden"}>{ mergeArrayRight6 }</Col>
</Col>
<Col xs={ 1 } className="merge-sort-box-area level-3-7">
<Col xs={ 1 } className={mergeArrayRight7 > -1 ? "merge-sort-box-level-3 merge-unsorted" : "merge-sort-box-level-3 merge-hidden"}>{ mergeArrayRight7 }</Col>
</Col>
</div>
)
}
}
export default MergeSort;
|
src/styles/theme-decorator.js
|
bgribben/material-ui
|
import React from 'react';
export default (customTheme) => {
return function(Component) {
return React.createClass({
childContextTypes: {
muiTheme: React.PropTypes.object,
},
getChildContext() {
return {
muiTheme: customTheme,
};
},
render() {
return React.createElement(Component, this.props);
},
});
};
};
|
src/parser/paladin/holy/modules/beacons/FailedBeaconTransfers.js
|
FaideWW/WoWAnalyzer
|
import React from 'react';
import SPELLS from 'common/SPELLS';
import SpellIcon from 'common/SpellIcon';
import Analyzer from 'parser/core/Analyzer';
import StatisticBox, { STATISTIC_ORDER } from 'interface/others/StatisticBox';
import BeaconTransferFactor from './BeaconTransferFactor';
import BeaconHealSource from './BeaconHealSource';
class FailedBeaconTransfers extends Analyzer {
static dependencies = {
beaconTransferFactor: BeaconTransferFactor,
beaconHealSource: BeaconHealSource, // for the events
};
lostBeaconHealing = 0;
on_byPlayer_beacontransferfailed(event) {
this.lostBeaconHealing += this.beaconTransferFactor.getExpectedTransfer(event);
}
statistic() {
if (this.lostBeaconHealing === 0) {
// Normally we don't want optional statistics, but this is an exception as this giving any results is very rare.
return null;
}
return (
<StatisticBox
position={STATISTIC_ORDER.UNIMPORTANT(0)}
icon={<SpellIcon id={SPELLS.BEACON_OF_LIGHT_CAST_AND_BUFF.id} />}
value={<span style={{ fontSize: '75%' }}>Up to {this.owner.formatItemHealingDone(this.lostBeaconHealing)}</span>}
label="Beacon healing lost (line of sight)"
tooltip={'The amount of <b>raw</b> healing that didn\'t transfer to one or more beacon targets due to an issue such as Line of Sight or phasing.'}
/>
);
}
}
export default FailedBeaconTransfers;
|
src/components/Tooltip/InnerToolTip.js
|
instacart/Snacks
|
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import Fade from '../Transitions/Fade'
import colors from '../../styles/colors'
import TooltipArrow from './TooltipArrow'
import spacing from '../../styles/spacing'
const styles = {
root: {
position: 'relative',
},
arrowPadding: {
top: { paddingBottom: '9px' },
bottom: { paddingTop: '9px' },
left: { paddingRight: '9px' },
right: { paddingLeft: '9px' },
},
innerContent: {
textAlign: 'center',
borderRadius: 4,
whiteSpace: 'nowrap',
fontWeight: 600,
},
}
const RESOLVED_COLOR = {
primary: {
background: colors.GREEN_500,
color: '#FFF',
border: `1px solid ${colors.GREEN_500}`,
},
secondary: {
background: '#FFF',
color: colors.GRAY_46,
border: `1px solid ${colors.GRAY_74}`,
},
dark: {
background: colors.GRAY_20,
color: '#FFF',
border: `1px solid ${colors.GRAY_20}`,
},
}
const RESOLVED_SIZE = {
small: {
fontSize: '14px',
paddingTop: '9px',
paddingBottom: '9px',
...spacing.PADDING_X_XS,
},
medium: {
fontSize: '16px',
paddingTop: '9px',
paddingBottom: '9px',
...spacing.PADDING_X_SM,
},
large: {
fontSize: '18px',
paddingTop: '12px',
paddingBottom: '12px',
...spacing.PADDING_X_MD,
},
}
class InnerToolTip extends PureComponent {
static propTypes = {
children: PropTypes.node,
snacksStyle: PropTypes.oneOf(['primary', 'secondary', 'dark']),
size: PropTypes.oneOf(['small', 'medium', 'large']),
customStyle: PropTypes.shape({
border: PropTypes.string,
padding: PropTypes.string,
boxShadow: PropTypes.string,
backgroundColor: PropTypes.string,
}),
arrowStyle: PropTypes.shape({
border: PropTypes.string,
boxShadowRight: PropTypes.string,
boxShadowBottom: PropTypes.string,
boxShadowLeft: PropTypes.string,
boxShadowTop: PropTypes.string,
}),
arrowPosition: PropTypes.shape({}),
}
static defaultProps = {
size: 'medium',
snacksStyle: 'dark',
}
get contentStyles() {
const { size, customStyle, snacksStyle } = this.props
return {
...styles.innerContent,
...RESOLVED_SIZE[size],
...RESOLVED_COLOR[snacksStyle],
...customStyle,
}
}
renderArrow() {
const { arrowPosition, arrowStyle, snacksStyle } = this.props
return (
<TooltipArrow arrowStyle={arrowStyle} position={arrowPosition} snacksStyle={snacksStyle} />
)
}
render() {
return (
<Fade>
{this.renderArrow()}
<div style={this.contentStyles}>{this.props.children}</div>
</Fade>
)
}
}
export default InnerToolTip
|
ajax/libs/react-highcharts/8.2.0/index.src.js
|
honestree/cdnjs
|
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"), require("highcharts"));
else if(typeof define === 'function' && define.amd)
define(["react", "highcharts"], factory);
else if(typeof exports === 'object')
exports["index"] = factory(require("react"), require("highcharts"));
else
root["index"] = factory(root["React"], root["Highcharts"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_4__) {
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__) {
module.exports = __webpack_require__(1);
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
module.exports = __webpack_require__(2)('Chart', __webpack_require__(4));
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {'use strict';
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__(3);
module.exports = function (chartType, Highcharts) {
var displayName = 'Highcharts' + chartType;
var result = React.createClass({
displayName: displayName,
propTypes: {
config: React.PropTypes.object.isRequired,
isPureConfig: React.PropTypes.bool,
neverReflow: React.PropTypes.bool
},
renderChart: function renderChart(config) {
var _this = this;
if (!config) {
throw new Error('Config must be specified for the ' + displayName + ' component');
}
var chartConfig = config.chart;
this.chart = new Highcharts[chartType](_extends({}, config, {
chart: _extends({}, chartConfig, {
renderTo: this.refs.chart
})
}));
global.requestAnimationFrame && requestAnimationFrame(function () {
_this.chart && _this.chart.options && _this.chart.reflow();
});
},
shouldComponentUpdate: function shouldComponentUpdate(nextProps) {
if (this.props.neverReflow || this.props.isPureConfig && this.props.config === nextProps.config) {
return true;
}
this.renderChart(nextProps.config);
return false;
},
getChart: function getChart() {
if (!this.chart) {
throw new Error('getChart() should not be called before the component is mounted');
}
return this.chart;
},
componentDidMount: function componentDidMount() {
this.renderChart(this.props.config);
},
componentWillUnmount: function componentWillUnmount() {
this.chart.destroy();
},
render: function render() {
var props = this.props;
props = _extends({}, props, {
ref: 'chart'
});
return React.createElement('div', props);
}
});
result.Highcharts = Highcharts;
return result;
};
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 3 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_3__;
/***/ },
/* 4 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_4__;
/***/ }
/******/ ])
});
;
|
ajax/libs/antd-mobile/1.0.1/antd-mobile.min.js
|
sashberd/cdnjs
|
/*!
* antd-mobile v1.0.1
*
* Copyright 2015-present, Alipay, Inc.
* All rights reserved.
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports["antd-mobile"]=t(require("react"),require("react-dom")):e["antd-mobile"]=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}(function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(typeof e[t]){case"function":break;case"object":e[t]=function(t){var n=t.slice(1),r=e[t[0]];return function(e,t,o){r.apply(this,[e,t,o].concat(n))}}(e[t]);break;default:e[t]=e[e[t]]}return e}([function(e,t,n){e.exports=n(360)},function(t,n){t.exports=e},function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var o=n(469),i=r(o),a=n(467),s=r(a),l=n(38),u=r(l);t["default"]=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof t?"undefined":(0,u["default"])(t)));e.prototype=(0,s["default"])(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(i["default"]?(0,i["default"])(e,t):e.__proto__=t)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var o=n(38),i=r(o);t["default"]=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==("undefined"==typeof t?"undefined":(0,i["default"])(t))&&"function"!=typeof t?e:t}},function(e,t,n){var r,o;/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var o=typeof r;if("string"===o||"number"===o)e.push(r);else if(Array.isArray(r))e.push(n.apply(null,r));else if("object"===o)for(var a in r)i.call(r,a)&&r[a]&&e.push(a)}}return e.join(" ")}var i={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=n:(r=[],o=function(){return n}.apply(t,r),!(void 0!==o&&(e.exports=o)))}()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var o=n(468),i=r(o);t["default"]=function(e,t,n){return t in e?(0,i["default"])(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var o=n(466),i=r(o);t["default"]=i["default"]||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}},function(e,t,n){"use strict";n(224),n(213)},function(e,n){e.exports=t},function(e,t,n){var r=n(155),o=new r;document.body?o.elem=o.render(document.body):document.addEventListener("DOMContentLoaded",function(){o.elem=o.render(document.body)},!1),e.exports=o},function(e,t){/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
"use strict";function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function r(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(i){return!1}}var o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=r()?Object.assign:function(e,t){for(var r,s,l=n(e),u=1;u<arguments.length;u++){r=Object(arguments[u]);for(var c in r)i.call(r,c)&&(l[c]=r[c]);if(o){s=o(r);for(var d=0;d<s.length;d++)a.call(r,s[d])&&(l[s[d]]=r[s[d]])}}return l}},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(59)("wks"),o=n(42),i=n(17).Symbol,a="function"==typeof i,s=e.exports=function(e){return r[e]||(r[e]=a&&i[e]||(a?i:o)("Symbol."+e))};s.store=r},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var i=n(6),a=o(i),s=n(2),l=o(s),u=n(4),c=o(u),d=n(3),f=o(d),p=n(1),h=r(p),m=n(5),v=o(m),y=function(e){function t(){(0,l["default"])(this,t);var r=(0,c["default"])(this,e.apply(this,arguments));return r.renderSvg=function(){var e=void 0;try{e=n(129)("./"+r.props.type+".svg")}finally{return e}},r}return(0,f["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.type,r=t.className,o=t.style,i=t.size,s=void 0===i?"md":i,l=this.renderSvg(),u=void 0;l?l="#"+n:(u=!0,l=n);var c=(0,v["default"])((e={"am-icon":!0},(0,a["default"])(e,"am-icon-"+(u?n.substr(1):n),!0),(0,a["default"])(e,"am-icon-"+s,!0),(0,a["default"])(e,r,!!r),e));return h.createElement("svg",{className:c,style:o},h.createElement("use",{xlinkHref:l}))},t}(h.Component);t["default"]=y,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return Object.keys(e).forEach(function(t){return e[t]=t}),e}function i(e,t){var n={};return t.forEach(function(t){n[t]=e[t]}),n}function a(e){var t=e.touches,n=e.changedTouches,r=t&&t.length>0,o=n&&n.length>0;return!r&&o?n[0]:r?t[0]:e}function s(){return Date.now()-P>=S}Object.defineProperty(t,"__esModule",{value:!0});var l=n(1),u=r(l),c=n(11),d=r(c),f=n(9),p=r(f),h=o({NOT_RESPONDER:null,RESPONDER_INACTIVE_PRESS_IN:null,RESPONDER_INACTIVE_PRESS_OUT:null,RESPONDER_ACTIVE_PRESS_IN:null,RESPONDER_ACTIVE_PRESS_OUT:null,RESPONDER_ACTIVE_LONG_PRESS_IN:null,RESPONDER_ACTIVE_LONG_PRESS_OUT:null,ERROR:null}),m={RESPONDER_ACTIVE_PRESS_OUT:!0,RESPONDER_ACTIVE_PRESS_IN:!0},v={RESPONDER_INACTIVE_PRESS_IN:!0,RESPONDER_ACTIVE_PRESS_IN:!0,RESPONDER_ACTIVE_LONG_PRESS_IN:!0},y={RESPONDER_ACTIVE_LONG_PRESS_IN:!0},g=o({DELAY:null,RESPONDER_GRANT:null,RESPONDER_RELEASE:null,RESPONDER_TERMINATED:null,ENTER_PRESS_RECT:null,LEAVE_PRESS_RECT:null,LONG_PRESS_DETECTED:null}),b={NOT_RESPONDER:{DELAY:h.ERROR,RESPONDER_GRANT:h.RESPONDER_INACTIVE_PRESS_IN,RESPONDER_RELEASE:h.ERROR,RESPONDER_TERMINATED:h.ERROR,ENTER_PRESS_RECT:h.ERROR,LEAVE_PRESS_RECT:h.ERROR,LONG_PRESS_DETECTED:h.ERROR},RESPONDER_INACTIVE_PRESS_IN:{DELAY:h.RESPONDER_ACTIVE_PRESS_IN,RESPONDER_GRANT:h.ERROR,RESPONDER_RELEASE:h.NOT_RESPONDER,RESPONDER_TERMINATED:h.NOT_RESPONDER,ENTER_PRESS_RECT:h.RESPONDER_INACTIVE_PRESS_IN,LEAVE_PRESS_RECT:h.RESPONDER_INACTIVE_PRESS_OUT,LONG_PRESS_DETECTED:h.ERROR},RESPONDER_INACTIVE_PRESS_OUT:{DELAY:h.RESPONDER_ACTIVE_PRESS_OUT,RESPONDER_GRANT:h.ERROR,RESPONDER_RELEASE:h.NOT_RESPONDER,RESPONDER_TERMINATED:h.NOT_RESPONDER,ENTER_PRESS_RECT:h.RESPONDER_INACTIVE_PRESS_IN,LEAVE_PRESS_RECT:h.RESPONDER_INACTIVE_PRESS_OUT,LONG_PRESS_DETECTED:h.ERROR},RESPONDER_ACTIVE_PRESS_IN:{DELAY:h.ERROR,RESPONDER_GRANT:h.ERROR,RESPONDER_RELEASE:h.NOT_RESPONDER,RESPONDER_TERMINATED:h.NOT_RESPONDER,ENTER_PRESS_RECT:h.RESPONDER_ACTIVE_PRESS_IN,LEAVE_PRESS_RECT:h.RESPONDER_ACTIVE_PRESS_OUT,LONG_PRESS_DETECTED:h.RESPONDER_ACTIVE_LONG_PRESS_IN},RESPONDER_ACTIVE_PRESS_OUT:{DELAY:h.ERROR,RESPONDER_GRANT:h.ERROR,RESPONDER_RELEASE:h.NOT_RESPONDER,RESPONDER_TERMINATED:h.NOT_RESPONDER,ENTER_PRESS_RECT:h.RESPONDER_ACTIVE_PRESS_IN,LEAVE_PRESS_RECT:h.RESPONDER_ACTIVE_PRESS_OUT,LONG_PRESS_DETECTED:h.ERROR},RESPONDER_ACTIVE_LONG_PRESS_IN:{DELAY:h.ERROR,RESPONDER_GRANT:h.ERROR,RESPONDER_RELEASE:h.NOT_RESPONDER,RESPONDER_TERMINATED:h.NOT_RESPONDER,ENTER_PRESS_RECT:h.RESPONDER_ACTIVE_LONG_PRESS_IN,LEAVE_PRESS_RECT:h.RESPONDER_ACTIVE_LONG_PRESS_OUT,LONG_PRESS_DETECTED:h.RESPONDER_ACTIVE_LONG_PRESS_IN},RESPONDER_ACTIVE_LONG_PRESS_OUT:{DELAY:h.ERROR,RESPONDER_GRANT:h.ERROR,RESPONDER_RELEASE:h.NOT_RESPONDER,RESPONDER_TERMINATED:h.NOT_RESPONDER,ENTER_PRESS_RECT:h.RESPONDER_ACTIVE_LONG_PRESS_IN,LEAVE_PRESS_RECT:h.RESPONDER_ACTIVE_LONG_PRESS_OUT,LONG_PRESS_DETECTED:h.ERROR},error:{DELAY:h.NOT_RESPONDER,RESPONDER_GRANT:h.RESPONDER_INACTIVE_PRESS_IN,RESPONDER_RELEASE:h.NOT_RESPONDER,RESPONDER_TERMINATED:h.NOT_RESPONDER,ENTER_PRESS_RECT:h.NOT_RESPONDER,LEAVE_PRESS_RECT:h.NOT_RESPONDER,LONG_PRESS_DETECTED:h.NOT_RESPONDER}},_=130,T=20,C=500,x=C-_,w=10,P=0,S=200,E=u["default"].createClass({displayName:"Touchable",getDefaultProps:function(){return{disabled:!1,delayPressIn:_,delayLongPress:x,delayPressOut:100,pressRetentionOffset:{left:T,right:T,top:T,bottom:T},hitSlop:void 0,longPressCancelsPress:!0}},getInitialState:function(){return{active:!1}},componentWillMount:function(){this.touchable={touchState:void 0}},componentDidMount:function(){this.root=p["default"].findDOMNode(this)},componentDidUpdate:function(){this.root=p["default"].findDOMNode(this)},componentWillUnmount:function(){this.releaseLockTimer&&clearTimeout(this.releaseLockTimer),this.touchableDelayTimeout&&clearTimeout(this.touchableDelayTimeout),this.longPressDelayTimeout&&clearTimeout(this.longPressDelayTimeout),this.pressOutDelayTimeout&&clearTimeout(this.pressOutDelayTimeout)},callChildEvent:function(e,t){var n=this.props.children.props[e];n&&n(t)},onTouchStart:function(e){this.callChildEvent("onTouchStart",e),this.lockMouse=!0,this.releaseLockTimer&&clearTimeout(this.releaseLockTimer),this.touchableHandleResponderGrant(e.nativeEvent)},onTouchMove:function(e){this.callChildEvent("onTouchMove",e),this.touchableHandleResponderMove(e.nativeEvent)},onTouchEnd:function(e){var t=this;this.callChildEvent("onTouchEnd",e),this.releaseLockTimer=setTimeout(function(){t.lockMouse=!1},300),this.touchableHandleResponderRelease(e.nativeEvent)},onTouchCancel:function(e){var t=this;this.callChildEvent("onTouchCancel",e),this.releaseLockTimer=setTimeout(function(){t.lockMouse=!1},300),this.touchableHandleResponderTerminate(e.nativeEvent)},onMouseDown:function(e){this.callChildEvent("onMouseDown",e),this.lockMouse||(this.touchableHandleResponderGrant(e.nativeEvent),document.addEventListener("mousemove",this.touchableHandleResponderMove,!1),document.addEventListener("mouseup",this.onMouseUp,!1))},onMouseUp:function(e){document.removeEventListener("mousemove",this.touchableHandleResponderMove,!1),document.removeEventListener("mouseup",this.onMouseUp,!1),this.touchableHandleResponderRelease(e)},_remeasureMetricsOnInit:function(e){var t=this.root,n=a(e),r=t.getBoundingClientRect();this.touchable={touchState:this.touchable.touchState,startMouse:{pageX:n.pageX,pageY:n.pageY},positionOnGrant:{left:r.left+window.pageXOffset,top:r.top+window.pageYOffset,width:r.width,height:r.height,clientLeft:r.left,clientTop:r.top}}},touchableHandleResponderGrant:function(e){var t=this;if(this.touchable.touchState=h.NOT_RESPONDER,this.pressOutDelayTimeout&&(clearTimeout(this.pressOutDelayTimeout),this.pressOutDelayTimeout=null),!this.props.fixClickPenetration||s()){this._remeasureMetricsOnInit(e),this._receiveSignal(g.RESPONDER_GRANT,e);var n=this.props.delayPressIn;n?this.touchableDelayTimeout=setTimeout(function(){t._handleDelay(e)},n):this._handleDelay(e);var r=this.props.delayLongPress;this.longPressDelayTimeout=setTimeout(function(){t._handleLongDelay(e)},r+n)}},checkScroll:function(e){var t=this.touchable.positionOnGrant,n=this.root.getBoundingClientRect();if(n.left!==t.clientLeft||n.top!==t.clientTop)return this._receiveSignal(g.RESPONDER_TERMINATED,e),!1},touchableHandleResponderRelease:function(e){if(this.touchable.startMouse){var t=a(e);return Math.abs(t.pageX-this.touchable.startMouse.pageX)>30||Math.abs(t.pageY-this.touchable.startMouse.pageY)>30?void this._receiveSignal(g.RESPONDER_TERMINATED,e):void(this.checkScroll(e)!==!1&&this._receiveSignal(g.RESPONDER_RELEASE,e))}},touchableHandleResponderTerminate:function(e){this.touchable.startMouse&&this._receiveSignal(g.RESPONDER_TERMINATED,e)},checkTouchWithinActive:function(e){var t=this.touchable.positionOnGrant,n=this.props,r=n.pressRetentionOffset,o=n.hitSlop,i=r.left,s=r.top,l=r.right,u=r.bottom;o&&(i+=o.left,s+=o.top,l+=o.right,u+=o.bottom);var c=a(e),d=c&&c.pageX,f=c&&c.pageY;return d>t.left-i&&f>t.top-s&&d<t.left+t.width+l&&f<t.top+t.height+u},touchableHandleResponderMove:function(e){if(this.touchable.startMouse&&this.touchable.dimensionsOnActivate&&this.touchable.touchState!==h.NOT_RESPONDER&&this.touchable.touchState!==h.RESPONDER_INACTIVE_PRESS_IN){var t=a(e),n=t&&t.pageX,r=t&&t.pageY;if(this.pressInLocation){var o=this._getDistanceBetweenPoints(n,r,this.pressInLocation.pageX,this.pressInLocation.pageY);o>w&&this._cancelLongPressDelayTimeout()}if(this.checkTouchWithinActive(e)){this._receiveSignal(g.ENTER_PRESS_RECT,e);var i=this.touchable.touchState;i===h.RESPONDER_INACTIVE_PRESS_IN&&this._cancelLongPressDelayTimeout()}else this._cancelLongPressDelayTimeout(),this._receiveSignal(g.LEAVE_PRESS_RECT,e)}},touchableHandleActivePressIn:function(e){this.setActive(!0),this.props.onPressIn&&this.props.onPressIn(e)},touchableHandleActivePressOut:function(e){this.setActive(!1),this.props.onPressOut&&this.props.onPressOut(e)},touchableHandlePress:function(e){this.props.onPress&&this.props.onPress(e),P=Date.now()},touchableHandleLongPress:function(e){this.props.onLongPress&&this.props.onLongPress(e)},setActive:function(e){(this.props.activeClassName||this.props.activeStyle)&&this.setState({active:e})},_remeasureMetricsOnActivation:function(){this.touchable.dimensionsOnActivate=this.touchable.positionOnGrant},_handleDelay:function(e){this.touchableDelayTimeout=null,this._receiveSignal(g.DELAY,e)},_handleLongDelay:function(e){this.longPressDelayTimeout=null;var t=this.touchable.touchState;t!==h.RESPONDER_ACTIVE_PRESS_IN&&t!==h.RESPONDER_ACTIVE_LONG_PRESS_IN?console.error("Attempted to transition from state `"+t+"` to `"+h.RESPONDER_ACTIVE_LONG_PRESS_IN+"`, which is not supported. This is most likely due to `Touchable.longPressDelayTimeout` not being cancelled."):this._receiveSignal(g.LONG_PRESS_DETECTED,e)},_receiveSignal:function(e,t){var n=this.touchable.touchState,r=b[n]&&b[n][e];r&&r!==h.ERROR&&n!==r&&(this._performSideEffectsForTransition(n,r,e,t),this.touchable.touchState=r)},_cancelLongPressDelayTimeout:function(){this.longPressDelayTimeout&&(clearTimeout(this.longPressDelayTimeout),this.longPressDelayTimeout=null)},_isHighlight:function(e){return e===h.RESPONDER_ACTIVE_PRESS_IN||e===h.RESPONDER_ACTIVE_LONG_PRESS_IN},_savePressInLocation:function(e){var t=a(e),n=t&&t.pageX,r=t&&t.pageY;this.pressInLocation={pageX:n,pageY:r}},_getDistanceBetweenPoints:function(e,t,n,r){var o=e-n,i=t-r;return Math.sqrt(o*o+i*i)},_performSideEffectsForTransition:function(e,t,n,r){var o=this._isHighlight(e),i=this._isHighlight(t),a=n===g.RESPONDER_TERMINATED||n===g.RESPONDER_RELEASE;if(a&&this._cancelLongPressDelayTimeout(),!m[e]&&m[t]&&this._remeasureMetricsOnActivation(),v[e]&&n===g.LONG_PRESS_DETECTED&&this.touchableHandleLongPress(r),i&&!o?this._startHighlight(r):!i&&o&&this._endHighlight(r),v[e]&&n===g.RESPONDER_RELEASE){var s=!!this.props.onLongPress,l=y[e]&&(!s||!this.props.longPressCancelsPress),u=!y[e]||l;u&&(i||o||(this._startHighlight(r),this._endHighlight(r)),this.touchableHandlePress(r))}this.touchableDelayTimeout&&(clearTimeout(this.touchableDelayTimeout),this.touchableDelayTimeout=null)},_startHighlight:function(e){this._savePressInLocation(e),this.touchableHandleActivePressIn(e)},_endHighlight:function(e){var t=this;this.props.delayPressOut?this.pressOutDelayTimeout=setTimeout(function(){t.touchableHandleActivePressOut(e)},this.props.delayPressOut):this.touchableHandleActivePressOut(e)},render:function(){var e=this.props,t=e.children,n=e.disabled,r=e.activeStyle,o=e.activeClassName,a=n?void 0:i(this,["onTouchStart","onTouchMove","onTouchEnd","onTouchCancel","onMouseDown"]),s=u["default"].Children.only(t);if(this.state.active){var l=s.props,c=l.style,f=l.className;return r&&(c=(0,d["default"])({},c,r)),o&&(f?f+=" "+o:f=o),u["default"].cloneElement(s,(0,d["default"])({className:f,style:c},a))}return u["default"].cloneElement(s,a)}});t["default"]=E,e.exports=t["default"]},[483,188],function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){var r=n(20),o=n(92),i=n(62),a=Object.defineProperty;t.f=n(21)?Object.defineProperty:function(e,t,n){if(r(e),t=i(t,!0),r(n),o)try{return a(e,t,n)}catch(s){}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){"use strict";var r=n(11);e.exports=function(e,t){for(var n=r({},e),o=0;o<t.length;o++){var i=t[o];delete n[i]}return n}},function(e,t,n){var r=n(32);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){e.exports=!n(31)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){var r=n(17),o=n(12),i=n(51),a=n(27),s="prototype",l=function(e,t,n){var u,c,d,f=e&l.F,p=e&l.G,h=e&l.S,m=e&l.P,v=e&l.B,y=e&l.W,g=p?o:o[t]||(o[t]={}),b=g[s],_=p?r:h?r[t]:(r[t]||{})[s];p&&(n=t);for(u in n)c=!f&&_&&void 0!==_[u],c&&u in g||(d=c?_[u]:n[u],g[u]=p&&"function"!=typeof _[u]?n[u]:v&&c?i(d,r):y&&_[u]==d?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[s]=e[s],t}(d):m&&"function"==typeof d?i(Function.call,d):d,m&&((g.virtual||(g.virtual={}))[u]=d,e&l.R&&b&&!b[u]&&a(b,u,d)))};l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(93),o=n(52);e.exports=function(e){return r(o(e))}},[480,192],function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}},function(e,t,n){var r=n(18),o=n(34);e.exports=n(21)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t){e.exports={}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(6),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(395),m=r(h),v=n(5),y=r(v),g=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,r=t.children,o=t.className,a=t.style,s=t.renderHeader,l=t.renderFooter,u=(0,y["default"])((e={},(0,i["default"])(e,n,!0),(0,i["default"])(e,o,o),e));return p["default"].createElement("div",{className:u,style:a},s?p["default"].createElement("div",{className:n+"-header"},"function"==typeof s?s():s):null,r?p["default"].createElement("div",{className:n+"-body"},r):null,l?p["default"].createElement("div",{className:n+"-footer"},"function"==typeof l?l():l):null)},t}(p["default"].Component);t["default"]=g,g.Item=m["default"],g.defaultProps={prefixCls:"am-list"},e.exports=t["default"]},function(e,t,n){"use strict";function r(e,t){return e+t}function o(e,t,n){var r=n;{if("object"!==("undefined"==typeof t?"undefined":P(t)))return"undefined"!=typeof r?("number"==typeof r&&(r+="px"),void(e.style[t]=r)):O(e,t);for(var i in t)t.hasOwnProperty(i)&&o(e,i,t[i])}}function i(e){var t=void 0,n=void 0,r=void 0,o=e.ownerDocument,i=o.body,a=o&&o.documentElement;return t=e.getBoundingClientRect(),n=t.left,r=t.top,n-=a.clientLeft||i.clientLeft||0,r-=a.clientTop||i.clientTop||0,{left:n,top:r}}function a(e,t){var n=e["page"+(t?"Y":"X")+"Offset"],r="scroll"+(t?"Top":"Left");if("number"!=typeof n){var o=e.document;n=o.documentElement[r],"number"!=typeof n&&(n=o.body[r])}return n}function s(e){return a(e)}function l(e){return a(e,!0)}function u(e){var t=i(e),n=e.ownerDocument,r=n.defaultView||n.parentWindow;return t.left+=s(r),t.top+=l(r),t}function c(e,t,n){var r=n,o="",i=e.ownerDocument;return r=r||i.defaultView.getComputedStyle(e,null),r&&(o=r.getPropertyValue(t)||r[t]),o}function d(e,t){var n=e[N]&&e[N][t];if(M.test(n)&&!k.test(t)){var r=e.style,o=r[R],i=e[D][R];e[D][R]=e[N][R],r[R]="fontSize"===t?"1em":n||0,n=r.pixelLeft+I,r[R]=o,e[D][R]=i}return""===n?"auto":n}function f(e,t){return"left"===e?t.useCssRight?"right":e:t.useCssBottom?"bottom":e}function p(e){return"left"===e?"right":"right"===e?"left":"top"===e?"bottom":"bottom"===e?"top":void 0}function h(e,t,n){"static"===o(e,"position")&&(e.style.position="relative");var i=-999,a=-999,s=f("left",n),l=f("top",n),c=p(s),d=p(l);"left"!==s&&(i=999),"top"!==l&&(a=999);var h="",m=u(e);("left"in t||"top"in t)&&(h=(0,S.getTransitionProperty)(e)||"",(0,S.setTransitionProperty)(e,"none")),"left"in t&&(e.style[c]="",e.style[s]=i+"px"),"top"in t&&(e.style[d]="",e.style[l]=a+"px");var v=u(e),y={};for(var g in t)if(t.hasOwnProperty(g)){var b=f(g,n),_="left"===g?i:a,T=m[g]-v[g];b===g?y[b]=_+T:y[b]=_-T}o(e,y),r(e.offsetTop,e.offsetLeft),("left"in t||"top"in t)&&(0,S.setTransitionProperty)(e,h);var C={};for(var x in t)if(t.hasOwnProperty(x)){var w=f(x,n),P=t[x]-m[x];x===w?C[w]=y[w]+P:C[w]=y[w]-P}o(e,C)}function m(e,t){var n=u(e),r=(0,S.getTransformXY)(e),o={x:r.x,y:r.y};"left"in t&&(o.x=r.x+t.left-n.left),"top"in t&&(o.y=r.y+t.top-n.top),(0,S.setTransformXY)(e,o)}function v(e,t,n){n.useCssRight||n.useCssBottom?h(e,t,n):n.useCssTransform&&(0,S.getTransformName)()in document.body.style?m(e,t,n):h(e,t,n)}function y(e,t){for(var n=0;n<e.length;n++)t(e[n])}function g(e){return"border-box"===O(e,"boxSizing")}function b(e,t,n){var r={},o=e.style,i=void 0;for(i in t)t.hasOwnProperty(i)&&(r[i]=o[i],o[i]=t[i]);n.call(e);for(i in t)t.hasOwnProperty(i)&&(o[i]=r[i])}function _(e,t,n){var r=0,o=void 0,i=void 0,a=void 0;for(i=0;i<t.length;i++)if(o=t[i])for(a=0;a<n.length;a++){var s=void 0;s="border"===o?""+o+n[a]+"Width":o+n[a],r+=parseFloat(O(e,s))||0}return r}function T(e){return null!==e&&void 0!==e&&e==e.window}function C(e,t,n){var r=n;if(T(e))return"width"===t?H.viewportWidth(e):H.viewportHeight(e);if(9===e.nodeType)return"width"===t?H.docWidth(e):H.docHeight(e);var o="width"===t?["Left","Right"]:["Top","Bottom"],i="width"===t?e.offsetWidth:e.offsetHeight,a=O(e),s=g(e,a),l=0;(null===i||void 0===i||i<=0)&&(i=void 0,l=O(e,t),(null===l||void 0===l||Number(l)<0)&&(l=e.style[t]||0),l=parseFloat(l)||0),void 0===r&&(r=s?W:A);var u=void 0!==i||s,c=i||l;return r===A?u?c-_(e,["border","padding"],o,a):l:u?r===W?c:c+(r===L?-_(e,["border"],o,a):_(e,["margin"],o,a)):l+_(e,j.slice(r),o,a)}function x(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=void 0,o=t[0];return 0!==o.offsetWidth?r=C.apply(void 0,t):b(o,F,function(){r=C.apply(void 0,t)}),r}function w(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}Object.defineProperty(t,"__esModule",{value:!0});var P="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},S=n(245),E=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,O=void 0,M=new RegExp("^("+E+")(?!px)[a-z%]+$","i"),k=/^(top|right|bottom|left)$/,N="currentStyle",D="runtimeStyle",R="left",I="px";"undefined"!=typeof window&&(O=window.getComputedStyle?c:d);var j=["margin","border","padding"],A=-1,L=2,W=1,V=0,H={};y(["Width","Height"],function(e){H["doc"+e]=function(t){var n=t.document;return Math.max(n.documentElement["scroll"+e],n.body["scroll"+e],H["viewport"+e](n))},H["viewport"+e]=function(t){var n="client"+e,r=t.document,o=r.body,i=r.documentElement,a=i[n];return"CSS1Compat"===r.compatMode&&a||o&&o[n]||a}});var F={position:"absolute",visibility:"hidden",display:"block"};y(["width","height"],function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);H["outer"+t]=function(t,n){return t&&x(t,e,n?V:W)};var n="width"===e?["Left","Right"]:["Top","Bottom"];H[e]=function(t,r){var i=r;{if(void 0===i)return t&&x(t,e,A);if(t){var a=O(t),s=g(t);return s&&(i+=_(t,["padding","border"],n,a)),o(t,e,i)}}}});var Y={getWindow:function(e){if(e&&e.document&&e.setTimeout)return e;var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},offset:function(e,t,n){return"undefined"==typeof t?u(e):void v(e,t,n||{})},isWindow:T,each:y,css:o,clone:function(e){var t=void 0,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);var r=e.overflow;if(r)for(t in e)e.hasOwnProperty(t)&&(n.overflow[t]=e.overflow[t]);return n},mix:w,getWindowScrollLeft:function(e){return s(e)},getWindowScrollTop:function(e){return l(e)},merge:function(){for(var e={},t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];for(var o=0;o<n.length;o++)Y.mix(e,n[o]);return e},viewportWidth:0,viewportHeight:0};w(Y,H),t["default"]=Y,e.exports=t["default"]},function(e,t){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){var r=n(97),o=n(53);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},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(383),i=r(o),a=n(384),s=r(a);i["default"].Item=s["default"],t["default"]=i["default"],e.exports=t["default"]},[480,186],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var o=n(465),i=r(o),a=n(464),s=r(a);t["default"]=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,l=(0,s["default"])(e);!(r=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(u){o=!0,i=u}finally{try{!r&&l["return"]&&l["return"]()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if((0,i["default"])(Object(t)))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var o=n(471),i=r(o),a=n(470),s=r(a),l="function"==typeof s["default"]&&"symbol"==typeof i["default"]?function(e){return typeof e}:function(e){return e&&"function"==typeof s["default"]&&e.constructor===s["default"]&&e!==s["default"].prototype?"symbol":typeof e};t["default"]="function"==typeof s["default"]&&"symbol"===l(i["default"])?function(e){return"undefined"==typeof e?"undefined":l(e)}:function(e){return e&&"function"==typeof s["default"]&&e.constructor===s["default"]&&e!==s["default"].prototype?"symbol":"undefined"==typeof e?"undefined":l(e)}},function(e,t,n){"use strict";var r=n(319);e.exports=function(e,t,n,o){var i=n?n.call(o,e,t):void 0;if(void 0!==i)return!!i;if(e===t)return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var a=r(e),s=r(t),l=a.length;if(l!==s.length)return!1;o=o||null;for(var u=Object.prototype.hasOwnProperty.bind(t),c=0;c<l;c++){var d=a[c];if(!u(d))return!1;var f=e[d],p=t[d],h=n?n.call(o,f,p,d):void 0;if(h===!1||void 0===h&&f!==p)return!1}return!0}},function(e,t,n){"use strict";e.exports=n(265)},function(e,t){t.f={}.propertyIsEnumerable},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){"use strict";var r=n(299)(!0);n(94)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},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(7),i=r(o),a=n(1),s=r(a),l=n(5),u=r(l),c=n(327),d=r(c),f=n(326),p=r(f),h=s["default"].createClass({displayName:"MultiPicker",mixins:[p["default"]],render:function(){var e=this,t=this.props,n=t.prefixCls,r=t.pickerPrefixCls,o=t.className,a=t.rootNativeProps,l=t.disabled,c=t.pickerItemStyle,f=t.indicatorStyle,p=t.pure,h=t.children,m=this.getValue(),v=h.map(function(t,o){return s["default"].createElement("div",{key:t.key||o,className:n+"-item"},s["default"].createElement(d["default"],(0,i["default"])({itemStyle:c,disabled:l,pure:p,indicatorStyle:f,prefixCls:r,selectedValue:m[o],onValueChange:e.onValueChange.bind(e,o)},t.props)))});return s["default"].createElement("div",(0,i["default"])({},a,{className:(0,u["default"])(o,n)}),v)}});t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){var r=l["default"].unstable_batchedUpdates?function(e){l["default"].unstable_batchedUpdates(n,e)}:n;return(0,a["default"])(e,t,r)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=n(227),a=r(i),s=n(9),l=r(s);e.exports=t["default"]},function(e,t){"use strict";function n(e){var t={};return Object.keys(e).forEach(function(n){0===n.indexOf("data-")&&(t[n]=e[n])}),t}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]},function(e,t){"use strict";function n(e,t){var n={},r={};return Object.keys(e).forEach(function(o){t.indexOf(o)!==-1?n[o]=e[o]:r[o]=e[o]}),[n,r]}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]},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),a=n(472),s=r(a),l=n(322),u=r(l),c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},d=i["default"].createClass({displayName:"DialogWrap",mixins:[(0,u["default"])({isVisible:function(e){return e.props.visible},autoDestroy:!1,getComponent:function(e,t){return i["default"].createElement(s["default"],c({},e.props,t,{key:"dialog"}))}})],getDefaultProps:function(){return{visible:!1}},shouldComponentUpdate:function(e){var t=e.visible;return!(!this.props.visible&&!t)},componentWillUnmount:function(){this.props.visible?this.renderComponent({afterClose:this.removeContainer,onClose:function(){},visible:!1}):this.removeContainer()},getElement:function(e){return this._component.getElement(e)},render:function(){return null}});t["default"]=d,e.exports=t["default"]},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(78),i=r(o),a=n(167),s=r(a),l=n(170),u=r(l);i["default"].IndexedList=s["default"],i["default"].RefreshControl=u["default"],t["default"]=i["default"],e.exports=t["default"]},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(280);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){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,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t){e.exports=!0},function(e,t,n){var r=n(20),o=n(295),i=n(53),a=n(58)("IE_PROTO"),s=function(){},l="prototype",u=function(){var e,t=n(91)("iframe"),r=i.length,o="<",a=">";for(t.style.display="none",n(285).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write(o+"script"+a+"document.F=Object"+o+"/script"+a),e.close(),u=e.F;r--;)delete u[l][i[r]];return u()};e.exports=Object.create||function(e,t){var n;return null!==e?(s[l]=r(e),n=new s,s[l]=null,n[a]=e):n=u(),void 0===t?n:o(n,t)}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(18).f,o=n(23),i=n(13)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){var r=n(59)("keys"),o=n(42);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t,n){var r=n(17),o="__core-js_shared__",i=r[o]||(r[o]={});e.exports=function(e){return i[e]||(i[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){var r=n(52);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(32);e.exports=function(e,t){if(!r(e))return e;var n,o;if(t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;if("function"==typeof(n=e.valueOf)&&!r(o=n.call(e)))return o;if(!t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){var r=n(17),o=n(12),i=n(54),a=n(64),s=n(18).f;e.exports=function(e){var t=o.Symbol||(o.Symbol=i?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:a.f(e)})}},function(e,t,n){t.f=n(13)},function(e,t,n){n(304);for(var r=n(17),o=n(27),i=n(28),a=n(13)("toStringTag"),s=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],l=0;l<5;l++){var u=s[l],c=r[u],d=c&&c.prototype;d&&!d[a]&&o(d,a,u),i[u]=i.Array}},function(e,t,n){"use strict";var r=function(){};e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){return Object.keys(t).some(function(n){return e.target===(0,y.findDOMNode)(t[n])})}function i(e,t){var n=t.min,r=t.max;return e<n||e>r}function a(e){return e.touches.length>1||"touchend"===e.type.toLowerCase()&&e.touches.length>0}function s(e,t){var n=t.marks,r=t.step,o=t.min,i=Object.keys(n).map(parseFloat);if(null!==r){var a=Math.round((e-o)/r)*r+o;i.push(a)}var s=i.map(function(t){return Math.abs(e-t)});return i[s.indexOf(Math.min.apply(Math,(0,v["default"])(s)))]}function l(e){var t=e.toString(),n=0;return t.indexOf(".")>=0&&(n=t.length-t.indexOf(".")-1),n}function u(e,t){return e?t.clientY:t.pageX}function c(e,t){return e?t.touches[0].clientY:t.touches[0].pageX}function d(e,t){var n=t.getBoundingClientRect();return e?n.top+.5*n.height:n.left+.5*n.width}function f(e,t){var n=t.max,r=t.min;return e<=r?r:e>=n?n:e}function p(e,t){var n=t.step,r=s(e,t);return null===n?r:parseFloat(r.toFixed(l(n)))}function h(e){e.stopPropagation(),e.preventDefault()}Object.defineProperty(t,"__esModule",{value:!0});var m=n(124),v=r(m);t.isEventFromHandle=o,t.isValueOutOfRange=i,t.isNotTouchEvent=a,t.getClosestPoint=s,t.getPrecision=l,t.getMousePosition=u,t.getTouchPosition=c,t.getHandleCenterPosition=d,t.ensureValueInRange=f,t.ensureValuePrecision=p,t.pauseEvent=h;var y=n(9)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return"string"==typeof e}function i(e){return o(e.type)&&S(e.props.children)?y["default"].cloneElement(e,{},e.props.children.split("").join(" ")):o(e)?(S(e)&&(e=e.split("").join(" ")),
y["default"].createElement("span",null,e)):e}Object.defineProperty(t,"__esModule",{value:!0});var a=n(7),s=r(a),l=n(6),u=r(l),c=n(2),d=r(c),f=n(4),p=r(f),h=n(3),m=r(h),v=n(1),y=r(v),g=n(5),b=r(g),_=n(14),T=r(_),C=n(15),x=r(C),w=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&(n[r[o]]=e[r[o]]);return n},P=/^[\u4e00-\u9fa5]{2}$/,S=P.test.bind(P),E=function(e){function t(){return(0,d["default"])(this,t),(0,p["default"])(this,e.apply(this,arguments))}return(0,m["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.children,r=t.className,o=t.prefixCls,a=t.type,l=t.size,c=t.inline,d=t.across,f=t.disabled,p=t.icon,h=t.loading,m=t.activeStyle,v=t.onClick,g=w(t,["children","className","prefixCls","type","size","inline","across","disabled","icon","loading","activeStyle","onClick"]),_=(e={},(0,u["default"])(e,r,r),(0,u["default"])(e,o,!0),(0,u["default"])(e,o+"-primary","primary"===a),(0,u["default"])(e,o+"-ghost","ghost"===a),(0,u["default"])(e,o+"-warning","warning"===a),(0,u["default"])(e,o+"-small","small"===l),(0,u["default"])(e,o+"-inline",c),(0,u["default"])(e,o+"-across",d),(0,u["default"])(e,o+"-disabled",f),(0,u["default"])(e,o+"-loading",h),e),C=h?"loading":p,P=y["default"].Children.map(n,i);return C&&(_[o+"-icon"]=!0),y["default"].createElement(x["default"],{activeClassName:m?o+"-active":void 0,disabled:f,activeStyle:m,onPress:f?function(){}:v},y["default"].createElement("a",(0,s["default"])({role:"button",className:(0,b["default"])(_)},g),C?y["default"].createElement(T["default"],{type:C}):null,P))},t}(y["default"].Component);E.defaultProps={prefixCls:"am-button",size:"large",inline:!1,across:!1,disabled:!1,loading:!1,activeStyle:{}},t["default"]=E,e.exports=t["default"]},[481,180],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(6),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(85),m=r(h),v=n(19),y=r(v),g=n(5),b=r(g),_=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,r=t.className,o=t.style,a=t.children,s=(0,b["default"])((e={},(0,i["default"])(e,r,!!r),(0,i["default"])(e,n+"-wrapper",!0),e)),l=p["default"].createElement("label",{className:s,style:o},p["default"].createElement(m["default"],(0,y["default"])(this.props,["className","style"])),a);return this.props.wrapLabel?l:p["default"].createElement(m["default"],this.props)},t}(p["default"].Component);t["default"]=_,_.defaultProps={prefixCls:"am-checkbox",wrapLabel:!0},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),i=r(o),a=n(6),s=r(a),l=n(2),u=r(l),c=n(4),d=r(c),f=n(3),p=r(f),h=n(1),m=r(h),v=n(48),y=r(v),g=n(5),b=r(g),_=n(11),T=r(_),C=n(15),x=r(C),w=function(e){function t(){return(0,u["default"])(this,t),(0,d["default"])(this,e.apply(this,arguments))}return(0,p["default"])(t,e),t.prototype.isInModal=function(e){var t=this.props.prefixCls,n=function(e){for(;e.parentNode&&e.parentNode!==document.body;){if(e.classList.contains(t))return e;e=e.parentNode}}(e.target);return n||e.preventDefault(),!0},t.prototype.renderFooterButton=function(e,t,n){var r={};if(e.style&&(r=e.style,"string"==typeof r)){var o={cancel:{fontWeight:"bold"},"default":{},destructive:{color:"red"}};r=o[r]||{}}var i=function(t){t.preventDefault(),e.onPress&&e.onPress()};return m["default"].createElement(x["default"],{activeClassName:t+"-button-active",key:n},m["default"].createElement("a",{className:t+"-button",style:r,href:"#",onClick:i},e.text||"Button"))},t.prototype.render=function(){var e,t=this,n=this.props,r=n.prefixCls,o=n.className,a=n.transparent,l=n.animated,u=n.transitionName,c=n.maskTransitionName,d=n.style,f=n.footer,p=void 0===f?[]:f,h=(0,b["default"])((e={},(0,s["default"])(e,o,!!o),(0,s["default"])(e,r+"-transparent",a),(0,s["default"])(e,r+"-android",!!navigator.userAgent.match(/Android/i)),e)),v=u||(l?a?"am-fade":"am-slide-up":null),g=c||(l?a?"am-fade":"am-slide-up":null),_=r+"-button-group-"+(2===p.length?"h":"v"),C=p.length?m["default"].createElement("div",{className:_},p.map(function(e,n){return t.renderFooterButton(e,r,n)})):null,x=a?(0,T["default"])({width:"5.4rem",height:"auto"},d):(0,T["default"])({width:"100%",height:"100%"},d),w=(0,T["default"])({},this.props);["prefixCls","className","transparent","animated","transitionName","maskTransitionName","style","footer","touchFeedback","wrapProps"].forEach(function(e){w.hasOwnProperty(e)&&delete w[e]});var P=new RegExp("\\biPhone\\b|\\biPod\\b","i").test(window.navigator.userAgent),S=P?{onTouchStart:function(e){return t.isInModal(e)}}:{};return m["default"].createElement(y["default"],(0,i["default"])({prefixCls:r,className:h,transitionName:v,maskTransitionName:g,style:x,footer:C,wrapProps:S},w))},t}(m["default"].Component);t["default"]=w,w.defaultProps={prefixCls:"am-modal",transparent:!1,animated:!0,style:{},onShow:function(){},footer:[]},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),i=r(o),a=n(6),s=r(a),l=n(2),u=r(l),c=n(4),d=r(c),f=n(3),p=r(f),h=n(1),m=r(h),v=n(85),y=r(v),g=n(19),b=r(g),_=n(5),T=r(_),C=function(e){function t(){return(0,u["default"])(this,t),(0,d["default"])(this,e.apply(this,arguments))}return(0,p["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,r=t.className,o=t.style,a=t.children,l=(0,T["default"])((e={},(0,s["default"])(e,r,!!r),(0,s["default"])(e,n+"-wrapper",!0),e)),u=m["default"].createElement("label",{className:l,style:o},m["default"].createElement(y["default"],(0,i["default"])({},(0,b["default"])(this.props,["className","style"]),{type:"radio"})),a);return this.props.wrapLabel?u:m["default"].createElement(y["default"],(0,i["default"])({},this.props,{type:"radio"}))},t}(m["default"].Component);t["default"]=C,C.defaultProps={prefixCls:"am-radio",wrapLabel:!0},e.exports=t["default"]},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(7),i=r(o),a=n(6),s=r(a),l=n(1),u=r(l),c=n(5),d=r(c),f=n(74),p=u["default"].createClass({displayName:"TabContent",propTypes:{animated:l.PropTypes.bool,animatedWithMargin:l.PropTypes.bool,prefixCls:l.PropTypes.string,children:l.PropTypes.any,activeKey:l.PropTypes.string,style:l.PropTypes.any,tabBarPosition:l.PropTypes.string},getDefaultProps:function(){return{animated:!0}},getTabPanes:function(){var e=this.props,t=e.activeKey,n=e.children,r=[];return u["default"].Children.forEach(n,function(n){if(n){var o=n.key,i=t===o;r.push(u["default"].cloneElement(n,{active:i,destroyInactiveTabPane:e.destroyInactiveTabPane,rootPrefixCls:e.prefixCls}))}}),r},render:function(){var e,t=this.props,n=t.prefixCls,r=t.children,o=t.activeKey,a=t.tabBarPosition,l=t.animated,c=t.animatedWithMargin,p=t.style,h=(0,d["default"])((e={},(0,s["default"])(e,n+"-content",!0),(0,s["default"])(e,l?n+"-content-animated":n+"-content-no-animated",!0),e));if(l){var m=(0,f.getActiveIndex)(r,o);if(m!==-1){var v=c?(0,f.getMarginStyle)(m,a):(0,f.getTransformPropValue)((0,f.getTransformByIndex)(m,a));p=(0,i["default"])({},p,v)}else p=(0,i["default"])({},p,{display:"none"})}return u["default"].createElement("div",{className:h,style:p},this.getTabPanes())}});t["default"]=p,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=[];return y["default"].Children.forEach(e,function(e){e&&t.push(e)}),t}function i(e,t){for(var n=o(e),r=0;r<n.length;r++)if(n[r].key===t)return r;return-1}function a(e,t){var n=o(e);return n[t].key}function s(e,t){e.transform=t,e.webkitTransform=t,e.mozTransform=t}function l(e){return"transform"in e||"webkitTransform"in e||"MozTransform"in e}function u(e,t){e.transition=t,e.webkitTransition=t,e.MozTransition=t}function c(e){return{transform:e,WebkitTransform:e,MozTransform:e}}function d(e){return"left"===e||"right"===e}function f(e,t){var n=d(t)?"translateY":"translateX";return n+"("+100*-e+"%) translateZ(0)"}function p(e,t){var n=d(t)?"marginTop":"marginLeft";return(0,m["default"])({},n,100*-e+"%")}Object.defineProperty(t,"__esModule",{value:!0});var h=n(6),m=r(h);t.toArray=o,t.getActiveIndex=i,t.getActiveKey=a,t.setTransform=s,t.isTransformSupported=l,t.setTransition=u,t.getTransformPropValue=c,t.isVertical=d,t.getTransformByIndex=f,t.getMarginStyle=p;var v=n(1),y=r(v)},function(e,t){e.exports=function(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1}},function(e,t,n){"use strict";function r(e,t){e.transform=t,e.webkitTransform=t,e.MozTransform=t}function o(e,t){e.transformOrigin=t,e.webkitTransformOrigin=t,e.MozTransformOrigin=t}function i(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=void 0,u=void 0,c=void 0,d=void 0,f=void 0,p=void 0,h=void 0,m=void 0;this.content=e,this.container=e.parentNode,this.options=a({},n,{scrollingComplete:function(){t.clearScrollbarTimer(),t.timer=setTimeout(function(){t._destroyed||(n.scrollingComplete&&n.scrollingComplete(),i&&["x","y"].forEach(function(e){i[e]&&t.setScrollbarOpacity(e,0)}))},0)}}),this.options.scrollbars&&(i=this.scrollbars={},u=this.indicators={},c=this.indicatorsSize={},d=this.scrollbarsSize={},f=this.indicatorsPos={},p=this.scrollbarsOpacity={},h=this.contentSize={},m=this.clientSize={},["x","y"].forEach(function(e){var n="x"===e?"scrollingX":"scrollingY";t.options[n]!==!1&&(i[e]=document.createElement("div"),i[e].className="zscroller-scrollbar-"+e,u[e]=document.createElement("div"),u[e].className="zscroller-indicator-"+e,i[e].appendChild(u[e]),c[e]=-1,p[e]=0,f[e]=0,t.container.appendChild(i[e]))}));var v=!0,y=e.style;this.scroller=new s(function(e,o,a){!v&&n.onScroll&&n.onScroll(),r(y,"translate3d("+-e+"px,"+-o+"px,0) scale("+a+")"),i&&["x","y"].forEach(function(n){if(i[n]){var r="x"===n?e:o;if(m[n]>=h[n])t.setScrollbarOpacity(n,0);else{v||t.setScrollbarOpacity(n,1);var a=m[n]/h[n]*d[n],s=a,u=void 0;r<0?(s=Math.max(a+r,l),u=0):r>h[n]-m[n]?(s=Math.max(a+h[n]-m[n]-r,l),u=d[n]-s):u=r/h[n]*d[n],t.setIndicatorSize(n,s),t.setIndicatorPos(n,u)}}}),v=!1},this.options),this.bindEvents(),o(e.style,"left top"),this.reflow()}var a=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};n(101);var s=n(164),l=8;i.prototype.setDisabled=function(e){this.disabled=e},i.prototype.clearScrollbarTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},i.prototype.setScrollbarOpacity=function(e,t){this.scrollbarsOpacity[e]!==t&&(this.scrollbars[e].style.opacity=t,this.scrollbarsOpacity[e]=t)},i.prototype.setIndicatorPos=function(e,t){this.indicatorsPos[e]!==t&&("x"===e?r(this.indicators[e].style,"translate3d("+t+"px,0,0)"):r(this.indicators[e].style,"translate3d(0, "+t+"px,0)"),this.indicatorsPos[e]=t)},i.prototype.setIndicatorSize=function(e,t){this.indicatorsSize[e]!==t&&(this.indicators[e].style["x"===e?"width":"height"]=t+"px",this.indicatorsSize[e]=t)},i.prototype.reflow=function(){this.scrollbars&&(this.contentSize.x=this.content.offsetWidth,this.contentSize.y=this.content.offsetHeight,this.clientSize.x=this.container.clientWidth,this.clientSize.y=this.container.clientHeight,this.scrollbars.x&&(this.scrollbarsSize.x=this.scrollbars.x.offsetWidth),this.scrollbars.y&&(this.scrollbarsSize.y=this.scrollbars.y.offsetHeight)),this.scroller.setDimensions(this.container.clientWidth,this.container.clientHeight,this.content.offsetWidth,this.content.offsetHeight);var e=this.container.getBoundingClientRect();this.scroller.setPosition(e.x+this.container.clientLeft,e.y+this.container.clientTop)},i.prototype.destroy=function(){this._destroyed=!0,window.removeEventListener("resize",this.onResize,!1),this.container.removeEventListener("touchstart",this.onTouchStart,!1),this.container.removeEventListener("touchmove",this.onTouchMove,!1),this.container.removeEventListener("touchend",this.onTouchEnd,!1),this.container.removeEventListener("touchcancel",this.onTouchCancel,!1),this.container.removeEventListener("mousedown",this.onMouseDown,!1),document.removeEventListener("mousemove",this.onMouseMove,!1),document.removeEventListener("mouseup",this.onMouseUp,!1),this.container.removeEventListener("mousewheel",this.onMouseWheel,!1)},i.prototype.bindEvents=function(){var e=this,t=this;window.addEventListener("resize",this.onResize=function(){t.reflow()},!1);var n=!1,r=void 0;this.container.addEventListener("touchstart",this.onTouchStart=function(o){n=!0,r&&(clearTimeout(r),r=null),o.touches[0]&&o.touches[0].target&&o.touches[0].target.tagName.match(/input|textarea|select/i)||e.disabled||(e.clearScrollbarTimer(),t.reflow(),t.scroller.doTouchStart(o.touches,o.timeStamp))},!1),this.container.addEventListener("touchmove",this.onTouchMove=function(e){e.preventDefault(),t.scroller.doTouchMove(e.touches,e.timeStamp,e.scale)},!1),this.container.addEventListener("touchend",this.onTouchEnd=function(e){t.scroller.doTouchEnd(e.timeStamp),r=setTimeout(function(){n=!1},300)},!1),this.container.addEventListener("touchcancel",this.onTouchCancel=function(e){t.scroller.doTouchEnd(e.timeStamp),r=setTimeout(function(){n=!1},300)},!1),this.onMouseUp=function(n){t.scroller.doTouchEnd(n.timeStamp),document.removeEventListener("mousemove",e.onMouseMove,!1),document.removeEventListener("mouseup",e.onMouseUp,!1)},this.onMouseMove=function(e){t.scroller.doTouchMove([{pageX:e.pageX,pageY:e.pageY}],e.timeStamp)},this.container.addEventListener("mousedown",this.onMouseDown=function(r){n||r.target.tagName.match(/input|textarea|select/i)||e.disabled||(e.clearScrollbarTimer(),t.scroller.doTouchStart([{pageX:r.pageX,pageY:r.pageY}],r.timeStamp),t.reflow(),r.preventDefault(),document.addEventListener("mousemove",e.onMouseMove,!1),document.addEventListener("mouseup",e.onMouseUp,!1))},!1),this.container.addEventListener("mousewheel",this.onMouseWheel=function(e){t.options.zooming&&(t.scroller.doMouseZoom(e.wheelDelta,e.timeStamp,e.pageX,e.pageY),e.preventDefault())},!1)},e.exports=i},function(e,t,n){function r(e,t){t.hasOwnProperty("vertical")&&console.warn("vertical is deprecated, please use `direction` instead");var n=t.direction;(n||t.hasOwnProperty("vertical"))&&(direction=n?n:t.vertical?"DIRECTION_ALL":"DIRECTION_HORIZONTAL",e.get("pan").set({direction:a[direction]}),e.get("swipe").set({direction:a[direction]})),t.options&&Object.keys(t.options).forEach(function(n){if("recognizers"===n)Object.keys(t.options.recognizers).forEach(function(n){var r=e.get(n);r.set(t.options.recognizers[n])},this);else{var r=n,o={};o[r]=t.options[n],e.set(o)}},this),t.recognizeWith&&Object.keys(t.recognizeWith).forEach(function(n){var r=e.get(n);r.recognizeWith(t.recognizeWith[n])},this),Object.keys(t).forEach(function(n){var r=l[n];r&&(e.off(r),e.on(r,t[n]))})}var o=n(1),i=n(9),a="undefined"!=typeof window?n(261):void 0,s={children:!0,direction:!0,options:!0,recognizeWith:!0,vertical:!0},l={action:"tap press",onDoubleTap:"doubletap",onPan:"pan",onPanCancel:"pancancel",onPanEnd:"panend",onPanStart:"panstart",onPinch:"pinch",onPinchCancel:"pinchcancel",onPinchEnd:"pinchend",onPinchIn:"pinchin",onPinchOut:"pinchout",onPinchStart:"pinchstart",onPress:"press",onPressUp:"pressup",onRotate:"rotate",onRotateCancel:"rotatecancel",onRotateEnd:"rotateend",onRotateMove:"rotatemove",onRotateStart:"rotatestart",onSwipe:"swipe",onTap:"tap"};Object.keys(l).forEach(function(e){s[e]=!0});var u=o.createClass({displayName:"Hammer",propTypes:{className:o.PropTypes.string},componentDidMount:function(){this.hammer=new a(i.findDOMNode(this)),r(this.hammer,this.props)},componentDidUpdate:function(){this.hammer&&r(this.hammer,this.props)},componentWillUnmount:function(){this.hammer&&(this.hammer.stop(),this.hammer.destroy()),this.hammer=null},render:function(){var e={};return Object.keys(this.props).forEach(function(t){s[t]||(e[t]=this.props[t])},this),o.cloneElement(o.Children.only(this.props.children),e)}});e.exports=u},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(7),i=r(o),a=n(26),s=r(a),l=n(2),u=r(l),c=n(4),d=r(c),f=n(3),p=r(f),h=n(1),m=r(h),v=n(9),y=r(v),g=n(168),b=r(g),_=n(172),T=r(_),C=n(171),x=r(C),w=n(173),P=r(w),S=n(161),E=r(S),O=n(314),M=r(O),k=n(234),N=r(k),D=n(338),R=n(169),I=r(R),j=1,A=10,L=1e3,W=1e3,V=50,H="listviewscroll",F=function(e){function t(){var n,r,o;(0,u["default"])(this,t);for(var i=arguments.length,a=Array(i),s=0;s<i;s++)a[s]=arguments[s];return n=r=(0,d["default"])(this,e.call.apply(e,[this].concat(a))),r.state={curRenderedRowsCount:r.props.initialListSize,highlightedRow:{}},r.stickyRefs={},o=n,(0,d["default"])(r,o)}return(0,p["default"])(t,e),t.prototype.getMetrics=function(){return{contentLength:this.scrollProperties.contentLength,totalRows:this.props.dataSource.getRowCount(),renderedRows:this.state.curRenderedRowsCount,visibleRows:Object.keys(this._visibleRows).length}},t.prototype.getScrollResponder=function(){return this.refs[H]&&this.refs[H].getScrollResponder&&this.refs[H].getScrollResponder()},t.prototype.scrollTo=function(){var e;this.refs[H]&&this.refs[H].scrollTo&&(e=this.refs[H]).scrollTo.apply(e,arguments)},t.prototype.setNativeProps=function(e){this.refs[H]&&this.refs[H].setNativeProps(e)},t.prototype.getInnerViewNode=function(){return this.refs[H].getInnerViewNode()},t.prototype.componentWillMount=function(){this.scrollProperties={visibleLength:null,contentLength:null,offset:0},this._childFrames=[],this._visibleRows={},this._prevRenderedRowsCount=0,this._sentEndForContentLength=null},t.prototype.componentDidMount=function(){},t.prototype.componentWillReceiveProps=function(e){var t=this;this.props.dataSource===e.dataSource&&this.props.initialListSize===e.initialListSize||this.setState(function(e,n){return t._prevRenderedRowsCount=0,{curRenderedRowsCount:Math.min(Math.max(e.curRenderedRowsCount,n.initialListSize),n.dataSource.getRowCount())}},function(){return t._renderMoreRowsIfNeeded()})},t.prototype.onRowHighlighted=function(e,t){this.setState({highlightedRow:{sectionID:e,rowID:t}})},t.prototype.render=function(){var e=this,t=[],n=this.props.dataSource,r=n.rowIdentities,o=0,a=[],l=this.props.renderHeader&&this.props.renderHeader(),u=this.props.renderFooter&&this.props.renderFooter(),c=l?1:0,d=function(s){var l=n.sectionIdentities[s],u=r[s];if(0===u.length)return"continue";if(e.props.renderSectionHeader){var d=o>=e._prevRenderedRowsCount&&n.sectionHeaderShouldUpdate(s),f=m["default"].createElement(P["default"],{key:"s_"+l,shouldUpdate:!!d,render:e.props.renderSectionHeader.bind(null,n.getSectionHeaderData(s),l)});e.props.stickyHeader&&(f=m["default"].createElement(D.Sticky,(0,i["default"])({},e.props.stickyProps,{key:"s_"+l,ref:function(t){e.stickyRefs[l]=t}}),f)),t.push(f),a.push(c++)}for(var p=[],h=0;h<u.length;h++){var v=u[h],y=l+"_"+v,g=o>=e._prevRenderedRowsCount&&n.rowShouldUpdate(s,h),b=m["default"].createElement(P["default"],{key:"r_"+y,shouldUpdate:!!g,render:e.props.renderRow.bind(null,n.getRowData(s,h),l,v,e.onRowHighlighted)});if(p.push(b),c++,e.props.renderSeparator&&(h!==u.length-1||s===r.length-1)){var _=e.state.highlightedRow.sectionID===l&&(e.state.highlightedRow.rowID===v||e.state.highlightedRow.rowID===u[h+1]),T=e.props.renderSeparator(l,v,_);T&&(p.push(T),c++)}if(++o===e.state.curRenderedRowsCount)break}return t.push(m["default"].cloneElement(e.props.renderSectionBodyWrapper(l),{className:e.props.sectionBodyClassName},p)),o>=e.state.curRenderedRowsCount?"break":void 0};e:for(var f=0;f<r.length;f++){var p=d(f);switch(p){case"continue":continue;case"break":break e}}var h=this.props,v=h.renderScrollComponent,y=(0,s["default"])(h,["renderScrollComponent"]);return t=m["default"].cloneElement(y.renderBodyComponent(),{},t),y.stickyHeader&&(t=m["default"].createElement(D.StickyContainer,y.stickyContainerProps,t)),this._sc=m["default"].cloneElement(v((0,i["default"])({},y,{onScroll:this._onScroll})),{ref:H,onContentSizeChange:this._onContentSizeChange,onLayout:this._onLayout},l,t,u,y.children),this._sc},t.prototype._measureAndUpdateScrollProps=function(){var e=this.getScrollResponder();!e||!e.getInnerViewNode},t.prototype._onContentSizeChange=function(e,t){var n=this.props.horizontal?e:t;n!==this.scrollProperties.contentLength&&(this.scrollProperties.contentLength=n,this._updateVisibleRows(),this._renderMoreRowsIfNeeded()),this.props.onContentSizeChange&&this.props.onContentSizeChange(e,t)},t.prototype._onLayout=function(e){var t=e.nativeEvent.layout,n=t.width,r=t.height,o=this.props.horizontal?n:r;o!==this.scrollProperties.visibleLength&&(this.scrollProperties.visibleLength=o,this._updateVisibleRows(),this._renderMoreRowsIfNeeded()),this.props.onLayout&&this.props.onLayout(e)},t.prototype._maybeCallOnEndReached=function(e){return!!(this.props.onEndReached&&this._getDistanceFromEnd(this.scrollProperties)<this.props.onEndReachedThreshold&&this.state.curRenderedRowsCount===this.props.dataSource.getRowCount())&&(this._sentEndForContentLength=this.scrollProperties.contentLength,this.props.onEndReached(e),!0)},t.prototype._renderMoreRowsIfNeeded=function(){if(null===this.scrollProperties.contentLength||null===this.scrollProperties.visibleLength||this.state.curRenderedRowsCount===this.props.dataSource.getRowCount())return void this._maybeCallOnEndReached();var e=this._getDistanceFromEnd(this.scrollProperties);e<this.props.scrollRenderAheadDistance&&this._pageInNewRows()},t.prototype._pageInNewRows=function(){var e=this;this.setState(function(t,n){var r=Math.min(t.curRenderedRowsCount+n.pageSize,n.dataSource.getRowCount());return e._prevRenderedRowsCount=t.curRenderedRowsCount,{curRenderedRowsCount:r}},function(){e._measureAndUpdateScrollProps(),e._prevRenderedRowsCount=e.state.curRenderedRowsCount})},t.prototype._getDistanceFromEnd=function(e){return e.contentLength-e.visibleLength-e.offset},t.prototype._updateVisibleRows=function(){},t.prototype._onScroll=function(e){var t=!this.props.horizontal,n=e,r=y["default"].findDOMNode(this.refs[H]);if(this.props.stickyHeader||this.props.useBodyScroll)this.scrollProperties.visibleLength=window[t?"innerHeight":"innerWidth"],this.scrollProperties.contentLength=r[t?"scrollHeight":"scrollWidth"],this.scrollProperties.offset=window.document.body[t?"scrollTop":"scrollLeft"];else if(this.props.useZscroller){var o=this.refs[H].domScroller;n=o,this.scrollProperties.visibleLength=o.container[t?"clientHeight":"clientWidth"],this.scrollProperties.contentLength=o.content[t?"offsetHeight":"offsetWidth"],this.scrollProperties.offset=o.scroller.getValues()[t?"top":"left"]}else this.scrollProperties.visibleLength=r[t?"offsetHeight":"offsetWidth"],this.scrollProperties.contentLength=r[t?"scrollHeight":"scrollWidth"],this.scrollProperties.offset=r[t?"scrollTop":"scrollLeft"];this._maybeCallOnEndReached(n)||this._renderMoreRowsIfNeeded(),this.props.onEndReached&&this._getDistanceFromEnd(this.scrollProperties)>this.props.onEndReachedThreshold&&(this._sentEndForContentLength=null),this.props.onScroll&&this.props.onScroll(n)},t}(m["default"].Component);F.DataSource=b["default"],F.propTypes=(0,i["default"])({},T["default"].propTypes,{dataSource:h.PropTypes.instanceOf(b["default"]).isRequired,renderSeparator:h.PropTypes.func,renderRow:h.PropTypes.func.isRequired,initialListSize:h.PropTypes.number,onEndReached:h.PropTypes.func,onEndReachedThreshold:h.PropTypes.number,pageSize:h.PropTypes.number,renderFooter:h.PropTypes.func,renderHeader:h.PropTypes.func,renderSectionHeader:h.PropTypes.func,renderScrollComponent:m["default"].PropTypes.func,scrollRenderAheadDistance:m["default"].PropTypes.number,onChangeVisibleRows:m["default"].PropTypes.func,scrollEventThrottle:m["default"].PropTypes.number,renderBodyComponent:h.PropTypes.func,renderSectionBodyWrapper:h.PropTypes.func,sectionBodyClassName:h.PropTypes.string,useZscroller:h.PropTypes.bool,useBodyScroll:h.PropTypes.bool,stickyHeader:h.PropTypes.bool,stickyProps:h.PropTypes.object,stickyContainerProps:h.PropTypes.object}),F.defaultProps={initialListSize:A,pageSize:j,renderScrollComponent:function(e){return m["default"].createElement(T["default"],e)},renderBodyComponent:function(){return m["default"].createElement("div",null)},renderSectionBodyWrapper:function(e){return m["default"].createElement("div",{key:e})},sectionBodyClassName:"list-view-section-body",scrollRenderAheadDistance:L,onEndReachedThreshold:W,scrollEventThrottle:V,stickyProps:{},stickyContainerProps:{}},(0,M["default"])(F.prototype,x["default"].Mixin),(0,M["default"])(F.prototype,E["default"]),(0,M["default"])(F.prototype,I["default"]),(0,N["default"])(F),F.isReactNativeComponent=!0,t["default"]=F,e.exports=t["default"]},function(e,t){"use strict";function n(e){var t=0;do isNaN(e.offsetTop)||(t+=e.offsetTop);while(e=e.offsetParent);return t}function r(e){return e.touches&&e.touches.length?e.touches[0]:e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e}function o(e,t){var n=!0;return function(r){n&&(n=!1,setTimeout(function(){n=!0},t),e(r))}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOffsetTop=n,t._event=r,t.throttle=o},function(e,t,n){"use strict";function r(e,t,n,r,i,a,s,l){if(o(t),!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,i,a,s,l],d=0;u=new Error(t.replace(/%s/g,function(){return c[d++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}}var o=function(e){};e.exports=r},function(e,t,n){"use strict";var r=n(174),o=r;e.exports=o},function(e,t){function n(e,t,n){n=n||{},n.childrenKeyName=n.childrenKeyName||"children";var r,o=e||[],i=[],a=0;do{var r=o.filter(function(e){return t(e,a)})[0];if(!r)break;i.push(r),o=r[n.childrenKeyName]||[],a+=1}while(o.length>0);return i}e.exports=n},function(e,t,n){function r(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}try{var o=n(75)}catch(i){var o=n(75)}var a=/\s+/,s=Object.prototype.toString;e.exports=function(e){return new r(e)},r.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array(),n=o(t,e);return~n||t.push(e),this.el.className=t.join(" "),this},r.prototype.remove=function(e){if("[object RegExp]"==s.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=o(t,e);return~n&&t.splice(n,1),this.el.className=t.join(" "),this},r.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},r.prototype.toggle=function(e,t){return this.list?("undefined"!=typeof t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):("undefined"!=typeof t?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},r.prototype.array=function(){var e=this.el.getAttribute("class")||"",t=e.replace(/^\s+|\s+$/g,""),n=t.split(a);return""===n[0]&&n.shift(),n},r.prototype.has=r.prototype.contains=function(e){return this.list?this.list.contains(e):!!~o(this.array(),e)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){for(var n=window.getComputedStyle(e,null),r="",o=0;o<h.length&&!(r=n.getPropertyValue(h[o]+t));o++);return r}function i(e){if(f){var t=parseFloat(o(e,"transition-delay"))||0,n=parseFloat(o(e,"transition-duration"))||0,r=parseFloat(o(e,"animation-delay"))||0,i=parseFloat(o(e,"animation-duration"))||0,a=Math.max(n+t,i+r);e.rcEndAnimTimeout=setTimeout(function(){e.rcEndAnimTimeout=null,e.rcEndListener&&e.rcEndListener()},1e3*a+200)}}function a(e){e.rcEndAnimTimeout&&(clearTimeout(e.rcEndAnimTimeout),e.rcEndAnimTimeout=null)}Object.defineProperty(t,"__esModule",{value:!0});var s="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},l=n(233),u=r(l),c=n(83),d=r(c),f=0!==u["default"].endEvents.length,p=["Webkit","Moz","O","ms"],h=["-webkit-","-moz-","-o-","ms-",""],m=function(e,t,n){var r="object"===("undefined"==typeof t?"undefined":s(t)),o=r?t.name:t,l=r?t.active:t+"-active",c=n,f=void 0,p=void 0,h=(0,d["default"])(e);return n&&"[object Object]"===Object.prototype.toString.call(n)&&(c=n.end,f=n.start,p=n.active),e.rcEndListener&&e.rcEndListener(),e.rcEndListener=function(t){t&&t.target!==e||(e.rcAnimTimeout&&(clearTimeout(e.rcAnimTimeout),e.rcAnimTimeout=null),a(e),h.remove(o),h.remove(l),u["default"].removeEndEventListener(e,e.rcEndListener),e.rcEndListener=null,c&&c())},u["default"].addEndEventListener(e,e.rcEndListener),f&&f(),h.add(o),e.rcAnimTimeout=setTimeout(function(){e.rcAnimTimeout=null,h.add(l),p&&setTimeout(p,0),i(e)},30),{stop:function(){e.rcEndListener&&e.rcEndListener()}}};m.style=function(e,t,n){e.rcEndListener&&e.rcEndListener(),e.rcEndListener=function(t){t&&t.target!==e||(e.rcAnimTimeout&&(clearTimeout(e.rcAnimTimeout),e.rcAnimTimeout=null),a(e),u["default"].removeEndEventListener(e,e.rcEndListener),e.rcEndListener=null,n&&n())},u["default"].addEndEventListener(e,e.rcEndListener),e.rcAnimTimeout=setTimeout(function(){for(var n in t)t.hasOwnProperty(n)&&(e.style[n]=t[n]);e.rcAnimTimeout=null,i(e)},0)},m.setTransition=function(e,t,n){var r=t,o=n;void 0===n&&(o=r,r=""),r=r||"",p.forEach(function(t){e.style[t+"Transition"+r]=o})},m.isCssAnimationSupported=f,t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";e.exports=n(238)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.ownerDocument,n=t.body,r=void 0,o=a["default"].css(e,"position"),i="fixed"===o||"absolute"===o;if(!i)return"html"===e.nodeName.toLowerCase()?null:e.parentNode;for(r=e.parentNode;r&&r!==n;r=r.parentNode)if(o=a["default"].css(r,"position"),"static"!==o)return r;return null}Object.defineProperty(t,"__esModule",{value:!0});var i=n(30),a=r(i);t["default"]=o,e.exports=t["default"]},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(26),i=r(o),a=n(1),s=r(a),l=s["default"].createClass({displayName:"LazyRenderBox",propTypes:{children:a.PropTypes.any,className:a.PropTypes.string,visible:a.PropTypes.bool,hiddenClassName:a.PropTypes.string},shouldComponentUpdate:function(e){return e.hiddenClassName||e.visible},render:function(){var e=this.props,t=e.hiddenClassName,n=e.visible,r=(0,i["default"])(e,["hiddenClassName","visible"]);return t||s["default"].Children.count(r.children)>1?(!n&&t&&(r.className+=" "+t),s["default"].createElement("div",r)):s["default"].Children.only(r.children)}});t["default"]=l,e.exports=t["default"]},function(e,t){!function(n,r){"object"==typeof t&&"undefined"!=typeof e?e.exports=r():"function"==typeof define&&define.amd?define(r):n.moment=r()}(this,function(){"use strict";function t(){return vr.apply(null,arguments)}function n(e){vr=e}function r(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function o(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function i(e){var t;for(t in e)return!1;return!0}function a(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function s(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function l(e,t){var n,r=[];
for(n=0;n<e.length;++n)r.push(t(e[n],n));return r}function u(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function c(e,t){for(var n in t)u(t,n)&&(e[n]=t[n]);return u(t,"toString")&&(e.toString=t.toString),u(t,"valueOf")&&(e.valueOf=t.valueOf),e}function d(e,t,n,r){return gt(e,t,n,r,!0).utc()}function f(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null}}function p(e){return null==e._pf&&(e._pf=f()),e._pf}function h(e){if(null==e._isValid){var t=p(e),n=gr.call(t.parsedDateParts,function(e){return null!=e}),r=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidMonth&&!t.invalidWeekday&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(r=r&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return r;e._isValid=r}return e._isValid}function m(e){var t=d(NaN);return null!=e?c(p(t),e):p(t).userInvalidated=!0,t}function v(e){return void 0===e}function y(e,t){var n,r,o;if(v(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),v(t._i)||(e._i=t._i),v(t._f)||(e._f=t._f),v(t._l)||(e._l=t._l),v(t._strict)||(e._strict=t._strict),v(t._tzm)||(e._tzm=t._tzm),v(t._isUTC)||(e._isUTC=t._isUTC),v(t._offset)||(e._offset=t._offset),v(t._pf)||(e._pf=p(t)),v(t._locale)||(e._locale=t._locale),br.length>0)for(n in br)r=br[n],o=t[r],v(o)||(e[r]=o);return e}function g(e){y(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),_r===!1&&(_r=!0,t.updateOffset(this),_r=!1)}function b(e){return e instanceof g||null!=e&&null!=e._isAMomentObject}function _(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function T(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=_(t)),n}function C(e,t,n){var r,o=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),a=0;for(r=0;r<o;r++)(n&&e[r]!==t[r]||!n&&T(e[r])!==T(t[r]))&&a++;return a+i}function x(e){t.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function w(e,n){var r=!0;return c(function(){if(null!=t.deprecationHandler&&t.deprecationHandler(null,e),r){for(var o,i=[],a=0;a<arguments.length;a++){if(o="","object"==typeof arguments[a]){o+="\n["+a+"] ";for(var s in arguments[0])o+=s+": "+arguments[0][s]+", ";o=o.slice(0,-2)}else o=arguments[a];i.push(o)}x(e+"\nArguments: "+Array.prototype.slice.call(i).join("")+"\n"+(new Error).stack),r=!1}return n.apply(this,arguments)},n)}function P(e,n){null!=t.deprecationHandler&&t.deprecationHandler(e,n),Tr[e]||(x(n),Tr[e]=!0)}function S(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function E(e){var t,n;for(n in e)t=e[n],S(t)?this[n]=t:this["_"+n]=t;this._config=e,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function O(e,t){var n,r=c({},e);for(n in t)u(t,n)&&(o(e[n])&&o(t[n])?(r[n]={},c(r[n],e[n]),c(r[n],t[n])):null!=t[n]?r[n]=t[n]:delete r[n]);for(n in e)u(e,n)&&!u(t,n)&&o(e[n])&&(r[n]=c({},r[n]));return r}function M(e){null!=e&&this.set(e)}function k(e,t,n){var r=this._calendar[e]||this._calendar.sameElse;return S(r)?r.call(t,n):r}function N(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])}function D(){return this._invalidDate}function R(e){return this._ordinal.replace("%d",e)}function I(e,t,n,r){var o=this._relativeTime[n];return S(o)?o(e,t,n,r):o.replace(/%d/i,e)}function j(e,t){var n=this._relativeTime[e>0?"future":"past"];return S(n)?n(t):n.replace(/%s/i,t)}function A(e,t){var n=e.toLowerCase();Nr[n]=Nr[n+"s"]=Nr[t]=e}function L(e){return"string"==typeof e?Nr[e]||Nr[e.toLowerCase()]:void 0}function W(e){var t,n,r={};for(n in e)u(e,n)&&(t=L(n),t&&(r[t]=e[n]));return r}function V(e,t){Dr[e]=t}function H(e){var t=[];for(var n in e)t.push({unit:n,priority:Dr[n]});return t.sort(function(e,t){return e.priority-t.priority}),t}function F(e,n){return function(r){return null!=r?(B(this,e,r),t.updateOffset(this,n),this):Y(this,e)}}function Y(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function B(e,t,n){e.isValid()&&e._d["set"+(e._isUTC?"UTC":"")+t](n)}function z(e){return e=L(e),S(this[e])?this[e]():this}function U(e,t){if("object"==typeof e){e=W(e);for(var n=H(e),r=0;r<n.length;r++)this[n[r].unit](e[n[r].unit])}else if(e=L(e),S(this[e]))return this[e](t);return this}function G(e,t,n){var r=""+Math.abs(e),o=t-r.length,i=e>=0;return(i?n?"+":"":"-")+Math.pow(10,Math.max(0,o)).toString().substr(1)+r}function X(e,t,n,r){var o=r;"string"==typeof r&&(o=function(){return this[r]()}),e&&(Ar[e]=o),t&&(Ar[t[0]]=function(){return G(o.apply(this,arguments),t[1],t[2])}),n&&(Ar[n]=function(){return this.localeData().ordinal(o.apply(this,arguments),e)})}function K(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function q(e){var t,n,r=e.match(Rr);for(t=0,n=r.length;t<n;t++)Ar[r[t]]?r[t]=Ar[r[t]]:r[t]=K(r[t]);return function(t){var o,i="";for(o=0;o<n;o++)i+=r[o]instanceof Function?r[o].call(t,e):r[o];return i}}function Z(e,t){return e.isValid()?(t=Q(t,e.localeData()),jr[t]=jr[t]||q(t),jr[t](e)):e.localeData().invalidDate()}function Q(e,t){function n(e){return t.longDateFormat(e)||e}var r=5;for(Ir.lastIndex=0;r>=0&&Ir.test(e);)e=e.replace(Ir,n),Ir.lastIndex=0,r-=1;return e}function $(e,t,n){eo[e]=S(t)?t:function(e,r){return e&&n?n:t}}function J(e,t){return u(eo,e)?eo[e](t._strict,t._locale):new RegExp(ee(e))}function ee(e){return te(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,r,o){return t||n||r||o}))}function te(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function ne(e,t){var n,r=t;for("string"==typeof e&&(e=[e]),a(t)&&(r=function(e,n){n[t]=T(e)}),n=0;n<e.length;n++)to[e[n]]=r}function re(e,t){ne(e,function(e,n,r,o){r._w=r._w||{},t(e,r._w,r,o)})}function oe(e,t,n){null!=t&&u(to,e)&&to[e](t,n._a,n,e)}function ie(e,t){return new Date(Date.UTC(e,t+1,0)).getUTCDate()}function ae(e,t){return e?r(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||po).test(t)?"format":"standalone"][e.month()]:this._months}function se(e,t){return e?r(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[po.test(t)?"format":"standalone"][e.month()]:this._monthsShort}function le(e,t,n){var r,o,i,a=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],r=0;r<12;++r)i=d([2e3,r]),this._shortMonthsParse[r]=this.monthsShort(i,"").toLocaleLowerCase(),this._longMonthsParse[r]=this.months(i,"").toLocaleLowerCase();return n?"MMM"===t?(o=fo.call(this._shortMonthsParse,a),o!==-1?o:null):(o=fo.call(this._longMonthsParse,a),o!==-1?o:null):"MMM"===t?(o=fo.call(this._shortMonthsParse,a),o!==-1?o:(o=fo.call(this._longMonthsParse,a),o!==-1?o:null)):(o=fo.call(this._longMonthsParse,a),o!==-1?o:(o=fo.call(this._shortMonthsParse,a),o!==-1?o:null))}function ue(e,t,n){var r,o,i;if(this._monthsParseExact)return le.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),r=0;r<12;r++){if(o=d([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(o,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(o,"").replace(".","")+"$","i")),n||this._monthsParse[r]||(i="^"+this.months(o,"")+"|^"+this.monthsShort(o,""),this._monthsParse[r]=new RegExp(i.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[r].test(e))return r;if(n&&"MMM"===t&&this._shortMonthsParse[r].test(e))return r;if(!n&&this._monthsParse[r].test(e))return r}}function ce(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=T(t);else if(t=e.localeData().monthsParse(t),!a(t))return e;return n=Math.min(e.date(),ie(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function de(e){return null!=e?(ce(this,e),t.updateOffset(this,!0),this):Y(this,"Month")}function fe(){return ie(this.year(),this.month())}function pe(e){return this._monthsParseExact?(u(this,"_monthsRegex")||me.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(u(this,"_monthsShortRegex")||(this._monthsShortRegex=vo),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)}function he(e){return this._monthsParseExact?(u(this,"_monthsRegex")||me.call(this),e?this._monthsStrictRegex:this._monthsRegex):(u(this,"_monthsRegex")||(this._monthsRegex=yo),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)}function me(){function e(e,t){return t.length-e.length}var t,n,r=[],o=[],i=[];for(t=0;t<12;t++)n=d([2e3,t]),r.push(this.monthsShort(n,"")),o.push(this.months(n,"")),i.push(this.months(n,"")),i.push(this.monthsShort(n,""));for(r.sort(e),o.sort(e),i.sort(e),t=0;t<12;t++)r[t]=te(r[t]),o[t]=te(o[t]);for(t=0;t<24;t++)i[t]=te(i[t]);this._monthsRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+r.join("|")+")","i")}function ve(e){return ye(e)?366:365}function ye(e){return e%4===0&&e%100!==0||e%400===0}function ge(){return ye(this.year())}function be(e,t,n,r,o,i,a){var s=new Date(e,t,n,r,o,i,a);return e<100&&e>=0&&isFinite(s.getFullYear())&&s.setFullYear(e),s}function _e(e){var t=new Date(Date.UTC.apply(null,arguments));return e<100&&e>=0&&isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e),t}function Te(e,t,n){var r=7+t-n,o=(7+_e(e,0,r).getUTCDay()-t)%7;return-o+r-1}function Ce(e,t,n,r,o){var i,a,s=(7+n-r)%7,l=Te(e,r,o),u=1+7*(t-1)+s+l;return u<=0?(i=e-1,a=ve(i)+u):u>ve(e)?(i=e+1,a=u-ve(e)):(i=e,a=u),{year:i,dayOfYear:a}}function xe(e,t,n){var r,o,i=Te(e.year(),t,n),a=Math.floor((e.dayOfYear()-i-1)/7)+1;return a<1?(o=e.year()-1,r=a+we(o,t,n)):a>we(e.year(),t,n)?(r=a-we(e.year(),t,n),o=e.year()+1):(o=e.year(),r=a),{week:r,year:o}}function we(e,t,n){var r=Te(e,t,n),o=Te(e+1,t,n);return(ve(e)-r+o)/7}function Pe(e){return xe(e,this._week.dow,this._week.doy).week}function Se(){return this._week.dow}function Ee(){return this._week.doy}function Oe(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")}function Me(e){var t=xe(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")}function ke(e,t){return"string"!=typeof e?e:isNaN(e)?(e=t.weekdaysParse(e),"number"==typeof e?e:null):parseInt(e,10)}function Ne(e,t){return"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function De(e,t){return e?r(this._weekdays)?this._weekdays[e.day()]:this._weekdays[this._weekdays.isFormat.test(t)?"format":"standalone"][e.day()]:this._weekdays}function Re(e){return e?this._weekdaysShort[e.day()]:this._weekdaysShort}function Ie(e){return e?this._weekdaysMin[e.day()]:this._weekdaysMin}function je(e,t,n){var r,o,i,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)i=d([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(i,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(i,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(i,"").toLocaleLowerCase();return n?"dddd"===t?(o=fo.call(this._weekdaysParse,a),o!==-1?o:null):"ddd"===t?(o=fo.call(this._shortWeekdaysParse,a),o!==-1?o:null):(o=fo.call(this._minWeekdaysParse,a),o!==-1?o:null):"dddd"===t?(o=fo.call(this._weekdaysParse,a),o!==-1?o:(o=fo.call(this._shortWeekdaysParse,a),o!==-1?o:(o=fo.call(this._minWeekdaysParse,a),o!==-1?o:null))):"ddd"===t?(o=fo.call(this._shortWeekdaysParse,a),o!==-1?o:(o=fo.call(this._weekdaysParse,a),o!==-1?o:(o=fo.call(this._minWeekdaysParse,a),o!==-1?o:null))):(o=fo.call(this._minWeekdaysParse,a),o!==-1?o:(o=fo.call(this._weekdaysParse,a),o!==-1?o:(o=fo.call(this._shortWeekdaysParse,a),o!==-1?o:null)))}function Ae(e,t,n){var r,o,i;if(this._weekdaysParseExact)return je.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++){if(o=d([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(o,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(o,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(o,"").replace(".",".?")+"$","i")),this._weekdaysParse[r]||(i="^"+this.weekdays(o,"")+"|^"+this.weekdaysShort(o,"")+"|^"+this.weekdaysMin(o,""),this._weekdaysParse[r]=new RegExp(i.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[r].test(e))return r;if(n&&"ddd"===t&&this._shortWeekdaysParse[r].test(e))return r;if(n&&"dd"===t&&this._minWeekdaysParse[r].test(e))return r;if(!n&&this._weekdaysParse[r].test(e))return r}}function Le(e){if(!this.isValid())return null!=e?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=ke(e,this.localeData()),this.add(e-t,"d")):t}function We(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")}function Ve(e){if(!this.isValid())return null!=e?this:NaN;if(null!=e){var t=Ne(e,this.localeData());return this.day(this.day()%7?t:t-7)}return this.day()||7}function He(e){return this._weekdaysParseExact?(u(this,"_weekdaysRegex")||Be.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(u(this,"_weekdaysRegex")||(this._weekdaysRegex=xo),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function Fe(e){return this._weekdaysParseExact?(u(this,"_weekdaysRegex")||Be.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(u(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=wo),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Ye(e){return this._weekdaysParseExact?(u(this,"_weekdaysRegex")||Be.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(u(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Po),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Be(){function e(e,t){return t.length-e.length}var t,n,r,o,i,a=[],s=[],l=[],u=[];for(t=0;t<7;t++)n=d([2e3,1]).day(t),r=this.weekdaysMin(n,""),o=this.weekdaysShort(n,""),i=this.weekdays(n,""),a.push(r),s.push(o),l.push(i),u.push(r),u.push(o),u.push(i);for(a.sort(e),s.sort(e),l.sort(e),u.sort(e),t=0;t<7;t++)s[t]=te(s[t]),l[t]=te(l[t]),u[t]=te(u[t]);this._weekdaysRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function ze(){return this.hours()%12||12}function Ue(){return this.hours()||24}function Ge(e,t){X(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function Xe(e,t){return t._meridiemParse}function Ke(e){return"p"===(e+"").toLowerCase().charAt(0)}function qe(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"}function Ze(e){return e?e.toLowerCase().replace("_","-"):e}function Qe(e){for(var t,n,r,o,i=0;i<e.length;){for(o=Ze(e[i]).split("-"),t=o.length,n=Ze(e[i+1]),n=n?n.split("-"):null;t>0;){if(r=$e(o.slice(0,t).join("-")))return r;if(n&&n.length>=t&&C(o,n,!0)>=t-1)break;t--}i++}return null}function $e(t){var n=null;if(!ko[t]&&"undefined"!=typeof e&&e&&e.exports)try{n=So._abbr,require("./locale/"+t),Je(n)}catch(r){}return ko[t]}function Je(e,t){var n;return e&&(n=v(t)?nt(e):et(e,t),n&&(So=n)),So._abbr}function et(e,t){if(null!==t){var n=Mo;if(t.abbr=e,null!=ko[e])P("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=ko[e]._config;else if(null!=t.parentLocale){if(null==ko[t.parentLocale])return No[t.parentLocale]||(No[t.parentLocale]=[]),No[t.parentLocale].push({name:e,config:t}),null;n=ko[t.parentLocale]._config}return ko[e]=new M(O(n,t)),No[e]&&No[e].forEach(function(e){et(e.name,e.config)}),Je(e),ko[e]}return delete ko[e],null}function tt(e,t){if(null!=t){var n,r=Mo;null!=ko[e]&&(r=ko[e]._config),t=O(r,t),n=new M(t),n.parentLocale=ko[e],ko[e]=n,Je(e)}else null!=ko[e]&&(null!=ko[e].parentLocale?ko[e]=ko[e].parentLocale:null!=ko[e]&&delete ko[e]);return ko[e]}function nt(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return So;if(!r(e)){if(t=$e(e))return t;e=[e]}return Qe(e)}function rt(){return wr(ko)}function ot(e){var t,n=e._a;return n&&p(e).overflow===-2&&(t=n[ro]<0||n[ro]>11?ro:n[oo]<1||n[oo]>ie(n[no],n[ro])?oo:n[io]<0||n[io]>24||24===n[io]&&(0!==n[ao]||0!==n[so]||0!==n[lo])?io:n[ao]<0||n[ao]>59?ao:n[so]<0||n[so]>59?so:n[lo]<0||n[lo]>999?lo:-1,p(e)._overflowDayOfYear&&(t<no||t>oo)&&(t=oo),p(e)._overflowWeeks&&t===-1&&(t=uo),p(e)._overflowWeekday&&t===-1&&(t=co),p(e).overflow=t),e}function it(e){var t,n,r,o,i,a,s=e._i,l=Do.exec(s)||Ro.exec(s);if(l){for(p(e).iso=!0,t=0,n=jo.length;t<n;t++)if(jo[t][1].exec(l[1])){o=jo[t][0],r=jo[t][2]!==!1;break}if(null==o)return void(e._isValid=!1);if(l[3]){for(t=0,n=Ao.length;t<n;t++)if(Ao[t][1].exec(l[3])){i=(l[2]||" ")+Ao[t][0];break}if(null==i)return void(e._isValid=!1)}if(!r&&null!=i)return void(e._isValid=!1);if(l[4]){if(!Io.exec(l[4]))return void(e._isValid=!1);a="Z"}e._f=o+(i||"")+(a||""),dt(e)}else e._isValid=!1}function at(e){var n=Lo.exec(e._i);return null!==n?void(e._d=new Date((+n[1]))):(it(e),void(e._isValid===!1&&(delete e._isValid,t.createFromInputFallback(e))))}function st(e,t,n){return null!=e?e:null!=t?t:n}function lt(e){var n=new Date(t.now());return e._useUTC?[n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()]:[n.getFullYear(),n.getMonth(),n.getDate()]}function ut(e){var t,n,r,o,i=[];if(!e._d){for(r=lt(e),e._w&&null==e._a[oo]&&null==e._a[ro]&&ct(e),e._dayOfYear&&(o=st(e._a[no],r[no]),e._dayOfYear>ve(o)&&(p(e)._overflowDayOfYear=!0),n=_e(o,0,e._dayOfYear),e._a[ro]=n.getUTCMonth(),e._a[oo]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=i[t]=r[t];for(;t<7;t++)e._a[t]=i[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[io]&&0===e._a[ao]&&0===e._a[so]&&0===e._a[lo]&&(e._nextDay=!0,e._a[io]=0),e._d=(e._useUTC?_e:be).apply(null,i),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[io]=24)}}function ct(e){var t,n,r,o,i,a,s,l;if(t=e._w,null!=t.GG||null!=t.W||null!=t.E)i=1,a=4,n=st(t.GG,e._a[no],xe(bt(),1,4).year),r=st(t.W,1),o=st(t.E,1),(o<1||o>7)&&(l=!0);else{i=e._locale._week.dow,a=e._locale._week.doy;var u=xe(bt(),i,a);n=st(t.gg,e._a[no],u.year),r=st(t.w,u.week),null!=t.d?(o=t.d,(o<0||o>6)&&(l=!0)):null!=t.e?(o=t.e+i,(t.e<0||t.e>6)&&(l=!0)):o=i}r<1||r>we(n,i,a)?p(e)._overflowWeeks=!0:null!=l?p(e)._overflowWeekday=!0:(s=Ce(n,r,o,i,a),e._a[no]=s.year,e._dayOfYear=s.dayOfYear)}function dt(e){if(e._f===t.ISO_8601)return void it(e);e._a=[],p(e).empty=!0;var n,r,o,i,a,s=""+e._i,l=s.length,u=0;for(o=Q(e._f,e._locale).match(Rr)||[],n=0;n<o.length;n++)i=o[n],r=(s.match(J(i,e))||[])[0],r&&(a=s.substr(0,s.indexOf(r)),a.length>0&&p(e).unusedInput.push(a),s=s.slice(s.indexOf(r)+r.length),u+=r.length),Ar[i]?(r?p(e).empty=!1:p(e).unusedTokens.push(i),oe(i,r,e)):e._strict&&!r&&p(e).unusedTokens.push(i);p(e).charsLeftOver=l-u,s.length>0&&p(e).unusedInput.push(s),e._a[io]<=12&&p(e).bigHour===!0&&e._a[io]>0&&(p(e).bigHour=void 0),p(e).parsedDateParts=e._a.slice(0),p(e).meridiem=e._meridiem,e._a[io]=ft(e._locale,e._a[io],e._meridiem),ut(e),ot(e)}function ft(e,t,n){var r;return null==n?t:null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?(r=e.isPM(n),r&&t<12&&(t+=12),r||12!==t||(t=0),t):t}function pt(e){var t,n,r,o,i;if(0===e._f.length)return p(e).invalidFormat=!0,void(e._d=new Date(NaN));for(o=0;o<e._f.length;o++)i=0,t=y({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[o],dt(t),h(t)&&(i+=p(t).charsLeftOver,i+=10*p(t).unusedTokens.length,p(t).score=i,(null==r||i<r)&&(r=i,n=t));c(e,n||t)}function ht(e){if(!e._d){var t=W(e._i);e._a=l([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),ut(e)}}function mt(e){var t=new g(ot(vt(e)));return t._nextDay&&(t.add(1,"d"),t._nextDay=void 0),t}function vt(e){var t=e._i,n=e._f;return e._locale=e._locale||nt(e._l),null===t||void 0===n&&""===t?m({nullInput:!0}):("string"==typeof t&&(e._i=t=e._locale.preparse(t)),b(t)?new g(ot(t)):(s(t)?e._d=t:r(n)?pt(e):n?dt(e):yt(e),h(e)||(e._d=null),e))}function yt(e){var n=e._i;void 0===n?e._d=new Date(t.now()):s(n)?e._d=new Date(n.valueOf()):"string"==typeof n?at(e):r(n)?(e._a=l(n.slice(0),function(e){return parseInt(e,10)}),ut(e)):"object"==typeof n?ht(e):a(n)?e._d=new Date(n):t.createFromInputFallback(e)}function gt(e,t,n,a,s){var l={};return n!==!0&&n!==!1||(a=n,n=void 0),(o(e)&&i(e)||r(e)&&0===e.length)&&(e=void 0),l._isAMomentObject=!0,l._useUTC=l._isUTC=s,l._l=n,l._i=e,l._f=t,l._strict=a,mt(l)}function bt(e,t,n,r){return gt(e,t,n,r,!1)}function _t(e,t){var n,o;if(1===t.length&&r(t[0])&&(t=t[0]),!t.length)return bt();for(n=t[0],o=1;o<t.length;++o)t[o].isValid()&&!t[o][e](n)||(n=t[o]);return n}function Tt(){var e=[].slice.call(arguments,0);return _t("isBefore",e)}function Ct(){var e=[].slice.call(arguments,0);return _t("isAfter",e)}function xt(e){var t=W(e),n=t.year||0,r=t.quarter||0,o=t.month||0,i=t.week||0,a=t.day||0,s=t.hour||0,l=t.minute||0,u=t.second||0,c=t.millisecond||0;this._milliseconds=+c+1e3*u+6e4*l+1e3*s*60*60,this._days=+a+7*i,this._months=+o+3*r+12*n,this._data={},this._locale=nt(),this._bubble()}function wt(e){return e instanceof xt}function Pt(e){return e<0?Math.round(-1*e)*-1:Math.round(e)}function St(e,t){X(e,0,0,function(){var e=this.utcOffset(),n="+";return e<0&&(e=-e,n="-"),n+G(~~(e/60),2)+t+G(~~e%60,2)})}function Et(e,t){var n=(t||"").match(e);if(null===n)return null;var r=n[n.length-1]||[],o=(r+"").match(Fo)||["-",0,0],i=+(60*o[1])+T(o[2]);return 0===i?0:"+"===o[0]?i:-i}function Ot(e,n){var r,o;return n._isUTC?(r=n.clone(),o=(b(e)||s(e)?e.valueOf():bt(e).valueOf())-r.valueOf(),r._d.setTime(r._d.valueOf()+o),t.updateOffset(r,!1),r):bt(e).local()}function Mt(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function kt(e,n){var r,o=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null!=e){if("string"==typeof e){if(e=Et(Qr,e),null===e)return this}else Math.abs(e)<16&&(e=60*e);return!this._isUTC&&n&&(r=Mt(this)),this._offset=e,this._isUTC=!0,null!=r&&this.add(r,"m"),o!==e&&(!n||this._changeInProgress?Gt(this,Ft(e-o,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?o:Mt(this)}function Nt(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}function Dt(e){return this.utcOffset(0,e)}function Rt(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Mt(this),"m")),this}function It(){if(null!=this._tzm)this.utcOffset(this._tzm);else if("string"==typeof this._i){var e=Et(Zr,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this}function jt(e){return!!this.isValid()&&(e=e?bt(e).utcOffset():0,(this.utcOffset()-e)%60===0)}function At(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Lt(){if(!v(this._isDSTShifted))return this._isDSTShifted;var e={};if(y(e,this),e=vt(e),e._a){var t=e._isUTC?d(e._a):bt(e._a);this._isDSTShifted=this.isValid()&&C(e._a,t.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Wt(){return!!this.isValid()&&!this._isUTC}function Vt(){return!!this.isValid()&&this._isUTC}function Ht(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function Ft(e,t){var n,r,o,i=e,s=null;return wt(e)?i={ms:e._milliseconds,d:e._days,M:e._months}:a(e)?(i={},t?i[t]=e:i.milliseconds=e):(s=Yo.exec(e))?(n="-"===s[1]?-1:1,i={y:0,d:T(s[oo])*n,h:T(s[io])*n,m:T(s[ao])*n,s:T(s[so])*n,ms:T(Pt(1e3*s[lo]))*n}):(s=Bo.exec(e))?(n="-"===s[1]?-1:1,i={y:Yt(s[2],n),M:Yt(s[3],n),w:Yt(s[4],n),d:Yt(s[5],n),h:Yt(s[6],n),m:Yt(s[7],n),s:Yt(s[8],n)}):null==i?i={}:"object"==typeof i&&("from"in i||"to"in i)&&(o=zt(bt(i.from),bt(i.to)),i={},i.ms=o.milliseconds,i.M=o.months),r=new xt(i),wt(e)&&u(e,"_locale")&&(r._locale=e._locale),r}function Yt(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function Bt(e,t){var n={milliseconds:0,months:0};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function zt(e,t){var n;return e.isValid()&&t.isValid()?(t=Ot(t,e),e.isBefore(t)?n=Bt(e,t):(n=Bt(t,e),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function Ut(e,t){return function(n,r){var o,i;return null===r||isNaN(+r)||(P(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),i=n,n=r,r=i),n="string"==typeof n?+n:n,o=Ft(n,r),Gt(this,o,e),this}}function Gt(e,n,r,o){var i=n._milliseconds,a=Pt(n._days),s=Pt(n._months);e.isValid()&&(o=null==o||o,i&&e._d.setTime(e._d.valueOf()+i*r),a&&B(e,"Date",Y(e,"Date")+a*r),s&&ce(e,Y(e,"Month")+s*r),o&&t.updateOffset(e,a||s))}function Xt(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"}function Kt(e,n){var r=e||bt(),o=Ot(r,this).startOf("day"),i=t.calendarFormat(this,o)||"sameElse",a=n&&(S(n[i])?n[i].call(this,r):n[i]);return this.format(a||this.localeData().calendar(i,this,bt(r)))}function qt(){return new g(this)}function Zt(e,t){var n=b(e)?e:bt(e);return!(!this.isValid()||!n.isValid())&&(t=L(v(t)?"millisecond":t),"millisecond"===t?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf())}function Qt(e,t){var n=b(e)?e:bt(e);return!(!this.isValid()||!n.isValid())&&(t=L(v(t)?"millisecond":t),"millisecond"===t?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf())}function $t(e,t,n,r){return r=r||"()",("("===r[0]?this.isAfter(e,n):!this.isBefore(e,n))&&(")"===r[1]?this.isBefore(t,n):!this.isAfter(t,n))}function Jt(e,t){var n,r=b(e)?e:bt(e);return!(!this.isValid()||!r.isValid())&&(t=L(t||"millisecond"),"millisecond"===t?this.valueOf()===r.valueOf():(n=r.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf()))}function en(e,t){return this.isSame(e,t)||this.isAfter(e,t)}function tn(e,t){return this.isSame(e,t)||this.isBefore(e,t)}function nn(e,t,n){var r,o,i,a;return this.isValid()?(r=Ot(e,this),r.isValid()?(o=6e4*(r.utcOffset()-this.utcOffset()),t=L(t),"year"===t||"month"===t||"quarter"===t?(a=rn(this,r),"quarter"===t?a/=3:"year"===t&&(a/=12)):(i=this-r,a="second"===t?i/1e3:"minute"===t?i/6e4:"hour"===t?i/36e5:"day"===t?(i-o)/864e5:"week"===t?(i-o)/6048e5:i),n?a:_(a)):NaN):NaN}function rn(e,t){var n,r,o=12*(t.year()-e.year())+(t.month()-e.month()),i=e.clone().add(o,"months");return t-i<0?(n=e.clone().add(o-1,"months"),r=(t-i)/(i-n)):(n=e.clone().add(o+1,"months"),r=(t-i)/(n-i)),-(o+r)||0}function on(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function an(){var e=this.clone().utc();return 0<e.year()&&e.year()<=9999?S(Date.prototype.toISOString)?this.toDate().toISOString():Z(e,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):Z(e,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function sn(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="";this.isLocal()||(e=0===this.utcOffset()?"moment.utc":"moment.parseZone",t="Z");var n="["+e+'("]',r=0<this.year()&&this.year()<=9999?"YYYY":"YYYYYY",o="-MM-DD[T]HH:mm:ss.SSS",i=t+'[")]';return this.format(n+r+o+i)}function ln(e){e||(e=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var n=Z(this,e);return this.localeData().postformat(n)}function un(e,t){return this.isValid()&&(b(e)&&e.isValid()||bt(e).isValid())?Ft({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function cn(e){return this.from(bt(),e)}function dn(e,t){return this.isValid()&&(b(e)&&e.isValid()||bt(e).isValid())?Ft({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function fn(e){return this.to(bt(),e)}function pn(e){var t;return void 0===e?this._locale._abbr:(t=nt(e),null!=t&&(this._locale=t),this)}function hn(){return this._locale}function mn(e){switch(e=L(e)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===e&&this.weekday(0),"isoWeek"===e&&this.isoWeekday(1),"quarter"===e&&this.month(3*Math.floor(this.month()/3)),this}function vn(e){return e=L(e),void 0===e||"millisecond"===e?this:("date"===e&&(e="day"),this.startOf(e).add(1,"isoWeek"===e?"week":e).subtract(1,"ms"))}function yn(){return this._d.valueOf()-6e4*(this._offset||0)}function gn(){return Math.floor(this.valueOf()/1e3)}function bn(){return new Date(this.valueOf())}function _n(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function Tn(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function Cn(){return this.isValid()?this.toISOString():null}function xn(){return h(this)}function wn(){return c({},p(this))}function Pn(){return p(this).overflow}function Sn(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function En(e,t){X(0,[e,e.length],0,t)}function On(e){return Dn.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Mn(e){return Dn.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)}function kn(){return we(this.year(),1,4)}function Nn(){var e=this.localeData()._week;return we(this.year(),e.dow,e.doy)}function Dn(e,t,n,r,o){var i;return null==e?xe(this,r,o).year:(i=we(e,r,o),t>i&&(t=i),Rn.call(this,e,t,n,r,o))}function Rn(e,t,n,r,o){var i=Ce(e,t,n,r,o),a=_e(i.year,0,i.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}function In(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)}function jn(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")}function An(e,t){t[lo]=T(1e3*("0."+e))}function Ln(){return this._isUTC?"UTC":""}function Wn(){return this._isUTC?"Coordinated Universal Time":""}function Vn(e){return bt(1e3*e)}function Hn(){return bt.apply(null,arguments).parseZone()}function Fn(e){return e}function Yn(e,t,n,r){var o=nt(),i=d().set(r,t);return o[n](i,e)}function Bn(e,t,n){if(a(e)&&(t=e,e=void 0),e=e||"",null!=t)return Yn(e,t,n,"month");var r,o=[];for(r=0;r<12;r++)o[r]=Yn(e,r,n,"month");return o}function zn(e,t,n,r){"boolean"==typeof e?(a(t)&&(n=t,t=void 0),t=t||""):(t=e,n=t,e=!1,a(t)&&(n=t,t=void 0),t=t||"");var o=nt(),i=e?o._week.dow:0;if(null!=n)return Yn(t,(n+i)%7,r,"day");var s,l=[];for(s=0;s<7;s++)l[s]=Yn(t,(s+i)%7,r,"day");return l}function Un(e,t){return Bn(e,t,"months")}function Gn(e,t){return Bn(e,t,"monthsShort")}function Xn(e,t,n){return zn(e,t,n,"weekdays")}function Kn(e,t,n){return zn(e,t,n,"weekdaysShort")}function qn(e,t,n){return zn(e,t,n,"weekdaysMin")}function Zn(){var e=this._data;return this._milliseconds=ei(this._milliseconds),this._days=ei(this._days),this._months=ei(this._months),e.milliseconds=ei(e.milliseconds),e.seconds=ei(e.seconds),e.minutes=ei(e.minutes),
e.hours=ei(e.hours),e.months=ei(e.months),e.years=ei(e.years),this}function Qn(e,t,n,r){var o=Ft(t,n);return e._milliseconds+=r*o._milliseconds,e._days+=r*o._days,e._months+=r*o._months,e._bubble()}function $n(e,t){return Qn(this,e,t,1)}function Jn(e,t){return Qn(this,e,t,-1)}function er(e){return e<0?Math.floor(e):Math.ceil(e)}function tr(){var e,t,n,r,o,i=this._milliseconds,a=this._days,s=this._months,l=this._data;return i>=0&&a>=0&&s>=0||i<=0&&a<=0&&s<=0||(i+=864e5*er(rr(s)+a),a=0,s=0),l.milliseconds=i%1e3,e=_(i/1e3),l.seconds=e%60,t=_(e/60),l.minutes=t%60,n=_(t/60),l.hours=n%24,a+=_(n/24),o=_(nr(a)),s+=o,a-=er(rr(o)),r=_(s/12),s%=12,l.days=a,l.months=s,l.years=r,this}function nr(e){return 4800*e/146097}function rr(e){return 146097*e/4800}function or(e){var t,n,r=this._milliseconds;if(e=L(e),"month"===e||"year"===e)return t=this._days+r/864e5,n=this._months+nr(t),"month"===e?n:n/12;switch(t=this._days+Math.round(rr(this._months)),e){case"week":return t/7+r/6048e5;case"day":return t+r/864e5;case"hour":return 24*t+r/36e5;case"minute":return 1440*t+r/6e4;case"second":return 86400*t+r/1e3;case"millisecond":return Math.floor(864e5*t)+r;default:throw new Error("Unknown unit "+e)}}function ir(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*T(this._months/12)}function ar(e){return function(){return this.as(e)}}function sr(e){return e=L(e),this[e+"s"]()}function lr(e){return function(){return this._data[e]}}function ur(){return _(this.days()/7)}function cr(e,t,n,r,o){return o.relativeTime(t||1,!!n,e,r)}function dr(e,t,n){var r=Ft(e).abs(),o=vi(r.as("s")),i=vi(r.as("m")),a=vi(r.as("h")),s=vi(r.as("d")),l=vi(r.as("M")),u=vi(r.as("y")),c=o<yi.s&&["s",o]||i<=1&&["m"]||i<yi.m&&["mm",i]||a<=1&&["h"]||a<yi.h&&["hh",a]||s<=1&&["d"]||s<yi.d&&["dd",s]||l<=1&&["M"]||l<yi.M&&["MM",l]||u<=1&&["y"]||["yy",u];return c[2]=t,c[3]=+e>0,c[4]=n,cr.apply(null,c)}function fr(e){return void 0===e?vi:"function"==typeof e&&(vi=e,!0)}function pr(e,t){return void 0!==yi[e]&&(void 0===t?yi[e]:(yi[e]=t,!0))}function hr(e){var t=this.localeData(),n=dr(this,!e,t);return e&&(n=t.pastFuture(+this,n)),t.postformat(n)}function mr(){var e,t,n,r=gi(this._milliseconds)/1e3,o=gi(this._days),i=gi(this._months);e=_(r/60),t=_(e/60),r%=60,e%=60,n=_(i/12),i%=12;var a=n,s=i,l=o,u=t,c=e,d=r,f=this.asSeconds();return f?(f<0?"-":"")+"P"+(a?a+"Y":"")+(s?s+"M":"")+(l?l+"D":"")+(u||c||d?"T":"")+(u?u+"H":"")+(c?c+"M":"")+(d?d+"S":""):"P0D"}var vr,yr;yr=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,r=0;r<n;r++)if(r in t&&e.call(this,t[r],r,t))return!0;return!1};var gr=yr,br=t.momentProperties=[],_r=!1,Tr={};t.suppressDeprecationWarnings=!1,t.deprecationHandler=null;var Cr;Cr=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)u(e,t)&&n.push(t);return n};var xr,wr=Cr,Pr={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Sr={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},Er="Invalid date",Or="%d",Mr=/\d{1,2}/,kr={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Nr={},Dr={},Rr=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Ir=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,jr={},Ar={},Lr=/\d/,Wr=/\d\d/,Vr=/\d{3}/,Hr=/\d{4}/,Fr=/[+-]?\d{6}/,Yr=/\d\d?/,Br=/\d\d\d\d?/,zr=/\d\d\d\d\d\d?/,Ur=/\d{1,3}/,Gr=/\d{1,4}/,Xr=/[+-]?\d{1,6}/,Kr=/\d+/,qr=/[+-]?\d+/,Zr=/Z|[+-]\d\d:?\d\d/gi,Qr=/Z|[+-]\d\d(?::?\d\d)?/gi,$r=/[+-]?\d+(\.\d{1,3})?/,Jr=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,eo={},to={},no=0,ro=1,oo=2,io=3,ao=4,so=5,lo=6,uo=7,co=8;xr=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1};var fo=xr;X("M",["MM",2],"Mo",function(){return this.month()+1}),X("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),X("MMMM",0,0,function(e){return this.localeData().months(this,e)}),A("month","M"),V("month",8),$("M",Yr),$("MM",Yr,Wr),$("MMM",function(e,t){return t.monthsShortRegex(e)}),$("MMMM",function(e,t){return t.monthsRegex(e)}),ne(["M","MM"],function(e,t){t[ro]=T(e)-1}),ne(["MMM","MMMM"],function(e,t,n,r){var o=n._locale.monthsParse(e,r,n._strict);null!=o?t[ro]=o:p(n).invalidMonth=e});var po=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,ho="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),mo="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),vo=Jr,yo=Jr;X("Y",0,0,function(){var e=this.year();return e<=9999?""+e:"+"+e}),X(0,["YY",2],0,function(){return this.year()%100}),X(0,["YYYY",4],0,"year"),X(0,["YYYYY",5],0,"year"),X(0,["YYYYYY",6,!0],0,"year"),A("year","y"),V("year",1),$("Y",qr),$("YY",Yr,Wr),$("YYYY",Gr,Hr),$("YYYYY",Xr,Fr),$("YYYYYY",Xr,Fr),ne(["YYYYY","YYYYYY"],no),ne("YYYY",function(e,n){n[no]=2===e.length?t.parseTwoDigitYear(e):T(e)}),ne("YY",function(e,n){n[no]=t.parseTwoDigitYear(e)}),ne("Y",function(e,t){t[no]=parseInt(e,10)}),t.parseTwoDigitYear=function(e){return T(e)+(T(e)>68?1900:2e3)};var go=F("FullYear",!0);X("w",["ww",2],"wo","week"),X("W",["WW",2],"Wo","isoWeek"),A("week","w"),A("isoWeek","W"),V("week",5),V("isoWeek",5),$("w",Yr),$("ww",Yr,Wr),$("W",Yr),$("WW",Yr,Wr),re(["w","ww","W","WW"],function(e,t,n,r){t[r.substr(0,1)]=T(e)});var bo={dow:0,doy:6};X("d",0,"do","day"),X("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),X("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),X("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),X("e",0,0,"weekday"),X("E",0,0,"isoWeekday"),A("day","d"),A("weekday","e"),A("isoWeekday","E"),V("day",11),V("weekday",11),V("isoWeekday",11),$("d",Yr),$("e",Yr),$("E",Yr),$("dd",function(e,t){return t.weekdaysMinRegex(e)}),$("ddd",function(e,t){return t.weekdaysShortRegex(e)}),$("dddd",function(e,t){return t.weekdaysRegex(e)}),re(["dd","ddd","dddd"],function(e,t,n,r){var o=n._locale.weekdaysParse(e,r,n._strict);null!=o?t.d=o:p(n).invalidWeekday=e}),re(["d","e","E"],function(e,t,n,r){t[r]=T(e)});var _o="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),To="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Co="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),xo=Jr,wo=Jr,Po=Jr;X("H",["HH",2],0,"hour"),X("h",["hh",2],0,ze),X("k",["kk",2],0,Ue),X("hmm",0,0,function(){return""+ze.apply(this)+G(this.minutes(),2)}),X("hmmss",0,0,function(){return""+ze.apply(this)+G(this.minutes(),2)+G(this.seconds(),2)}),X("Hmm",0,0,function(){return""+this.hours()+G(this.minutes(),2)}),X("Hmmss",0,0,function(){return""+this.hours()+G(this.minutes(),2)+G(this.seconds(),2)}),Ge("a",!0),Ge("A",!1),A("hour","h"),V("hour",13),$("a",Xe),$("A",Xe),$("H",Yr),$("h",Yr),$("HH",Yr,Wr),$("hh",Yr,Wr),$("hmm",Br),$("hmmss",zr),$("Hmm",Br),$("Hmmss",zr),ne(["H","HH"],io),ne(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ne(["h","hh"],function(e,t,n){t[io]=T(e),p(n).bigHour=!0}),ne("hmm",function(e,t,n){var r=e.length-2;t[io]=T(e.substr(0,r)),t[ao]=T(e.substr(r)),p(n).bigHour=!0}),ne("hmmss",function(e,t,n){var r=e.length-4,o=e.length-2;t[io]=T(e.substr(0,r)),t[ao]=T(e.substr(r,2)),t[so]=T(e.substr(o)),p(n).bigHour=!0}),ne("Hmm",function(e,t,n){var r=e.length-2;t[io]=T(e.substr(0,r)),t[ao]=T(e.substr(r))}),ne("Hmmss",function(e,t,n){var r=e.length-4,o=e.length-2;t[io]=T(e.substr(0,r)),t[ao]=T(e.substr(r,2)),t[so]=T(e.substr(o))});var So,Eo=/[ap]\.?m?\.?/i,Oo=F("Hours",!0),Mo={calendar:Pr,longDateFormat:Sr,invalidDate:Er,ordinal:Or,ordinalParse:Mr,relativeTime:kr,months:ho,monthsShort:mo,week:bo,weekdays:_o,weekdaysMin:Co,weekdaysShort:To,meridiemParse:Eo},ko={},No={},Do=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ro=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Io=/Z|[+-]\d\d(?::?\d\d)?/,jo=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],Ao=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Lo=/^\/?Date\((\-?\d+)/i;t.createFromInputFallback=w("value provided is not in a recognized ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),t.ISO_8601=function(){};var Wo=w("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=bt.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:m()}),Vo=w("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=bt.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:m()}),Ho=function(){return Date.now?Date.now():+new Date};St("Z",":"),St("ZZ",""),$("Z",Qr),$("ZZ",Qr),ne(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Et(Qr,e)});var Fo=/([\+\-]|\d\d)/gi;t.updateOffset=function(){};var Yo=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Bo=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;Ft.fn=xt.prototype;var zo=Ut(1,"add"),Uo=Ut(-1,"subtract");t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Go=w("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});X(0,["gg",2],0,function(){return this.weekYear()%100}),X(0,["GG",2],0,function(){return this.isoWeekYear()%100}),En("gggg","weekYear"),En("ggggg","weekYear"),En("GGGG","isoWeekYear"),En("GGGGG","isoWeekYear"),A("weekYear","gg"),A("isoWeekYear","GG"),V("weekYear",1),V("isoWeekYear",1),$("G",qr),$("g",qr),$("GG",Yr,Wr),$("gg",Yr,Wr),$("GGGG",Gr,Hr),$("gggg",Gr,Hr),$("GGGGG",Xr,Fr),$("ggggg",Xr,Fr),re(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,r){t[r.substr(0,2)]=T(e)}),re(["gg","GG"],function(e,n,r,o){n[o]=t.parseTwoDigitYear(e)}),X("Q",0,"Qo","quarter"),A("quarter","Q"),V("quarter",7),$("Q",Lr),ne("Q",function(e,t){t[ro]=3*(T(e)-1)}),X("D",["DD",2],"Do","date"),A("date","D"),V("date",9),$("D",Yr),$("DD",Yr,Wr),$("Do",function(e,t){return e?t._ordinalParse:t._ordinalParseLenient}),ne(["D","DD"],oo),ne("Do",function(e,t){t[oo]=T(e.match(Yr)[0],10)});var Xo=F("Date",!0);X("DDD",["DDDD",3],"DDDo","dayOfYear"),A("dayOfYear","DDD"),V("dayOfYear",4),$("DDD",Ur),$("DDDD",Vr),ne(["DDD","DDDD"],function(e,t,n){n._dayOfYear=T(e)}),X("m",["mm",2],0,"minute"),A("minute","m"),V("minute",14),$("m",Yr),$("mm",Yr,Wr),ne(["m","mm"],ao);var Ko=F("Minutes",!1);X("s",["ss",2],0,"second"),A("second","s"),V("second",15),$("s",Yr),$("ss",Yr,Wr),ne(["s","ss"],so);var qo=F("Seconds",!1);X("S",0,0,function(){return~~(this.millisecond()/100)}),X(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),X(0,["SSS",3],0,"millisecond"),X(0,["SSSS",4],0,function(){return 10*this.millisecond()}),X(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),X(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),X(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),X(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),X(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),A("millisecond","ms"),V("millisecond",16),$("S",Ur,Lr),$("SS",Ur,Wr),$("SSS",Ur,Vr);var Zo;for(Zo="SSSS";Zo.length<=9;Zo+="S")$(Zo,Kr);for(Zo="S";Zo.length<=9;Zo+="S")ne(Zo,An);var Qo=F("Milliseconds",!1);X("z",0,0,"zoneAbbr"),X("zz",0,0,"zoneName");var $o=g.prototype;$o.add=zo,$o.calendar=Kt,$o.clone=qt,$o.diff=nn,$o.endOf=vn,$o.format=ln,$o.from=un,$o.fromNow=cn,$o.to=dn,$o.toNow=fn,$o.get=z,$o.invalidAt=Pn,$o.isAfter=Zt,$o.isBefore=Qt,$o.isBetween=$t,$o.isSame=Jt,$o.isSameOrAfter=en,$o.isSameOrBefore=tn,$o.isValid=xn,$o.lang=Go,$o.locale=pn,$o.localeData=hn,$o.max=Vo,$o.min=Wo,$o.parsingFlags=wn,$o.set=U,$o.startOf=mn,$o.subtract=Uo,$o.toArray=_n,$o.toObject=Tn,$o.toDate=bn,$o.toISOString=an,$o.inspect=sn,$o.toJSON=Cn,$o.toString=on,$o.unix=gn,$o.valueOf=yn,$o.creationData=Sn,$o.year=go,$o.isLeapYear=ge,$o.weekYear=On,$o.isoWeekYear=Mn,$o.quarter=$o.quarters=In,$o.month=de,$o.daysInMonth=fe,$o.week=$o.weeks=Oe,$o.isoWeek=$o.isoWeeks=Me,$o.weeksInYear=Nn,$o.isoWeeksInYear=kn,$o.date=Xo,$o.day=$o.days=Le,$o.weekday=We,$o.isoWeekday=Ve,$o.dayOfYear=jn,$o.hour=$o.hours=Oo,$o.minute=$o.minutes=Ko,$o.second=$o.seconds=qo,$o.millisecond=$o.milliseconds=Qo,$o.utcOffset=kt,$o.utc=Dt,$o.local=Rt,$o.parseZone=It,$o.hasAlignedHourOffset=jt,$o.isDST=At,$o.isLocal=Wt,$o.isUtcOffset=Vt,$o.isUtc=Ht,$o.isUTC=Ht,$o.zoneAbbr=Ln,$o.zoneName=Wn,$o.dates=w("dates accessor is deprecated. Use date instead.",Xo),$o.months=w("months accessor is deprecated. Use month instead",de),$o.years=w("years accessor is deprecated. Use year instead",go),$o.zone=w("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Nt),$o.isDSTShifted=w("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Lt);var Jo=M.prototype;Jo.calendar=k,Jo.longDateFormat=N,Jo.invalidDate=D,Jo.ordinal=R,Jo.preparse=Fn,Jo.postformat=Fn,Jo.relativeTime=I,Jo.pastFuture=j,Jo.set=E,Jo.months=ae,Jo.monthsShort=se,Jo.monthsParse=ue,Jo.monthsRegex=he,Jo.monthsShortRegex=pe,Jo.week=Pe,Jo.firstDayOfYear=Ee,Jo.firstDayOfWeek=Se,Jo.weekdays=De,Jo.weekdaysMin=Ie,Jo.weekdaysShort=Re,Jo.weekdaysParse=Ae,Jo.weekdaysRegex=He,Jo.weekdaysShortRegex=Fe,Jo.weekdaysMinRegex=Ye,Jo.isPM=Ke,Jo.meridiem=qe,Je("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,n=1===T(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+n}}),t.lang=w("moment.lang is deprecated. Use moment.locale instead.",Je),t.langData=w("moment.langData is deprecated. Use moment.localeData instead.",nt);var ei=Math.abs,ti=ar("ms"),ni=ar("s"),ri=ar("m"),oi=ar("h"),ii=ar("d"),ai=ar("w"),si=ar("M"),li=ar("y"),ui=lr("milliseconds"),ci=lr("seconds"),di=lr("minutes"),fi=lr("hours"),pi=lr("days"),hi=lr("months"),mi=lr("years"),vi=Math.round,yi={s:45,m:45,h:22,d:26,M:11},gi=Math.abs,bi=xt.prototype;return bi.abs=Zn,bi.add=$n,bi.subtract=Jn,bi.as=or,bi.asMilliseconds=ti,bi.asSeconds=ni,bi.asMinutes=ri,bi.asHours=oi,bi.asDays=ii,bi.asWeeks=ai,bi.asMonths=si,bi.asYears=li,bi.valueOf=ir,bi._bubble=tr,bi.get=sr,bi.milliseconds=ui,bi.seconds=ci,bi.minutes=di,bi.hours=fi,bi.days=pi,bi.weeks=ur,bi.months=hi,bi.years=mi,bi.humanize=hr,bi.toISOString=mr,bi.toString=mr,bi.toJSON=mr,bi.locale=pn,bi.localeData=hn,bi.toIsoString=w("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",mr),bi.lang=Go,X("X",0,0,"unix"),X("x",0,0,"valueOf"),$("x",qr),$("X",$r),ne("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))}),ne("x",function(e,t,n){n._d=new Date(T(e))}),t.version="2.17.1",n(bt),t.fn=$o,t.min=Tt,t.max=Ct,t.now=Ho,t.utc=d,t.unix=Vn,t.months=Un,t.isDate=s,t.locale=Je,t.invalid=m,t.duration=Ft,t.isMoment=b,t.weekdays=Xn,t.parseZone=Hn,t.localeData=nt,t.isDuration=wt,t.monthsShort=Gn,t.weekdaysMin=qn,t.defineLocale=et,t.updateLocale=tt,t.locales=rt,t.weekdaysShort=Kn,t.normalizeUnits=L,t.relativeTimeRounding=fr,t.relativeTimeThreshold=pr,t.calendarFormat=Xt,t.prototype=$o,t})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={isAppearSupported:function(e){return e.transitionName&&e.transitionAppear||e.animation.appear},isEnterSupported:function(e){return e.transitionName&&e.transitionEnter||e.animation.enter},isLeaveSupported:function(e){return e.transitionName&&e.transitionLeave||e.animation.leave},allowAppearCallback:function(e){return e.transitionAppear||e.animation.appear},allowEnterCallback:function(e){return e.transitionEnter||e.animation.enter},allowLeaveCallback:function(e){return e.transitionLeave||e.animation.leave}};t["default"]=n,e.exports=t["default"]},function(e,t,n){var r=n(50),o=n(13)("toStringTag"),i="Arguments"==r(function(){return arguments}()),a=function(e,t){try{return e[t]}catch(n){}};e.exports=function(e){var t,n,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=a(t=Object(e),o))?n:i?r(t):"Object"==(s=r(t))&&"function"==typeof t.callee?"Arguments":s}},function(e,t,n){var r=n(32),o=n(17).document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},function(e,t,n){e.exports=!n(21)&&!n(31)(function(){return 7!=Object.defineProperty(n(91)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var r=n(50);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){"use strict";var r=n(54),o=n(22),i=n(98),a=n(27),s=n(23),l=n(28),u=n(289),c=n(57),d=n(297),f=n(13)("iterator"),p=!([].keys&&"next"in[].keys()),h="@@iterator",m="keys",v="values",y=function(){return this};e.exports=function(e,t,n,g,b,_,T){u(n,t,g);var C,x,w,P=function(e){if(!p&&e in M)return M[e];switch(e){case m:return function(){return new n(this,e)};case v:return function(){return new n(this,e)}}return function(){return new n(this,e)}},S=t+" Iterator",E=b==v,O=!1,M=e.prototype,k=M[f]||M[h]||b&&M[b],N=k||P(b),D=b?E?P("entries"):N:void 0,R="Array"==t?M.entries||k:k;if(R&&(w=d(R.call(new e)),w!==Object.prototype&&(c(w,S,!0),r||s(w,f)||a(w,f,y))),E&&k&&k.name!==v&&(O=!0,N=function(){return k.call(this)}),r&&!T||!p&&!O&&M[f]||a(M,f,N),l[t]=N,l[S]=y,b)if(C={values:E?N:P(v),keys:_?N:P(m),entries:D},T)for(x in C)x in M||i(M,x,C[x]);else o(o.P+o.F*(p||O),t,C);return C}},function(e,t,n){var r=n(41),o=n(34),i=n(24),a=n(62),s=n(23),l=n(92),u=Object.getOwnPropertyDescriptor;t.f=n(21)?u:function(e,t){if(e=i(e),t=a(t,!0),l)try{return u(e,t)}catch(n){}if(s(e,t))return o(!r.f.call(e,t),e[t])}},function(e,t,n){var r=n(97),o=n(53).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},function(e,t,n){var r=n(23),o=n(24),i=n(282)(!1),a=n(58)("IE_PROTO");e.exports=function(e,t){var n,s=o(e),l=0,u=[];for(n in s)n!=a&&r(s,n)&&u.push(n);for(;t.length>l;)r(s,n=t[l++])&&(~i(u,n)||u.push(n));return u}},function(e,t,n){e.exports=n(27)},function(e,t,n){var r=n(60),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(90),o=n(13)("iterator"),i=n(28);e.exports=n(12).getIteratorMethod=function(e){if(void 0!=e)return e[o]||e["@@iterator"]||i[r(e)]}},function(e,t,n){(function(t){for(var r=n(162),o="undefined"==typeof window?t:window,i=["moz","webkit"],a="AnimationFrame",s=o["request"+a],l=o["cancel"+a]||o["cancelRequest"+a],u=0;!s&&u<i.length;u++)s=o[i[u]+"Request"+a],l=o[i[u]+"Cancel"+a]||o[i[u]+"CancelRequest"+a];if(!s||!l){var c=0,d=0,f=[],p=1e3/60;s=function(e){if(0===f.length){var t=r(),n=Math.max(0,p-(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(n){setTimeout(function(){throw n},0)}},Math.round(n))}return f.push({handle:++d,callback:e,cancelled:!1}),d},l=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(){l.apply(o,arguments)},e.exports.polyfill=function(){o.requestAnimationFrame=s,o.cancelAnimationFrame=l}}).call(t,function(){return this}())},function(e,t,n){"use strict";e.exports=n(324)},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),a=n(48),s=r(a),l=n(329),u=r(l),c=n(15),d=r(c),f=i["default"].createClass({displayName:"PopupPicker",mixins:[u["default"]],getDefaultProps:function(){return{prefixCls:"rmc-picker-popup",triggerType:"onClick",WrapComponent:"span"}},getModal:function(){var e=this.props;if(!this.state.visible)return null;var t=e.prefixCls;return i["default"].createElement(s["default"],{prefixCls:""+t,className:e.className||"",visible:!0,closable:!1,transitionName:e.transitionName||e.popupTransitionName,maskTransitionName:e.maskTransitionName,onClose:this.hide,style:e.style},i["default"].createElement("div",null,i["default"].createElement("div",{className:t+"-header"},i["default"].createElement(d["default"],{activeClassName:t+"-item-active"},i["default"].createElement("div",{className:t+"-item "+t+"-header-left",onClick:this.onDismiss},e.dismissText)),i["default"].createElement("div",{className:t+"-item "+t+"-title"},e.title),i["default"].createElement(d["default"],{activeClassName:t+"-item-active"},i["default"].createElement("div",{className:t+"-item "+t+"-header-right",onClick:this.onOk},e.okText))),this.getContent()))},render:function(){return this.getRender()}});t["default"]=f,e.exports=t["default"]},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),a=n(82),s=r(a),l=n(44),u=r(l),c=i["default"].createClass({displayName:"Cascader",getDefaultProps:function(){return{cols:3,prefixCls:"rmc-cascader",pickerPrefixCls:"rmc-picker",data:[],disabled:!1}},getInitialState:function(){return{value:this.getValue(this.props.data,this.props.defaultValue||this.props.value)}},componentWillReceiveProps:function(e){"value"in e&&this.setState({value:this.getValue(e.data,e.value)})},onValueChange:function(e,t){var n=(0,s["default"])(this.props.data,function(n,r){return r<=t&&n.value===e[r]}),r=n[t],o=void 0;for(o=t+1;r&&r.children&&r.children.length&&o<this.props.cols;o++)r=r.children[0],e[o]=r.value;e.length=o,"value"in this.props||this.setState({value:e}),this.props.onChange(e)},getValue:function(e,t){var n=e||this.props.data,r=t||this.props.value||this.props.defaultValue;if(!r||!r.length){r=[];for(var o=0;o<this.props.cols;o++)n&&n.length&&(r[o]=n[0].value,n=n[0].children)}return r},getCols:function(){var e=this.props,t=e.data,n=e.cols,r=this.state.value,o=(0,s["default"])(t,function(e,t){return e.value===r[t]}).map(function(e){return e.children});return o.length=n-1,o.unshift(t),o.map(function(e){return{props:{children:e||[]}}})},render:function(){var e=this.props,t=e.prefixCls,n=e.pickerPrefixCls,r=e.className,o=e.rootNativeProps,a=e.disabled,s=e.pickerItemStyle;return i["default"].createElement(u["default"],{prefixCls:t,pickerPrefixCls:n,disabled:a,className:r,selectedValue:this.state.value,rootNativeProps:o,pickerItemStyle:s,onValueChange:this.onValueChange},this.getCols())}});t["default"]=c,e.exports=t["default"]},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function o(e){n(this,o);var t=[];e=e||{},this.subscribe=function(e){t.push(e)},this.unsubscribe=function(e){var n=t.indexOf(e);n!==-1&&t.splice(n,1)},this.update=function(n){n&&n(e),t.forEach(function(t){return t(e)})}};t["default"]=r,e.exports=t["default"]},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(7),i=r(o),a=n(26),s=r(a),l=n(2),u=r(l),c=n(4),d=r(c),f=n(3),p=r(f),h=n(1),m=r(h),v=function(e){function t(){return(0,u["default"])(this,t),(0,d["default"])(this,e.apply(this,arguments))}return(0,p["default"])(t,e),t.prototype.render=function(){var e=this.props,t=e.className,n=e.vertical,r=e.offset,o=(0,s["default"])(e,["className","vertical","offset"]),a=n?{bottom:r+"%"}:{left:r+"%"};return m["default"].createElement("div",(0,i["default"])({},o,{className:t,style:a}))},t}(m["default"].Component);t["default"]=v,v.propTypes={className:h.PropTypes.string,vertical:h.PropTypes.bool,offset:h.PropTypes.number},e.exports=t["default"]},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),a=function(e){var t=e.className,n=e.included,r=e.vertical,o=e.offset,a=e.length,s={visibility:n?"visible":"hidden"};return r?(s.bottom=o+"%",s.height=a+"%"):(s.left=o+"%",s.width=a+"%"),i["default"].createElement("div",{className:t,style:s})};t["default"]=a,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}function i(){}function a(e){var t,n;return n=t=function(e){function t(n){(0,h["default"])(this,t);var r=(0,v["default"])(this,e.call(this,n));r.onMouseDown=function(e){if(0===e.button){var t=r.props.vertical,n=R.getMousePosition(t,e);if(R.isEventFromHandle(e,r.handlesRefs)){var o=R.getHandleCenterPosition(t,e.target);r.dragOffset=n-o,n=o}else r.dragOffset=0;r.onStart(n),r.addDocumentMouseEvents(),R.pauseEvent(e)}},r.onTouchStart=function(e){if(!R.isNotTouchEvent(e)){var t=r.props.vertical,n=R.getTouchPosition(t,e);if(R.isEventFromHandle(e,r.handlesRefs)){var o=R.getHandleCenterPosition(t,e.target);r.dragOffset=n-o,n=o}else r.dragOffset=0;r.onStart(n),r.addDocumentTouchEvents(),R.pauseEvent(e)}},r.onMouseMove=function(e){if(!r.sliderRef)return void r.onEnd();var t=R.getMousePosition(r.props.vertical,e);r.onMove(e,t-r.dragOffset)},r.onTouchMove=function(e){if(R.isNotTouchEvent(e)||!r.sliderRef)return void r.onEnd();var t=R.getTouchPosition(r.props.vertical,e);r.onMove(e,t-r.dragOffset)},r.saveSlider=function(e){r.sliderRef=e};return r.handlesRefs={},r}return(0,g["default"])(t,e),t.prototype.componentWillUnmount=function(){e.prototype.componentWillUnmount&&e.prototype.componentWillUnmount.call(this),this.removeDocumentEvents()},t.prototype.addDocumentTouchEvents=function(){this.onTouchMoveListener=(0,C["default"])(document,"touchmove",this.onTouchMove),this.onTouchUpListener=(0,C["default"])(document,"touchend",this.onEnd)},t.prototype.addDocumentMouseEvents=function(){this.onMouseMoveListener=(0,C["default"])(document,"mousemove",this.onMouseMove),this.onMouseUpListener=(0,C["default"])(document,"mouseup",this.onEnd)},t.prototype.removeDocumentEvents=function(){this.onTouchMoveListener&&this.onTouchMoveListener.remove(),this.onTouchUpListener&&this.onTouchUpListener.remove(),this.onMouseMoveListener&&this.onMouseMoveListener.remove(),this.onMouseUpListener&&this.onMouseUpListener.remove()},t.prototype.getSliderStart=function(){var e=this.sliderRef,t=e.getBoundingClientRect();return this.props.vertical?t.top:t.left},t.prototype.getSliderLength=function(){var e=this.sliderRef;return e?this.props.vertical?e.clientHeight:e.clientWidth:0},t.prototype.calcValue=function(e){var t=this.props,n=t.vertical,r=t.min,o=t.max,i=Math.abs(Math.max(e,0)/this.getSliderLength()),a=n?(1-i)*(o-r)+r:i*(o-r)+r;return a},t.prototype.calcValueByPos=function(e){var t=e-this.getSliderStart(),n=this.trimAlignValue(this.calcValue(t));return n},t.prototype.calcOffset=function(e){var t=this.props,n=t.min,r=t.max,o=(e-n)/(r-n);return 100*o},t.prototype.saveHandle=function(e,t){this.handlesRefs[e]=t},t.prototype.render=function(){var t,n=this.props,r=n.prefixCls,o=n.className,a=n.marks,s=n.dots,l=n.step,u=n.included,c=n.disabled,d=n.vertical,p=n.min,h=n.max,m=n.children,v=n.style,y=e.prototype.render.call(this),g=y.tracks,b=y.handles,T=(0,w["default"])((t={},(0,f["default"])(t,r,!0),(0,f["default"])(t,r+"-with-marks",Object.keys(a).length),(0,f["default"])(t,r+"-disabled",c),(0,f["default"])(t,r+"-vertical",d),(0,f["default"])(t,o,o),t));return _["default"].createElement("div",{ref:this.saveSlider,className:T,onTouchStart:c?i:this.onTouchStart,onMouseDown:c?i:this.onMouseDown,style:v},_["default"].createElement("div",{className:r+"-rail"}),g,_["default"].createElement(E["default"],{prefixCls:r,vertical:d,marks:a,dots:s,step:l,included:u,lowerBound:this.getLowerBound(),upperBound:this.getUpperBound(),max:h,min:p}),b,_["default"].createElement(M["default"],{className:r+"-mark",vertical:d,marks:a,included:u,lowerBound:this.getLowerBound(),upperBound:this.getUpperBound(),max:h,min:p}),m)},t}(e),t.displayName="ComponentEnhancer("+e.displayName+")",t.propTypes=(0,c["default"])({},e.propTypes,{min:b.PropTypes.number,max:b.PropTypes.number,step:b.PropTypes.number,marks:b.PropTypes.object,included:b.PropTypes.bool,className:b.PropTypes.string,prefixCls:b.PropTypes.string,disabled:b.PropTypes.bool,children:b.PropTypes.any,onBeforeChange:b.PropTypes.func,onChange:b.PropTypes.func,onAfterChange:b.PropTypes.func,handle:b.PropTypes.func,dots:b.PropTypes.bool,vertical:b.PropTypes.bool,style:b.PropTypes.object}),t.defaultProps=(0,c["default"])({},e.defaultProps,{prefixCls:"rc-slider",className:"",min:0,max:100,step:1,marks:{},handle:function(e){var t=e.index,n=(0,l["default"])(e,["index"]);return delete n.dragging,delete n.value,_["default"].createElement(N["default"],(0,c["default"])({},n,{key:t}))},onBeforeChange:i,onChange:i,onAfterChange:i,included:!0,disabled:!1,dots:!1,vertical:!1}),n}Object.defineProperty(t,"__esModule",{value:!0});var s=n(26),l=o(s),u=n(7),c=o(u),d=n(6),f=o(d),p=n(2),h=o(p),m=n(4),v=o(m),y=n(3),g=o(y);t["default"]=a;var b=n(1),_=o(b),T=n(45),C=o(T),x=n(5),w=o(x),P=n(66),S=(o(P),n(358)),E=o(S),O=n(357),M=o(O),k=n(106),N=o(k),D=n(67),R=r(D);e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n,r){var o=t&&t.antLocale&&t.antLocale[n]?t.antLocale[n]:r(),i=(0,s["default"])({},o);return e.locale&&(i=(0,s["default"])(i,e.locale),e.locale.lang&&(i.lang=(0,s["default"])({},o.lang,e.locale.lang))),i}function i(e){var t=e.antLocale&&e.antLocale.locale;return e.antLocale&&e.antLocale.exist&&!t?"zh-cn":t}Object.defineProperty(t,"__esModule",{value:!0}),t.getComponentLocale=o,t.getLocaleCode=i;var a=n(11),s=r(a)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(6),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(5),m=r(h),v=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t,n=this.props,r=n.text,o=n.prefixCls,a=n.overflowCount,s=n.className,l=n.style,u=n.children,c=n.hot,d=this.props.dot,f=this.props.size,h=this.props.corner;r=r>a?a+"+":r,d&&(r="");var v=!(r&&"0"!==r||d),y=(0,m["default"])((e={},(0,i["default"])(e,o+"-dot",d),(0,i["default"])(e,o+"-dot-large",d&&"large"===f),(0,i["default"])(e,o+"-text",!d&&!h),(0,i["default"])(e,o+"-corner",h),(0,i["default"])(e,o+"-corner-large",h&&"large"===f),e)),g=(0,m["default"])((t={},(0,i["default"])(t,s,!!s),(0,i["default"])(t,o,!0),(0,i["default"])(t,o+"-not-a-wrapper",!u),(0,i["default"])(t,o+"-corner-wrapper",h),(0,i["default"])(t,o+"-hot",!!c),(0,i["default"])(t,o+"-corner-wrapper-large",h&&"large"===f),t));return p["default"].createElement("span",{className:g,title:r},u,!v&&p["default"].createElement("sup",{className:y,style:l}," ",r," "))},t}(p["default"].Component);t["default"]=v,v.defaultProps={
prefixCls:"am-badge",text:null,dot:!1,corner:!1,overflowCount:99,size:null},e.exports=t["default"]},[480,179],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),i=r(o),a=n(6),s=r(a),l=n(2),u=r(l),c=n(4),d=r(c),f=n(3),p=r(f),h=n(1),m=r(h),v=n(5),y=r(v),g=n(258),b=r(g),_=n(11),T=r(_),C=function(e){function t(n){(0,u["default"])(this,t);var r=(0,d["default"])(this,e.call(this,n));return r.onChange=function(e){r.setState({selectedIndex:e},function(){r.props.afterChange&&r.props.afterChange(e)})},r.state={selectedIndex:r.props.selectedIndex},r}return(0,p["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.className,r=t.prefixCls,o=(0,T["default"])({},this.props);o=(0,T["default"])(o,{wrapAround:o.infinite,slideIndex:o.selectedIndex,beforeSlide:o.beforeChange});var a=[],l=this.state.selectedIndex;o.dots&&(a=[{component:m["default"].createClass({displayName:"component",render:function(){for(var e=this.props,t=e.slideCount,n=e.slidesToScroll,o=[],i=0;i<t;i+=n)o.push(i);var a=o.map(function(e){var t,n=(0,y["default"])((t={},(0,s["default"])(t,r+"-wrap-dot",!0),(0,s["default"])(t,r+"-wrap-dot-active",e===l),t));return m["default"].createElement("div",{className:n,key:e},m["default"].createElement("span",null))});return m["default"].createElement("div",{className:r+"-wrap"},a)}}),position:"BottomCenter"}]),["infinite","selectedIndex","beforeChange","afterChange","dots"].forEach(function(e){o.hasOwnProperty(e)&&delete o[e]});var u=(0,y["default"])((e={},(0,s["default"])(e,n,n),(0,s["default"])(e,r,!0),(0,s["default"])(e,r+"-vertical",o.vertical),e));return m["default"].createElement(b["default"],(0,i["default"])({},o,{className:u,decorators:a,afterSlide:this.onChange}))},t}(m["default"].Component);t["default"]=C,C.defaultProps={prefixCls:"am-carousel",dots:!0,arrows:!1,autoplay:!1,infinite:!1,edgeEasing:"linear",cellAlign:"center",selectedIndex:0},e.exports=t["default"]},[480,182],[482,183],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n=(0,c["default"])(e,["renderHeader","renderFooter","renderSectionHeader","renderBodyComponent"]),r=(0,a["default"])(n,2),o=r[0],i=o.renderHeader,s=o.renderFooter,u=o.renderSectionHeader,d=o.renderBodyComponent,f=r[1],h=e.listPrefixCls,m={renderHeader:null,renderFooter:null,renderSectionHeader:null,renderBodyComponent:d||function(){return l["default"].createElement("div",{className:h+"-body"})}};return i&&(m.renderHeader=function(){return l["default"].createElement("div",{className:h+"-header"},i())}),s&&(m.renderFooter=function(){return l["default"].createElement("div",{className:h+"-footer"},s())}),u&&(m.renderSectionHeader=t?function(e,t){return l["default"].createElement("div",null,l["default"].createElement(p,{prefixCls:h},u(e,t)))}:function(e,t){return l["default"].createElement(p,{prefixCls:h},u(e,t))}),{restProps:f,extraProps:m}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(37),a=r(i);t["default"]=o;var s=n(1),l=r(s),u=n(47),c=r(u),d=n(29),f=r(d),p=f["default"].Item;e.exports=t["default"]},[480,199],function(e,t,n){"use strict";n(116),n(200)},[482,204],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return f&&(f.destroy(),f=null),f=u["default"].newInstance({prefixCls:p,style:{top:e?0:"50%"},transitionName:"am-fade",className:e?p+"-mask":""})}function i(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,i=arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],l={info:"",success:n(154),fail:n(153),offline:n(152),loading:"loading"}[t],u=o(a);u.notice({duration:r,style:{},content:l?s["default"].createElement("div",{className:p+"-text "+p+"-text-icon"},s["default"].createElement(d["default"],{type:l,size:"lg"}),s["default"].createElement("div",{className:p+"-text-info"},e)):s["default"].createElement("div",{className:p+"-text"},s["default"].createElement("div",null,e)),onClose:function(){i&&i(),u.destroy(),u=null,f=null}})}Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),s=r(a),l=n(237),u=r(l),c=n(14),d=r(c),f=void 0,p="am-toast";t["default"]={SHORT:3,LONG:8,show:function(e,t,n){return i(e,"info",t,function(){},n)},info:function(e,t,n,r){return i(e,"info",t,n,r)},success:function(e,t,n,r){return i(e,"success",t,n,r)},fail:function(e,t,n,r){return i(e,"fail",t,n,r)},offline:function(e,t,n,r){return i(e,"offline",t,n,r)},loading:function(e,t,n,r){return i(e,"loading",t,n,r)},hide:function(){f&&(f.destroy(),f=null)}},e.exports=t["default"]},[481,221],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(2),i=r(o),a=n(4),s=r(a),l=n(3),u=r(l),c=n(1),d=r(c),f=n(11),p=r(f),h=function(e){function t(){return(0,i["default"])(this,t),(0,s["default"])(this,e.apply(this,arguments))}return(0,u["default"])(t,e),t.prototype.render=function(){var e=(0,p["default"])({},this.props);if(Array.isArray(e.style)){var t={};e.style.forEach(function(e){(0,p["default"])(t,e)}),e.style=t}var n=e.Component;return d["default"].createElement(n,e)},t}(d["default"].Component);t["default"]=h,h.defaultProps={Component:"div"},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(6),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(5),m=r(h),v=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,r=t.size,o=t.className,a=t.children,s=t.style,l=(0,m["default"])((e={},(0,i["default"])(e,""+n,!0),(0,i["default"])(e,n+"-"+r,!0),(0,i["default"])(e,o,!!o),e));return p["default"].createElement("div",{className:l,style:s},a)},t}(p["default"].Component);t["default"]=v,v.defaultProps={prefixCls:"am-wingblank",size:"lg"},e.exports=t["default"]},[480,223],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var o=n(463),i=r(o);t["default"]=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return(0,i["default"])(e)}},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(6),i=r(o),a=n(7),s=r(a),l=n(1),u=r(l),c=n(5),d=r(c),f={"float":"right"};t["default"]={getDefaultProps:function(){return{styles:{}}},onTabClick:function(e){this.props.onTabClick(e)},getTabs:function(){var e=this,t=this.props,n=t.panels,r=t.activeKey,o=[],i=t.prefixCls;return u["default"].Children.forEach(n,function(t){if(t){var n=t.key,a=r===n?i+"-tab-active":"";a+=" "+i+"-tab";var l={};t.props.disabled?a+=" "+i+"-tab-disabled":l={onClick:e.onTabClick.bind(e,n)};var c={};r===n&&(c.ref="activeTab"),o.push(u["default"].createElement("div",(0,s["default"])({role:"tab","aria-disabled":t.props.disabled?"true":"false","aria-selected":r===n?"true":"false"},l,{className:a,key:n},c),t.props.tab))}}),o},getRootNode:function(e){var t,n=this.props,r=n.prefixCls,o=n.onKeyDown,a=n.className,s=n.extraContent,l=n.style,c=(0,d["default"])((t={},(0,i["default"])(t,r+"-bar",1),(0,i["default"])(t,a,!!a),t));return u["default"].createElement("div",{role:"tablist",className:c,tabIndex:"0",ref:"root",onKeyDown:o,style:l},s?u["default"].createElement("div",{style:f,key:"extra"},s):null,e)}},e.exports=t["default"]},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(6),i=r(o),a=n(1),s=r(a),l=n(5),u=r(l),c=s["default"].createClass({displayName:"TabPane",propTypes:{className:a.PropTypes.string,active:a.PropTypes.bool,style:a.PropTypes.any,destroyInactiveTabPane:a.PropTypes.bool,forceRender:a.PropTypes.bool,placeholder:a.PropTypes.node},getDefaultProps:function(){return{placeholder:null}},render:function(){var e,t=this.props,n=t.className,r=t.destroyInactiveTabPane,o=t.active,a=t.forceRender;this._isActived=this._isActived||o;var l=t.rootPrefixCls+"-tabpane",c=(0,u["default"])((e={},(0,i["default"])(e,l,1),(0,i["default"])(e,l+"-inactive",!o),(0,i["default"])(e,l+"-active",o),(0,i["default"])(e,n,n),e)),d=r?o:this._isActived;return s["default"].createElement("div",{style:t.style,role:"tabpanel","aria-hidden":t.active?"false":"true",className:c},d||a?t.children:t.placeholder)}});t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.TabPane=t["default"]=void 0;var o=n(479),i=r(o),a=n(126),s=r(a);t["default"]=i["default"],t.TabPane=s["default"]},function(e,t,n){function r(e){return n(o(e))}function o(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./accordion/style/index.web.tsx":362,"./action-sheet/style/index.web.tsx":364,"./activity-indicator/style/index.web.tsx":366,"./badge/style/index.web.tsx":111,"./button/style/index.web.tsx":69,"./card/style/index.web.tsx":371,"./carousel/style/index.web.tsx":113,"./checkbox/style/index.web.tsx":114,"./create-tooltip/style/index.web.tsx":376,"./date-picker/style/index.web.tsx":379,"./drawer/style/index.web.tsx":382,"./flex/style/index.web.tsx":36,"./grid/style/index.web.tsx":386,"./icon/style/index.web.tsx":16,"./image-picker/style/index.web.tsx":388,"./input-item/style/index.web.tsx":391,"./list-view/style/index.web.tsx":394,"./list/style/index.web.tsx":25,"./locale-provider/style/index.web.tsx":397,"./menu/style/index.web.tsx":400,"./modal/style/index.web.tsx":404,"./nav-bar/style/index.web.tsx":406,"./notice-bar/style/index.web.tsx":409,"./pagination/style/index.web.tsx":412,"./picker-view/style/index.web.tsx":116,"./picker/style/index.web.tsx":117,"./popover/style/index.web.tsx":419,"./popup/style/index.web.tsx":421,"./progress/style/index.web.tsx":423,"./radio/style/index.web.tsx":118,"./range/style/index.web.tsx":427,"./refresh-control/style/index.web.tsx":429,"./result/style/index.web.tsx":431,"./search-bar/style/index.web.tsx":434,"./segmented-control/style/index.web.tsx":436,"./slider/style/index.web.tsx":438,"./stepper/style/index.web.tsx":440,"./steps/style/index.web.tsx":442,"./swipe-action/style/index.web.tsx":444,"./switch/style/index.web.tsx":446,"./tab-bar/style/index.web.tsx":449,"./table/style/index.web.tsx":451,"./tabs/style/index.web.tsx":453,"./tag/style/index.web.tsx":455,"./text/style/index.web.tsx":457,"./textarea-item/style/index.web.tsx":459,"./toast/style/index.web.tsx":120,"./view/style/index.web.tsx":460,"./white-space/style/index.web.tsx":462,"./wing-blank/style/index.web.tsx":123};r.keys=function(){return Object.keys(i)},r.resolve=o,e.exports=r,r.id=128},function(e,t,n){function r(e){return n(o(e))}function o(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./check-circle-o.svg":130,"./check-circle.svg":131,"./check.svg":132,"./cross-circle-o.svg":133,"./cross-circle.svg":134,"./cross.svg":135,"./down.svg":136,"./ellipsis-circle.svg":137,"./ellipsis.svg":138,"./exclamation-circle.svg":139,"./info-circle.svg":140,"./koubei-o.svg":141,"./koubei.svg":142,"./left.svg":143,"./loading.svg":144,"./question-circle.svg":145,"./right.svg":146,"./search.svg":147,"./up.svg":148};r.keys=function(){return Object.keys(i)},r.resolve=o,e.exports=r,r.id=129},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 48 48" id="check-circle-o" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs/> <g id="check-circle-o_Page-1" stroke="none" stroke-width="1" fill-rule="evenodd"> <g id="check-circle-o_step-48px-对勾"> <path d="M24,48 C37.254834,48 48,37.254834 48,24 C48,10.745166 37.254834,0 24,0 C10.745166,0 0,10.745166 0,24 C0,37.254834 10.745166,48 24,48 Z M24,45 C35.5979797,45 45,35.5979797 45,24 C45,12.4020203 35.5979797,3 24,3 C12.4020203,3 3,12.4020203 3,24 C3,35.5979797 12.4020203,45 24,45 Z" id="check-circle-o_Combined-Shape"/> <polygon id="check-circle-o_Path-3" points="12.2000122 23.2000122 10 25.2999878 20 35.2000122 37.2000122 15 35 13 19.8000031 30.7999878"/> </g> </g> </symbol>';e.exports=r.add(o,"check-circle-o")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 48 48" id="check-circle" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs/> <g id="check-circle_Page-1" stroke="none" stroke-width="1" fill-rule="evenodd"> <g id="check-circle_step-48px-对勾-实心"> <path d="M24,48 C37.254834,48 48,37.254834 48,24 C48,10.745166 37.254834,0 24,0 C10.745166,0 0,10.745166 0,24 C0,37.254834 10.745166,48 24,48 Z M13.1000061,23.2000122 L10.8999939,25.2999878 L20.8999939,35.2000122 L38.1000061,15 L35.8999939,13 L20.6999969,30.7999878 L13.1000061,23.2000122 Z" id="check-circle_Combined-Shape"/> </g> </g> </symbol>';e.exports=r.add(o,"check-circle")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 44 44" id="check" ><title>Operation Icons Copy 6</title><path d="M34.538 8L38 11.518 17.808 32 8 22.033l3.462-3.518 6.346 6.45z" fill-rule="evenodd"/></symbol>';e.exports=r.add(o,"check")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 48 48" id="cross-circle-o" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Generator: Sketch 41.2 (35397) - http://www.bohemiancoding.com/sketch --> <title>step-48-错误-实心</title> <desc>Created with Sketch.</desc> <defs/> <g id="cross-circle-o_Page-1" stroke="none" stroke-width="1" fill-rule="evenodd"> <g id="cross-circle-o_step-48-错误-实心"> <path d="M24,48 C37.2552,48 48,37.2552 48,24 C48,10.7448 37.2552,0 24,0 C10.7448,0 0,10.7448 0,24 C0,37.2552 10.7448,48 24,48 Z M24.3528979,22.2299765 L16.7595141,14.6369589 C15.963097,13.8383925 15.2222827,13.8154868 14.4974902,14.4296225 C13.7726977,15.0437582 13.9375537,16.0471152 14.3727954,16.496517 L22.2249682,24.343746 L14.5037158,32.0674399 C13.7781456,32.7949682 13.9458544,33.7125204 14.4392626,34.2443808 C14.9326708,34.7762412 15.9934008,34.9267538 16.7512744,34.0698813 L24.3382495,26.4858969 L31.981621,34.1089438 C32.7780381,34.9075102 33.5898974,34.8343466 34.1933347,34.2552795 C34.796772,33.6762124 34.9135187,32.812668 34.1183231,32.0153264 L26.4613005,24.346281 L34.0048754,16.8248862 C34.8162768,16.1279868 34.9043097,15.0655787 34.3015063,14.4849204 C33.3827441,13.5999106 32.4530774,14.1466814 32.0377123,14.5631674 L24.3528979,22.2299765 Z" id="cross-circle-o_Combined-Shape"/> </g> </g> </symbol>';e.exports=r.add(o,"cross-circle-o")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 48 48" id="cross-circle" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs/> <g id="cross-circle_Page-1" stroke="none" stroke-width="1" fill-rule="evenodd"> <g id="cross-circle_step-48-错误"> <path d="M24,48 C37.2552,48 48,37.2552 48,24 C48,10.7448 37.2552,0 24,0 C10.7448,0 0,10.7448 0,24 C0,37.2552 10.7448,48 24,48 Z M24,45 C35.5983,45 45,35.5983 45,24 C45,12.4017 35.5983,3 24,3 C12.4017,3 3,12.4017 3,24 C3,35.5983 12.4017,45 24,45 Z" id="cross-circle_Combined-Shape"/> <path d="M24.3392549,22.2189068 L16.5648998,14.4445518 C15.9703079,13.8499598 15.0255464,13.8549458 14.43976,14.4407322 C13.8498895,15.0306027 13.8556836,15.9779762 14.4435795,16.5658721 L22.2179346,24.3402272 L14.4435795,32.1145823 C13.8556836,32.7024782 13.8498895,33.6498517 14.43976,34.2397221 C15.0255464,34.8255086 15.9703079,34.8304945 16.5648998,34.2359026 L24.3392549,26.4615475 L32.11361,34.2359026 C32.7082019,34.8304945 33.6529634,34.8255086 34.2387498,34.2397221 C34.8286203,33.6498517 34.8228262,32.7024782 34.2349303,32.1145823 L26.4605753,24.3402272 L34.2349303,16.5658721 C34.8228262,15.9779762 34.8286203,15.0306027 34.2387498,14.4407322 C33.6529634,13.8549458 32.7082019,13.8499598 32.11361,14.4445518 L24.3392549,22.2189068 Z" id="cross-circle_Combined-Shape"/> </g> </g> </symbol>';e.exports=r.add(o,"cross-circle")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 44 44" id="cross" > <defs/> <g id="cross_ALL-ICON" stroke-rule="evenodd" stroke-width="1" fill-rule="evenodd"> <g id="cross_Group-15" fill-rule="evenodd" transform="translate(6.000000, 6.000000)"> <rect id="cross_Rectangle-1643" opacity="0" x="0" y="0" width="22" height="22"/> <path d="M18.0084687,15.8522394 L26.9766601,6.8840479 L25.0926122,5 L16.1244208,13.9681915 L7.15622933,5 L5.27218143,6.8840479 L14.2403729,15.8522394 L5,25.0926122 L6.8840479,26.9766601 L16.1244208,17.7362872 L25.3647937,26.9766601 L27.2488416,25.0926122 L18.0084687,15.8522394 Z" id="cross_Combined-Shape"/> </g> </g> </symbol>';e.exports=r.add(o,"cross")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 44 44" id="down" ><title>Operation Icons Copy 4</title><path d="M22.355 28.237l-11.483-10.9c-.607-.576-1.714-.396-2.48.41l.674-.71c-.763.802-.73 2.071-.282 2.496l11.37 10.793-.04.039 2.088 2.196 1.098-1.043 12.308-11.682c.447-.425.48-1.694-.282-2.496l.674.71c-.766-.806-1.873-.986-2.48-.41L22.355 28.237z" fill-rule="evenodd"/></symbol>';e.exports=r.add(o,"down")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 44 44" id="ellipsis-circle" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Generator: Sketch 41.1 (35376) - http://www.bohemiancoding.com/sketch --> <title>ellipsis-circle-cp</title> <desc>Created with Sketch.</desc> <defs/> <g id="ellipsis-circle_Page-1" stroke="none" stroke-width="1" fill-rule="evenodd"> <g id="ellipsis-circle_ellipsis-circle-cp"> <g id="ellipsis-circle_Group"> <path d="M22.13,0.109 C10.049,0.109 0.255,9.903 0.255,21.984 C0.255,34.065 10.049,43.859 22.13,43.859 C34.211,43.859 44.005,34.065 44.005,21.984 C44.005,9.903 34.211,0.109 22.13,0.109 Z M22.13,40.8090008 C11.7336013,40.8090008 3.30499924,32.3803987 3.30499924,21.984 C3.30499924,11.5876013 11.7336013,3.15899924 22.13,3.15899924 C32.5263987,3.15899924 40.9550008,11.5876013 40.9550008,21.984 C40.9550008,32.3803987 32.5263987,40.8090008 22.13,40.8090008 Z" id="ellipsis-circle_Shape"/> <circle id="ellipsis-circle_Oval" cx="21.888" cy="22.701" r="2.445"/> <circle id="ellipsis-circle_Oval" cx="12.23" cy="22.701" r="2.445"/> <circle id="ellipsis-circle_Oval" cx="31.546" cy="22.701" r="2.445"/> </g> </g> </g> </symbol>';e.exports=r.add(o,"ellipsis-circle")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 44 44" id="ellipsis" xmlns:xlink="http://www.w3.org/1999/xlink"> <g> <circle cx="21.888" cy="22" r="4.045"/> <circle cx="5.913" cy="22" r="4.045"/> <circle cx="37.863" cy="22" r="4.045"/> </g> </symbol>';e.exports=r.add(o,"ellipsis")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 64 64" id="exclamation-circle" ><title>Share Icons Copy 3</title><path d="M59.58 40.889L41.193 9.11C39.135 5.382 35.723 3 31.387 3c-3.11 0-6.521 2.382-8.58 6.111L4.42 40.89C1.632 45.525 1.294 49.7 3.195 53.11 5.015 56.208 7.572 58 13 58h36.773c5.428 0 9.21-1.792 11.031-4.889 1.9-3.41 1.564-7.584-1.225-12.222zm-2.452 11c-.635 1.695-3.802 2.444-7.354 2.444H13c-3.591 0-5.493-.75-6.129-2.444-1.712-2.41-1.375-5.262 0-8.556l18.386-31.777c2.116-3.168 4.394-4.89 6.13-4.89 2.96 0 5.238 1.722 7.354 4.89l18.386 31.777c1.374 3.294 1.713 6.146 0 8.556zm-25.74-33c-.405 0-1.227.836-1.227 2.444v15.89c0 1.608.822 2.444 1.226 2.444 1.628 0 2.452-.836 2.452-2.445V21.333c0-1.608-.824-2.444-2.452-2.444zm0 23.222c-.405 0-1.227.788-1.227 1.222v2.445c0 .434.822 1.222 1.226 1.222 1.628 0 2.452-.788 2.452-1.222v-2.445c0-.434-.824-1.222-2.452-1.222z" fill-rule="evenodd"/></symbol>';e.exports=r.add(o,"exclamation-circle")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 44 44" id="info-circle" xmlns:xlink="http://www.w3.org/1999/xlink"> <g> <circle cx="13.828" cy="19.63" r="1.938"/> <circle cx="21.767" cy="19.63" r="1.938"/> <circle cx="29.767" cy="19.63" r="1.938"/> <path d="M22.102,4.161c-9.918,0-17.958,7.146-17.958,15.961c0,4.935,2.522,9.345,6.481,12.273v5.667l0.038,0.012\r\n\t\tc0.182,1.28,1.272,2.267,2.602,2.267c0.747,0,1.419-0.313,1.899-0.812l0.002,0.001l5.026-3.539\r\n\t\tc0.628,0.059,1.265,0.093,1.911,0.093c9.918,0,17.958-7.146,17.958-15.961C40.06,11.307,32.02,4.161,22.102,4.161z M22.062,34.062\r\n\t\tc-0.902,0-1.781-0.081-2.642-0.207l-5.882,4.234c-0.024,0.025-0.055,0.04-0.083,0.06l-0.008,0.006l0,0\r\n\t\tc-0.083,0.055-0.177,0.095-0.284,0.095c-0.29,0-0.525-0.235-0.525-0.525l0.005-6.375c-3.91-2.516-6.456-6.544-6.456-11.1\r\n\t\tc0-7.628,7.107-13.812,15.875-13.812s15.875,6.184,15.875,13.812S30.83,34.062,22.062,34.062z"/> </g> </symbol>';e.exports=r.add(o,"info-circle")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 43 38" id="koubei-o" xmlns:xlink="http://www.w3.org/1999/xlink"> <g> <path d="M37.75,0.227H5.25c-3.125,0-4.59,2.425-4.59,4.315v8.03c0,9.346,5.751,17.213,13.64,20.35\r\n\t\tc0.129,0.049,0.242,0.135,0.325,0.246c0.145,0.207,0.128,0.409,0.128,0.409l0.001,2.033c0,0,0.241,0.743,0.667,1.167\r\n\t\tc0.254,0.254,0.899,0.545,1.201,0.577c0.929,0.099,2.059,0.226,4.716-0.125c4.85-0.649,9.406-2.706,13.111-5.918\r\n\t\tc6.157-5.345,8.549-12.549,8.549-18.738V4.625C42.998,2.735,41.792,0.227,37.75,0.227z M41.037,13.272\r\n\t\tc0,5.58-2.277,11.784-7.87,16.603c-3.366,2.896-7.511,4.831-11.917,5.417c-2.413,0.317-3.347,0.186-4.191,0.096\r\n\t\tc-0.275-0.029-0.496-0.076-0.392-1.013c0.104-1.958-0.194-2.156-0.325-2.342c-0.076-0.1-0.261-0.287-0.378-0.332\r\n\t\tC8.797,28.874,2.577,21.698,2.577,13.272V5.203c0-1.703,0.335-3.06,3.173-3.06h31.292c3.671,0,3.995,1.174,3.995,2.878V13.272z"/> <path d="M32.531,19.444c-0.336,0-0.62,0.171-0.809,0.42l-0.01-0.007l-0.002-0.001\r\n\t\tc-2.083,3.131-5.64,5.196-9.682,5.196c-6.419,0-11.623-5.204-11.623-11.623h-0.038c-0.02-0.552-0.467-0.995-1.023-0.995\r\n\t\tc-0.556,0-1.003,0.443-1.023,0.995H8.314c0,0.01,0.001,0.019,0.001,0.029c0,0.003-0.001,0.005-0.001,0.007\r\n\t\tc0,0.004,0.002,0.008,0.002,0.012c0.026,7.552,6.154,13.667,13.713,13.667c4.757,0,8.945-2.423,11.406-6.101\r\n\t\tc0,0,0.127-0.368,0.127-0.57C33.561,19.905,33.1,19.444,32.531,19.444z"/> <ellipse cx="35.456" cy="12.506" rx="1.95" ry="1.918"/> </g> </symbol>';e.exports=r.add(o,"koubei-o")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 43 38" id="koubei" ><title>口碑</title><g fill-rule="evenodd"><path d="M4.921 1.227c-1.814 0-3.284 1.452-3.284 3.243v8.459c0 8.86 6.073 16.517 13.589 19.49a.701.701 0 0 1 .31.233c.138.196.122.388.122.388v2.148s-.012.463.393.865c.242.241.506.338.794.368.885.094 1.962.214 4.493-.119a23.972 23.972 0 0 0 12.492-5.61c5.866-5.067 8.145-11.896 8.145-17.763V4.563c0-1.792-1.47-3.336-3.285-3.336H4.92z"/><path d="M33.506 12.506c0-1.06.873-1.918 1.95-1.918 1.078 0 1.95.858 1.95 1.918 0 1.059-.872 1.918-1.95 1.918-1.077 0-1.95-.86-1.95-1.918z" fill="#FFF"/><path d="M9.127 13.465c0 6.087 5.564 12.847 12.626 12.784 3.336-.03 8.006-1.522 10.778-5.784" stroke="#FFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></g></symbol>';e.exports=r.add(o,"koubei")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 44 44" id="left" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Operation Icons Copy 4</title> <g> <defs> <rect id="left_SVGID_1_" x="-129" y="-845" width="24" height="24"/> </defs> <clipPath id="left_SVGID_2_"> <use xlink:href="#left_SVGID_1_" overflow="visible"/> </clipPath> <g clip-path="url(#left_SVGID_2_)"> <defs> <rect id="left_SVGID_3_" x="-903" y="-949" width="1850" height="1945"/> </defs> <clipPath id="left_SVGID_4_"> <use xlink:href="#left_SVGID_3_" overflow="visible"/> </clipPath> <rect x="-134" y="-850" opacity="0" clip-path="url(#left_SVGID_4_)" fill="#D8D8D8" width="34" height="34"/> </g> </g> <polygon points="16.247,21.399 28.48,9.166 30.601,11.287 20.483,21.406 30.601,31.524 28.48,33.645 16.247,21.412 16.254,21.406 \r\n\t"/> </symbol>';e.exports=r.add(o,"left")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 -2 59.75 60.25" id="loading" > <path fill="#cccccc" d="M29.691-.527c-15.648 0-28.333 12.685-28.333 28.333s12.685 28.333 28.333 28.333c15.648 0 28.333-12.685 28.333-28.333S45.339-.527 29.691-.527zm.184 53.75c-14.037 0-25.417-11.379-25.417-25.417S15.838 2.39 29.875 2.39s25.417 11.379 25.417 25.417-11.38 25.416-25.417 25.416z"/> <path fill="none" stroke="#108ee9" stroke-width="3" stroke-linecap="round" stroke-miterlimit="10" d="M56.587 29.766c.369-7.438-1.658-14.699-6.393-19.552"/> </symbol>';e.exports=r.add(o,"loading")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 44 44" id="question-circle" ><title>Operation Icons Copy 12</title><g fill-rule="evenodd"><path d="M21.186 3C10.333 3 1.827 11.506 1.827 22.358 1.827 32.494 10.333 41 21.186 41c10.133 0 18.641-8.506 18.641-18.642C39.827 11.506 31.32 3 21.186 3m15.641 19c0 8.823-7.179 16-16 16-8.823 0-16-7.177-16-16s7.177-16 16-16c8.821 0 16 7.177 16 16z"/><path d="M22.827 31.5a1.5 1.5 0 1 1-2.999.001 1.5 1.5 0 0 1 3-.001"/><path d="M26.827 16.02c0 .957-.203 1.822-.61 2.593-.427.792-1.117 1.612-2.073 2.457-.867.734-1.453 1.435-1.754 2.096-.302.7-.453 1.693-.453 2.979a.828.828 0 0 1-.823.855.828.828 0 0 1-.584-.22.877.877 0 0 1-.24-.635c0-1.305.168-2.38.506-3.227.336-.883.93-1.682 1.779-2.4 1.01-.883 1.71-1.692 2.1-2.428.337-.645.504-1.38.504-2.209-.018-.936-.3-1.7-.85-2.289-.654-.717-1.62-1.075-2.896-1.075-1.506 0-2.596.535-3.269 1.6-.46.754-.689 1.645-.689 2.677 0 .257-.09.477-.266.66a.747.747 0 0 1-.558.25.73.73 0 0 1-.585-.194c-.16-.164-.239-.393-.239-.69 0-1.819.584-3.272 1.754-4.357C18.644 11.486 19.927 11 21.433 11h.293c1.452 0 2.638.414 3.561 1.241 1.027.902 1.54 2.162 1.54 3.78z"/></g></symbol>';e.exports=r.add(o,"question-circle")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 44 44" id="right" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Operation Icons Copy 4</title> <g> <defs> <rect id="right_SVGID_1_" x="-129" y="-845" width="24" height="24"/> </defs> <clipPath id="right_SVGID_2_"> <use xlink:href="#right_SVGID_1_" overflow="visible"/> </clipPath> <g clip-path="url(#right_SVGID_2_)"> <defs> <rect id="right_SVGID_3_" x="-903" y="-949" width="1850" height="1945"/> </defs> <clipPath id="right_SVGID_4_"> <use xlink:href="#right_SVGID_3_" overflow="visible"/> </clipPath> <rect x="-134" y="-850" opacity="0" clip-path="url(#right_SVGID_4_)" fill="#D8D8D8" width="34" height="34"/> </g> </g> <polygon points="30.601,21.399 18.368,9.166 16.247,11.287 26.365,21.406 16.247,31.524 18.368,33.645 30.601,21.412 30.595,21.406 \r\n\t"/> </symbol>';e.exports=r.add(o,"right")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 44 44" id="search" ><title>System Icons Copy 8</title><path d="M32.981 29.255l8.914 8.293L39.603 40l-8.859-8.242a15.952 15.952 0 0 1-10.754 4.147C11.16 35.905 4 28.763 4 19.952 4 11.142 11.16 4 19.99 4s15.99 7.142 15.99 15.952c0 3.472-1.112 6.685-2.999 9.303zm.05-9.21c0 7.123-5.701 12.918-12.88 12.918-7.177 0-13.016-5.795-13.016-12.918 0-7.12 5.839-12.917 13.017-12.917 7.178 0 12.879 5.797 12.879 12.917z" fill-rule="evenodd"/></symbol>';e.exports=r.add(o,"search")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 44 44" id="up" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Operation Icons Copy 4</title> <g> <title>background</title> <rect x="-1" y="-1" width="46" height="46" id="up_canvas_background" fill="none"/> </g> <g> <title>Layer 1</title> <g id="up_svg_1"> <defs> <rect id="up_SVGID_1_" x="-129" y="-845" width="24" height="24"/> </defs> <clipPath id="up_SVGID_2_"> <use xlink:href="#up_SVGID_1_" id="up_svg_2"/> </clipPath> <g clip-path="url(#up_SVGID_2_)" id="up_svg_3"> <defs> <rect id="up_SVGID_3_" x="-903" y="-949" width="1850" height="1945"/> </defs> <clipPath id="up_SVGID_4_"> <use xlink:href="#up_SVGID_3_" id="up_svg_4"/> </clipPath> <rect x="-134" y="-850" opacity="0" clip-path="url(#up_SVGID_4_)" fill="#D8D8D8" width="34" height="34" id="up_svg_5"/> </g> </g> <polygon points="30.601,21.399 18.368,9.166 16.247,11.287 26.365,21.406 16.247,31.524 18.368,33.645 30.601,21.412 30.595,21.406 " id="up_svg_6" transform="rotate(-90 23.423999786376957,21.405500411987305) "/> </g> </symbol>';e.exports=r.add(o,"up")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 38 33" id="trips" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Generator: Sketch 40.3 (33839) - http://www.bohemiancoding.com/sketch --> <title>trips</title> <desc>Created with Sketch.</desc> <g id="trips_Page-1" stroke="none" stroke-width="1" fill-rule="evenodd"> <g id="trips_trips" transform="translate(-3.000000, -6.000000)"> <g id="trips_公告" transform="translate(3.000000, 6.000000)"> <g id="trips_Group"> <g id="trips_Clipped"> <g id="trips_SVGID_1_"/> <path d="M17.8380885,28.8008456 C17.2741703,28.3318378 16.6455959,27.816834 16.0021839,27.3037838 C11.7577003,23.9185869 10.7075891,23.6354324 9.99594098,23.6354324 C9.98183655,23.6354324 9.96876731,23.6390425 9.95483541,23.6394672 C9.94090352,23.6390425 9.92774801,23.6354324 9.91372985,23.6354324 L3.56156186,23.6354324 C2.82839047,23.6354324 2.65879228,23.431529 2.65879228,22.7067181 L2.65879228,10.0854286 C2.65879228,9.59442085 2.71775482,9.28574131 3.32014756,9.28574131 L9.10192736,9.28574131 C9.79489898,9.28574131 10.8596322,9.00560232 15.5026629,5.65680309 C16.3303814,5.06 17.1386901,4.460139 17.8381317,3.93392278 L17.8381317,28.8008456 L17.8380885,28.8008456 L17.8380885,28.8008456 Z M19.6822747,0.191416988 C19.2187696,-0.0285830116 18.6682656,0.0318532819 18.265319,0.347413127 C18.2459955,0.362745174 16.2823314,1.89938996 14.1134415,3.47234749 C10.340874,6.2085444 9.24266969,6.66417375 9.01988876,6.73658687 L3.67638138,6.73658687 C3.64929398,6.73658687 3.62332804,6.74015444 3.59641317,6.74066409 L1.18330533,6.74066409 C0.574960272,6.74066409 0.0818660613,7.22619305 0.0818660613,7.82520463 L0.0818660613,25.1392046 C0.0818660613,25.7381313 0.574960272,26.2237452 1.18330533,26.2237452 L9.89440636,26.2240849 C10.1138229,26.3026988 11.1503042,26.7748069 14.4976686,29.4626718 C16.4448558,31.0260309 18.1924245,32.5521853 18.2098502,32.5672625 C18.4601067,32.7860309 18.7780817,32.9002355 19.1001975,32.9002355 C19.2858842,32.9002355 19.4731237,32.8620965 19.6493212,32.7841197 C20.130597,32.5710425 20.4401612,32.1000386 20.4401612,31.5801506 L20.4401612,1.38022394 C20.4404631,0.873714286 20.1458229,0.411586873 19.6822747,0.191416988 L19.6822747,0.191416988 Z" id="trips_Shape" mask="url(#mask-2)"/> </g> <g id="trips_Clipped"> <g id="trips_SVGID_1_"/> <path d="M31.41884,16.4745174 C31.41884,13.1115328 29.566286,10.177888 26.8136368,8.5987722 C26.688681,8.53366409 26.3941703,8.40794981 26.1889875,8.40794981 C25.5777094,8.40794981 25.0820704,8.89598456 25.0820704,9.49788417 C25.0820704,9.90182625 25.3007106,10.2621931 25.6320999,10.4504672 C27.7604881,11.6411853 29.1970692,13.8919807 29.1970692,16.4745174 C29.1970692,19.1024131 27.7105403,21.388417 25.5202565,22.5618494 C25.2015914,22.7531815 24.9901975,23.1012741 24.9901975,23.4957452 C24.9901975,24.0976448 25.4858365,24.585722 26.0971146,24.585722 C26.3568604,24.587973 26.6645267,24.4372008 26.6645267,24.4372008 C29.5000772,22.8798301 31.41884,19.8984903 31.41884,16.4745174" id="trips_Shape" mask="url(#mask-4)"/> </g> <g id="trips_Clipped"> <g id="trips_SVGID_1_"/> <path d="M30.1410306,3.05655598 C29.9354597,2.93530116 29.7303201,2.83642857 29.4821771,2.83642857 C28.8739183,2.83642857 28.3807378,3.32195753 28.3807378,3.92096911 C28.3807378,4.35255985 28.6413462,4.69980309 29.0094847,4.89669884 C33.05284,7.21977992 35.7724064,11.5325869 35.7724064,16.4745174 C35.7724064,21.4131776 33.0561612,25.7233514 29.0172917,28.0474942 C28.6629557,28.2368726 28.3577911,28.5957954 28.3577911,29.0397027 C28.3577911,29.6386293 28.8509285,30.1242432 29.4592304,30.1242432 C29.7034484,30.1242432 29.8982792,30.0318263 30.10963,29.9109112 C34.8016595,27.2147645 37.9575142,22.2096371 37.9575142,16.4745598 C37.9575142,10.7523089 34.8155482,5.75690734 30.1410306,3.05655598" id="trips_Shape" mask="url(#mask-6)"/> </g> </g> </g> </g> </g> </symbol>';e.exports=r.add(o,"trips")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 54 54" id="minus" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Generator: Sketch 42 (36781) - http://www.bohemiancoding.com/sketch --> <title>减一步54px</title> <desc>Created with Sketch.</desc> <defs> <rect id="minus_path-1" x="0" y="0" width="54" height="54" rx="6"/> <mask id="minus_mask-2" maskContentUnits="userSpaceOnUse" maskUnits="objectBoundingBox" x="0" y="0" width="54" height="54" fill="white"> <use xlink:href="#minus_path-1"/> </mask> </defs> <g id="minus_壹乐" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="minus_Stepper步进器" transform="translate(-1190.000000, -2026.000000)"> <g id="minus_减一步54px" transform="translate(1190.000000, 2026.000000)"> <use id="minus_Rectangle-26-Copy-24" stroke="#D9D9D9" mask="url(#minus_mask-2)" stroke-width="4" fill="#FFFFFF" xlink:href="#minus_path-1"/> <path d="M13,27 L41,27" id="minus_Line" stroke="#000000" stroke-width="2" stroke-linecap="square"/> </g> </g> </g> </symbol>';
e.exports=r.add(o,"minus")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 54 54" id="plus" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Generator: Sketch 42 (36781) - http://www.bohemiancoding.com/sketch --> <title>加一步54px</title> <desc>Created with Sketch.</desc> <defs> <rect id="plus_path-1" x="0" y="0" width="54" height="54" rx="6"/> <mask id="plus_mask-2" maskContentUnits="userSpaceOnUse" maskUnits="objectBoundingBox" x="0" y="0" width="54" height="54" fill="white"> <use xlink:href="#plus_path-1"/> </mask> </defs> <g id="plus_壹乐" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="plus_Stepper步进器" transform="translate(-1363.000000, -2026.000000)"> <g id="plus_加一步54px" transform="translate(1363.000000, 2026.000000)"> <use id="plus_Rectangle-26-Copy-22" stroke="#D9D9D9" mask="url(#plus_mask-2)" stroke-width="4" fill="#FFFFFF" xlink:href="#plus_path-1"/> <path d="M13,27 L41,27" id="plus_Line" stroke="#000000" stroke-width="2" stroke-linecap="square"/> <path d="M27,13 L27,41" id="plus_Line" stroke="#000000" stroke-width="2" stroke-linecap="square"/> </g> </g> </g> </symbol>';e.exports=r.add(o,"plus")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 72 72" id="dislike" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Generator: Sketch 41.2 (35397) - http://www.bohemiancoding.com/sketch --> <title>哭脸</title> <desc>Created with Sketch.</desc> <defs/> <g id="dislike_Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="dislike_哭脸"> <path d="M36,72 C55.882251,72 72,55.882251 72,36 C72,16.117749 55.882251,0 36,0 C16.117749,0 0,16.117749 0,36 C0,55.882251 16.117749,72 36,72 Z M36,70 C54.7776815,70 70,54.7776815 70,36 C70,17.2223185 54.7776815,2 36,2 C17.2223185,2 2,17.2223185 2,36 C2,54.7776815 17.2223185,70 36,70 Z" id="dislike_Combined-Shape" fill="#FFFFFF"/> <rect id="dislike_Rectangle-483" fill="#FFFFFF" x="47" y="22" width="2" height="6"/> <rect id="dislike_Rectangle-483" fill="#FFFFFF" x="23" y="22" width="2" height="6"/> <path d="M21,51 C21,51 25.5997148,44 36,44 C46.4002852,44 51,51 51,51" id="dislike_Path-534" stroke="#FFFFFF" stroke-width="2"/> </g> </g> </symbol>';e.exports=r.add(o,"dislike")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 72 72" id="fail" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Generator: Sketch 41.2 (35397) - http://www.bohemiancoding.com/sketch --> <title>失败</title> <desc>Created with Sketch.</desc> <defs/> <g id="fail_Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="fail_失败"> <path d="M36,72 C55.882251,72 72,55.882251 72,36 C72,16.117749 55.882251,0 36,0 C16.117749,0 0,16.117749 0,36 C0,55.882251 16.117749,72 36,72 Z M36,70 C54.7776815,70 70,54.7776815 70,36 C70,17.2223185 54.7776815,2 36,2 C17.2223185,2 2,17.2223185 2,36 C2,54.7776815 17.2223185,70 36,70 Z" id="fail_Combined-Shape" fill="#FFFFFF"/> <path d="M22,22 L50.3038735,50.3038735" id="fail_Path-530" stroke="#FFFFFF" stroke-width="2"/> <path d="M22,50.3038735 L50.3038735,22" id="fail_Path-530" stroke="#FFFFFF" stroke-width="2"/> </g> </g> </symbol>';e.exports=r.add(o,"fail")},function(e,t,n){var r=n(10),o='<symbol viewBox="0 0 72 72" id="success" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Generator: Sketch 41.2 (35397) - http://www.bohemiancoding.com/sketch --> <title>成功</title> <desc>Created with Sketch.</desc> <defs/> <g id="success_Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="success_成功"> <path d="M36,72 C55.882251,72 72,55.882251 72,36 C72,16.117749 55.882251,0 36,0 C16.117749,0 0,16.117749 0,36 C0,55.882251 16.117749,72 36,72 Z M36,70 C54.7776815,70 70,54.7776815 70,36 C70,17.2223185 54.7776815,2 36,2 C17.2223185,2 2,17.2223185 2,36 C2,54.7776815 17.2223185,70 36,70 Z" id="success_Combined-Shape" fill="#FFFFFF"/> <polyline id="success_Path-529" stroke="#FFFFFF" stroke-width="2" points="19 34.5404212 30.5454644 46.4633152 52.8136936 24"/> </g> </g> </symbol>';e.exports=r.add(o,"success")},function(e,t,n){function r(e){return Array.prototype.slice.call(e,0)}function o(e){return e.replace(/\(|\)/g,"\\$&")}function i(e,t,n){var i=e.querySelectorAll(u);i&&r(i).forEach(function(e){e.attributes&&r(e.attributes).forEach(function(r){var i=r.localName.toLowerCase();if(l.indexOf(i)!==-1){var a=c.exec(e.getAttribute(i));if(a&&0===a[1].indexOf(t)){var s=o(n+a[1].split(t)[1]);e.setAttribute(i,"url("+s+")")}}})})}function a(){var e=document.getElementsByTagName("base")[0],t=window.location.href.split("#")[0],n=e&&e.href;this.urlPrefix=n&&n!==t?t+f:f;var o=new s;o.sniff(),this.browser=o.browser,this.content=[],"ie"!==this.browser.name&&n&&window.addEventListener("spriteLoaderLocationUpdated",function(e){var t=this.urlPrefix,n=e.detail.newUrl.split(f)[0]+f;if(i(this.svg,t,n),this.urlPrefix=n,"firefox"===this.browser.name||"edge"===this.browser.name||"chrome"===this.browser.name&&this.browser.version[0]>=49){var o=r(document.querySelectorAll("use[*|href]"));o.forEach(function(e){var r=e.getAttribute(p);r&&0===r.indexOf(t)&&e.setAttributeNS(h,p,n+r.split(f)[1])})}}.bind(this))}var s=n(228),l=["clipPath","colorProfile","src","cursor","fill","filter","marker","markerStart","markerMid","markerEnd","mask","stroke"],u="["+l.join("],[")+"]",c=/^url\((.*)\)$/,d=function(e){for(var t=e.querySelector("defs"),n=e.querySelectorAll("symbol linearGradient, symbol radialGradient, symbol pattern"),r=0,o=n.length;r<o;r++)t.appendChild(n[r])},f="#",p="xlink:href",h="http://www.w3.org/1999/xlink",m='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="'+h+'"',v="</svg>",y="{content}";a.styles=["position:absolute","width:0","height:0","visibility:hidden"],a.spriteTemplate=function(){return m+' style="'+a.styles.join(";")+'"><defs>'+y+"</defs>"+v},a.symbolTemplate=function(){return m+">"+y+v},a.prototype.content=null,a.prototype.add=function(e,t){return this.svg&&this.appendSymbol(e),this.content.push(e),f+t},a.prototype.wrapSVG=function(e,t){var n=t.replace(y,e),r=(new DOMParser).parseFromString(n,"image/svg+xml").documentElement;return document.importNode&&(r=document.importNode(r,!0)),"ie"!==this.browser.name&&this.urlPrefix&&i(r,f,this.urlPrefix),r},a.prototype.appendSymbol=function(e){var t=this.wrapSVG(e,a.symbolTemplate()).childNodes[0];this.svg.querySelector("defs").appendChild(t),"firefox"===this.browser.name&&d(this.svg)},a.prototype.toString=function(){var e=document.createElement("div");return e.appendChild(this.render()),e.innerHTML},a.prototype.render=function(e,t){e=e||null,t="boolean"!=typeof t||t;var n=this.wrapSVG(this.content.join(""),a.spriteTemplate());return"firefox"===this.browser.name&&d(n),e&&(t&&e.childNodes[0]?e.insertBefore(n,e.childNodes[0]):e.appendChild(n)),this.svg=n,n},e.exports=a},function(e,t){/*!
* is-extendable <https://github.com/jonschlinkert/is-extendable>
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
"use strict";e.exports=function(e){return"undefined"!=typeof e&&null!==e&&("object"==typeof e||"function"==typeof e)}},function(e,t,n){/*!
* for-own <https://github.com/jonschlinkert/for-own>
*
* Copyright (c) 2014-2016, Jon Schlinkert.
* Licensed under the MIT License.
*/
"use strict";var r=n(159),o=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){r(e,function(r,i){if(o.call(e,i))return t.call(n,e[i],i,e)})}},function(e,t,n){!function(t,n){e.exports=n()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}({0:/*!*****************!*\
!*** multi lib ***!
\*****************/
function(e,t,n){e.exports=n(/*! ./index.js */169)},5:/*!******************************!*\
!*** ./~/process/browser.js ***!
\******************************/
function(e,t){function n(){u=!1,a.length?l=a.concat(l):c=-1,l.length&&r()}function r(){if(!u){var e=setTimeout(n);u=!0;for(var t=l.length;t;){for(a=l,l=[];++c<t;)a&&a[c].run();c=-1,t=l.length}a=null,u=!1,clearTimeout(e)}}function o(e,t){this.fun=e,this.array=t}function i(){}var a,s=e.exports={},l=[],u=!1,c=-1;s.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];l.push(new o(e,t)),1!==l.length||u||setTimeout(r,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=i,s.addListener=i,s.once=i,s.off=i,s.removeListener=i,s.removeAllListeners=i,s.emit=i,s.binding=function(e){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},169:/*!******************!*\
!*** ./index.js ***!
\******************/
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(/*! tween-functions */170),i=r(o),a=n(/*! raf */171),s=r(a),l="ADDITIVE",u=o.easeInOutQuad,c=300,d=0,f={ADDITIVE:"ADDITIVE",DESTRUCTIVE:"DESTRUCTIVE"},p={_rafID:null,getInitialState:function(){return{tweenQueue:[]}},componentWillUnmount:function(){s["default"].cancel(this._rafID),this._rafID=-1},tweenState:function(e,t){var n=this,r=t.easing,o=t.duration,i=t.delay,a=t.beginValue,p=t.endValue,h=t.onEnd,m=t.stackBehavior;this.setState(function(t){var v=t,y=void 0,g=void 0;if("string"==typeof e)y=e,g=e;else{for(var b=0;b<e.length-1;b++)v=v[e[b]];y=e[e.length-1],g=e.join("|")}var _={easing:r||u,duration:null==o?c:o,delay:null==i?d:i,beginValue:null==a?v[y]:a,endValue:p,onEnd:h,stackBehavior:m||l},T=t.tweenQueue;return _.stackBehavior===f.DESTRUCTIVE&&(T=t.tweenQueue.filter(function(e){return e.pathHash!==g})),T.push({pathHash:g,config:_,initTime:Date.now()+_.delay}),v[y]=_.endValue,1===T.length&&(n._rafID=(0,s["default"])(n._rafCb)),{tweenQueue:T}})},getTweeningValue:function(e){var t=this.state,n=void 0,r=void 0;if("string"==typeof e)n=t[e],r=e;else{n=t;for(var o=0;o<e.length;o++)n=n[e[o]];r=e.join("|")}for(var i=Date.now(),o=0;o<t.tweenQueue.length;o++){var a=t.tweenQueue[o],s=a.pathHash,l=a.initTime,u=a.config;if(s===r){var c=i-l>u.duration?u.duration:Math.max(0,i-l),d=0===u.duration?u.endValue:u.easing(c,u.beginValue,u.endValue,u.duration),f=d-u.endValue;n+=f}}return n},_rafCb:function(){var e=this.state;if(0!==e.tweenQueue.length){for(var t=Date.now(),n=[],r=0;r<e.tweenQueue.length;r++){var o=e.tweenQueue[r],i=o.initTime,a=o.config;t-i<a.duration?n.push(o):a.onEnd&&a.onEnd()}this._rafID!==-1&&(this.setState({tweenQueue:n}),this._rafID=(0,s["default"])(this._rafCb))}}};t["default"]={Mixin:p,easingTypes:i["default"],stackBehavior:f},e.exports=t["default"]},170:/*!************************************!*\
!*** ./~/tween-functions/index.js ***!
\************************************/
function(e,t){"use strict";var n={linear:function(e,t,n,r){var o=n-t;return o*e/r+t},easeInQuad:function(e,t,n,r){var o=n-t;return o*(e/=r)*e+t},easeOutQuad:function(e,t,n,r){var o=n-t;return-o*(e/=r)*(e-2)+t},easeInOutQuad:function(e,t,n,r){var o=n-t;return(e/=r/2)<1?o/2*e*e+t:-o/2*(--e*(e-2)-1)+t},easeInCubic:function(e,t,n,r){var o=n-t;return o*(e/=r)*e*e+t},easeOutCubic:function(e,t,n,r){var o=n-t;return o*((e=e/r-1)*e*e+1)+t},easeInOutCubic:function(e,t,n,r){var o=n-t;return(e/=r/2)<1?o/2*e*e*e+t:o/2*((e-=2)*e*e+2)+t},easeInQuart:function(e,t,n,r){var o=n-t;return o*(e/=r)*e*e*e+t},easeOutQuart:function(e,t,n,r){var o=n-t;return-o*((e=e/r-1)*e*e*e-1)+t},easeInOutQuart:function(e,t,n,r){var o=n-t;return(e/=r/2)<1?o/2*e*e*e*e+t:-o/2*((e-=2)*e*e*e-2)+t},easeInQuint:function(e,t,n,r){var o=n-t;return o*(e/=r)*e*e*e*e+t},easeOutQuint:function(e,t,n,r){var o=n-t;return o*((e=e/r-1)*e*e*e*e+1)+t},easeInOutQuint:function(e,t,n,r){var o=n-t;return(e/=r/2)<1?o/2*e*e*e*e*e+t:o/2*((e-=2)*e*e*e*e+2)+t},easeInSine:function(e,t,n,r){var o=n-t;return-o*Math.cos(e/r*(Math.PI/2))+o+t},easeOutSine:function(e,t,n,r){var o=n-t;return o*Math.sin(e/r*(Math.PI/2))+t},easeInOutSine:function(e,t,n,r){var o=n-t;return-o/2*(Math.cos(Math.PI*e/r)-1)+t},easeInExpo:function(e,t,n,r){var o=n-t;return 0==e?t:o*Math.pow(2,10*(e/r-1))+t},easeOutExpo:function(e,t,n,r){var o=n-t;return e==r?t+o:o*(-Math.pow(2,-10*e/r)+1)+t},easeInOutExpo:function(e,t,n,r){var o=n-t;return 0===e?t:e===r?t+o:(e/=r/2)<1?o/2*Math.pow(2,10*(e-1))+t:o/2*(-Math.pow(2,-10*--e)+2)+t},easeInCirc:function(e,t,n,r){var o=n-t;return-o*(Math.sqrt(1-(e/=r)*e)-1)+t},easeOutCirc:function(e,t,n,r){var o=n-t;return o*Math.sqrt(1-(e=e/r-1)*e)+t},easeInOutCirc:function(e,t,n,r){var o=n-t;return(e/=r/2)<1?-o/2*(Math.sqrt(1-e*e)-1)+t:o/2*(Math.sqrt(1-(e-=2)*e)+1)+t},easeInElastic:function(e,t,n,r){var o,i,a,s=n-t;return a=1.70158,i=0,o=s,0===e?t:1===(e/=r)?t+s:(i||(i=.3*r),o<Math.abs(s)?(o=s,a=i/4):a=i/(2*Math.PI)*Math.asin(s/o),-(o*Math.pow(2,10*(e-=1))*Math.sin((e*r-a)*(2*Math.PI)/i))+t)},easeOutElastic:function(e,t,n,r){var o,i,a,s=n-t;return a=1.70158,i=0,o=s,0===e?t:1===(e/=r)?t+s:(i||(i=.3*r),o<Math.abs(s)?(o=s,a=i/4):a=i/(2*Math.PI)*Math.asin(s/o),o*Math.pow(2,-10*e)*Math.sin((e*r-a)*(2*Math.PI)/i)+s+t)},easeInOutElastic:function(e,t,n,r){var o,i,a,s=n-t;return a=1.70158,i=0,o=s,0===e?t:2===(e/=r/2)?t+s:(i||(i=r*(.3*1.5)),o<Math.abs(s)?(o=s,a=i/4):a=i/(2*Math.PI)*Math.asin(s/o),e<1?-.5*(o*Math.pow(2,10*(e-=1))*Math.sin((e*r-a)*(2*Math.PI)/i))+t:o*Math.pow(2,-10*(e-=1))*Math.sin((e*r-a)*(2*Math.PI)/i)*.5+s+t)},easeInBack:function(e,t,n,r,o){var i=n-t;return void 0===o&&(o=1.70158),i*(e/=r)*e*((o+1)*e-o)+t},easeOutBack:function(e,t,n,r,o){var i=n-t;return void 0===o&&(o=1.70158),i*((e=e/r-1)*e*((o+1)*e+o)+1)+t},easeInOutBack:function(e,t,n,r,o){var i=n-t;return void 0===o&&(o=1.70158),(e/=r/2)<1?i/2*(e*e*(((o*=1.525)+1)*e-o))+t:i/2*((e-=2)*e*(((o*=1.525)+1)*e+o)+2)+t},easeInBounce:function(e,t,r,o){var i,a=r-t;return i=n.easeOutBounce(o-e,0,a,o),a-i+t},easeOutBounce:function(e,t,n,r){var o=n-t;return(e/=r)<1/2.75?o*(7.5625*e*e)+t:e<2/2.75?o*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?o*(7.5625*(e-=2.25/2.75)*e+.9375)+t:o*(7.5625*(e-=2.625/2.75)*e+.984375)+t},easeInOutBounce:function(e,t,r,o){var i,a=r-t;return e<o/2?(i=n.easeInBounce(2*e,0,a,o),.5*i+t):(i=n.easeOutBounce(2*e-o,0,a,o),.5*i+.5*a+t)}};e.exports=n},171:/*!************************!*\
!*** ./~/raf/index.js ***!
\************************/
function(e,t,n){(function(t){for(var r=n(/*! performance-now */172),o="undefined"==typeof window?t:window,i=["moz","webkit"],a="AnimationFrame",s=o["request"+a],l=o["cancel"+a]||o["cancelRequest"+a],u=0;!s&&u<i.length;u++)s=o[i[u]+"Request"+a],l=o[i[u]+"Cancel"+a]||o[i[u]+"CancelRequest"+a];if(!s||!l){var c=0,d=0,f=[],p=1e3/60;s=function(e){if(0===f.length){var t=r(),n=Math.max(0,p-(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(n){setTimeout(function(){throw n},0)}},Math.round(n))}return f.push({handle:++d,callback:e,cancelled:!1}),d},l=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(){l.apply(o,arguments)},e.exports.polyfill=function(){o.requestAnimationFrame=s,o.cancelAnimationFrame=l}}).call(t,function(){return this}())},172:/*!**************************************************!*\
!*** ./~/performance-now/lib/performance-now.js ***!
\**************************************************/
function(e,t,n){(function(t){(function(){var n,r,o;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:"undefined"!=typeof t&&null!==t&&t.hrtime?(e.exports=function(){return(n()-o)/1e6},r=t.hrtime,n=function(){var e;return e=r(),1e9*e[0]+e[1]},o=n()):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(/*! ./~/process/browser.js */5))}})})},function(e,t){/*!
* for-in <https://github.com/jonschlinkert/for-in>
*
* Copyright (c) 2014-2016, Jon Schlinkert.
* Licensed under the MIT License.
*/
"use strict";e.exports=function(e,t,n){for(var r in e)if(t.call(n,e[r],r,e)===!1)break}},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 a(){m&&p&&(m=!1,p.length?h=p.concat(h):v=-1,h.length&&s())}function s(){if(!m){var e=o(a);m=!0;for(var t=h.length;t;){for(p=h,h=[];++v<t;)p&&p[v].run();v=-1,t=h.length}p=null,m=!1,i(e)}}function l(e,t){this.fun=e,this.array=t}function u(){}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 p,h=[],m=!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];h.push(new l(e,t)),1!==h.length||m||o(s)},l.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=u,f.addListener=u,f.once=u,f.off=u,f.removeListener=u,f.removeAllListeners=u,f.emit=u,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}},function(e,t){(function(t){"use strict";var n="undefined"==typeof window?t:window,r=function(e,t,n){return function(r,o){var i=e(function(){t.call(this,i),r.apply(this,arguments)}.bind(this),o);return this[n]?this[n].push(i):this[n]=[i],i}},o=function(e,t){return function(n){if(this[t]){var r=this[t].indexOf(n);r!==-1&&this[t].splice(r,1)}e(n)}},i="TimerMixin_timeouts",a=o(n.clearTimeout,i),s=r(n.setTimeout,a,i),l="TimerMixin_intervals",u=o(n.clearInterval,l),c=r(n.setInterval,function(){},l),d="TimerMixin_immediates",f=o(n.clearImmediate,d),p=r(n.setImmediate,f,d),h="TimerMixin_rafs",m=o(n.cancelAnimationFrame,h),v=r(n.requestAnimationFrame,m,h),y={componentWillUnmount:function(){this[i]&&this[i].forEach(function(e){n.clearTimeout(e)}),this[i]=null,this[l]&&this[l].forEach(function(e){n.clearInterval(e)}),this[l]=null,this[d]&&this[d].forEach(function(e){n.clearImmediate(e)}),this[d]=null,this[h]&&this[h].forEach(function(e){n.cancelAnimationFrame(e)}),this[h]=null},setTimeout:s,clearTimeout:a,setInterval:c,clearInterval:u,setImmediate:p,clearImmediate:f,requestAnimationFrame:v,cancelAnimationFrame:m};e.exports=y}).call(t,function(){return this}())},function(e,t,n){(function(t){(function(){var n,r,o;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:"undefined"!=typeof t&&null!==t&&t.hrtime?(e.exports=function(){return(n()-o)/1e6},r=t.hrtime,n=function(){var e;return e=r(),1e9*e[0]+e[1]},o=n()):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(160))},function(e,t,n){(function(t){var r=n(101),o=60,i=1e3,a={},s=1,l="undefined"!=typeof window?window:void 0;l||(l="undefined"!=typeof t?t:{});var u={stop:function(e){var t=null!=a[e];return t&&(a[e]=null),t},isRunning:function(e){return null!=a[e]},start:function(e,t,n,l,u){var c=+new Date,d=c,f=0,p=0,h=s++;if(h%20===0){var m={};for(var v in a)m[v]=!0;a=m}var y=function(s){var m=s!==!0,v=+new Date;if(!a[h]||t&&!t(h))return a[h]=null,void(n&&n(o-p/((v-c)/i),h,!1));if(m)for(var g=Math.round((v-d)/(i/o))-1,b=0;b<Math.min(g,4);b++)y(!0),p++;l&&(f=(v-c)/l,f>1&&(f=1));var _=u?u(f):f;e(_,v,m)!==!1&&1!==f||!m?m&&(d=v,r(y)):(a[h]=null,n&&n(o-p/((v-c)/i),h,1===f||null==l))};return a[h]=!0,r(y),h}};e.exports=u}).call(t,function(){return this}())},function(e,t,n){var r,o=n(163),i=function(){};r=function(e,t){this.__callback=e,this.options={scrollingX:!0,scrollingY:!0,animating:!0,animationDuration:250,bouncing:!0,locking:!0,paging:!1,snapping:!1,zooming:!1,minZoom:.5,maxZoom:3,speedMultiplier:1,scrollingComplete:i,penetrationDeceleration:.03,penetrationAcceleration:.08};for(var n in t)this.options[n]=t[n]};var a=function(e){return Math.pow(e-1,3)+1},s=function(e){return(e/=.5)<1?.5*Math.pow(e,3):.5*(Math.pow(e-2,3)+2)},l={__isSingleTouch:!1,__isTracking:!1,__didDecelerationComplete:!1,__isGesturing:!1,__isDragging:!1,__isDecelerating:!1,__isAnimating:!1,__clientLeft:0,__clientTop:0,__clientWidth:0,__clientHeight:0,__contentWidth:0,__contentHeight:0,__snapWidth:100,__snapHeight:100,__refreshHeight:null,__refreshActive:!1,__refreshActivate:null,__refreshDeactivate:null,__refreshStart:null,__zoomLevel:1,__scrollLeft:0,__scrollTop:0,__maxScrollLeft:0,__maxScrollTop:0,__scheduledLeft:0,__scheduledTop:0,__scheduledZoom:0,__lastTouchLeft:null,__lastTouchTop:null,__lastTouchMove:null,__positions:null,__minDecelerationScrollLeft:null,__minDecelerationScrollTop:null,__maxDecelerationScrollLeft:null,__maxDecelerationScrollTop:null,__decelerationVelocityX:null,__decelerationVelocityY:null,setDimensions:function(e,t,n,r){var o=this;e===+e&&(o.__clientWidth=e),t===+t&&(o.__clientHeight=t),n===+n&&(o.__contentWidth=n),r===+r&&(o.__contentHeight=r),o.__computeScrollMax(),o.scrollTo(o.__scrollLeft,o.__scrollTop,!0)},setPosition:function(e,t){var n=this;n.__clientLeft=e||0,n.__clientTop=t||0},setSnapSize:function(e,t){var n=this;n.__snapWidth=e,n.__snapHeight=t},activatePullToRefresh:function(e,t,n,r){var o=this;o.__refreshHeight=e,o.__refreshActivate=t,o.__refreshDeactivate=n,o.__refreshStart=r},triggerPullToRefresh:function(){this.__publish(this.__scrollLeft,-this.__refreshHeight,this.__zoomLevel,!0),this.__refreshStart&&this.__refreshStart()},finishPullToRefresh:function(){var e=this;e.__refreshActive=!1,e.__refreshDeactivate&&e.__refreshDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)},getValues:function(){var e=this;return{left:e.__scrollLeft,top:e.__scrollTop,zoom:e.__zoomLevel}},getScrollMax:function(){var e=this;return{left:e.__maxScrollLeft,top:e.__maxScrollTop}},zoomTo:function(e,t,n,r,i){var a=this;if(!a.options.zooming)throw new Error("Zooming is not enabled!");i&&(a.__zoomComplete=i),a.__isDecelerating&&(o.stop(a.__isDecelerating),a.__isDecelerating=!1);var s=a.__zoomLevel;null==n&&(n=a.__clientWidth/2),null==r&&(r=a.__clientHeight/2),e=Math.max(Math.min(e,a.options.maxZoom),a.options.minZoom),a.__computeScrollMax(e);var l=(n+a.__scrollLeft)*e/s-n,u=(r+a.__scrollTop)*e/s-r;l>a.__maxScrollLeft?l=a.__maxScrollLeft:l<0&&(l=0),u>a.__maxScrollTop?u=a.__maxScrollTop:u<0&&(u=0),a.__publish(l,u,e,t)},zoomBy:function(e,t,n,r,o){var i=this;i.zoomTo(i.__zoomLevel*e,t,n,r,o)},scrollTo:function(e,t,n,r,i){var a=this;if(a.__isDecelerating&&(o.stop(a.__isDecelerating),a.__isDecelerating=!1),null!=r&&r!==a.__zoomLevel){if(!a.options.zooming)throw new Error("Zooming is not enabled!");e*=r,t*=r,a.__computeScrollMax(r)}else r=a.__zoomLevel;a.options.scrollingX?a.options.paging?e=Math.round(e/a.__clientWidth)*a.__clientWidth:a.options.snapping&&(e=Math.round(e/a.__snapWidth)*a.__snapWidth):e=a.__scrollLeft,a.options.scrollingY?a.options.paging?t=Math.round(t/a.__clientHeight)*a.__clientHeight:a.options.snapping&&(t=Math.round(t/a.__snapHeight)*a.__snapHeight):t=a.__scrollTop,e=Math.max(Math.min(a.__maxScrollLeft,e),0),t=Math.max(Math.min(a.__maxScrollTop,t),0),e===a.__scrollLeft&&t===a.__scrollTop&&(n=!1,i&&i()),a.__isTracking||a.__publish(e,t,r,n)},scrollBy:function(e,t,n){var r=this,o=r.__isAnimating?r.__scheduledLeft:r.__scrollLeft,i=r.__isAnimating?r.__scheduledTop:r.__scrollTop;r.scrollTo(o+(e||0),i+(t||0),n)},doMouseZoom:function(e,t,n,r){var o=this,i=e>0?.97:1.03;return o.zoomTo(o.__zoomLevel*i,!1,n-o.__clientLeft,r-o.__clientTop)},doTouchStart:function(e,t){if(null==e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);var n=this;n.__interruptedAnimation=!0,n.__isDecelerating&&(o.stop(n.__isDecelerating),n.__isDecelerating=!1,n.__interruptedAnimation=!0),n.__isAnimating&&(o.stop(n.__isAnimating),n.__isAnimating=!1,n.__interruptedAnimation=!0);var r,i,a=1===e.length;a?(r=e[0].pageX,i=e[0].pageY):(r=Math.abs(e[0].pageX+e[1].pageX)/2,i=Math.abs(e[0].pageY+e[1].pageY)/2),n.__initialTouchLeft=r,n.__initialTouchTop=i,n.__zoomLevelStart=n.__zoomLevel,n.__lastTouchLeft=r,n.__lastTouchTop=i,n.__lastTouchMove=t,n.__lastScale=1,n.__enableScrollX=!a&&n.options.scrollingX,n.__enableScrollY=!a&&n.options.scrollingY,n.__isTracking=!0,n.__didDecelerationComplete=!1,n.__isDragging=!a,n.__isSingleTouch=a,n.__positions=[]},doTouchMove:function(e,t,n){if(null==e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);var r=this;if(r.__isTracking){var o,i;2===e.length?(o=Math.abs(e[0].pageX+e[1].pageX)/2,i=Math.abs(e[0].pageY+e[1].pageY)/2):(o=e[0].pageX,i=e[0].pageY);var a=r.__positions;if(r.__isDragging){var s=o-r.__lastTouchLeft,l=i-r.__lastTouchTop,u=r.__scrollLeft,c=r.__scrollTop,d=r.__zoomLevel;if(null!=n&&r.options.zooming){var f=d;if(d=d/r.__lastScale*n,d=Math.max(Math.min(d,r.options.maxZoom),r.options.minZoom),f!==d){var p=o-r.__clientLeft,h=i-r.__clientTop;u=(p+u)*d/f-p,c=(h+c)*d/f-h,r.__computeScrollMax(d)}}if(r.__enableScrollX){u-=s*this.options.speedMultiplier;var m=r.__maxScrollLeft;(u>m||u<0)&&(r.options.bouncing?u+=s/2*this.options.speedMultiplier:u=u>m?m:0)}if(r.__enableScrollY){c-=l*this.options.speedMultiplier;var v=r.__maxScrollTop;(c>v||c<0)&&(r.options.bouncing?(c+=l/2*this.options.speedMultiplier,r.__enableScrollX||null==r.__refreshHeight||(!r.__refreshActive&&c<=-r.__refreshHeight?(r.__refreshActive=!0,r.__refreshActivate&&r.__refreshActivate()):r.__refreshActive&&c>-r.__refreshHeight&&(r.__refreshActive=!1,r.__refreshDeactivate&&r.__refreshDeactivate()))):c=c>v?v:0)}a.length>60&&a.splice(0,30),a.push(u,c,t),r.__publish(u,c,d)}else{var y=r.options.locking?3:0,g=5,b=Math.abs(o-r.__initialTouchLeft),_=Math.abs(i-r.__initialTouchTop);r.__enableScrollX=r.options.scrollingX&&b>=y,r.__enableScrollY=r.options.scrollingY&&_>=y,a.push(r.__scrollLeft,r.__scrollTop,t),r.__isDragging=(r.__enableScrollX||r.__enableScrollY)&&(b>=g||_>=g),r.__isDragging&&(r.__interruptedAnimation=!1)}r.__lastTouchLeft=o,r.__lastTouchTop=i,r.__lastTouchMove=t,r.__lastScale=n}},doTouchEnd:function(e){if(e instanceof Date&&(e=e.valueOf()),"number"!=typeof e)throw new Error("Invalid timestamp value: "+e);var t=this;if(t.__isTracking){if(t.__isTracking=!1,t.__isDragging)if(t.__isDragging=!1,t.__isSingleTouch&&t.options.animating&&e-t.__lastTouchMove<=100){for(var n=t.__positions,r=n.length-1,o=r,i=r;i>0&&n[i]>t.__lastTouchMove-100;i-=3)o=i;if(o!==r){var a=n[r]-n[o],s=t.__scrollLeft-n[o-2],l=t.__scrollTop-n[o-1];t.__decelerationVelocityX=s/a*(1e3/60),t.__decelerationVelocityY=l/a*(1e3/60);var u=t.options.paging||t.options.snapping?4:1;Math.abs(t.__decelerationVelocityX)>u||Math.abs(t.__decelerationVelocityY)>u?t.__refreshActive||t.__startDeceleration(e):t.options.scrollingComplete()}else t.options.scrollingComplete()}else e-t.__lastTouchMove>100&&t.options.scrollingComplete();t.__isDecelerating||(t.__refreshActive&&t.__refreshStart?(t.__publish(t.__scrollLeft,-t.__refreshHeight,t.__zoomLevel,!0),t.__refreshStart&&t.__refreshStart()):((t.__interruptedAnimation||t.__isDragging)&&t.options.scrollingComplete(),t.scrollTo(t.__scrollLeft,t.__scrollTop,!0,t.__zoomLevel),t.__refreshActive&&(t.__refreshActive=!1,t.__refreshDeactivate&&t.__refreshDeactivate()))),t.__positions.length=0}},__publish:function(e,t,n,r){var i=this,l=i.__isAnimating;if(l&&(o.stop(l),i.__isAnimating=!1),r&&i.options.animating){i.__scheduledLeft=e,i.__scheduledTop=t,i.__scheduledZoom=n;var u=i.__scrollLeft,c=i.__scrollTop,d=i.__zoomLevel,f=e-u,p=t-c,h=n-d,m=function(e,t,n){n&&(i.__scrollLeft=u+f*e,i.__scrollTop=c+p*e,i.__zoomLevel=d+h*e,i.__callback&&i.__callback(i.__scrollLeft,i.__scrollTop,i.__zoomLevel))},v=function(e){return i.__isAnimating===e},y=function(e,t,n){t===i.__isAnimating&&(i.__isAnimating=!1),(i.__didDecelerationComplete||n)&&i.options.scrollingComplete(),i.options.zooming&&(i.__computeScrollMax(),i.__zoomComplete&&(i.__zoomComplete(),i.__zoomComplete=null))};i.__isAnimating=o.start(m,v,y,i.options.animationDuration,l?a:s)}else i.__scheduledLeft=i.__scrollLeft=e,i.__scheduledTop=i.__scrollTop=t,i.__scheduledZoom=i.__zoomLevel=n,i.__callback&&i.__callback(e,t,n),i.options.zooming&&(i.__computeScrollMax(),i.__zoomComplete&&(i.__zoomComplete(),i.__zoomComplete=null))},__computeScrollMax:function(e){var t=this;null==e&&(e=t.__zoomLevel),t.__maxScrollLeft=Math.max(t.__contentWidth*e-t.__clientWidth,0),t.__maxScrollTop=Math.max(t.__contentHeight*e-t.__clientHeight,0)},__startDeceleration:function(e){var t=this;if(t.options.paging){var n=Math.max(Math.min(t.__scrollLeft,t.__maxScrollLeft),0),r=Math.max(Math.min(t.__scrollTop,t.__maxScrollTop),0),i=t.__clientWidth,a=t.__clientHeight;t.__minDecelerationScrollLeft=Math.floor(n/i)*i,t.__minDecelerationScrollTop=Math.floor(r/a)*a,t.__maxDecelerationScrollLeft=Math.ceil(n/i)*i,t.__maxDecelerationScrollTop=Math.ceil(r/a)*a}else t.__minDecelerationScrollLeft=0,t.__minDecelerationScrollTop=0,t.__maxDecelerationScrollLeft=t.__maxScrollLeft,t.__maxDecelerationScrollTop=t.__maxScrollTop;var s=function(e,n,r){t.__stepThroughDeceleration(r)},l=t.options.minVelocityToKeepDecelerating;l||(l=t.options.snapping?4:.001);var u=function(){var e=Math.abs(t.__decelerationVelocityX)>=l||Math.abs(t.__decelerationVelocityY)>=l;return e||(t.__didDecelerationComplete=!0),e},c=function(e,n,r){t.__isDecelerating=!1,t.scrollTo(t.__scrollLeft,t.__scrollTop,t.options.snapping,null,t.__didDecelerationComplete&&t.options.scrollingComplete)};t.__isDecelerating=o.start(s,u,c)},__stepThroughDeceleration:function(e){var t=this,n=t.__scrollLeft+t.__decelerationVelocityX,r=t.__scrollTop+t.__decelerationVelocityY;if(!t.options.bouncing){var o=Math.max(Math.min(t.__maxDecelerationScrollLeft,n),t.__minDecelerationScrollLeft);o!==n&&(n=o,t.__decelerationVelocityX=0);var i=Math.max(Math.min(t.__maxDecelerationScrollTop,r),t.__minDecelerationScrollTop);i!==r&&(r=i,t.__decelerationVelocityY=0)}if(e?t.__publish(n,r,t.__zoomLevel):(t.__scrollLeft=n,t.__scrollTop=r),!t.options.paging){var a=.95;t.__decelerationVelocityX*=a,t.__decelerationVelocityY*=a}if(t.options.bouncing){var s=0,l=0,u=t.options.penetrationDeceleration,c=t.options.penetrationAcceleration;n<t.__minDecelerationScrollLeft?s=t.__minDecelerationScrollLeft-n:n>t.__maxDecelerationScrollLeft&&(s=t.__maxDecelerationScrollLeft-n),r<t.__minDecelerationScrollTop?l=t.__minDecelerationScrollTop-r:r>t.__maxDecelerationScrollTop&&(l=t.__maxDecelerationScrollTop-r),0!==s&&(s*t.__decelerationVelocityX<=0?t.__decelerationVelocityX+=s*u:t.__decelerationVelocityX=s*c),0!==l&&(l*t.__decelerationVelocityY<=0?t.__decelerationVelocityY+=l*u:t.__decelerationVelocityY=l*c)}}};for(var u in l)r.prototype[u]=l[u];e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){for(var t=e,n=0,r=0;t&&!isNaN(t.offsetLeft)&&!isNaN(t.offsetTop);)n+=t.offsetLeft-t.scrollLeft,r+=t.offsetTop-t.scrollTop,t=t.offsetParent;return{top:r,left:n}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),a=r(i),s=n(7),l=r(s),u=n(38),c=r(u),d=n(2),f=r(d),p=n(4),h=r(p),m=n(3),v=r(m),y=n(1),g=r(y),b=n(9),_=r(b),T=n(5),C=r(T),x=20,w=function(e){function t(n){(0,f["default"])(this,t);var r=(0,h["default"])(this,e.call(this,n));return r.onOverlayClicked=function(){r.props.open&&r.props.onOpenChange(!1,{overlayClicked:!0})},r.onTouchStart=function(e){if(!r.isTouching()){var t=e.targetTouches[0];r.setState({touchIdentifier:r.notTouch?null:t.identifier,touchStartX:t.clientX,touchStartY:t.clientY,touchCurrentX:t.clientX,touchCurrentY:t.clientY})}},r.onTouchMove=function(e){if(r.isTouching())for(var t=0;t<e.targetTouches.length;t++)if(e.targetTouches[t].identifier===r.state.touchIdentifier){r.setState({touchCurrentX:e.targetTouches[t].clientX,touchCurrentY:e.targetTouches[t].clientY});break}},r.onTouchEnd=function(){if(r.notTouch=!1,r.isTouching()){var e=r.touchSidebarWidth();(r.props.open&&e<r.state.sidebarWidth-r.props.dragToggleDistance||!r.props.open&&e>r.props.dragToggleDistance)&&r.props.onOpenChange(!r.props.open);var t=r.touchSidebarHeight();(r.props.open&&t<r.state.sidebarHeight-r.props.dragToggleDistance||!r.props.open&&t>r.props.dragToggleDistance)&&r.props.onOpenChange(!r.props.open),r.setState({touchIdentifier:null,touchStartX:null,touchStartY:null,touchCurrentX:null,touchCurrentY:null})}},r.onScroll=function(){r.isTouching()&&r.inCancelDistanceOnScroll()&&r.setState({touchIdentifier:null,touchStartX:null,touchStartY:null,touchCurrentX:null,touchCurrentY:null})},r.inCancelDistanceOnScroll=function(){var e=void 0;switch(r.props.position){case"right":e=Math.abs(r.state.touchCurrentX-r.state.touchStartX)<x;break;case"bottom":e=Math.abs(r.state.touchCurrentY-r.state.touchStartY)<x;break;case"top":e=Math.abs(r.state.touchStartY-r.state.touchCurrentY)<x;break;case"left":default:e=Math.abs(r.state.touchStartX-r.state.touchCurrentX)<x}return e},r.isTouching=function(){return null!==r.state.touchIdentifier},r.saveSidebarSize=function(){var e=_["default"].findDOMNode(r.refs.sidebar),t=e.offsetWidth,n=e.offsetHeight,i=o(_["default"].findDOMNode(r.refs.sidebar)).top,a=o(_["default"].findDOMNode(r.refs.dragHandle)).top;t!==r.state.sidebarWidth&&r.setState({sidebarWidth:t}),n!==r.state.sidebarHeight&&r.setState({sidebarHeight:n}),i!==r.state.sidebarTop&&r.setState({sidebarTop:i}),a!==r.state.dragHandleTop&&r.setState({dragHandleTop:a})},r.touchSidebarWidth=function(){return"right"===r.props.position?r.props.open&&window.innerWidth-r.state.touchStartX<r.state.sidebarWidth?r.state.touchCurrentX>r.state.touchStartX?r.state.sidebarWidth+r.state.touchStartX-r.state.touchCurrentX:r.state.sidebarWidth:Math.min(window.innerWidth-r.state.touchCurrentX,r.state.sidebarWidth):"left"===r.props.position?r.props.open&&r.state.touchStartX<r.state.sidebarWidth?r.state.touchCurrentX>r.state.touchStartX?r.state.sidebarWidth:r.state.sidebarWidth-r.state.touchStartX+r.state.touchCurrentX:Math.min(r.state.touchCurrentX,r.state.sidebarWidth):void 0},r.touchSidebarHeight=function(){if("bottom"===r.props.position)return r.props.open&&window.innerHeight-r.state.touchStartY<r.state.sidebarHeight?r.state.touchCurrentY>r.state.touchStartY?r.state.sidebarHeight+r.state.touchStartY-r.state.touchCurrentY:r.state.sidebarHeight:Math.min(window.innerHeight-r.state.touchCurrentY,r.state.sidebarHeight);if("top"===r.props.position){var e=r.state.touchStartY-r.state.sidebarTop;return r.props.open&&e<r.state.sidebarHeight?r.state.touchCurrentY>r.state.touchStartY?r.state.sidebarHeight:r.state.sidebarHeight-r.state.touchStartY+r.state.touchCurrentY:Math.min(r.state.touchCurrentY-r.state.dragHandleTop,r.state.sidebarHeight)}},r.renderStyle=function(e){var t=e.sidebarStyle,n=e.isTouching,o=e.overlayStyle,i=e.contentStyle;if("right"===r.props.position||"left"===r.props.position){if(t.transform="translateX(0%)",t.WebkitTransform="translateX(0%)",n){var a=r.touchSidebarWidth()/r.state.sidebarWidth;"right"===r.props.position&&(t.transform="translateX("+100*(1-a)+"%)",t.WebkitTransform="translateX("+100*(1-a)+"%)"),"left"===r.props.position&&(t.transform="translateX(-"+100*(1-a)+"%)",t.WebkitTransform="translateX(-"+100*(1-a)+"%)"),o.opacity=a,o.visibility="visible"}i&&(i[r.props.position]=r.state.sidebarWidth+"px")}if("top"===r.props.position||"bottom"===r.props.position){if(t.transform="translateY(0%)",t.WebkitTransform="translateY(0%)",n){var s=r.touchSidebarHeight()/r.state.sidebarHeight;"bottom"===r.props.position&&(t.transform="translateY("+100*(1-s)+"%)",t.WebkitTransform="translateY("+100*(1-s)+"%)"),"top"===r.props.position&&(t.transform="translateY(-"+100*(1-s)+"%)",t.WebkitTransform="translateY(-"+100*(1-s)+"%)"),o.opacity=s,o.visibility="visible"}i&&(i[r.props.position]=r.state.sidebarHeight+"px")}},r.state={sidebarWidth:0,sidebarHeight:0,sidebarTop:0,dragHandleTop:0,touchIdentifier:null,touchStartX:null,touchStartY:null,touchCurrentX:null,touchCurrentY:null,touchSupported:"object"===("undefined"==typeof window?"undefined":(0,c["default"])(window))&&"ontouchstart"in window},r}return(0,v["default"])(t,e),t.prototype.componentDidMount=function(){this.saveSidebarSize()},t.prototype.componentDidUpdate=function(){this.isTouching()||this.saveSidebarSize()},t.prototype.render=function(){var e,t=this,n=this.props,r=n.className,o=n.style,i=n.prefixCls,s=n.position,u=n.transitions,c=n.touch,d=n.enableDragHandle,f=n.sidebar,p=n.children,h=n.docked,m=n.open,v=(0,l["default"])({},this.props.sidebarStyle),y=(0,l["default"])({},this.props.contentStyle),b=(0,l["default"])({},this.props.overlayStyle),_=(e={},(0,a["default"])(e,r,!!r),(0,a["default"])(e,i,!0),(0,a["default"])(e,i+"-"+s,!0),e),T={style:o},x=this.isTouching();x?this.renderStyle({sidebarStyle:v,isTouching:!0,overlayStyle:b}):h?0!==this.state.sidebarWidth&&(_[i+"-docked"]=!0,this.renderStyle({sidebarStyle:v,contentStyle:y})):m&&(_[i+"-open"]=!0,this.renderStyle({sidebarStyle:v}),b.opacity=1,b.visibility="visible"),!x&&u||(v.transition="none",v.WebkitTransition="none",y.transition="none",b.transition="none");var w=null;return this.state.touchSupported&&c&&(m?(T.onTouchStart=function(e){t.notTouch=!0,t.onTouchStart(e)},T.onTouchMove=this.onTouchMove,T.onTouchEnd=this.onTouchEnd,T.onTouchCancel=this.onTouchEnd,T.onScroll=this.onScroll):d&&(w=g["default"].createElement("div",{className:i+"-draghandle",style:this.props.dragHandleStyle,onTouchStart:this.onTouchStart,onTouchMove:this.onTouchMove,onTouchEnd:this.onTouchEnd,onTouchCancel:this.onTouchEnd,ref:"dragHandle"}))),g["default"].createElement("div",(0,l["default"])({className:(0,C["default"])(_)},T),g["default"].createElement("div",{className:i+"-sidebar",style:v,ref:"sidebar"},f),g["default"].createElement("div",{className:i+"-overlay",style:b,role:"presentation",ref:"overlay",onClick:this.onOverlayClicked}),g["default"].createElement("div",{className:i+"-content",style:y,ref:"content"},w,p))},t}(g["default"].Component);w.propTypes={prefixCls:g["default"].PropTypes.string,className:g["default"].PropTypes.string,children:g["default"].PropTypes.node.isRequired,style:g["default"].PropTypes.object,sidebarStyle:g["default"].PropTypes.object,contentStyle:g["default"].PropTypes.object,overlayStyle:g["default"].PropTypes.object,dragHandleStyle:g["default"].PropTypes.object,sidebar:g["default"].PropTypes.node.isRequired,docked:g["default"].PropTypes.bool,open:g["default"].PropTypes.bool,transitions:g["default"].PropTypes.bool,touch:g["default"].PropTypes.bool,enableDragHandle:g["default"].PropTypes.bool,position:g["default"].PropTypes.oneOf(["left","right","top","bottom"]),dragToggleDistance:g["default"].PropTypes.number,onOpenChange:g["default"].PropTypes.func},w.defaultProps={prefixCls:"rc-drawer",sidebarStyle:{},contentStyle:{},overlayStyle:{},dragHandleStyle:{},docked:!1,open:!1,transitions:!0,touch:!0,enableDragHandle:!0,position:"left",dragToggleDistance:30,onOpenChange:function(){}},t["default"]=w,e.exports=t["default"]},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(165),i=r(o);t["default"]=i["default"],e.exports=t["default"]},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(7),i=r(o),a=n(6),s=r(a),l=n(26),u=r(l),c=n(2),d=r(c),f=n(4),p=r(f),h=n(3),m=r(h),v=n(1),y=r(v),g=n(9),b=r(g),_=n(5),T=r(_),C=n(78),x=r(C),w=n(79),P=function(e){function t(n){(0,d["default"])(this,t);var r=(0,p["default"])(this,e.call(this,n));return S.call(r),r.state={pageSize:n.pageSize,_delay:!1},r}return(0,m["default"])(t,e),t.prototype.componentDidMount=function(){this.dataChange(this.props),this.getQsInfo()},t.prototype.componentWillReceiveProps=function(e){this.props.dataSource!==e.dataSource&&this.dataChange(e)},t.prototype.componentDidUpdate=function(){this.getQsInfo()},t.prototype.componentWillUnmount=function(){this._timer&&clearTimeout(this._timer),this._hCache=null},t.prototype.renderQuickSearchBar=function(e,t){var n=this,r=this.props,o=r.dataSource,i=r.prefixCls,a=o.sectionIdentities.map(function(e){return{value:e,label:o._getSectionHeaderData(o._dataBlob,e)}});return y["default"].createElement("ul",{ref:"quickSearchBar",className:i+"-quick-search-bar",style:t,onTouchStart:this.onTouchStart,onTouchMove:this.onTouchMove,onTouchEnd:this.onTouchEnd,onTouchCancel:this.onTouchEnd},y["default"].createElement("li",{"data-qf-target":e.value,onClick:function(){return n.onQuickSearchTop(void 0,e.value)}},e.label),a.map(function(e){return y["default"].createElement("li",{key:e.value,"data-qf-target":e.value,onClick:function(){return n.onQuickSearch(e.value)}},e.label)}))},t.prototype.render=function(){var e,t,n=this,r=this.state,o=r._delay,a=r.pageSize,l=this.props,c=l.className,d=l.prefixCls,f=l.children,p=l.quickSearchBarTop,h=l.quickSearchBarStyle,m=l.initialListSize,v=void 0===m?Math.min(20,this.props.dataSource.getRowCount()):m,g=l.showQuickSearchIndicator,b=l.renderSectionHeader,_=l.sectionHeaderClassName,C=(0,u["default"])(l,["className","prefixCls","children","quickSearchBarTop","quickSearchBarStyle","initialListSize","showQuickSearchIndicator","renderSectionHeader","sectionHeaderClassName"]);return y["default"].createElement("div",{className:d+"-container"},o&&this.props.delayActivityIndicator,y["default"].createElement(x["default"],(0,i["default"])({},C,{ref:"indexedListView",className:(0,T["default"])((e={},(0,s["default"])(e,c,c),(0,s["default"])(e,d,!0),e)),initialListSize:v,pageSize:a,renderSectionHeader:function(e,t){return y["default"].cloneElement(b(e,t),{ref:function(e){return n.sectionComponents[t]=e},className:_||d+"-section-header"})}}),f),this.renderQuickSearchBar(p,h),g?y["default"].createElement("div",{className:(0,T["default"])((t={},(0,s["default"])(t,d+"-qsindicator",!0),(0,s["default"])(t,d+"-qsindicator-hide",!g||!this.state.showQuickSearchIndicator),t)),ref:"qsIndicator"}):null)},t}(y["default"].Component);P.propTypes=(0,i["default"])({},x["default"].propTypes,{children:v.PropTypes.any,prefixCls:v.PropTypes.string,className:v.PropTypes.string,sectionHeaderClassName:v.PropTypes.string,quickSearchBarTop:v.PropTypes.object,quickSearchBarStyle:v.PropTypes.object,onQuickSearch:v.PropTypes.func,showQuickSearchIndicator:v.PropTypes.bool}),P.defaultProps={prefixCls:"rmc-indexed-list",quickSearchBarTop:{value:"#",label:"#"},onQuickSearch:function(){},showQuickSearchIndicator:!1,delayTime:100,delayActivityIndicator:""};var S=function(){var e=this;this.onQuickSearchTop=function(t,n){e.props.stickyHeader?window.document.body.scrollTop=0:b["default"].findDOMNode(e.refs.indexedListView.refs.listviewscroll).scrollTop=0,e.props.onQuickSearch(t,n)},this.onQuickSearch=function(t){var n=b["default"].findDOMNode(e.refs.indexedListView.refs.listviewscroll),r=b["default"].findDOMNode(e.sectionComponents[t]);if(e.props.stickyHeader){var o=e.refs.indexedListView.stickyRefs[t];o&&o.refs.placeholder&&(r=b["default"].findDOMNode(o.refs.placeholder)),window.document.body.scrollTop=r.getBoundingClientRect().top-n.getBoundingClientRect().top+(0,w.getOffsetTop)(n)}else n.scrollTop+=r.getBoundingClientRect().top-n.getBoundingClientRect().top;e.props.onQuickSearch(t)},this.onTouchStart=function(t){e._target=t.target,e._basePos=e.refs.quickSearchBar.getBoundingClientRect(),document.addEventListener("touchmove",e._disableParent,!1),document.body.className=document.body.className+" "+e.props.prefixCls+"-qsb-moving",e.updateIndicator(e._target)},this.onTouchMove=function(t){if(t.preventDefault(),e._target){var n=(0,w._event)(t),r=e._basePos,o=void 0;if(n.clientY>=r.top&&n.clientY<=r.top+e._qsHeight){o=Math.floor((n.clientY-r.top)/e._avgH);var i=void 0;if(o in e._hCache&&(i=e._hCache[o][0]),i){var a=i.getAttribute("data-qf-target");e._target!==i&&(e.props.quickSearchBarTop.value===a?e.onQuickSearchTop(void 0,a):e.onQuickSearch(a),e.updateIndicator(i)),e._target=i}}}},this.onTouchEnd=function(){e._target&&(document.removeEventListener("touchmove",e._disableParent,!1),document.body.className=document.body.className.replace(new RegExp(e.props.prefixCls+"-qsb-moving","g"),""),e.updateIndicator(e._target,!0),e._target=null)},this.getQsInfo=function(){var t=e.refs.quickSearchBar,n=t.offsetHeight,r=[];[].slice.call(t.querySelectorAll("[data-qf-target]")).forEach(function(e){r.push([e])});for(var o=n/r.length,i=0,a=0,s=r.length;a<s;a++)i=a*o,r[a][1]=[i,i+o];e._qsHeight=n,e._avgH=o,e._hCache=r},this.sectionComponents={},this.dataChange=function(t){var n=t.dataSource.getRowCount();n&&(e.setState({_delay:!0}),e._timer&&clearTimeout(e._timer),e._timer=setTimeout(function(){e.setState({pageSize:n,_delay:!1},function(){return e.refs.indexedListView._pageInNewRows()})},t.delayTime))},this.updateIndicator=function(t,n){var r=t;r.getAttribute("data-qf-target")||(r=r.parentNode),e.props.showQuickSearchIndicator&&(e.refs.qsIndicator.innerText=r.innerText.trim(),e.setState({showQuickSearchIndicator:!0}),e._indicatorTimer&&clearTimeout(e._indicatorTimer),e._indicatorTimer=setTimeout(function(){e.setState({showQuickSearchIndicator:!1})},1e3));var o=e.props.prefixCls+"-quick-search-bar-over";e._hCache.forEach(function(e){e[0].className=e[0].className.replace(o,"")}),n||(r.className=r.className+" "+o)},this._disableParent=function(e){e.preventDefault(),e.stopPropagation()}};t["default"]=P,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return e[t][n]}function i(e,t){return e[t]}function a(e){for(var t=0,n=0;n<e.length;n++){var r=e[n];t+=r.length}return t}function s(e){if((0,p["default"])(e))return{};for(var t={},n=0;n<e.length;n++){var r=e[n];(0,m["default"])(!t[r],"Value appears more than once in array: "+r),t[r]=!0}return t}var l=n(2),u=r(l),c=n(80),d=r(c),f=n(175),p=r(f),h=n(81),m=r(h),v=function(){function e(t){(0,u["default"])(this,e),(0,d["default"])(t&&"function"==typeof t.rowHasChanged,"Must provide a rowHasChanged function."),this._rowHasChanged=t.rowHasChanged,this._getRowData=t.getRowData||o,this._sectionHeaderHasChanged=t.sectionHeaderHasChanged,this._getSectionHeaderData=t.getSectionHeaderData||i,this._dataBlob=null,this._dirtyRows=[],this._dirtySections=[],this._cachedRowCount=0,this.rowIdentities=[],this.sectionIdentities=[]}return e.prototype.cloneWithRows=function(e,t){var n=t?[t]:null;return this._sectionHeaderHasChanged||(this._sectionHeaderHasChanged=function(){return!1}),this.cloneWithRowsAndSections({s1:e},["s1"],n)},e.prototype.cloneWithRowsAndSections=function(t,n,r){(0,d["default"])("function"==typeof this._sectionHeaderHasChanged,"Must provide a sectionHeaderHasChanged function with section data."),(0,d["default"])(!n||!r||n.length===r.length,"row and section ids lengths must be the same");var o=new e({getRowData:this._getRowData,getSectionHeaderData:this._getSectionHeaderData,rowHasChanged:this._rowHasChanged,sectionHeaderHasChanged:this._sectionHeaderHasChanged});return o._dataBlob=t,n?o.sectionIdentities=n:o.sectionIdentities=Object.keys(t),r?o.rowIdentities=r:(o.rowIdentities=[],o.sectionIdentities.forEach(function(e){o.rowIdentities.push(Object.keys(t[e]))})),o._cachedRowCount=a(o.rowIdentities),o._calculateDirtyArrays(this._dataBlob,this.sectionIdentities,this.rowIdentities),o},e.prototype.getRowCount=function(){return this._cachedRowCount;
},e.prototype.getRowAndSectionCount=function(){return this._cachedRowCount+this.sectionIdentities.length},e.prototype.rowShouldUpdate=function(e,t){var n=this._dirtyRows[e][t];return(0,m["default"])(void 0!==n,"missing dirtyBit for section, row: "+e+", "+t),n},e.prototype.getRowData=function(e,t){var n=this.sectionIdentities[e],r=this.rowIdentities[e][t];return(0,m["default"])(void 0!==n&&void 0!==r,"rendering invalid section, row: "+e+", "+t),this._getRowData(this._dataBlob,n,r)},e.prototype.getRowIDForFlatIndex=function(e){for(var t=e,n=0;n<this.sectionIdentities.length;n++){if(!(t>=this.rowIdentities[n].length))return this.rowIdentities[n][t];t-=this.rowIdentities[n].length}return null},e.prototype.getSectionIDForFlatIndex=function(e){for(var t=e,n=0;n<this.sectionIdentities.length;n++){if(!(t>=this.rowIdentities[n].length))return this.sectionIdentities[n];t-=this.rowIdentities[n].length}return null},e.prototype.getSectionLengths=function(){for(var e=[],t=0;t<this.sectionIdentities.length;t++)e.push(this.rowIdentities[t].length);return e},e.prototype.sectionHeaderShouldUpdate=function(e){var t=this._dirtySections[e];return(0,m["default"])(void 0!==t,"missing dirtyBit for section: "+e),t},e.prototype.getSectionHeaderData=function(e){if(!this._getSectionHeaderData)return null;var t=this.sectionIdentities[e];return(0,m["default"])(void 0!==t,"renderSection called on invalid section: "+e),this._getSectionHeaderData(this._dataBlob,t)},e.prototype._calculateDirtyArrays=function(e,t,n){for(var r=s(t),o={},i=0;i<n.length;i++){var a=t[i];(0,m["default"])(!o[a],"SectionID appears more than once: "+a),o[a]=s(n[i])}this._dirtySections=[],this._dirtyRows=[];for(var l,u=0;u<this.sectionIdentities.length;u++){var a=this.sectionIdentities[u];l=!r[a];var c=this._sectionHeaderHasChanged;!l&&c&&(l=c(this._getSectionHeaderData(e,a),this._getSectionHeaderData(this._dataBlob,a))),this._dirtySections.push(!!l),this._dirtyRows[u]=[];for(var d=0;d<this.rowIdentities[u].length;d++){var f=this.rowIdentities[u][d];l=!r[a]||!o[a][f]||this._rowHasChanged(this._getRowData(e,a,f),this._getRowData(this._dataBlob,a,f)),this._dirtyRows[u].push(!!l)}}},e}();e.exports=v},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),n(9)),a=r(i);t["default"]={bindEvt:function(){var e=this.getEle();e.addEventListener("touchstart",this.onPullUpStart),e.addEventListener("touchmove",this.onPullUpMove),e.addEventListener("touchend",this.onPullUpEnd),e.addEventListener("touchcancel",this.onPullUpEnd)},unBindEvt:function(){var e=this.getEle();e.removeEventListener("touchstart",this.onPullUpStart),e.removeEventListener("touchmove",this.onPullUpMove),e.removeEventListener("touchend",this.onPullUpEnd),e.removeEventListener("touchcancel",this.onPullUpEnd)},getEle:function(){var e=this.props,t=e.stickyHeader,n=e.useBodyScroll,r=void 0;return r=t||n?document.body:a["default"].findDOMNode(this.refs.listviewscroll.refs.ScrollView)},componentDidMount:function(){this.bindEvt()},componentWillUnmount:function(){this.unBindEvt()},onPullUpStart:function(e){this._pullUpStartPageY=e.touches[0].screenY,this._isPullUp=!1,this._pullUpEle=this.getEle()},onPullUpMove:function(e){e.touches[0].screenY<this._pullUpStartPageY&&this._reachBottom()&&(this._isPullUp=!0)},onPullUpEnd:function(e){this._isPullUp&&this.props.onEndReached&&this.props.onEndReached(e),this._isPullUp=!1},_reachBottom:function(){var e=this._pullUpEle;return e===document.body?e.scrollHeight-e.scrollTop===window.innerHeight:e.scrollHeight-e.scrollTop===e.clientHeight}},e.exports=t["default"]},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(6),i=r(o),a=n(1),s=r(a),l=n(5),u=r(l);t["default"]=s["default"].createClass({displayName:"RefreshControl",propTypes:{prefixCls:a.PropTypes.string,className:a.PropTypes.string,style:a.PropTypes.object,icon:a.PropTypes.any,loading:a.PropTypes.any,distanceToRefresh:a.PropTypes.number,refreshing:a.PropTypes.bool,onRefresh:a.PropTypes.func.isRequired},getDefaultProps:function(){return{prefixCls:"list-view-refresh-control",distanceToRefresh:50,refreshing:!1,icon:[s["default"].createElement("div",{key:"0",className:"list-view-refresh-control-pull"},"\u2193 \u4e0b\u62c9"),s["default"].createElement("div",{key:"1",className:"list-view-refresh-control-release"},"\u2191 \u91ca\u653e")],loading:s["default"].createElement("div",null,"loading...")}},getInitialState:function(){return{active:!1,deactive:!1,loadingState:!1}},render:function(){var e,t=this.props,n=t.prefixCls,r=t.className,o=void 0===r?"":r,a=t.style,l=t.icon,c=t.loading,d=t.refreshing,f=this.state,p=f.active,h=f.deactive,m=f.loadingState,v=(0,u["default"])((e={},(0,i["default"])(e,o,o),(0,i["default"])(e,n+"-ptr",!0),(0,i["default"])(e,n+"-active",p),(0,i["default"])(e,n+"-deactive",h),(0,i["default"])(e,n+"-loading",m||d),e));return s["default"].createElement("div",{ref:"ptr",className:v,style:a},s["default"].createElement("div",{className:n+"-ptr-icon"},l),s["default"].createElement("div",{className:n+"-ptr-loading"},c))}}),e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}var o=n(1),i=(r(o),n(9)),a=r(i),s=n(81),l=r(s),u=16,c={scrollResponderMixinGetInitialState:function(){return{isTouching:!1,lastMomentumScrollBeginTime:0,lastMomentumScrollEndTime:0,observedScrollSinceBecomingResponder:!1,becameResponderWhileAnimating:!1}},scrollResponderHandleScrollShouldSetResponder:function(){return this.state.isTouching},scrollResponderHandleStartShouldSetResponder:function(){return!1},scrollResponderHandleStartShouldSetResponderCapture:function(e){return this.scrollResponderIsAnimating()},scrollResponderHandleMoveShouldSetResponderCapture:function(e){return!0},scrollResponderHandleResponderReject:function(){(0,l["default"])(!1,"ScrollView doesn't take rejection well - scrolls anyway")},scrollResponderHandleTerminationRequest:function(){return!this.state.observedScrollSinceBecomingResponder},scrollResponderHandleTouchEnd:function(e){var t=e.nativeEvent;this.state.isTouching=0!==t.touches.length,this.props.onTouchEnd&&this.props.onTouchEnd(e)},scrollResponderHandleResponderRelease:function(e){this.props.onResponderRelease&&this.props.onResponderRelease(e),this.props.keyboardShouldPersistTaps||this.state.observedScrollSinceBecomingResponder||this.state.becameResponderWhileAnimating||this.props.onScrollResponderKeyboardDismissed&&this.props.onScrollResponderKeyboardDismissed(e)},scrollResponderHandleScroll:function(e){this.state.observedScrollSinceBecomingResponder=!0,this.props.onScroll&&this.props.onScroll(e)},scrollResponderHandleResponderGrant:function(e){this.state.observedScrollSinceBecomingResponder=!1,this.props.onResponderGrant&&this.props.onResponderGrant(e),this.state.becameResponderWhileAnimating=this.scrollResponderIsAnimating()},scrollResponderHandleScrollBeginDrag:function(e){this.props.onScrollBeginDrag&&this.props.onScrollBeginDrag(e)},scrollResponderHandleScrollEndDrag:function(e){this.props.onScrollEndDrag&&this.props.onScrollEndDrag(e)},scrollResponderHandleMomentumScrollBegin:function(e){this.state.lastMomentumScrollBeginTime=Date.now(),this.props.onMomentumScrollBegin&&this.props.onMomentumScrollBegin(e)},scrollResponderHandleMomentumScrollEnd:function(e){this.state.lastMomentumScrollEndTime=Date.now(),this.props.onMomentumScrollEnd&&this.props.onMomentumScrollEnd(e)},scrollResponderHandleTouchStart:function(e){this.state.isTouching=!0,this.props.onTouchStart&&this.props.onTouchStart(e)},scrollResponderHandleTouchMove:function(e){this.props.onTouchMove&&this.props.onTouchMove(e)},scrollResponderIsAnimating:function(){var e=Date.now(),t=e-this.state.lastMomentumScrollEndTime,n=t<u||this.state.lastMomentumScrollEndTime<this.state.lastMomentumScrollBeginTime;return n},scrollResponderScrollTo:function(e,t){this.scrollResponderScrollWithouthAnimationTo(e,t)},scrollResponderScrollWithouthAnimationTo:function(e,t){var n=a["default"].findDOMNode(this);n.offsetX=e,n.offsetY=t},scrollResponderZoomTo:function(e){},scrollResponderScrollNativeHandleToKeyboard:function(e,t,n){this.additionalScrollOffset=t||0,this.preventNegativeScrollOffset=!!n},scrollResponderInputMeasureAndScrollToKeyboard:function(e,t,n,r){if(this.keyboardWillOpenTo){var o=t-this.keyboardWillOpenTo.endCoordinates.screenY+r+this.additionalScrollOffset;this.preventNegativeScrollOffset&&(o=Math.max(0,o)),this.scrollResponderScrollTo(0,o)}this.additionalOffset=0,this.preventNegativeScrollOffset=!1},scrollResponderTextInputFocusError:function(e){console.error("Error measuring text field: ",e)},componentWillMount:function(){},scrollResponderKeyboardWillShow:function(e){this.keyboardWillOpenTo=e,this.props.onKeyboardWillShow&&this.props.onKeyboardWillShow(e)},scrollResponderKeyboardWillHide:function(e){this.keyboardWillOpenTo=null,this.props.onKeyboardWillHide&&this.props.onKeyboardWillHide(e)},scrollResponderKeyboardDidShow:function(e){e&&(this.keyboardWillOpenTo=e),this.props.onKeyboardDidShow&&this.props.onKeyboardDidShow(e)},scrollResponderKeyboardDidHide:function(){this.keyboardWillOpenTo=null,this.props.onKeyboardDidHide&&this.props.onKeyboardDidHide()}},d={Mixin:c};e.exports=d},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(6),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(9),m=r(h),v=n(76),y=r(v),g=n(11),b=r(g),_=n(5),T=r(_),C=n(79),x="ScrollView",w="InnerScrollView",P={children:f.PropTypes.any,className:f.PropTypes.string,prefixCls:f.PropTypes.string,listPrefixCls:f.PropTypes.string,listViewPrefixCls:f.PropTypes.string,style:f.PropTypes.object,contentContainerStyle:f.PropTypes.object,onScroll:f.PropTypes.func,scrollEventThrottle:f.PropTypes.number,removeClippedSubviews:f.PropTypes.bool,refreshControl:f.PropTypes.element},S={base:{position:"relative",overflow:"auto",WebkitOverflowScrolling:"touch",flex:1},zScroller:{position:"relative",overflow:"hidden",flex:1}},E=function(e){function t(){var n,r,o;(0,s["default"])(this,t);for(var i=arguments.length,a=Array(i),l=0;l<i;l++)a[l]=arguments[l];return n=r=(0,u["default"])(this,e.call.apply(e,[this].concat(a))),r.throttleScroll=function(){var e=function(){};return r.props.scrollEventThrottle&&r.props.onScroll&&(e=(0,C.throttle)(function(e){r.props.onScroll&&r.props.onScroll(e)},r.props.scrollEventThrottle)),e},r.scrollingComplete=function(){r.props.refreshControl&&r.refs.refreshControl.state.deactive&&r.refs.refreshControl.setState({deactive:!1})},o=n,(0,u["default"])(r,o)}return(0,d["default"])(t,e),t.prototype.componentDidUpdate=function(e){if(e.refreshControl&&this.props.refreshControl){var t=e.refreshControl.props.refreshing,n=this.props.refreshControl.props.refreshing;t&&!n&&this.refreshControlRefresh?this.refreshControlRefresh():this.manuallyRefresh||t||!n||this.domScroller.scroller.triggerPullToRefresh()}},t.prototype.componentDidMount=function(){var e=this;this.tsExec=this.throttleScroll(),this.onLayout=function(){return e.props.onLayout({nativeEvent:{layout:{width:window.innerWidth,height:window.innerHeight}}})};var t=m["default"].findDOMNode(this.refs[x]);this.props.stickyHeader||this.props.useBodyScroll?(window.addEventListener("scroll",this.tsExec),window.addEventListener("resize",this.onLayout)):this.props.useZscroller?this.renderZscroller():t.addEventListener("scroll",this.tsExec)},t.prototype.componentWillUnmount=function(){this.props.stickyHeader||this.props.useBodyScroll?(window.removeEventListener("scroll",this.tsExec),window.removeEventListener("resize",this.onLayout)):this.props.useZscroller?this.domScroller.destroy():m["default"].findDOMNode(this.refs[x]).removeEventListener("scroll",this.tsExec)},t.prototype.scrollTo=function(){if(this.props.stickyHeader||this.props.useBodyScroll){var e;(e=window).scrollTo.apply(e,arguments)}else if(this.props.useZscroller){var t;(t=this.domScroller.scroller).scrollTo.apply(t,arguments)}else{var n=m["default"].findDOMNode(this.refs[x]);n.scrollLeft=arguments.length<=0?void 0:arguments[0],n.scrollTop=arguments.length<=1?void 0:arguments[1]}},t.prototype.renderZscroller=function(){var e=this,t=this.props,n=t.scrollerOptions,r=t.refreshControl;this.domScroller=new y["default"](m["default"].findDOMNode(this.refs[w]),(0,b["default"])({},{scrollingX:!1,onScroll:this.tsExec,scrollingComplete:this.scrollingComplete},n)),r&&!function(){var t=e.domScroller.scroller,n=r.props,o=n.distanceToRefresh,i=n.onRefresh;t.activatePullToRefresh(o,function(){e.manuallyRefresh=!0,e.refs.refreshControl.setState({active:!0})},function(){e.manuallyRefresh=!1,e.refs.refreshControl.setState({deactive:!0,active:!1,loadingState:!1})},function(){e.refs.refreshControl.setState({deactive:!1,loadingState:!0});var n=function(){t.finishPullToRefresh(),e.refreshControlRefresh=null};Promise.all([new Promise(function(t){i(),e.refreshControlRefresh=t}),new Promise(function(e){return setTimeout(e,1e3)})]).then(n,n)}),r.props.refreshing&&t.triggerPullToRefresh()}()},t.prototype.render=function(){var e,t,n=this.props,r=n.children,o=n.className,a=n.prefixCls,s=void 0===a?"":a,l=n.listPrefixCls,u=void 0===l?"":l,c=n.listViewPrefixCls,d=void 0===c?"rmc-list-view":c,f=n.style,h=void 0===f?{}:f,m=n.contentContainerStyle,v=n.useZscroller,y=n.refreshControl,g=n.stickyHeader,_=n.useBodyScroll,C=S.base;g||_?C=null:v&&(C=S.zScroller);var P=s||d||"",E={ref:x,style:(0,b["default"])({},C,h),className:(0,T["default"])((e={},(0,i["default"])(e,o,!!o),(0,i["default"])(e,P+"-scrollview",!0),e))},O={ref:w,style:(0,b["default"])({},{position:"absolute",minWidth:"100%"},m),className:(0,T["default"])((t={},(0,i["default"])(t,P+"-scrollview-content",!0),(0,i["default"])(t,u,!!u),t))};return y?p["default"].createElement("div",E,p["default"].createElement("div",O,p["default"].cloneElement(y,{ref:"refreshControl"}),r)):g||_?p["default"].createElement("div",E,r):p["default"].createElement("div",E,p["default"].createElement("div",O,r))},t}(p["default"].Component);E.propTypes=P,t["default"]=E,e.exports=t["default"]},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(2),i=r(o),a=n(4),s=r(a),l=n(3),u=r(l),c=n(1),d=r(c),f=function(e){function t(){return(0,i["default"])(this,t),(0,s["default"])(this,e.apply(this,arguments))}return(0,u["default"])(t,e),t.prototype.shouldComponentUpdate=function(e){return e.shouldUpdate},t.prototype.render=function(){return this.props.render()},t}(d["default"].Component);f.propTypes={shouldUpdate:c.PropTypes.bool.isRequired,render:c.PropTypes.func.isRequired},t["default"]=f,e.exports=t["default"]},function(e,t){"use strict";function n(e){return function(){return e}}var r=function(){};r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){"use strict";function r(e){if(Array.isArray(e))return 0===e.length;if("object"==typeof e){if(e){o(e)&&void 0!==e.size?i(!1):void 0;for(var t in e)return!1}return!0}return!e}function o(e){return"undefined"!=typeof Symbol&&e[Symbol.iterator]}var i=n(80);e.exports=r},function(e,t){},176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,function(e,t){"use strict";function n(){return!1}function r(){return!0}function o(){this.timeStamp=Date.now(),this.target=void 0,this.currentTarget=void 0}Object.defineProperty(t,"__esModule",{value:!0}),o.prototype={isEventObject:1,constructor:o,isDefaultPrevented:n,isPropagationStopped:n,isImmediatePropagationStopped:n,preventDefault:function(){this.isDefaultPrevented=r},stopPropagation:function(){this.isPropagationStopped=r},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=r,this.stopPropagation()},halt:function(e){e?this.stopImmediatePropagation():this.stopPropagation(),this.preventDefault()}},t["default"]=o,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return null===e||void 0===e}function i(){return f}function a(){return p}function s(e){var t=e.type,n="function"==typeof e.stopPropagation||"boolean"==typeof e.cancelBubble;u["default"].call(this),this.nativeEvent=e;var r=a;"defaultPrevented"in e?r=e.defaultPrevented?i:a:"getPreventDefault"in e?r=e.getPreventDefault()?i:a:"returnValue"in e&&(r=e.returnValue===p?i:a),this.isDefaultPrevented=r;var o=[],s=void 0,l=void 0,c=void 0,d=h.concat();for(m.forEach(function(e){t.match(e.reg)&&(d=d.concat(e.props),e.fix&&o.push(e.fix))}),l=d.length;l;)c=d[--l],this[c]=e[c];for(!this.target&&n&&(this.target=e.srcElement||document),this.target&&3===this.target.nodeType&&(this.target=this.target.parentNode),l=o.length;l;)(s=o[--l])(this,e);this.timeStamp=e.timeStamp||Date.now()}Object.defineProperty(t,"__esModule",{value:!0});var l=n(225),u=r(l),c=n(11),d=r(c),f=!0,p=!1,h=["altKey","bubbles","cancelable","ctrlKey","currentTarget","eventPhase","metaKey","shiftKey","target","timeStamp","view","type"],m=[{reg:/^key/,props:["char","charCode","key","keyCode","which"],fix:function(e,t){o(e.which)&&(e.which=o(t.charCode)?t.keyCode:t.charCode),void 0===e.metaKey&&(e.metaKey=e.ctrlKey)}},{reg:/^touch/,props:["touches","changedTouches","targetTouches"]},{reg:/^hashchange$/,props:["newURL","oldURL"]},{reg:/^gesturechange$/i,props:["rotation","scale"]},{reg:/^(mousewheel|DOMMouseScroll)$/,props:[],fix:function(e,t){var n=void 0,r=void 0,o=void 0,i=t.wheelDelta,a=t.axis,s=t.wheelDeltaY,l=t.wheelDeltaX,u=t.detail;i&&(o=i/120),u&&(o=0-(u%3===0?u/3:u)),void 0!==a&&(a===e.HORIZONTAL_AXIS?(r=0,n=0-o):a===e.VERTICAL_AXIS&&(n=0,r=o)),void 0!==s&&(r=s/120),void 0!==l&&(n=-1*l/120),n||r||(r=o),void 0!==n&&(e.deltaX=n),void 0!==r&&(e.deltaY=r),void 0!==o&&(e.delta=o)}},{reg:/^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i,props:["buttons","clientX","clientY","button","offsetX","relatedTarget","which","fromElement","toElement","offsetY","pageX","pageY","screenX","screenY"],fix:function(e,t){var n=void 0,r=void 0,i=void 0,a=e.target,s=t.button;return a&&o(e.pageX)&&!o(t.clientX)&&(n=a.ownerDocument||document,r=n.documentElement,i=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||i&&i.scrollLeft||0)-(r&&r.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||i&&i.scrollTop||0)-(r&&r.clientTop||i&&i.clientTop||0)),e.which||void 0===s||(1&s?e.which=1:2&s?e.which=3:4&s?e.which=2:e.which=0),!e.relatedTarget&&e.fromElement&&(e.relatedTarget=e.fromElement===a?e.toElement:e.fromElement),e}}],v=u["default"].prototype;(0,d["default"])(s.prototype,v,{constructor:s,preventDefault:function(){var e=this.nativeEvent;e.preventDefault?e.preventDefault():e.returnValue=p,v.preventDefault.call(this)},stopPropagation:function(){var e=this.nativeEvent;e.stopPropagation?e.stopPropagation():e.cancelBubble=f,v.stopPropagation.call(this)}}),t["default"]=s,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){function r(t){var r=new a["default"](t);n.call(e,r)}return e.addEventListener?(e.addEventListener(t,r,!1),{remove:function(){e.removeEventListener(t,r,!1)}}):e.attachEvent?(e.attachEvent("on"+t,r),{remove:function(){e.detachEvent("on"+t,r)}}):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=n(226),a=r(i);e.exports=t["default"]},function(e,t){!function(t){function n(){var e=this;s.forEach(function(t){e[t]={name:a,version:[],versionString:a}})}function r(e,t,n){i[t].forEach(function(r){var i=r[0],s=r[1],l=n.match(i);l&&(e[t].name=s,l[2]?(e[t].versionString=l[2],e[t].version=[]):l[1]?(e[t].versionString=l[1].replace(/_/g,"."),e[t].version=o(l[1])):(e[t].versionString=a,e[t].version=[]))})}function o(e){return e.split(/[\._]/).map(function(e){return parseInt(e)})}var i={browser:[[/msie ([\.\_\d]+)/,"ie"],[/trident\/.*?rv:([\.\_\d]+)/,"ie"],[/firefox\/([\.\_\d]+)/,"firefox"],[/chrome\/([\.\_\d]+)/,"chrome"],[/version\/([\.\_\d]+).*?safari/,"safari"],[/mobile safari ([\.\_\d]+)/,"safari"],[/android.*?version\/([\.\_\d]+).*?safari/,"com.android.browser"],[/crios\/([\.\_\d]+).*?safari/,"chrome"],[/opera/,"opera"],[/opera\/([\.\_\d]+)/,"opera"],[/opera ([\.\_\d]+)/,"opera"],[/opera mini.*?version\/([\.\_\d]+)/,"opera.mini"],[/opios\/([a-z\.\_\d]+)/,"opera"],[/blackberry/,"blackberry"],[/blackberry.*?version\/([\.\_\d]+)/,"blackberry"],[/bb\d+.*?version\/([\.\_\d]+)/,"blackberry"],[/rim.*?version\/([\.\_\d]+)/,"blackberry"],[/iceweasel\/([\.\_\d]+)/,"iceweasel"],[/edge\/([\.\d]+)/,"edge"]],os:[[/linux ()([a-z\.\_\d]+)/,"linux"],[/mac os x/,"macos"],[/mac os x.*?([\.\_\d]+)/,"macos"],[/os ([\.\_\d]+) like mac os/,"ios"],[/openbsd ()([a-z\.\_\d]+)/,"openbsd"],[/android/,"android"],[/android ([a-z\.\_\d]+);/,"android"],[/mozilla\/[a-z\.\_\d]+ \((?:mobile)|(?:tablet)/,"firefoxos"],[/windows\s*(?:nt)?\s*([\.\_\d]+)/,"windows"],[/windows phone.*?([\.\_\d]+)/,"windows.phone"],[/windows mobile/,"windows.mobile"],[/blackberry/,"blackberryos"],[/bb\d+/,"blackberryos"],[/rim.*?os\s*([\.\_\d]+)/,"blackberryos"]],device:[[/ipad/,"ipad"],[/iphone/,"iphone"],[/lumia/,"lumia"],[/htc/,"htc"],[/nexus/,"nexus"],[/galaxy nexus/,"galaxy.nexus"],[/nokia/,"nokia"],[/ gt\-/,"galaxy"],[/ sm\-/,"galaxy"],[/xbox/,"xbox"],[/(?:bb\d+)|(?:blackberry)|(?: rim )/,"blackberry"]]},a="Unknown",s=Object.keys(i);n.prototype.sniff=function(e){var t=this,n=(e||navigator.userAgent||"").toLowerCase();s.forEach(function(e){r(t,e,n)})},"undefined"!=typeof e&&e.exports?e.exports=n:(t.Sniffr=new n,t.Sniffr.sniff(navigator.userAgent))}(this)},function(e,t,n){var r;/*!
Copyright (c) 2015 Jed Watson.
Based on code that is Copyright 2013-2015, Facebook, Inc.
All rights reserved.
*/
!function(){"use strict";var o=!("undefined"==typeof window||!window.document||!window.document.createElement),i={canUseDOM:o,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:o&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:o&&!!window.screen};r=function(){return i}.call(t,n,t,e),!(void 0!==r&&(e.exports=r))}()},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(7),i=r(o),a=n(37),s=r(a),l=n(2),u=r(l),c=n(4),d=r(c),f=n(3),p=r(f),h=n(1),m=r(h),v=n(77),y=r(v),g=n(257),b=r(g),_=n(232),T=r(_),C=function(e){function t(n){(0,u["default"])(this,t);var r=(0,d["default"])(this,e.call(this,n));return r.onPanStart=r.onPanStart.bind(r),r.onPan=r.onPan.bind(r),r.onPanEnd=r.onPanEnd.bind(r),r.openedLeft=!1,r.openedRight=!1,r}return(0,p["default"])(t,e),t.prototype.componentDidMount=function(){var e=this.props,t=e.left,n=e.right,r=this.refs.content.offsetWidth;this.refs.cover&&(this.refs.cover.style.width=r+"px"),this.contentWidth=r,this.btnsLeftWidth=r/5*t.length,this.btnsRightWidth=r/5*n.length,document.body.addEventListener("touchstart",this.onCloseSwipe.bind(this),!0)},t.prototype.componentWillUnmount=function(){document.body.removeEventListener("touchstart",this.onCloseSwipe.bind(this))},t.prototype.onCloseSwipe=function(e){if(this.openedLeft||this.openedRight){var t=function(e){for(;e.parentNode&&e.parentNode!==document.body;){if(e.className.indexOf("rc-swipeout-actions")>-1)return e;e=e.parentNode}}(e.target);t||(e.preventDefault(),this.close())}},t.prototype.onPanStart=function(e){this.props.disabled||(this.panStartX=e.deltaX)},t.prototype.onPan=function(e){if(!this.props.disabled){var t=this.props,n=t.left,r=t.right,o=e.deltaX-this.panStartX;o<0&&r.length?this._setStyle(Math.min(o,0)):o>0&&n.length&&this._setStyle(Math.max(o,0))}},t.prototype.onPanEnd=function(e){if(!this.props.disabled){var t=this.props,n=t.left,r=t.right,o=e.deltaX-this.panStartX,i=this.contentWidth,a=this.btnsLeftWidth,s=this.btnsRightWidth,l=.33*i,u=o>l||o>a/2,c=o<-l||o<-s/2;c&&o<0&&r.length?this.open(-s,!1,!0):u&&o>0&&n.length?this.open(a,!0,!1):this.close()}},t.prototype.onBtnClick=function(e,t){var n=t.onPress;n&&n(e),this.props.autoClose&&this.close()},t.prototype._getContentEasing=function(e,t){return e<0&&e<t?t-Math.pow(t-e,.85):e>0&&e>t?t+Math.pow(e-t,.85):e},t.prototype._setStyle=function(e){var t=this.props,n=t.left,r=t.right,o=e>0?this.btnsLeftWidth:-this.btnsRightWidth,i=this._getContentEasing(e,o);if(this.refs.content.style.left=i+"px",this.refs.cover.style.display=Math.abs(e)>0?"block":"none",this.refs.cover.style.left=i+"px",n.length){var a=Math.max(Math.min(e,Math.abs(o)),0);this.refs.left.style.width=a+"px"}if(r.length){var s=Math.max(Math.min(-e,Math.abs(o)),0);this.refs.right.style.width=s+"px"}},t.prototype.open=function(e,t,n){this.openedLeft||this.openedRight||this.props.onOpen(),this.openedLeft=t,this.openedRight=n,this._setStyle(e)},t.prototype.close=function(){(this.openedLeft||this.openedRight)&&this.props.onClose(),this._setStyle(0),this.openedLeft=!1,this.openedRight=!1},t.prototype.renderButtons=function(e,t){var n=this,r=this.props.prefixCls;return e&&e.length?m["default"].createElement("div",{className:r+"-actions "+r+"-actions-"+t,ref:t},e.map(function(e,t){return m["default"].createElement("div",{key:t,className:r+"-btn",style:e.style,onClick:function(t){return n.onBtnClick(t,e)}},m["default"].createElement("div",{className:r+"-text"},e.text||"Click"))})):null},t.prototype.render=function(){var e=(0,T["default"])(this.props,["prefixCls","left","right","children"]),t=(0,s["default"])(e,2),n=t[0],r=n.prefixCls,o=n.left,a=n.right,l=n.children,u=t[1],c=(0,b["default"])(u,["disabled","autoClose","onOpen","onClose"]);return o.length||a.length?m["default"].createElement("div",(0,i["default"])({className:""+r},c),m["default"].createElement("div",{className:r+"-cover",ref:"cover"}),this.renderButtons(o,"left"),this.renderButtons(a,"right"),m["default"].createElement(y["default"],{direction:"DIRECTION_HORIZONTAL",onPanStart:this.onPanStart,onPan:this.onPan,onPanEnd:this.onPanEnd},m["default"].createElement("div",{className:r+"-content",ref:"content"},l))):m["default"].createElement("div",(0,i["default"])({ref:"content"},c),l)},t}(m["default"].Component);C.propTypes={prefixCls:h.PropTypes.string,autoClose:h.PropTypes.bool,disabled:h.PropTypes.bool,left:h.PropTypes.arrayOf(h.PropTypes.object),right:h.PropTypes.arrayOf(h.PropTypes.object),onOpen:h.PropTypes.func,onClose:h.PropTypes.func,children:h.PropTypes.any},C.defaultProps={prefixCls:"rc-swipeout",autoClose:!1,disabled:!1,left:[],right:[],onOpen:function(){},onClose:function(){}},t["default"]=C,e.exports=t["default"]},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(230);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return r(o)["default"]}}),e.exports=t["default"]},function(e,t){"use strict";function n(e,t){var n={},r={};return Object.keys(e).forEach(function(o){t.indexOf(o)!==-1?n[o]=e[o]:r[o]=e[o]}),[n,r]}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]},function(e,t){"use strict";function n(){var e=document.createElement("div"),t=e.style;"AnimationEvent"in window||delete i.animationend.animation,"TransitionEvent"in window||delete i.transitionend.transition;for(var n in i)if(i.hasOwnProperty(n)){var r=i[n];for(var o in r)if(o in t){a.push(r[o]);break}}}function r(e,t,n){e.addEventListener(t,n,!1)}function o(e,t,n){e.removeEventListener(t,n,!1)}Object.defineProperty(t,"__esModule",{value:!0});var i={transitionend:{transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"mozTransitionEnd",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd"},animationend:{animation:"animationend",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"mozAnimationEnd",OAnimation:"oAnimationEnd",msAnimation:"MSAnimationEnd"}},a=[];"undefined"!=typeof window&&"undefined"!=typeof document&&n();var s={addEndEventListener:function(e,t){return 0===a.length?void window.setTimeout(t,0):void a.forEach(function(n){r(e,n,t)})},endEvents:a,removeEndEventListener:function(e,t){0!==a.length&&a.forEach(function(n){o(e,n,t)})}};t["default"]=s,e.exports=t["default"]},function(e,t){"use strict";function n(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return 1===t.length?r.apply(void 0,t):o.apply(void 0,t)}function r(e){var t=void 0;return"undefined"!=typeof Reflect&&"function"==typeof Reflect.ownKeys?t=Reflect.ownKeys(e.prototype):(t=Object.getOwnPropertyNames(e.prototype),"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(e.prototype)))),t.forEach(function(t){if("constructor"!==t){var n=Object.getOwnPropertyDescriptor(e.prototype,t);"function"==typeof n.value&&Object.defineProperty(e.prototype,t,o(e,t,n))}}),e}function o(e,t,n){var r=n.value;if("function"!=typeof r)throw new Error("@autobind decorator can only be applied to methods not: "+typeof r);var o=!1;return{configurable:!0,get:function(){if(o||this===e.prototype||this.hasOwnProperty(t))return r;var n=r.bind(this);return o=!0,Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),o=!1,n}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=r(i),s=n(5),l=r(s),u=a["default"].createClass({displayName:"Notice",propTypes:{duration:i.PropTypes.number,onClose:i.PropTypes.func,children:i.PropTypes.any},getDefaultProps:function(){return{onEnd:function(){},onClose:function(){},duration:1.5,style:{right:"50%"}}},componentDidMount:function(){var e=this;this.props.duration&&(this.closeTimer=setTimeout(function(){e.close()},1e3*this.props.duration))},componentWillUnmount:function(){this.clearCloseTimer()},clearCloseTimer:function(){this.closeTimer&&(clearTimeout(this.closeTimer),this.closeTimer=null)},close:function(){this.clearCloseTimer(),this.props.onClose()},render:function(){var e,t=this.props,n=t.prefixCls+"-notice",r=(e={},o(e,""+n,1),o(e,n+"-closable",t.closable),o(e,t.className,!!t.className),e);return a["default"].createElement("div",{className:(0,l["default"])(r),style:t.style},a["default"].createElement("div",{className:n+"-content"},t.children),t.closable?a["default"].createElement("a",{tabIndex:"0",onClick:this.close,className:n+"-close"},a["default"].createElement("span",{className:n+"-close-x"})):null)}});t["default"]=u,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(){return"rcNotification_"+_+"_"+b++}Object.defineProperty(t,"__esModule",{value:!0});var a=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(1),l=r(s),u=n(9),c=r(u),d=n(40),f=r(d),p=n(321),h=r(p),m=n(5),v=r(m),y=n(235),g=r(y),b=0,_=Date.now(),T=l["default"].createClass({displayName:"Notification",propTypes:{prefixCls:s.PropTypes.string,transitionName:s.PropTypes.string,animation:s.PropTypes.oneOfType([s.PropTypes.string,s.PropTypes.object]),style:s.PropTypes.object},getDefaultProps:function(){return{prefixCls:"rc-notification",animation:"fade",style:{top:65,left:"50%"}}},getInitialState:function(){return{notices:[]}},getTransitionName:function(){var e=this.props,t=e.transitionName;return!t&&e.animation&&(t=e.prefixCls+"-"+e.animation),t},add:function(e){var t=e.key=e.key||i();this.setState(function(n){var r=n.notices;if(!r.filter(function(e){return e.key===t}).length)return{notices:r.concat(e)}})},remove:function(e){this.setState(function(t){return{notices:t.notices.filter(function(t){return t.key!==e})}})},render:function(){var e,t=this,n=this.props,r=this.state.notices.map(function(e){var r=(0,h["default"])(t.remove.bind(t,e.key),e.onClose);return l["default"].createElement(g["default"],a({prefixCls:n.prefixCls},e,{onClose:r}),e.content)}),i=(e={},o(e,n.prefixCls,1),o(e,n.className,!!n.className),e);return l["default"].createElement("div",{className:(0,v["default"])(i),style:n.style},l["default"].createElement(f["default"],{transitionName:this.getTransitionName()},r))}});T.newInstance=function(e){var t=e||{},n=document.createElement("div");document.body.appendChild(n);var r=c["default"].render(l["default"].createElement(T,t),n);return{notice:function(e){r.add(e)},removeNotice:function(e){r.remove(e)},component:r,destroy:function(){c["default"].unmountComponentAtNode(n),document.body.removeChild(n)}}},t["default"]=T,e.exports=t["default"]},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(236),i=r(o);t["default"]=i["default"],e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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):o(e,t))}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},c=n(1),d=r(c),f=n(333),p=r(f),h=n(5),m=r(h),v=function(e){function t(n){a(this,t);var r=s(this,e.call(this,n));r.handleFocus=function(e){r.setState({focus:!0}),r.props.onFocus(e)},r.handleBlur=function(e){r.setState({focus:!1}),r.props.onBlur(e)},r.handleChange=function(e){r.props.disabled||("checked"in r.props||r.setState({checked:e.target.checked}),r.props.onChange({target:u({},r.props,{checked:e.target.checked}),stopPropagation:function(){e.stopPropagation()},preventDefault:function(){e.preventDefault()}}))};var o=!1;return o="checked"in n?n.checked:n.defaultChecked,r.state={checked:o,focus:!1},r}return l(t,e),t.prototype.componentWillReceiveProps=function(e){"checked"in e&&this.setState({checked:e.checked})},t.prototype.shouldComponentUpdate=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return p["default"].shouldComponentUpdate.apply(this,t)},t.prototype.render=function(){var e,t=u({},this.props);delete t.defaultChecked;var n=this.state,r=t.prefixCls,o=n.checked;"boolean"==typeof o&&(o=o?1:0);var a=(0,m["default"])((e={},i(e,t.className,!!t.className),i(e,r,1),i(e,r+"-checked",o),i(e,r+"-checked-"+o,!!o),i(e,r+"-focused",n.focus),i(e,r+"-disabled",t.disabled),e));return d["default"].createElement("span",{className:a,style:t.style},d["default"].createElement("span",{className:r+"-inner"}),d["default"].createElement("input",{name:t.name,type:t.type,readOnly:t.readOnly,disabled:t.disabled,tabIndex:t.tabIndex,className:r+"-input",checked:!!o,onClick:this.props.onClick,onFocus:this.handleFocus,onBlur:this.handleBlur,onChange:this.handleChange}))},t}(d["default"].Component);v.propTypes={name:d["default"].PropTypes.string,prefixCls:d["default"].PropTypes.string,style:d["default"].PropTypes.object,type:d["default"].PropTypes.string,className:d["default"].PropTypes.string,defaultChecked:d["default"].PropTypes.oneOfType([d["default"].PropTypes.number,d["default"].PropTypes.bool]),disabled:d["default"].PropTypes.bool,checked:d["default"].PropTypes.oneOfType([d["default"].PropTypes.number,d["default"].PropTypes.bool]),onFocus:d["default"].PropTypes.func,onBlur:d["default"].PropTypes.func,onChange:d["default"].PropTypes.func,onClick:d["default"].PropTypes.func},v.defaultProps={prefixCls:"rc-checkbox",style:{},type:"checkbox",className:"",defaultChecked:!1,onFocus:function(){},onBlur:function(){},onChange:function(){}},t["default"]=v,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n,r){var o=a["default"].clone(e),i={width:t.width,height:t.height};return r.adjustX&&o.left<n.left&&(o.left=n.left),r.resizeWidth&&o.left>=n.left&&o.left+i.width>n.right&&(i.width-=o.left+i.width-n.right),r.adjustX&&o.left+i.width>n.right&&(o.left=Math.max(n.right-i.width,n.left)),r.adjustY&&o.top<n.top&&(o.top=n.top),r.resizeHeight&&o.top>=n.top&&o.top+i.height>n.bottom&&(i.height-=o.top+i.height-n.bottom),r.adjustY&&o.top+i.height>n.bottom&&(o.top=Math.max(n.bottom-i.height,n.top)),a["default"].mix(o,i)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(30),a=r(i);t["default"]=o,e.exports=t["default"]},function(e,t){"use strict";function n(e,t){var n=t.charAt(0),r=t.charAt(1),o=e.width,i=e.height,a=void 0,s=void 0;return a=e.left,s=e.top,"c"===n?s+=i/2:"b"===n&&(s+=i),"c"===r?a+=o/2:"r"===r&&(a+=o),{left:a,top:s}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n,r,o){var i=void 0,s=void 0,l=void 0,u=void 0;return i={left:e.left,top:e.top},l=(0,a["default"])(t,n[1]),u=(0,a["default"])(e,n[0]),s=[u.left-l.left,u.top-l.top],{left:i.left-s[0]+r[0]-o[0],top:i.top-s[1]+r[1]-o[1]}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(240),a=r(i);t["default"]=o,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=void 0,n=void 0,r=void 0;if(a["default"].isWindow(e)||9===e.nodeType){var o=a["default"].getWindow(e);t={left:a["default"].getWindowScrollLeft(o),top:a["default"].getWindowScrollTop(o)},n=a["default"].viewportWidth(o),r=a["default"].viewportHeight(o)}else t=a["default"].offset(e),n=a["default"].outerWidth(e),r=a["default"].outerHeight(e);return t.width=n,t.height=r,t}Object.defineProperty(t,"__esModule",{value:!0});var i=n(30),a=r(i);t["default"]=o,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){for(var t={left:0,right:1/0,top:0,bottom:1/0},n=(0,l["default"])(e),r=void 0,o=void 0,i=void 0,s=e.ownerDocument,u=s.defaultView||s.parentWindow,c=s.body,d=s.documentElement;n;){if(navigator.userAgent.indexOf("MSIE")!==-1&&0===n.clientWidth||n===c||n===d||"visible"===a["default"].css(n,"overflow")){if(n===c||n===d)break}else{var f=a["default"].offset(n);f.left+=n.clientLeft,f.top+=n.clientTop,t.top=Math.max(t.top,f.top),t.right=Math.min(t.right,f.left+n.clientWidth),t.bottom=Math.min(t.bottom,f.top+n.clientHeight),t.left=Math.max(t.left,f.left)}n=(0,l["default"])(n)}return r=a["default"].getWindowScrollLeft(u),o=a["default"].getWindowScrollTop(u),t.left=Math.max(t.left,r),t.top=Math.max(t.top,o),i={width:a["default"].viewportWidth(u),height:a["default"].viewportHeight(u)},t.right=Math.min(t.right,r+i.width),t.bottom=Math.min(t.bottom,o+i.height),t.top>=0&&t.left>=0&&t.bottom>t.top&&t.right>t.left?t:null}Object.defineProperty(t,"__esModule",{value:!0});var i=n(30),a=r(i),s=n(86),l=r(s);t["default"]=o,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return e.left<n.left||e.left+t.width>n.right}function i(e,t,n){return e.top<n.top||e.top+t.height>n.bottom}function a(e,t,n){return e.left>n.right||e.left+t.width<n.left}function s(e,t,n){return e.top>n.bottom||e.top+t.height<n.top}function l(e,t,n){var r=[];return h["default"].each(e,function(e){r.push(e.replace(t,function(e){return n[e]}))}),r}function u(e,t){return e[t]=-e[t],e}function c(e,t){var n=void 0;return n=/%$/.test(e)?parseInt(e.substring(0,e.length-1),10)/100*t:parseInt(e,10),n||0}function d(e,t){e[0]=c(e[0],t.width),e[1]=c(e[1],t.height)}function f(e,t,n){var r=n.points,c=n.offset||[0,0],f=n.targetOffset||[0,0],p=n.overflow,m=n.target||t,v=n.source||e;c=[].concat(c),f=[].concat(f),p=p||{};var y={},b=0,T=(0,g["default"])(v),x=(0,C["default"])(v),P=(0,C["default"])(m);d(c,x),d(f,P);var S=(0,w["default"])(x,P,r,c,f),E=h["default"].merge(x,S);if(T&&(p.adjustX||p.adjustY)){if(p.adjustX&&o(S,x,T)){var O=l(r,/[lr]/gi,{l:"r",r:"l"}),M=u(c,0),k=u(f,0),N=(0,w["default"])(x,P,O,M,k);a(N,x,T)||(b=1,r=O,c=M,f=k)}if(p.adjustY&&i(S,x,T)){var D=l(r,/[tb]/gi,{t:"b",b:"t"}),R=u(c,1),I=u(f,1),j=(0,w["default"])(x,P,D,R,I);s(j,x,T)||(b=1,r=D,c=R,f=I)}b&&(S=(0,w["default"])(x,P,r,c,f),h["default"].mix(E,S)),y.adjustX=p.adjustX&&o(S,x,T),y.adjustY=p.adjustY&&i(S,x,T),(y.adjustX||y.adjustY)&&(E=(0,_["default"])(S,x,T,y))}return E.width!==x.width&&h["default"].css(v,"width",h["default"].width(v)+E.width-x.width),E.height!==x.height&&h["default"].css(v,"height",h["default"].height(v)+E.height-x.height),h["default"].offset(v,{left:E.left,top:E.top},{useCssRight:n.useCssRight,useCssBottom:n.useCssBottom,useCssTransform:n.useCssTransform}),{points:r,offset:c,targetOffset:f,overflow:y}}Object.defineProperty(t,"__esModule",{value:!0});var p=n(30),h=r(p),m=n(86),v=r(m),y=n(243),g=r(y),b=n(239),_=r(b),T=n(242),C=r(T),x=n(241),w=r(x);f.__getOffsetParent=v["default"],f.__getVisibleRectForElement=g["default"],t["default"]=f,e.exports=t["default"]},function(e,t){"use strict";function n(){if(void 0!==c)return c;c="";var e=document.createElement("p").style,t="Transform";for(var n in d)n+t in e&&(c=n);return c}function r(){return n()?n()+"TransitionProperty":"transitionProperty"}function o(){return n()?n()+"Transform":"transform"}function i(e,t){var n=r();n&&(e.style[n]=t,"transitionProperty"!==n&&(e.style.transitionProperty=t))}function a(e,t){var n=o();n&&(e.style[n]=t,"transform"!==n&&(e.style.transform=t))}function s(e){return e.style.transitionProperty||e.style[r()]}function l(e){var t=window.getComputedStyle(e,null),n=t.getPropertyValue("transform")||t.getPropertyValue(o());if(n&&"none"!==n){var r=n.replace(/[^0-9\-.,]/g,"").split(",");return{x:parseFloat(r[12]||r[4],0),y:parseFloat(r[13]||r[5],0)}}return{x:0,y:0}}function u(e,t){var n=window.getComputedStyle(e,null),r=n.getPropertyValue("transform")||n.getPropertyValue(o());if(r&&"none"!==r){var i=void 0,s=r.match(f);if(s)s=s[1],i=s.split(",").map(function(e){return parseFloat(e,10)}),i[4]=t.x,i[5]=t.y,a(e,"matrix("+i.join(",")+")");else{var l=r.match(p)[1];i=l.split(",").map(function(e){return parseFloat(e,10)}),i[12]=t.x,i[13]=t.y,a(e,"matrix3d("+i.join(",")+")")}}else a(e,"translateX("+t.x+"px) translateY("+t.y+"px) translateZ(0)")}Object.defineProperty(t,"__esModule",{value:!0}),t.getTransformName=o,t.setTransitionProperty=i,t.getTransitionProperty=s,t.getTransformXY=l,t.setTransformXY=u;var c=void 0,d={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-",O:"-o-"},f=/matrix\((.*)\)/,p=/matrix3d\((.*)\)/},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function a(e){var t=e;return Array.isArray(t)||(t=t?[t]:[]),t}Object.defineProperty(t,"__esModule",{value:!0});var s=n(1),l=r(s),u=n(247),c=r(u),d=n(250),f=r(d),p=n(5),h=r(p),m=l["default"].createClass({displayName:"Collapse",propTypes:{children:s.PropTypes.any,prefixCls:s.PropTypes.string,activeKey:s.PropTypes.oneOfType([s.PropTypes.string,s.PropTypes.arrayOf(s.PropTypes.string)]),defaultActiveKey:s.PropTypes.oneOfType([s.PropTypes.string,s.PropTypes.arrayOf(s.PropTypes.string)]),openAnimation:s.PropTypes.object,onChange:s.PropTypes.func,accordion:s.PropTypes.bool,className:s.PropTypes.string,style:s.PropTypes.object},statics:{Panel:c["default"]},getDefaultProps:function(){return{prefixCls:"rc-collapse",onChange:function(){},accordion:!1}},getInitialState:function(){var e=this.props,t=e.activeKey,n=e.defaultActiveKey,r=n;return"activeKey"in this.props&&(r=t),{openAnimation:this.props.openAnimation||(0,f["default"])(this.props.prefixCls),activeKey:a(r)}},componentWillReceiveProps:function(e){"activeKey"in e&&this.setState({activeKey:a(e.activeKey)}),"openAnimation"in e&&this.setState({openAnimation:e.openAnimation})},onClickItem:function(e){var t=this;return function(){var n=t.state.activeKey;if(t.props.accordion)n=n[0]===e?[]:[e];else{n=[].concat(i(n));var r=n.indexOf(e),o=r>-1;o?n.splice(r,1):n.push(e)}t.setActiveKey(n)}},getItems:function(){var e=this,t=this.state.activeKey,n=this.props,r=n.prefixCls,o=n.accordion,i=[];return s.Children.forEach(this.props.children,function(n,a){if(n){var s=n.key||String(a),u=n.props.header,c=!1;c=o?t[0]===s:t.indexOf(s)>-1;var d={key:s,header:u,isActive:c,prefixCls:r,openAnimation:e.state.openAnimation,children:n.props.children,onItemClick:e.onClickItem(s).bind(e)};i.push(l["default"].cloneElement(n,d))}}),i},setActiveKey:function(e){"activeKey"in this.props||this.setState({activeKey:e}),this.props.onChange(this.props.accordion?e[0]:e)},render:function(){var e,t=this.props,n=t.prefixCls,r=t.className,i=t.style,a=(0,h["default"])((e={},o(e,n,!0),o(e,r,!!r),e));return l["default"].createElement("div",{className:a,style:i},this.getItems())}});t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=r(i),s=n(5),l=r(s),u=n(248),c=r(u),d=n(40),f=r(d),p=a["default"].createClass({displayName:"CollapsePanel",propTypes:{className:i.PropTypes.oneOfType([i.PropTypes.string,i.PropTypes.object]),children:i.PropTypes.any,openAnimation:i.PropTypes.object,prefixCls:i.PropTypes.string,header:i.PropTypes.oneOfType([i.PropTypes.string,i.PropTypes.number,i.PropTypes.node]),showArrow:i.PropTypes.bool,isActive:i.PropTypes.bool,onItemClick:i.PropTypes.func,style:i.PropTypes.object},getDefaultProps:function(){return{showArrow:!0,isActive:!1,onItemClick:function(){}}},handleItemClick:function(){this.props.onItemClick()},render:function(){var e,t=this.props,n=t.className,r=t.style,i=t.prefixCls,s=t.header,u=t.children,d=t.isActive,p=t.showArrow,h=i+"-header",m=(0,l["default"])((e={},o(e,i+"-item",!0),o(e,i+"-item-active",d),e),n);return a["default"].createElement("div",{className:m,style:r},a["default"].createElement("div",{className:h,onClick:this.handleItemClick,role:"tab","aria-expanded":d},p&&a["default"].createElement("i",{className:"arrow"}),s),a["default"].createElement(f["default"],{showProp:"isActive",exclusive:!0,component:"",animation:this.props.openAnimation},a["default"].createElement(c["default"],{prefixCls:i,isActive:d},u)))}});t["default"]=p,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=r(i),s=n(5),l=r(s),u=a["default"].createClass({displayName:"PanelContent",propTypes:{prefixCls:i.PropTypes.string,isActive:i.PropTypes.bool,children:i.PropTypes.any},shouldComponentUpdate:function(e){return this.props.isActive||e.isActive},render:function(){var e;if(this._isActived=this._isActived||this.props.isActive,!this._isActived)return null;var t=this.props,n=t.prefixCls,r=t.isActive,i=t.children,s=(0,l["default"])((e={},o(e,n+"-content",!0),o(e,n+"-content-active",r),o(e,n+"-content-inactive",!r),e));return a["default"].createElement("div",{className:s,role:"tabpanel"},a["default"].createElement("div",{className:n+"-content-box"},i))}});t["default"]=u,e.exports=t["default"]},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(246),i=r(o);t["default"]=i["default"],e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n,r){var o=void 0;return(0,s["default"])(e,n,{start:function(){t?(o=e.offsetHeight,e.style.height=0):e.style.height=e.offsetHeight+"px"},active:function(){e.style.height=(t?o:0)+"px"},end:function(){e.style.height="",r()}})}function i(e){return{enter:function(t,n){return o(t,!0,e+"-anim",n)},leave:function(t,n){return o(t,!1,e+"-anim",n)}}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(84),s=r(a);t["default"]=i,e.exports=t["default"]},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(7),i=r(o),a=n(1),s=r(a),l=n(9),u=r(l),c=n(269),d=r(c),f=n(40),p=r(f),h=n(252),m=r(h),v=n(87),y=r(v),g=s["default"].createClass({displayName:"Popup",propTypes:{visible:a.PropTypes.bool,style:a.PropTypes.object,getClassNameFromAlign:a.PropTypes.func,onAlign:a.PropTypes.func,getRootDomNode:a.PropTypes.func,onMouseEnter:a.PropTypes.func,align:a.PropTypes.any,destroyPopupOnHide:a.PropTypes.bool,className:a.PropTypes.string,prefixCls:a.PropTypes.string,onMouseLeave:a.PropTypes.func},componentDidMount:function(){this.rootNode=this.getPopupDomNode()},onAlign:function(e,t){var n=this.props,r=n.getClassNameFromAlign(n.align),o=n.getClassNameFromAlign(t);r!==o&&(this.currentAlignClassName=o,e.className=this.getClassName(o)),n.onAlign(e,t)},getPopupDomNode:function(){return u["default"].findDOMNode(this.refs.popup)},getTarget:function(){return this.props.getRootDomNode()},getMaskTransitionName:function(){var e=this.props,t=e.maskTransitionName,n=e.maskAnimation;return!t&&n&&(t=e.prefixCls+"-"+n),t},getTransitionName:function(){var e=this.props,t=e.transitionName;return!t&&e.animation&&(t=e.prefixCls+"-"+e.animation),t},getClassName:function(e){return this.props.prefixCls+" "+this.props.className+" "+e},getPopupElement:function(){var e=this.props,t=e.align,n=e.style,r=e.visible,o=e.prefixCls,a=e.destroyPopupOnHide,l=this.getClassName(this.currentAlignClassName||e.getClassNameFromAlign(t)),u=o+"-hidden";r||(this.currentAlignClassName=null);var c=(0,i["default"])({},n,this.getZIndexStyle()),f={className:l,prefixCls:o,ref:"popup",onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,style:c};return a?s["default"].createElement(p["default"],{component:"",exclusive:!0,transitionAppear:!0,transitionName:this.getTransitionName()},r?s["default"].createElement(d["default"],{target:this.getTarget,key:"popup",ref:this.saveAlign,monitorWindowResize:!0,align:t,onAlign:this.onAlign},s["default"].createElement(m["default"],(0,i["default"])({visible:!0},f),e.children)):null):s["default"].createElement(p["default"],{component:"",exclusive:!0,transitionAppear:!0,transitionName:this.getTransitionName(),showProp:"xVisible"},s["default"].createElement(d["default"],{target:this.getTarget,key:"popup",ref:this.saveAlign,monitorWindowResize:!0,xVisible:r,childrenProps:{visible:"xVisible"},disabled:!r,align:t,onAlign:this.onAlign},s["default"].createElement(m["default"],(0,i["default"])({hiddenClassName:u},f),e.children)))},getZIndexStyle:function(){var e={},t=this.props;return void 0!==t.zIndex&&(e.zIndex=t.zIndex),e},getMaskElement:function(){var e=this.props,t=void 0;if(e.mask){var n=this.getMaskTransitionName();t=s["default"].createElement(y["default"],{style:this.getZIndexStyle(),key:"mask",className:e.prefixCls+"-mask",hiddenClassName:e.prefixCls+"-mask-hidden",visible:e.visible}),n&&(t=s["default"].createElement(p["default"],{key:"mask",showProp:"visible",transitionAppear:!0,component:"",transitionName:n},t))}return t},saveAlign:function(e){this.alignInstance=e},render:function(){return s["default"].createElement("div",null,this.getMaskElement(),this.getPopupElement())}});t["default"]=g,e.exports=t["default"]},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),a=n(87),s=r(a),l=i["default"].createClass({displayName:"PopupInner",propTypes:{hiddenClassName:o.PropTypes.string,className:o.PropTypes.string,prefixCls:o.PropTypes.string,onMouseEnter:o.PropTypes.func,onMouseLeave:o.PropTypes.func,children:o.PropTypes.any},render:function(){var e=this.props,t=e.className;return e.visible||(t+=" "+e.hiddenClassName),i["default"].createElement("div",{className:t,onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,style:e.style},i["default"].createElement(s["default"],{className:e.prefixCls+"-content",visible:e.visible},e.children))}});t["default"]=l,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){}function i(){return""}Object.defineProperty(t,"__esModule",{value:!0});var a=n(7),s=r(a),l=n(1),u=r(l),c=n(9),d=r(c),f=n(332),p=r(f),h=n(45),m=r(h),v=n(251),y=r(v),g=n(255),b=n(334),_=r(b),T=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"],C=u["default"].createClass({displayName:"Trigger",propTypes:{children:l.PropTypes.any,action:l.PropTypes.oneOfType([l.PropTypes.string,l.PropTypes.arrayOf(l.PropTypes.string)]),showAction:l.PropTypes.any,hideAction:l.PropTypes.any,getPopupClassNameFromAlign:l.PropTypes.any,
onPopupVisibleChange:l.PropTypes.func,afterPopupVisibleChange:l.PropTypes.func,popup:l.PropTypes.oneOfType([l.PropTypes.node,l.PropTypes.func]).isRequired,popupStyle:l.PropTypes.object,prefixCls:l.PropTypes.string,popupClassName:l.PropTypes.string,popupPlacement:l.PropTypes.string,builtinPlacements:l.PropTypes.object,popupTransitionName:l.PropTypes.string,popupAnimation:l.PropTypes.any,mouseEnterDelay:l.PropTypes.number,mouseLeaveDelay:l.PropTypes.number,zIndex:l.PropTypes.number,focusDelay:l.PropTypes.number,blurDelay:l.PropTypes.number,getPopupContainer:l.PropTypes.func,destroyPopupOnHide:l.PropTypes.bool,mask:l.PropTypes.bool,maskClosable:l.PropTypes.bool,onPopupAlign:l.PropTypes.func,popupAlign:l.PropTypes.object,popupVisible:l.PropTypes.bool,maskTransitionName:l.PropTypes.string,maskAnimation:l.PropTypes.string},mixins:[(0,_["default"])({autoMount:!1,isVisible:function(e){return e.state.popupVisible},getContainer:function(e){var t=document.createElement("div"),n=e.props.getPopupContainer?e.props.getPopupContainer((0,c.findDOMNode)(e)):document.body;return n.appendChild(t),t}})],getDefaultProps:function(){return{prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:i,onPopupVisibleChange:o,afterPopupVisibleChange:o,onPopupAlign:o,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[]}},getInitialState:function(){var e=this.props,t=void 0;return t="popupVisible"in e?!!e.popupVisible:!!e.defaultPopupVisible,{popupVisible:t}},componentWillMount:function(){var e=this;T.forEach(function(t){e["fire"+t]=function(n){e.fireEvents(t,n)}})},componentDidMount:function(){this.componentDidUpdate({},{popupVisible:this.state.popupVisible})},componentWillReceiveProps:function(e){var t=e.popupVisible;void 0!==t&&this.setState({popupVisible:t})},componentDidUpdate:function(e,t){var n=this.props,r=this.state;return this.renderComponent(null,function(){t.popupVisible!==r.popupVisible&&n.afterPopupVisibleChange(r.popupVisible)}),this.isClickToHide()&&r.popupVisible?void(this.clickOutsideHandler||(this.clickOutsideHandler=(0,m["default"])(document,"mousedown",this.onDocumentClick),this.touchOutsideHandler=(0,m["default"])(document,"touchstart",this.onDocumentClick))):void(this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.touchOutsideHandler.remove(),this.clickOutsideHandler=null,this.touchOutsideHandler=null))},componentWillUnmount:function(){this.clearDelayTimer(),this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.touchOutsideHandler.remove(),this.clickOutsideHandler=null,this.touchOutsideHandler=null)},onMouseEnter:function(e){this.fireEvents("onMouseEnter",e),this.delaySetPopupVisible(!0,this.props.mouseEnterDelay)},onMouseLeave:function(e){this.fireEvents("onMouseLeave",e),this.delaySetPopupVisible(!1,this.props.mouseLeaveDelay)},onPopupMouseEnter:function(){this.clearDelayTimer()},onPopupMouseLeave:function(e){e.relatedTarget&&!e.relatedTarget.setTimeout&&this._component&&(0,p["default"])(this._component.getPopupDomNode(),e.relatedTarget)||this.delaySetPopupVisible(!1,this.props.mouseLeaveDelay)},onFocus:function(e){this.fireEvents("onFocus",e),this.clearDelayTimer(),this.isFocusToShow()&&(this.focusTime=Date.now(),this.delaySetPopupVisible(!0,this.props.focusDelay))},onMouseDown:function(e){this.fireEvents("onMouseDown",e),this.preClickTime=Date.now()},onTouchStart:function(e){this.fireEvents("onTouchStart",e),this.preTouchTime=Date.now()},onBlur:function(e){this.fireEvents("onBlur",e),this.clearDelayTimer(),this.isBlurToHide()&&this.delaySetPopupVisible(!1,this.props.blurDelay)},onClick:function(e){if(this.fireEvents("onClick",e),this.focusTime){var t=void 0;if(this.preClickTime&&this.preTouchTime?t=Math.min(this.preClickTime,this.preTouchTime):this.preClickTime?t=this.preClickTime:this.preTouchTime&&(t=this.preTouchTime),Math.abs(t-this.focusTime)<20)return;this.focusTime=0}this.preClickTime=0,this.preTouchTime=0,e.preventDefault();var n=!this.state.popupVisible;(this.isClickToHide()&&!n||n&&this.isClickToShow())&&this.setPopupVisible(!this.state.popupVisible)},onDocumentClick:function(e){if(!this.props.mask||this.props.maskClosable){var t=e.target,n=(0,c.findDOMNode)(this),r=this.getPopupDomNode();(0,p["default"])(n,t)||(0,p["default"])(r,t)||this.close()}},getPopupDomNode:function(){return this._component&&this._component.isMounted()?this._component.getPopupDomNode():null},getRootDomNode:function(){return d["default"].findDOMNode(this)},getPopupClassNameFromAlign:function(e){var t=[],n=this.props,r=n.popupPlacement,o=n.builtinPlacements,i=n.prefixCls;return r&&o&&t.push((0,g.getPopupClassNameFromAlign)(o,i,e)),n.getPopupClassNameFromAlign&&t.push(n.getPopupClassNameFromAlign(e)),t.join(" ")},getPopupAlign:function(){var e=this.props,t=e.popupPlacement,n=e.popupAlign,r=e.builtinPlacements;return t&&r?(0,g.getAlignFromPlacement)(r,t,n):n},getComponent:function(){var e=this.props,t=this.state,n={};return this.isMouseEnterToShow()&&(n.onMouseEnter=this.onPopupMouseEnter),this.isMouseLeaveToHide()&&(n.onMouseLeave=this.onPopupMouseLeave),u["default"].createElement(y["default"],(0,s["default"])({prefixCls:e.prefixCls,destroyPopupOnHide:e.destroyPopupOnHide,visible:t.popupVisible,className:e.popupClassName,action:e.action,align:this.getPopupAlign(),onAlign:e.onPopupAlign,animation:e.popupAnimation,getClassNameFromAlign:this.getPopupClassNameFromAlign},n,{getRootDomNode:this.getRootDomNode,style:e.popupStyle,mask:e.mask,zIndex:e.zIndex,transitionName:e.popupTransitionName,maskAnimation:e.maskAnimation,maskTransitionName:e.maskTransitionName}),"function"==typeof e.popup?e.popup():e.popup)},setPopupVisible:function(e){this.clearDelayTimer(),this.state.popupVisible!==e&&("popupVisible"in this.props||this.setState({popupVisible:e}),this.props.onPopupVisibleChange(e))},delaySetPopupVisible:function(e,t){var n=this,r=1e3*t;this.clearDelayTimer(),r?this.delayTimer=setTimeout(function(){n.setPopupVisible(e),n.clearDelayTimer()},r):this.setPopupVisible(e)},clearDelayTimer:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)},createTwoChains:function(e){var t=this.props.children.props,n=this.props;return t[e]&&n[e]?this["fire"+e]:t[e]||n[e]},isClickToShow:function(){var e=this.props,t=e.action,n=e.showAction;return t.indexOf("click")!==-1||n.indexOf("click")!==-1},isClickToHide:function(){var e=this.props,t=e.action,n=e.hideAction;return t.indexOf("click")!==-1||n.indexOf("click")!==-1},isMouseEnterToShow:function(){var e=this.props,t=e.action,n=e.showAction;return t.indexOf("hover")!==-1||n.indexOf("mouseEnter")!==-1},isMouseLeaveToHide:function(){var e=this.props,t=e.action,n=e.hideAction;return t.indexOf("hover")!==-1||n.indexOf("mouseLeave")!==-1},isFocusToShow:function(){var e=this.props,t=e.action,n=e.showAction;return t.indexOf("focus")!==-1||n.indexOf("focus")!==-1},isBlurToHide:function(){var e=this.props,t=e.action,n=e.hideAction;return t.indexOf("focus")!==-1||n.indexOf("blur")!==-1},forcePopupAlign:function(){this.state.popupVisible&&this.popupInstance&&this.popupInstance.alignInstance&&this.popupInstance.alignInstance.forceAlign()},fireEvents:function(e,t){var n=this.props.children.props[e];n&&n(t);var r=this.props[e];r&&r(t)},close:function(){this.setPopupVisible(!1)},render:function(){var e=this.props,t=e.children,n=u["default"].Children.only(t),r={};return this.isClickToHide()||this.isClickToShow()?(r.onClick=this.onClick,r.onMouseDown=this.onMouseDown,r.onTouchStart=this.onTouchStart):(r.onClick=this.createTwoChains("onClick"),r.onMouseDown=this.createTwoChains("onMouseDown"),r.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?r.onMouseEnter=this.onMouseEnter:r.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?r.onMouseLeave=this.onMouseLeave:r.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(r.onFocus=this.onFocus,r.onBlur=this.onBlur):(r.onFocus=this.createTwoChains("onFocus"),r.onBlur=this.createTwoChains("onBlur")),u["default"].cloneElement(n,r)}});t["default"]=C,e.exports=t["default"]},function(e,t,n){"use strict";e.exports=n(253)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){return e[0]===t[0]&&e[1]===t[1]}function i(e,t,n){var r=e[t]||{};return(0,l["default"])({},r,n)}function a(e,t,n){var r=n.points;for(var i in e)if(e.hasOwnProperty(i)&&o(e[i].points,r))return t+"-placement-"+i;return""}Object.defineProperty(t,"__esModule",{value:!0});var s=n(7),l=r(s);t.getAlignFromPlacement=i,t.getPopupClassNameFromAlign=a},function(e,t){function n(e){return Object.prototype.toString.call(e)}function r(e){return e}function o(e){return"function"!=typeof e?e:function(){return e.apply(this,arguments)}}function i(e,t,n){t in e?e[t]=n:Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}function a(e,t,r){if(void 0!==e&&void 0!==t){var o=function(e){return e&&e.constructor&&e.constructor.name?e.constructor.name:n(e).slice(8,-1)};throw new TypeError("Cannot mixin key "+r+" because it is provided by multiple sources, and the types are "+o(e)+" and "+o(t))}return void 0===e?t:e}function s(e,t){var r=n(e);if("[object Object]"!==r){var o=e.constructor?e.constructor.name:"Unknown",i=t.constructor?t.constructor.name:"Unknown";throw new Error("cannot merge returned value of type "+o+" with an "+i)}}var l=e.exports=function(e,t){var n=t||{};return n.unknownFunction||(n.unknownFunction=l.ONCE),n.nonFunctionProperty||(n.nonFunctionProperty=a),function(t,r){Object.keys(r).forEach(function(a){var s=t[a],l=r[a],u=e[a];if(void 0!==s||void 0!==l){if(u){var c=u(s,l,a);return void i(t,a,o(c))}var d="function"==typeof s,f="function"==typeof l;return d&&void 0===l||f&&void 0===s||d&&f?void i(t,a,o(n.unknownFunction(s,l,a))):void(t[a]=n.nonFunctionProperty(s,l,a))}})}};l._mergeObjects=function(e,t){if(Array.isArray(e)&&Array.isArray(t))return e.concat(t);s(e,t),s(t,e);var n={};return Object.keys(e).forEach(function(r){if(Object.prototype.hasOwnProperty.call(t,r))throw new Error("cannot merge returns because both have the "+JSON.stringify(r)+" key");n[r]=e[r]}),Object.keys(t).forEach(function(e){n[e]=t[e]}),n},l.ONCE=function(e,t,n){if(e&&t)throw new TypeError("Cannot mixin "+n+" because it has a unique constraint.");return e||t},l.MANY=function(e,t,n){return function(){return t&&t.apply(this,arguments),e?e.apply(this,arguments):void 0}},l.MANY_MERGED_LOOSE=function(e,t,n){return e&&t?l._mergeObjects(e,t):e||t},l.MANY_MERGED=function(e,t,n){return function(){var n=t&&t.apply(this,arguments),r=e&&e.apply(this,arguments);return n&&r?l._mergeObjects(n,r):r||n}},l.REDUCE_LEFT=function(e,t,n){var o=e||r,i=t||r;return function(){return i.call(this,o.apply(this,arguments))}},l.REDUCE_RIGHT=function(e,t,n){var o=e||r,i=t||r;return function(){return o.call(this,i.apply(this,arguments))}}},function(e,t,n){/*!
* object.omit <https://github.com/jonschlinkert/object.omit>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
"use strict";var r=n(156),o=n(157);e.exports=function(e,t){if(!r(e))return{};t=[].concat.apply([],[].slice.call(arguments,1));var n,i=t[t.length-1],a={};"function"==typeof i&&(n=t.pop());var s="function"==typeof n;return t.length||s?(o(e,function(r,o){t.indexOf(o)===-1&&(s?n(r,o,e)&&(a[o]=r):a[o]=r)}),a):e}},function(e,t,n){"use strict";var r=n(259);e.exports=r},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),a=r(i),s=n(9),l=(r(s),n(158)),u=r(l),c=n(260),d=r(c),f=n(11),p=r(f),h=n(229),m=r(h),v=function(e,t,n){null!==e&&"undefined"!=typeof e&&(e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n)},y=function(e,t,n){null!==e&&"undefined"!=typeof e&&(e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null)},g=a["default"].createClass({displayName:"Carousel",mixins:[u["default"].Mixin],propTypes:{afterSlide:a["default"].PropTypes.func,autoplay:a["default"].PropTypes.bool,autoplayInterval:a["default"].PropTypes.number,beforeSlide:a["default"].PropTypes.func,cellAlign:a["default"].PropTypes.oneOf(["left","center","right"]),cellSpacing:a["default"].PropTypes.number,data:a["default"].PropTypes.func,decorators:a["default"].PropTypes.arrayOf(a["default"].PropTypes.shape({component:a["default"].PropTypes.func,position:a["default"].PropTypes.oneOf(["TopLeft","TopCenter","TopRight","CenterLeft","CenterCenter","CenterRight","BottomLeft","BottomCenter","BottomRight"]),style:a["default"].PropTypes.object})),dragging:a["default"].PropTypes.bool,easing:a["default"].PropTypes.string,edgeEasing:a["default"].PropTypes.string,framePadding:a["default"].PropTypes.string,frameOverflow:a["default"].PropTypes.string,initialSlideHeight:a["default"].PropTypes.number,initialSlideWidth:a["default"].PropTypes.number,slideIndex:a["default"].PropTypes.number,slidesToShow:a["default"].PropTypes.number,slidesToScroll:a["default"].PropTypes.oneOfType([a["default"].PropTypes.number,a["default"].PropTypes.oneOf(["auto"])]),slideWidth:a["default"].PropTypes.oneOfType([a["default"].PropTypes.string,a["default"].PropTypes.number]),speed:a["default"].PropTypes.number,swiping:a["default"].PropTypes.bool,vertical:a["default"].PropTypes.bool,width:a["default"].PropTypes.string,wrapAround:a["default"].PropTypes.bool},getDefaultProps:function(){return{afterSlide:function(){},autoplay:!1,autoplayInterval:3e3,beforeSlide:function(){},cellAlign:"left",cellSpacing:0,data:function(){},decorators:d["default"],dragging:!0,easing:"easeOutCirc",edgeEasing:"easeOutElastic",framePadding:"0px",frameOverflow:"hidden",slideIndex:0,slidesToScroll:1,slidesToShow:1,slideWidth:1,speed:500,swiping:!0,vertical:!1,width:"100%",wrapAround:!1}},getInitialState:function(){return{currentSlide:this.props.slideIndex,dragging:!1,frameWidth:0,left:0,slideCount:0,slidesToScroll:this.props.slidesToScroll,slideWidth:0,top:0}},componentWillMount:function(){this.setInitialDimensions()},componentDidMount:function(){this.setDimensions(),this.bindEvents(),this.setExternalData(),this.props.autoplay&&this.startAutoplay()},componentWillReceiveProps:function(e){this.setState({slideCount:e.children.length}),this.setDimensions(e),this.props.slideIndex!==e.slideIndex&&e.slideIndex!==this.state.currentSlide&&this.goToSlide(e.slideIndex),this.props.autoplay!==e.autoplay&&(e.autoplay?this.startAutoplay():this.stopAutoplay())},componentWillUnmount:function(){this.unbindEvents(),this.stopAutoplay()},render:function(){var e=this,t=a["default"].Children.count(this.props.children)>1?this.formatChildren(this.props.children):this.props.children;return a["default"].createElement("div",{className:["slider",this.props.className||""].join(" "),ref:"slider",style:(0,p["default"])(this.getSliderStyles(),this.props.style||{})},a["default"].createElement("div",o({className:"slider-frame",ref:"frame",style:this.getFrameStyles()},this.getTouchEvents(),this.getMouseEvents(),{onClick:this.handleClick}),a["default"].createElement("ul",{className:"slider-list",ref:"list",style:this.getListStyles()},t)),this.props.decorators?this.props.decorators.map(function(t,n){return a["default"].createElement("div",{style:(0,p["default"])(e.getDecoratorStyles(t.position),t.style||{}),className:"slider-decorator-"+n,key:n},a["default"].createElement(t.component,{currentSlide:e.state.currentSlide,slideCount:e.state.slideCount,frameWidth:e.state.frameWidth,slideWidth:e.state.slideWidth,slidesToScroll:e.state.slidesToScroll,cellSpacing:e.props.cellSpacing,slidesToShow:e.props.slidesToShow,wrapAround:e.props.wrapAround,nextSlide:e.nextSlide,previousSlide:e.previousSlide,goToSlide:e.goToSlide}))}):null,a["default"].createElement("style",{type:"text/css",dangerouslySetInnerHTML:{__html:e.getStyleTagStyles()}}))},touchObject:{},getTouchEvents:function(){var e=this;return e.props.swiping===!1?null:{onTouchStart:function(t){e.touchObject={startX:t.touches[0].pageX,startY:t.touches[0].pageY},e.handleMouseOver()},onTouchMove:function(t){var n=e.swipeDirection(e.touchObject.startX,t.touches[0].pageX,e.touchObject.startY,t.touches[0].pageY);0!==n&&t.preventDefault();var r=e.props.vertical?Math.round(Math.sqrt(Math.pow(t.touches[0].pageY-e.touchObject.startY,2))):Math.round(Math.sqrt(Math.pow(t.touches[0].pageX-e.touchObject.startX,2)));e.touchObject={startX:e.touchObject.startX,startY:e.touchObject.startY,endX:t.touches[0].pageX,endY:t.touches[0].pageY,length:r,direction:n},e.setState({left:e.props.vertical?0:e.getTargetLeft(e.touchObject.length*e.touchObject.direction),top:e.props.vertical?e.getTargetLeft(e.touchObject.length*e.touchObject.direction):0})},onTouchEnd:function(t){e.handleSwipe(t),e.handleMouseOut()},onTouchCancel:function(t){e.handleSwipe(t)}}},clickSafe:!0,getMouseEvents:function(){var e=this;return this.props.dragging===!1?null:{onMouseOver:function(){e.handleMouseOver()},onMouseOut:function(){e.handleMouseOut()},onMouseDown:function(t){e.touchObject={startX:t.clientX,startY:t.clientY},e.setState({dragging:!0})},onMouseMove:function(t){if(e.state.dragging){var n=e.swipeDirection(e.touchObject.startX,t.clientX,e.touchObject.startY,t.clientY);0!==n&&t.preventDefault();var r=e.props.vertical?Math.round(Math.sqrt(Math.pow(t.clientY-e.touchObject.startY,2))):Math.round(Math.sqrt(Math.pow(t.clientX-e.touchObject.startX,2)));e.touchObject={startX:e.touchObject.startX,startY:e.touchObject.startY,endX:t.clientX,endY:t.clientY,length:r,direction:n},e.setState({left:e.props.vertical?0:e.getTargetLeft(e.touchObject.length*e.touchObject.direction),top:e.props.vertical?e.getTargetLeft(e.touchObject.length*e.touchObject.direction):0})}},onMouseUp:function(t){e.state.dragging&&e.handleSwipe(t)},onMouseLeave:function(t){e.state.dragging&&e.handleSwipe(t)}}},handleMouseOver:function(){this.props.autoplay&&(this.autoplayPaused=!0,this.stopAutoplay())},handleMouseOut:function(){this.props.autoplay&&this.autoplayPaused&&(this.startAutoplay(),this.autoplayPaused=null)},handleClick:function(e){this.clickSafe===!0&&(e.preventDefault(),e.stopPropagation(),e.nativeEvent&&e.nativeEvent.stopPropagation())},handleSwipe:function(e){"undefined"!=typeof this.touchObject.length&&this.touchObject.length>44?this.clickSafe=!0:this.clickSafe=!1;var t=this.props.slidesToShow;"auto"===this.props.slidesToScroll&&(t=this.state.slidesToScroll),this.touchObject.length>this.state.slideWidth/t/5?1===this.touchObject.direction?this.state.currentSlide>=a["default"].Children.count(this.props.children)-t&&!this.props.wrapAround?this.animateSlide(u["default"].easingTypes[this.props.edgeEasing]):this.nextSlide():this.touchObject.direction===-1&&(this.state.currentSlide<=0&&!this.props.wrapAround?this.animateSlide(u["default"].easingTypes[this.props.edgeEasing]):this.previousSlide()):this.goToSlide(this.state.currentSlide),this.touchObject={},this.setState({dragging:!1})},swipeDirection:function(e,t,n,r){var o,i,a,s;return o=e-t,i=n-r,a=Math.atan2(i,o),s=Math.round(180*a/Math.PI),s<0&&(s=360-Math.abs(s)),s<=45&&s>=0?1:s<=360&&s>=315?1:s>=135&&s<=225?-1:this.props.vertical===!0?s>=35&&s<=135?1:-1:0},autoplayIterator:function(){return this.props.wrapAround?this.nextSlide():void(this.state.currentSlide!==this.state.slideCount-this.state.slidesToShow?this.nextSlide():this.stopAutoplay())},startAutoplay:function(){this.autoplayID=setInterval(this.autoplayIterator,this.props.autoplayInterval)},resetAutoplay:function(){this.props.autoplay&&!this.autoplayPaused&&(this.stopAutoplay(),this.startAutoplay())},stopAutoplay:function(){this.autoplayID&&clearInterval(this.autoplayID)},goToSlide:function(e){var t=this;if(e>=a["default"].Children.count(this.props.children)||e<0){if(!this.props.wrapAround)return;if(e>=a["default"].Children.count(this.props.children))return this.props.beforeSlide(this.state.currentSlide,0),this.setState({currentSlide:0},function(){t.animateSlide(null,null,t.getTargetLeft(null,e),function(){t.animateSlide(null,.01),t.props.afterSlide(0),t.resetAutoplay(),t.setExternalData()})});var n=a["default"].Children.count(this.props.children)-this.state.slidesToScroll;return this.props.beforeSlide(this.state.currentSlide,n),this.setState({currentSlide:n},function(){t.animateSlide(null,null,t.getTargetLeft(null,e),function(){t.animateSlide(null,.01),t.props.afterSlide(n),t.resetAutoplay(),t.setExternalData()})})}this.props.beforeSlide(this.state.currentSlide,e),this.setState({currentSlide:e},function(){t.animateSlide(),this.props.afterSlide(e),t.resetAutoplay(),t.setExternalData()})},nextSlide:function(){var e=a["default"].Children.count(this.props.children),t=this.props.slidesToShow;if("auto"===this.props.slidesToScroll&&(t=this.state.slidesToScroll),!(this.state.currentSlide>=e-t)||this.props.wrapAround)if(this.props.wrapAround)this.goToSlide(this.state.currentSlide+this.state.slidesToScroll);else{if(1!==this.props.slideWidth)return this.goToSlide(this.state.currentSlide+this.state.slidesToScroll);this.goToSlide(Math.min(this.state.currentSlide+this.state.slidesToScroll,e-t))}},previousSlide:function(){this.state.currentSlide<=0&&!this.props.wrapAround||(this.props.wrapAround?this.goToSlide(this.state.currentSlide-this.state.slidesToScroll):this.goToSlide(Math.max(0,this.state.currentSlide-this.state.slidesToScroll)))},animateSlide:function(e,t,n,r){this.tweenState(this.props.vertical?"top":"left",{easing:e||u["default"].easingTypes[this.props.easing],duration:t||this.props.speed,endValue:n||this.getTargetLeft(),onEnd:r||null})},getTargetLeft:function(e,t){var n,r=t||this.state.currentSlide;switch(this.props.cellAlign){case"left":n=0,n-=this.props.cellSpacing*r;break;case"center":n=(this.state.frameWidth-this.state.slideWidth)/2,n-=this.props.cellSpacing*r;break;case"right":n=this.state.frameWidth-this.state.slideWidth,n-=this.props.cellSpacing*r}var o=this.state.slideWidth*r,i=this.state.currentSlide>0&&r+this.state.slidesToScroll>=this.state.slideCount;return i&&1!==this.props.slideWidth&&!this.props.wrapAround&&"auto"===this.props.slidesToScroll&&(o=this.state.slideWidth*this.state.slideCount-this.state.frameWidth,n=0,n-=this.props.cellSpacing*(this.state.slideCount-1)),n-=e||0,(o-n)*-1},bindEvents:function(){var e=this;m["default"].canUseDOM&&(v(window,"resize",e.onResize),v(document,"readystatechange",e.onReadyStateChange))},onResize:function(){this.setDimensions()},onReadyStateChange:function(){this.setDimensions()},unbindEvents:function(){var e=this;m["default"].canUseDOM&&(y(window,"resize",e.onResize),y(document,"readystatechange",e.onReadyStateChange))},formatChildren:function(e){var t=this,n=this.props.vertical?this.getTweeningValue("top"):this.getTweeningValue("left");return a["default"].Children.map(e,function(e,r){return a["default"].createElement("li",{className:"slider-slide",style:t.getSlideStyles(r,n),key:r},e)})},setInitialDimensions:function(){var e,t,n,r=this;e=this.props.vertical?this.props.initialSlideHeight||0:this.props.initialSlideWidth||0,n=this.props.initialSlideHeight?this.props.initialSlideHeight*this.props.slidesToShow:0,t=n+this.props.cellSpacing*(this.props.slidesToShow-1),this.setState({slideHeight:n,frameWidth:this.props.vertical?t:"100%",slideCount:a["default"].Children.count(this.props.children),slideWidth:e},function(){r.setLeft(),r.setExternalData()})},setDimensions:function(e){e=e||this.props;var t,n,r,o,i,a,s,l=this;n=e.slidesToScroll,o=this.refs.frame,r=o.childNodes[0].childNodes[0],r?(r.style.height="auto",s=this.props.vertical?r.offsetHeight*e.slidesToShow:r.offsetHeight):s=100,t="number"!=typeof e.slideWidth?parseInt(e.slideWidth):e.vertical?s/e.slidesToShow*e.slideWidth:o.offsetWidth/e.slidesToShow*e.slideWidth,e.vertical||(t-=e.cellSpacing*((100-100/e.slidesToShow)/100)),a=s+e.cellSpacing*(e.slidesToShow-1),i=e.vertical?a:o.offsetWidth,"auto"===e.slidesToScroll&&(n=Math.floor(i/(t+e.cellSpacing))),this.setState({slideHeight:s,frameWidth:i,slideWidth:t,slidesToScroll:n,left:e.vertical?0:this.getTargetLeft(),top:e.vertical?this.getTargetLeft():0},function(){l.setLeft()})},setLeft:function(){this.setState({left:this.props.vertical?0:this.getTargetLeft(),top:this.props.vertical?this.getTargetLeft():0})},setExternalData:function(){this.props.data&&this.props.data()},getListStyles:function(){var e=this.state.slideWidth*a["default"].Children.count(this.props.children),t=this.props.cellSpacing*a["default"].Children.count(this.props.children),n="translate3d("+this.getTweeningValue("left")+"px, "+this.getTweeningValue("top")+"px, 0)";return{transform:n,WebkitTransform:n,msTransform:"translate("+this.getTweeningValue("left")+"px, "+this.getTweeningValue("top")+"px)",position:"relative",display:"block",margin:this.props.vertical?this.props.cellSpacing/2*-1+"px 0px":"0px "+this.props.cellSpacing/2*-1+"px",padding:0,height:this.props.vertical?e+t:this.state.slideHeight,width:this.props.vertical?"auto":e+t,cursor:this.state.dragging===!0?"pointer":"inherit",boxSizing:"border-box",MozBoxSizing:"border-box"}},getFrameStyles:function(){return{position:"relative",display:"block",overflow:this.props.frameOverflow,height:this.props.vertical?this.state.frameWidth||"initial":"auto",margin:this.props.framePadding,padding:0,transform:"translate3d(0, 0, 0)",WebkitTransform:"translate3d(0, 0, 0)",msTransform:"translate(0, 0)",boxSizing:"border-box",MozBoxSizing:"border-box"}},getSlideStyles:function(e,t){var n=this.getSlideTargetPosition(e,t);return{position:"absolute",left:this.props.vertical?0:n,top:this.props.vertical?n:0,display:this.props.vertical?"block":"inline-block",listStyleType:"none",verticalAlign:"top",width:this.props.vertical?"100%":this.state.slideWidth,height:"auto",boxSizing:"border-box",MozBoxSizing:"border-box",marginLeft:this.props.vertical?"auto":this.props.cellSpacing/2,marginRight:this.props.vertical?"auto":this.props.cellSpacing/2,marginTop:this.props.vertical?this.props.cellSpacing/2:"auto",marginBottom:this.props.vertical?this.props.cellSpacing/2:"auto"}},getSlideTargetPosition:function(e,t){var n=this.state.frameWidth/this.state.slideWidth,r=(this.state.slideWidth+this.props.cellSpacing)*e,o=(this.state.slideWidth+this.props.cellSpacing)*n*-1;if(this.props.wrapAround){var i=Math.ceil(t/this.state.slideWidth);if(this.state.slideCount-i<=e)return(this.state.slideWidth+this.props.cellSpacing)*(this.state.slideCount-e)*-1;var a=Math.ceil((Math.abs(t)-Math.abs(o))/this.state.slideWidth);if(1!==this.state.slideWidth&&(a=Math.ceil((Math.abs(t)-this.state.slideWidth)/this.state.slideWidth)),e<=a-1)return(this.state.slideWidth+this.props.cellSpacing)*(this.state.slideCount+e)}return r},getSliderStyles:function(){return{position:"relative",display:"block",width:this.props.width,height:"auto",boxSizing:"border-box",MozBoxSizing:"border-box",visibility:this.state.slideWidth?"visible":"hidden"}},getStyleTagStyles:function(){return".slider-slide > img {width: 100%; display: block;}"},getDecoratorStyles:function(e){switch(e){case"TopLeft":return{position:"absolute",top:0,left:0};case"TopCenter":return{position:"absolute",top:0,left:"50%",transform:"translateX(-50%)",WebkitTransform:"translateX(-50%)",msTransform:"translateX(-50%)"};case"TopRight":return{position:"absolute",top:0,right:0};case"CenterLeft":return{position:"absolute",top:"50%",left:0,transform:"translateY(-50%)",WebkitTransform:"translateY(-50%)",msTransform:"translateY(-50%)"};case"CenterCenter":return{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%,-50%)",WebkitTransform:"translate(-50%, -50%)",msTransform:"translate(-50%, -50%)"};case"CenterRight":return{position:"absolute",top:"50%",right:0,transform:"translateY(-50%)",WebkitTransform:"translateY(-50%)",msTransform:"translateY(-50%)"};case"BottomLeft":return{position:"absolute",bottom:0,left:0};case"BottomCenter":return{position:"absolute",bottom:0,left:"50%",transform:"translateX(-50%)",WebkitTransform:"translateX(-50%)",msTransform:"translateX(-50%)"};case"BottomRight":return{position:"absolute",bottom:0,right:0};default:return{position:"absolute",top:0,left:0}}}});g.ControllerMixin={getInitialState:function(){return{carousels:{}}},setCarouselData:function(e){var t=this.state.carousels;t[e]=this.refs[e],this.setState({carousels:t})}},t["default"]=g,e.exports=t["default"]},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),a=[{component:i["default"].createClass({displayName:"component",render:function(){return i["default"].createElement("button",{style:this.getButtonStyles(0===this.props.currentSlide&&!this.props.wrapAround),onClick:this.handleClick},"PREV")},handleClick:function(e){e.preventDefault(),this.props.previousSlide()},getButtonStyles:function(e){return{border:0,background:"rgba(0,0,0,0.4)",color:"white",padding:10,outline:0,opacity:e?.3:1,cursor:"pointer"}}}),position:"CenterLeft"},{component:i["default"].createClass({displayName:"component",render:function(){return i["default"].createElement("button",{style:this.getButtonStyles(this.props.currentSlide+this.props.slidesToScroll>=this.props.slideCount&&!this.props.wrapAround),onClick:this.handleClick},"NEXT")},handleClick:function(e){e.preventDefault(),this.props.nextSlide()},getButtonStyles:function(e){return{border:0,background:"rgba(0,0,0,0.4)",color:"white",padding:10,outline:0,opacity:e?.3:1,cursor:"pointer"}}}),position:"CenterRight"},{component:i["default"].createClass({displayName:"component",render:function(){var e=this,t=this.getIndexes(e.props.slideCount,e.props.slidesToScroll);return i["default"].createElement("ul",{style:e.getListStyles()},t.map(function(t){return i["default"].createElement("li",{style:e.getListItemStyles(),key:t},i["default"].createElement("button",{style:e.getButtonStyles(e.props.currentSlide===t),onClick:e.props.goToSlide.bind(null,t)},"\u2022"))}))},getIndexes:function(e,t){for(var n=[],r=0;r<e;r+=t)n.push(r);return n},getListStyles:function(){return{position:"relative",margin:0,top:-10,padding:0}},getListItemStyles:function(){return{listStyleType:"none",display:"inline-block"}},getButtonStyles:function(e){return{border:0,background:"transparent",color:"black",cursor:"pointer",padding:10,outline:0,fontSize:24,opacity:e?1:.5}}}),position:"BottomCenter"}];t["default"]=a,e.exports=t["default"]},function(e,t,n){var r;/*! Hammer.JS - v2.0.7 - 2016-04-22
* http://hammerjs.github.io/
*
* Copyright (c) 2016 Jorik Tangelder;
* Licensed under the MIT license */
!function(o,i,a,s){"use strict";function l(e,t,n){return setTimeout(p(e,n),t)}function u(e,t,n){return!!Array.isArray(e)&&(c(e,n[t],n),!0)}function c(e,t,n){var r;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==s)for(r=0;r<e.length;)t.call(n,e[r],r,e),r++;else for(r in e)e.hasOwnProperty(r)&&t.call(n,e[r],r,e)}function d(e,t,n){var r="DEPRECATED METHOD: "+t+"\n"+n+" AT \n";return function(){var t=new Error("get-stack-trace"),n=t&&t.stack?t.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",i=o.console&&(o.console.warn||o.console.log);return i&&i.call(o.console,r,n),e.apply(this,arguments)}}function f(e,t,n){var r,o=t.prototype;r=e.prototype=Object.create(o),r.constructor=e,r._super=o,n&&me(r,n)}function p(e,t){return function(){return e.apply(t,arguments)}}function h(e,t){return typeof e==ge?e.apply(t?t[0]||s:s,t):e}function m(e,t){return e===s?t:e}function v(e,t,n){c(_(t),function(t){e.addEventListener(t,n,!1)})}function y(e,t,n){c(_(t),function(t){e.removeEventListener(t,n,!1)})}function g(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function b(e,t){return e.indexOf(t)>-1}function _(e){return e.trim().split(/\s+/g)}function T(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var r=0;r<e.length;){if(n&&e[r][n]==t||!n&&e[r]===t)return r;r++}return-1}function C(e){return Array.prototype.slice.call(e,0)}function x(e,t,n){for(var r=[],o=[],i=0;i<e.length;){var a=t?e[i][t]:e[i];T(o,a)<0&&r.push(e[i]),o[i]=a,i++}return n&&(r=t?r.sort(function(e,n){return e[t]>n[t]}):r.sort()),r}function w(e,t){for(var n,r,o=t[0].toUpperCase()+t.slice(1),i=0;i<ve.length;){if(n=ve[i],r=n?n+o:t,r in e)return r;i++}return s}function P(){return we++}function S(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow||o}function E(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){h(e.options.enable,[e])&&n.handler(t)},this.init()}function O(e){var t,n=e.options.inputClass;return new(t=n?n:Ee?Y:Oe?U:Se?X:F)(e,M)}function M(e,t,n){var r=n.pointers.length,o=n.changedPointers.length,i=t&Ie&&r-o===0,a=t&(Ae|Le)&&r-o===0;n.isFirst=!!i,n.isFinal=!!a,i&&(e.session={}),n.eventType=t,k(e,n),e.emit("hammer.input",n),e.recognize(n),e.session.prevInput=n}function k(e,t){var n=e.session,r=t.pointers,o=r.length;n.firstInput||(n.firstInput=R(t)),o>1&&!n.firstMultiple?n.firstMultiple=R(t):1===o&&(n.firstMultiple=!1);var i=n.firstInput,a=n.firstMultiple,s=a?a.center:i.center,l=t.center=I(r);t.timeStamp=Te(),t.deltaTime=t.timeStamp-i.timeStamp,t.angle=W(s,l),t.distance=L(s,l),N(n,t),t.offsetDirection=A(t.deltaX,t.deltaY);var u=j(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=u.x,t.overallVelocityY=u.y,t.overallVelocity=_e(u.x)>_e(u.y)?u.x:u.y,t.scale=a?H(a.pointers,r):1,t.rotation=a?V(a.pointers,r):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,D(n,t);var c=e.element;g(t.srcEvent.target,c)&&(c=t.srcEvent.target),t.target=c}function N(e,t){var n=t.center,r=e.offsetDelta||{},o=e.prevDelta||{},i=e.prevInput||{};t.eventType!==Ie&&i.eventType!==Ae||(o=e.prevDelta={x:i.deltaX||0,y:i.deltaY||0},r=e.offsetDelta={x:n.x,y:n.y}),t.deltaX=o.x+(n.x-r.x),t.deltaY=o.y+(n.y-r.y)}function D(e,t){var n,r,o,i,a=e.lastInterval||t,l=t.timeStamp-a.timeStamp;if(t.eventType!=Le&&(l>Re||a.velocity===s)){var u=t.deltaX-a.deltaX,c=t.deltaY-a.deltaY,d=j(l,u,c);r=d.x,o=d.y,n=_e(d.x)>_e(d.y)?d.x:d.y,i=A(u,c),e.lastInterval=t}else n=a.velocity,r=a.velocityX,o=a.velocityY,i=a.direction;t.velocity=n,t.velocityX=r,t.velocityY=o,t.direction=i}function R(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:be(e.pointers[n].clientX),clientY:be(e.pointers[n].clientY)},n++;return{timeStamp:Te(),pointers:t,center:I(t),deltaX:e.deltaX,deltaY:e.deltaY}}function I(e){var t=e.length;if(1===t)return{x:be(e[0].clientX),y:be(e[0].clientY)};for(var n=0,r=0,o=0;o<t;)n+=e[o].clientX,r+=e[o].clientY,o++;return{x:be(n/t),y:be(r/t)}}function j(e,t,n){return{x:t/e||0,y:n/e||0}}function A(e,t){return e===t?We:_e(e)>=_e(t)?e<0?Ve:He:t<0?Fe:Ye}function L(e,t,n){n||(n=Ge);var r=t[n[0]]-e[n[0]],o=t[n[1]]-e[n[1]];return Math.sqrt(r*r+o*o)}function W(e,t,n){n||(n=Ge);var r=t[n[0]]-e[n[0]],o=t[n[1]]-e[n[1]];return 180*Math.atan2(o,r)/Math.PI}function V(e,t){return W(t[1],t[0],Xe)+W(e[1],e[0],Xe)}function H(e,t){return L(t[0],t[1],Xe)/L(e[0],e[1],Xe)}function F(){this.evEl=qe,this.evWin=Ze,this.pressed=!1,E.apply(this,arguments)}function Y(){this.evEl=Je,this.evWin=et,E.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function B(){this.evTarget=nt,this.evWin=rt,this.started=!1,E.apply(this,arguments)}function z(e,t){var n=C(e.touches),r=C(e.changedTouches);return t&(Ae|Le)&&(n=x(n.concat(r),"identifier",!0)),[n,r]}function U(){this.evTarget=it,this.targetIds={},E.apply(this,arguments)}function G(e,t){var n=C(e.touches),r=this.targetIds;if(t&(Ie|je)&&1===n.length)return r[n[0].identifier]=!0,[n,n];var o,i,a=C(e.changedTouches),s=[],l=this.target;if(i=n.filter(function(e){return g(e.target,l)}),t===Ie)for(o=0;o<i.length;)r[i[o].identifier]=!0,o++;for(o=0;o<a.length;)r[a[o].identifier]&&s.push(a[o]),t&(Ae|Le)&&delete r[a[o].identifier],o++;return s.length?[x(i.concat(s),"identifier",!0),s]:void 0}function X(){E.apply(this,arguments);var e=p(this.handler,this);this.touch=new U(this.manager,e),this.mouse=new F(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function K(e,t){e&Ie?(this.primaryTouch=t.changedPointers[0].identifier,q.call(this,t)):e&(Ae|Le)&&q.call(this,t)}function q(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var r=this.lastTouches,o=function(){var e=r.indexOf(n);e>-1&&r.splice(e,1)};setTimeout(o,at)}}function Z(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,r=0;r<this.lastTouches.length;r++){var o=this.lastTouches[r],i=Math.abs(t-o.x),a=Math.abs(n-o.y);if(i<=st&&a<=st)return!0}return!1}function Q(e,t){this.manager=e,this.set(t)}function $(e){if(b(e,pt))return pt;var t=b(e,ht),n=b(e,mt);return t&&n?pt:t||n?t?ht:mt:b(e,ft)?ft:dt}function J(){if(!ut)return!1;var e={},t=o.CSS&&o.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(n){e[n]=!t||o.CSS.supports("touch-action",n)}),e}function ee(e){this.options=me({},this.defaults,e||{}),this.id=P(),this.manager=null,this.options.enable=m(this.options.enable,!0),this.state=yt,this.simultaneous={},this.requireFail=[]}function te(e){return e&Ct?"cancel":e&_t?"end":e&bt?"move":e>?"start":""}function ne(e){return e==Ye?"down":e==Fe?"up":e==Ve?"left":e==He?"right":""}function re(e,t){var n=t.manager;return n?n.get(e):e}function oe(){ee.apply(this,arguments)}function ie(){oe.apply(this,arguments),this.pX=null,this.pY=null}function ae(){oe.apply(this,arguments)}function se(){ee.apply(this,arguments),this._timer=null,this._input=null}function le(){oe.apply(this,arguments)}function ue(){oe.apply(this,arguments)}function ce(){ee.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function de(e,t){return t=t||{},t.recognizers=m(t.recognizers,de.defaults.preset),new fe(e,t)}function fe(e,t){this.options=me({},de.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=O(this),this.touchAction=new Q(this,this.options.touchAction),pe(this,!0),c(this.options.recognizers,function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])},this)}function pe(e,t){var n=e.element;if(n.style){var r;c(e.options.cssProps,function(o,i){r=w(n.style,i),t?(e.oldCssProps[r]=n.style[r],n.style[r]=o):n.style[r]=e.oldCssProps[r]||""}),t||(e.oldCssProps={})}}function he(e,t){var n=i.createEvent("Event");n.initEvent(e,!0,!0),n.gesture=t,t.target.dispatchEvent(n)}var me,ve=["","webkit","Moz","MS","ms","o"],ye=i.createElement("div"),ge="function",be=Math.round,_e=Math.abs,Te=Date.now;me="function"!=typeof Object.assign?function(e){if(e===s||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(r!==s&&null!==r)for(var o in r)r.hasOwnProperty(o)&&(t[o]=r[o])}return t}:Object.assign;var Ce=d(function(e,t,n){for(var r=Object.keys(t),o=0;o<r.length;)(!n||n&&e[r[o]]===s)&&(e[r[o]]=t[r[o]]),o++;return e},"extend","Use `assign`."),xe=d(function(e,t){return Ce(e,t,!0)},"merge","Use `assign`."),we=1,Pe=/mobile|tablet|ip(ad|hone|od)|android/i,Se="ontouchstart"in o,Ee=w(o,"PointerEvent")!==s,Oe=Se&&Pe.test(navigator.userAgent),Me="touch",ke="pen",Ne="mouse",De="kinect",Re=25,Ie=1,je=2,Ae=4,Le=8,We=1,Ve=2,He=4,Fe=8,Ye=16,Be=Ve|He,ze=Fe|Ye,Ue=Be|ze,Ge=["x","y"],Xe=["clientX","clientY"];E.prototype={handler:function(){},init:function(){this.evEl&&v(this.element,this.evEl,this.domHandler),this.evTarget&&v(this.target,this.evTarget,this.domHandler),this.evWin&&v(S(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&y(this.element,this.evEl,this.domHandler),this.evTarget&&y(this.target,this.evTarget,this.domHandler),this.evWin&&y(S(this.element),this.evWin,this.domHandler)}};var Ke={mousedown:Ie,mousemove:je,mouseup:Ae},qe="mousedown",Ze="mousemove mouseup";f(F,E,{handler:function(e){var t=Ke[e.type];t&Ie&&0===e.button&&(this.pressed=!0),t&je&&1!==e.which&&(t=Ae),this.pressed&&(t&Ae&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:Ne,srcEvent:e}))}});var Qe={pointerdown:Ie,pointermove:je,pointerup:Ae,pointercancel:Le,pointerout:Le},$e={2:Me,3:ke,4:Ne,5:De},Je="pointerdown",et="pointermove pointerup pointercancel";o.MSPointerEvent&&!o.PointerEvent&&(Je="MSPointerDown",et="MSPointerMove MSPointerUp MSPointerCancel"),f(Y,E,{handler:function(e){var t=this.store,n=!1,r=e.type.toLowerCase().replace("ms",""),o=Qe[r],i=$e[e.pointerType]||e.pointerType,a=i==Me,s=T(t,e.pointerId,"pointerId");o&Ie&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):o&(Ae|Le)&&(n=!0),s<0||(t[s]=e,this.callback(this.manager,o,{pointers:t,changedPointers:[e],pointerType:i,srcEvent:e}),n&&t.splice(s,1))}});var tt={touchstart:Ie,touchmove:je,touchend:Ae,touchcancel:Le},nt="touchstart",rt="touchstart touchmove touchend touchcancel";f(B,E,{handler:function(e){var t=tt[e.type];if(t===Ie&&(this.started=!0),this.started){var n=z.call(this,e,t);t&(Ae|Le)&&n[0].length-n[1].length===0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:Me,srcEvent:e})}}});var ot={touchstart:Ie,touchmove:je,touchend:Ae,touchcancel:Le},it="touchstart touchmove touchend touchcancel";f(U,E,{handler:function(e){var t=ot[e.type],n=G.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:Me,srcEvent:e})}});var at=2500,st=25;f(X,E,{handler:function(e,t,n){var r=n.pointerType==Me,o=n.pointerType==Ne;if(!(o&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(r)K.call(this,t,n);else if(o&&Z.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var lt=w(ye.style,"touchAction"),ut=lt!==s,ct="compute",dt="auto",ft="manipulation",pt="none",ht="pan-x",mt="pan-y",vt=J();Q.prototype={set:function(e){e==ct&&(e=this.compute()),ut&&this.manager.element.style&&vt[e]&&(this.manager.element.style[lt]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return c(this.manager.recognizers,function(t){h(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),$(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)return void t.preventDefault();var r=this.actions,o=b(r,pt)&&!vt[pt],i=b(r,mt)&&!vt[mt],a=b(r,ht)&&!vt[ht];if(o){var s=1===e.pointers.length,l=e.distance<2,u=e.deltaTime<250;if(s&&l&&u)return}return a&&i?void 0:o||i&&n&Be||a&&n&ze?this.preventSrc(t):void 0},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var yt=1,gt=2,bt=4,_t=8,Tt=_t,Ct=16,xt=32;ee.prototype={defaults:{},set:function(e){return me(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(u(e,"recognizeWith",this))return this;var t=this.simultaneous;return e=re(e,this),t[e.id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return u(e,"dropRecognizeWith",this)?this:(e=re(e,this),delete this.simultaneous[e.id],this)},requireFailure:function(e){if(u(e,"requireFailure",this))return this;var t=this.requireFail;return e=re(e,this),T(t,e)===-1&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(u(e,"dropRequireFailure",this))return this;e=re(e,this);var t=T(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){function t(t){n.manager.emit(t,e)}var n=this,r=this.state;r<_t&&t(n.options.event+te(r)),t(n.options.event),e.additionalEvent&&t(e.additionalEvent),r>=_t&&t(n.options.event+te(r))},tryEmit:function(e){return this.canEmit()?this.emit(e):void(this.state=xt)},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(xt|yt)))return!1;e++}return!0},recognize:function(e){var t=me({},e);return h(this.options.enable,[this,t])?(this.state&(Tt|Ct|xt)&&(this.state=yt),this.state=this.process(t),void(this.state&(gt|bt|_t|Ct)&&this.tryEmit(t))):(this.reset(),void(this.state=xt))},process:function(e){},getTouchAction:function(){},reset:function(){}},f(oe,ee,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,r=t&(gt|bt),o=this.attrTest(e);return r&&(n&Le||!o)?t|Ct:r||o?n&Ae?t|_t:t>?t|bt:gt:xt}}),f(ie,oe,{defaults:{event:"pan",threshold:10,pointers:1,direction:Ue},getTouchAction:function(){var e=this.options.direction,t=[];return e&Be&&t.push(mt),e&ze&&t.push(ht),t},directionTest:function(e){var t=this.options,n=!0,r=e.distance,o=e.direction,i=e.deltaX,a=e.deltaY;return o&t.direction||(t.direction&Be?(o=0===i?We:i<0?Ve:He,n=i!=this.pX,r=Math.abs(e.deltaX)):(o=0===a?We:a<0?Fe:Ye,n=a!=this.pY,r=Math.abs(e.deltaY))),e.direction=o,n&&r>t.threshold&&o&t.direction},attrTest:function(e){return oe.prototype.attrTest.call(this,e)&&(this.state>||!(this.state>)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=ne(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),f(ae,oe,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[pt]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state>)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),f(se,ee,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[dt]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,o=e.deltaTime>t.time;if(this._input=e,!r||!n||e.eventType&(Ae|Le)&&!o)this.reset();else if(e.eventType&Ie)this.reset(),this._timer=l(function(){this.state=Tt,this.tryEmit()},t.time,this);else if(e.eventType&Ae)return Tt;return xt},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===Tt&&(e&&e.eventType&Ae?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=Te(),this.manager.emit(this.options.event,this._input)))}}),f(le,oe,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[pt]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state>)}}),f(ue,oe,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Be|ze,pointers:1},getTouchAction:function(){return ie.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(Be|ze)?t=e.overallVelocity:n&Be?t=e.overallVelocityX:n&ze&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&_e(t)>this.options.velocity&&e.eventType&Ae},emit:function(e){var t=ne(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),f(ce,ee,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ft]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,o=e.deltaTime<t.time;if(this.reset(),e.eventType&Ie&&0===this.count)return this.failTimeout();if(r&&o&&n){if(e.eventType!=Ae)return this.failTimeout();var i=!this.pTime||e.timeStamp-this.pTime<t.interval,a=!this.pCenter||L(this.pCenter,e.center)<t.posThreshold;this.pTime=e.timeStamp,this.pCenter=e.center,a&&i?this.count+=1:this.count=1,this._input=e;var s=this.count%t.taps;if(0===s)return this.hasRequireFailures()?(this._timer=l(function(){this.state=Tt,this.tryEmit()},t.interval,this),gt):Tt}return xt},failTimeout:function(){return this._timer=l(function(){this.state=xt},this.options.interval,this),xt},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Tt&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),de.VERSION="2.0.7",de.defaults={domEvents:!1,touchAction:ct,enable:!0,inputTarget:null,inputClass:null,preset:[[le,{enable:!1}],[ae,{enable:!1},["rotate"]],[ue,{direction:Be}],[ie,{direction:Be},["swipe"]],[ce],[ce,{event:"doubletap",taps:2},["tap"]],[se]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var wt=1,Pt=2;fe.prototype={set:function(e){return me(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?Pt:wt},recognize:function(e){var t=this.session;if(!t.stopped){this.touchAction.preventDefaults(e);var n,r=this.recognizers,o=t.curRecognizer;(!o||o&&o.state&Tt)&&(o=t.curRecognizer=null);for(var i=0;i<r.length;)n=r[i],t.stopped===Pt||o&&n!=o&&!n.canRecognizeWith(o)?n.reset():n.recognize(e),!o&&n.state&(gt|bt|_t)&&(o=t.curRecognizer=n),i++}},get:function(e){if(e instanceof ee)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event==e)return t[n];return null},add:function(e){if(u(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(u(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,n=T(t,e);n!==-1&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==s&&t!==s){var n=this.handlers;return c(_(e),function(e){n[e]=n[e]||[],n[e].push(t)}),this}},off:function(e,t){if(e!==s){var n=this.handlers;return c(_(e),function(e){t?n[e]&&n[e].splice(T(n[e],t),1):delete n[e]}),this}},emit:function(e,t){this.options.domEvents&&he(e,t);var n=this.handlers[e]&&this.handlers[e].slice();if(n&&n.length){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var r=0;r<n.length;)n[r](t),r++}},destroy:function(){this.element&&pe(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},me(de,{INPUT_START:Ie,INPUT_MOVE:je,INPUT_END:Ae,INPUT_CANCEL:Le,STATE_POSSIBLE:yt,STATE_BEGAN:gt,STATE_CHANGED:bt,STATE_ENDED:_t,STATE_RECOGNIZED:Tt,STATE_CANCELLED:Ct,STATE_FAILED:xt,DIRECTION_NONE:We,DIRECTION_LEFT:Ve,DIRECTION_RIGHT:He,DIRECTION_UP:Fe,DIRECTION_DOWN:Ye,DIRECTION_HORIZONTAL:Be,DIRECTION_VERTICAL:ze,DIRECTION_ALL:Ue,Manager:fe,Input:E,TouchAction:Q,TouchInput:U,MouseInput:F,PointerEventInput:Y,TouchMouseInput:X,SingleTouchInput:B,Recognizer:ee,AttrRecognizer:oe,Tap:ce,Pan:ie,Swipe:ue,Pinch:ae,Rotate:le,Press:se,on:v,off:y,each:c,merge:xe,extend:Ce,assign:me,inherit:f,bindFn:p,prefixed:w});var St="undefined"!=typeof o?o:"undefined"!=typeof self?self:{};St.Hammer=de,r=function(){return de}.call(t,n,t,e),!(r!==s&&(e.exports=r))}(window,document,"Hammer")},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 u(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):o(e,t))}function c(e){return"string"==typeof e}Object.defineProperty(t,"__esModule",{value:!0});var d=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},f=n(1),p=r(f),h=n(5),m=r(h),v=function(e){function t(){return s(this,t),l(this,e.apply(this,arguments))}return u(t,e),t.prototype.render=function(){var e,t,n=this.props,r=n.className,o=n.prefixCls,s=n.style,l=n.tailWidth,u=n.itemWidth,f=n.status,h=void 0===f?"wait":f,v=n.iconPrefix,y=n.icon,g=n.wrapperStyle,b=n.adjustMarginRight,_=n.stepLast,T=n.stepNumber,C=n.description,x=n.title,w=n.progressDot,P=a(n,["className","prefixCls","style","tailWidth","itemWidth","status","iconPrefix","icon","wrapperStyle","adjustMarginRight","stepLast","stepNumber","description","title","progressDot"]),S=(0,m["default"])((e={},i(e,o+"-icon",!0),i(e,v+"icon",!0),i(e,v+"icon-"+y,y&&c(y)),i(e,v+"icon-check",!y&&"finish"===h),i(e,v+"icon-cross",!y&&"error"===h),e)),E=void 0,O=p["default"].createElement("span",{className:o+"-icon-dot"});E=w?"function"==typeof w?p["default"].createElement("span",{className:o+"-icon"},w(O,{index:T-1,status:h,title:x,description:C})):p["default"].createElement("span",{className:o+"-icon"},O):y&&!c(y)?p["default"].createElement("span",{className:o+"-icon"},y):y||"finish"===h||"error"===h?p["default"].createElement("span",{className:S}):p["default"].createElement("span",{className:o+"-icon"},T);var M=(0,m["default"])((t={},i(t,o+"-item",!0),i(t,o+"-item-last",_),i(t,o+"-status-"+h,!0),i(t,o+"-custom",y),i(t,r,!!r),t));return p["default"].createElement("div",d({},P,{className:M,style:d({width:u,marginRight:b},s)}),_?"":p["default"].createElement("div",{ref:"tail",style:l?{width:l}:{},className:o+"-tail"},p["default"].createElement("i",null)),p["default"].createElement("div",{className:o+"-step"},p["default"].createElement("div",{className:o+"-head",style:{background:g.background||g.backgroundColor}},p["default"].createElement("div",{className:o+"-head-inner"},E)),p["default"].createElement("div",{ref:"main",className:o+"-main"},p["default"].createElement("div",{className:o+"-title",style:{background:g.background||g.backgroundColor}},x),C?p["default"].createElement("div",{className:o+"-description"},C):"")))},t}(p["default"].Component);t["default"]=v,v.propTypes={className:f.PropTypes.string,prefixCls:f.PropTypes.string,style:f.PropTypes.object,wrapperStyle:f.PropTypes.object,tailWidth:f.PropTypes.oneOfType([f.PropTypes.number,f.PropTypes.string]),itemWidth:f.PropTypes.oneOfType([f.PropTypes.number,f.PropTypes.string]),status:f.PropTypes.string,iconPrefix:f.PropTypes.string,icon:f.PropTypes.node,adjustMarginRight:f.PropTypes.oneOfType([f.PropTypes.number,f.PropTypes.string]),stepLast:f.PropTypes.bool,stepNumber:f.PropTypes.string,description:f.PropTypes.any,title:f.PropTypes.any,progressDot:f.PropTypes.oneOfType([f.PropTypes.bool,f.PropTypes.func])},e.exports=v,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 u(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):o(e,t))}Object.defineProperty(t,"__esModule",{value:!0});var c=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},d=n(1),f=r(d),p=n(9),h=r(p),m=n(5),v=r(m),y=function(e){function t(n){s(this,t);var r=l(this,e.call(this,n));return r.calcStepOffsetWidth=function(){var e=h["default"].findDOMNode(r);e.children.length>0&&(r.calcTimeout&&clearTimeout(r.calcTimeout),r.calcTimeout=setTimeout(function(){var t=(e.lastChild.offsetWidth||0)+1,n=(e.firstChild.offsetWidth||0)+1;r.state.lastStepOffsetWidth===t&&r.state.firstStepOffsetWidth===n||r.setState({lastStepOffsetWidth:t,firstStepOffsetWidth:n})}))},r.state={lastStepOffsetWidth:0,firstStepOffsetWidth:0},r}return u(t,e),t.prototype.componentDidMount=function(){this.calcStepOffsetWidth()},t.prototype.componentDidUpdate=function(){this.calcStepOffsetWidth()},t.prototype.componentWillUnmount=function(){this.calcTimeout&&clearTimeout(this.calcTimeout)},t.prototype.render=function(){var e,t=this,n=this.props,r=n.prefixCls,o=n.style,s=void 0===o?{}:o,l=n.className,u=n.children,d=n.direction,p=n.labelPlacement,h=n.iconPrefix,m=n.status,y=n.size,g=n.current,b=n.progressDot,_=a(n,["prefixCls","style","className","children","direction","labelPlacement","iconPrefix","status","size","current","progressDot"]),T=u.length-1,C=this.state.lastStepOffsetWidth>0,x=b?"vertical":p,w=(0,v["default"])((e={},i(e,r,!0),i(e,r+"-"+y,y),i(e,r+"-"+d,!0),i(e,r+"-label-"+x,"horizontal"===d),i(e,r+"-hidden",!C),i(e,r+"-dot",!!b),i(e,l,l),e));return f["default"].createElement("div",c({className:w,style:s},_),f["default"].Children.map(u,function(e,o){var i="vertical"!==d&&o!==T&&C?100/T+"%":null,a="vertical"===d||o===T?null:-Math.round(t.state.lastStepOffsetWidth/T+1),l="vertical"===d?"":t.state.firstStepOffsetWidth+Math.round(t.state.lastStepOffsetWidth/2+1)-Math.round(t.state.lastStepOffsetWidth/T+1),u={stepNumber:(o+1).toString(),stepLast:o===T,itemWidth:i,tailWidth:l,adjustMarginRight:a,prefixCls:r,iconPrefix:h,wrapperStyle:s,progressDot:b};return"error"===m&&o===g-1&&(u.className=n.prefixCls+"-next-error"),e.props.status||(o===g?u.status=m:o<g?u.status="finish":u.status="wait"),f["default"].cloneElement(e,u)},this))},t}(f["default"].Component);t["default"]=y,y.propTypes={prefixCls:d.PropTypes.string,iconPrefix:d.PropTypes.string,direction:d.PropTypes.string,labelPlacement:d.PropTypes.string,children:d.PropTypes.any,status:d.PropTypes.string,size:d.PropTypes.string,progressDot:d.PropTypes.oneOfType([d.PropTypes.bool,d.PropTypes.func])},y.defaultProps={prefixCls:"rc-steps",iconPrefix:"rc",direction:"horizontal",labelPlacement:"horizontal",current:0,status:"process",size:"",progressDot:!1},e.exports=t["default"]},function(e,t,n){"use strict";var r=n(263);r.Step=n(262),e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=e.children;return l["default"].isValidElement(t)&&!t.key?l["default"].cloneElement(t,{key:h}):t}function a(){}Object.defineProperty(t,"__esModule",{value:!0});var s=n(1),l=r(s),u=n(267),c=n(266),d=r(c),f=n(89),p=r(f),h="rc_animate_"+Date.now(),m=l["default"].createClass({displayName:"Animate",propTypes:{component:l["default"].PropTypes.any,animation:l["default"].PropTypes.object,transitionName:l["default"].PropTypes.oneOfType([l["default"].PropTypes.string,l["default"].PropTypes.object]),transitionEnter:l["default"].PropTypes.bool,transitionAppear:l["default"].PropTypes.bool,exclusive:l["default"].PropTypes.bool,transitionLeave:l["default"].PropTypes.bool,onEnd:l["default"].PropTypes.func,onEnter:l["default"].PropTypes.func,onLeave:l["default"].PropTypes.func,onAppear:l["default"].PropTypes.func,showProp:l["default"].PropTypes.string},getDefaultProps:function(){return{animation:{},component:"span",transitionEnter:!0,transitionLeave:!0,transitionAppear:!1,onEnd:a,onEnter:a,onLeave:a,onAppear:a}},getInitialState:function(){return this.currentlyAnimatingKeys={},this.keysToEnter=[],this.keysToLeave=[],{children:(0,u.toArrayChildren)(i(this.props))}},componentDidMount:function(){var e=this,t=this.props.showProp,n=this.state.children;t&&(n=n.filter(function(e){return!!e.props[t]})),n.forEach(function(t){t&&e.performAppear(t.key)})},componentWillReceiveProps:function(e){var t=this;this.nextProps=e;var n=(0,u.toArrayChildren)(i(e)),r=this.props;r.exclusive&&Object.keys(this.currentlyAnimatingKeys).forEach(function(e){t.stop(e)});var a=r.showProp,s=this.currentlyAnimatingKeys,c=r.exclusive?(0,u.toArrayChildren)(i(r)):this.state.children,d=[];a?(c.forEach(function(e){var t=e&&(0,u.findChildInChildrenByKey)(n,e.key),r=void 0;r=t&&t.props[a]||!e.props[a]?t:l["default"].cloneElement(t||e,o({},a,!0)),r&&d.push(r)}),n.forEach(function(e){e&&(0,u.findChildInChildrenByKey)(c,e.key)||d.push(e)})):d=(0,u.mergeChildren)(c,n),this.setState({children:d}),n.forEach(function(e){var n=e&&e.key;if(!e||!s[n]){var r=e&&(0,u.findChildInChildrenByKey)(c,n);if(a){var o=e.props[a];if(r){var i=(0,u.findShownChildInChildrenByKey)(c,n,a);!i&&o&&t.keysToEnter.push(n)}else o&&t.keysToEnter.push(n)}else r||t.keysToEnter.push(n)}}),c.forEach(function(e){var r=e&&e.key;if(!e||!s[r]){var o=e&&(0,u.findChildInChildrenByKey)(n,r);if(a){var i=e.props[a];if(o){var l=(0,u.findShownChildInChildrenByKey)(n,r,a);!l&&i&&t.keysToLeave.push(r)}else i&&t.keysToLeave.push(r)}else o||t.keysToLeave.push(r)}})},componentDidUpdate:function(){var e=this.keysToEnter;this.keysToEnter=[],e.forEach(this.performEnter);var t=this.keysToLeave;this.keysToLeave=[],t.forEach(this.performLeave)},performEnter:function(e){this.refs[e]&&(this.currentlyAnimatingKeys[e]=!0,this.refs[e].componentWillEnter(this.handleDoneAdding.bind(this,e,"enter")))},performAppear:function(e){this.refs[e]&&(this.currentlyAnimatingKeys[e]=!0,this.refs[e].componentWillAppear(this.handleDoneAdding.bind(this,e,"appear")))},handleDoneAdding:function(e,t){var n=this.props;if(delete this.currentlyAnimatingKeys[e],!n.exclusive||n===this.nextProps){var r=(0,u.toArrayChildren)(i(n));this.isValidChildByKey(r,e)?"appear"===t?p["default"].allowAppearCallback(n)&&(n.onAppear(e),n.onEnd(e,!0)):p["default"].allowEnterCallback(n)&&(n.onEnter(e),
n.onEnd(e,!0)):this.performLeave(e)}},performLeave:function(e){this.refs[e]&&(this.currentlyAnimatingKeys[e]=!0,this.refs[e].componentWillLeave(this.handleDoneLeaving.bind(this,e)))},handleDoneLeaving:function(e){var t=this.props;if(delete this.currentlyAnimatingKeys[e],!t.exclusive||t===this.nextProps){var n=(0,u.toArrayChildren)(i(t));if(this.isValidChildByKey(n,e))this.performEnter(e);else{var r=function(){p["default"].allowLeaveCallback(t)&&(t.onLeave(e),t.onEnd(e,!1))};this.isMounted()&&!(0,u.isSameChildren)(this.state.children,n,t.showProp)?this.setState({children:n},r):r()}}},isValidChildByKey:function(e,t){var n=this.props.showProp;return n?(0,u.findShownChildInChildrenByKey)(e,t,n):(0,u.findChildInChildrenByKey)(e,t)},stop:function(e){delete this.currentlyAnimatingKeys[e];var t=this.refs[e];t&&t.stop()},render:function(){var e=this.props;this.nextProps=e;var t=this.state.children,n=null;t&&(n=t.map(function(t){if(null===t||void 0===t)return t;if(!t.key)throw new Error("must set key for <rc-animate> children");return l["default"].createElement(d["default"],{key:t.key,ref:t.key,animation:e.animation,transitionName:e.transitionName,transitionEnter:e.transitionEnter,transitionAppear:e.transitionAppear,transitionLeave:e.transitionLeave},t)}));var r=e.component;if(r){var o=e;return"string"==typeof r&&(o={className:e.className,style:e.style}),l["default"].createElement(r,o,n)}return n[0]||null}});t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o="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},i=n(1),a=r(i),s=n(9),l=r(s),u=n(84),c=r(u),d=n(89),f=r(d),p={enter:"transitionEnter",appear:"transitionAppear",leave:"transitionLeave"},h=a["default"].createClass({displayName:"AnimateChild",propTypes:{children:a["default"].PropTypes.any},componentWillUnmount:function(){this.stop()},componentWillEnter:function(e){f["default"].isEnterSupported(this.props)?this.transition("enter",e):e()},componentWillAppear:function(e){f["default"].isAppearSupported(this.props)?this.transition("appear",e):e()},componentWillLeave:function(e){f["default"].isLeaveSupported(this.props)?this.transition("leave",e):e()},transition:function(e,t){var n=this,r=l["default"].findDOMNode(this),i=this.props,a=i.transitionName,s="object"===("undefined"==typeof a?"undefined":o(a));this.stop();var d=function(){n.stopper=null,t()};if((u.isCssAnimationSupported||!i.animation[e])&&a&&i[p[e]]){var f=s?a[e]:a+"-"+e,h=f+"-active";s&&a[e+"Active"]&&(h=a[e+"Active"]),this.stopper=(0,c["default"])(r,{name:f,active:h},d)}else this.stopper=i.animation[e](r,d)},stop:function(){var e=this.stopper;e&&(this.stopper=null,e.stop())},render:function(){return this.props.children}});t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=[];return d["default"].Children.forEach(e,function(e){t.push(e)}),t}function i(e,t){var n=null;return e&&e.forEach(function(e){n||e&&e.key===t&&(n=e)}),n}function a(e,t,n){var r=null;return e&&e.forEach(function(e){if(e&&e.key===t&&e.props[n]){if(r)throw new Error("two child with same key for <rc-animate> children");r=e}}),r}function s(e,t,n){var r=0;return e&&e.forEach(function(e){r||(r=e&&e.key===t&&!e.props[n])}),r}function l(e,t,n){var r=e.length===t.length;return r&&e.forEach(function(e,o){var i=t[o];e&&i&&(e&&!i||!e&&i?r=!1:e.key!==i.key?r=!1:n&&e.props[n]!==i.props[n]&&(r=!1))}),r}function u(e,t){var n=[],r={},o=[];return e.forEach(function(e){e&&i(t,e.key)?o.length&&(r[e.key]=o,o=[]):o.push(e)}),t.forEach(function(e){e&&r.hasOwnProperty(e.key)&&(n=n.concat(r[e.key])),n.push(e)}),n=n.concat(o)}Object.defineProperty(t,"__esModule",{value:!0}),t.toArrayChildren=o,t.findChildInChildrenByKey=i,t.findShownChildInChildrenByKey=a,t.findHiddenChildInChildrenByKey=s,t.isSameChildren=l,t.mergeChildren=u;var c=n(1),d=r(c)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){function n(){o&&(clearTimeout(o),o=null)}function r(){n(),o=setTimeout(e,t)}var o=void 0;return r.clear=n,r}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=r(i),s=n(9),l=r(s),u=n(244),c=r(u),d=n(45),f=r(d),p=n(270),h=r(p),m=a["default"].createClass({displayName:"Align",propTypes:{childrenProps:i.PropTypes.object,align:i.PropTypes.object.isRequired,target:i.PropTypes.func,onAlign:i.PropTypes.func,monitorBufferTime:i.PropTypes.number,monitorWindowResize:i.PropTypes.bool,disabled:i.PropTypes.bool,children:i.PropTypes.any},getDefaultProps:function(){return{target:function(){return window},onAlign:function(){},monitorBufferTime:50,monitorWindowResize:!1,disabled:!1}},componentDidMount:function(){var e=this.props;this.forceAlign(),!e.disabled&&e.monitorWindowResize&&this.startMonitorWindowResize()},componentDidUpdate:function(e){var t=!1,n=this.props;if(!n.disabled)if(e.disabled||e.align!==n.align)t=!0;else{var r=e.target(),o=n.target();(0,h["default"])(r)&&(0,h["default"])(o)?t=!1:r!==o&&(t=!0)}t&&this.forceAlign(),n.monitorWindowResize&&!n.disabled?this.startMonitorWindowResize():this.stopMonitorWindowResize()},componentWillUnmount:function(){this.stopMonitorWindowResize()},startMonitorWindowResize:function(){this.resizeHandler||(this.bufferMonitor=o(this.forceAlign,this.props.monitorBufferTime),this.resizeHandler=(0,f["default"])(window,"resize",this.bufferMonitor))},stopMonitorWindowResize:function(){this.resizeHandler&&(this.bufferMonitor.clear(),this.resizeHandler.remove(),this.resizeHandler=null)},forceAlign:function(){var e=this.props;if(!e.disabled){var t=l["default"].findDOMNode(this);e.onAlign(t,(0,c["default"])(t,e.target(),e.align))}},render:function(){var e=this.props,t=e.childrenProps,n=e.children,r=a["default"].Children.only(n);if(t){var o={};for(var i in t)t.hasOwnProperty(i)&&(o[i]=this.props[t[i]]);return a["default"].cloneElement(r,o)}return r}});t["default"]=m,e.exports=t["default"]},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(268),i=r(o);t["default"]=i["default"],e.exports=t["default"]},function(e,t){"use strict";function n(e){return null!=e&&e==e.window}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]},function(e,t,n){n(43),n(303),e.exports=n(12).Array.from},function(e,t,n){n(65),n(43),e.exports=n(301)},function(e,t,n){n(65),n(43),e.exports=n(302)},function(e,t,n){n(305),e.exports=n(12).Object.assign},function(e,t,n){n(306);var r=n(12).Object;e.exports=function(e,t){return r.create(e,t)}},function(e,t,n){n(307);var r=n(12).Object;e.exports=function(e,t,n){return r.defineProperty(e,t,n)}},function(e,t,n){n(308),e.exports=n(12).Object.setPrototypeOf},function(e,t,n){n(310),n(309),n(311),n(312),e.exports=n(12).Symbol},function(e,t,n){n(43),n(65),e.exports=n(64).f("iterator")},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){e.exports=function(){}},function(e,t,n){var r=n(24),o=n(99),i=n(300);e.exports=function(e){return function(t,n,a){var s,l=r(t),u=o(l.length),c=i(a,u);if(e&&n!=n){for(;u>c;)if(s=l[c++],s!=s)return!0}else for(;u>c;c++)if((e||c in l)&&l[c]===n)return e||c||0;return!e&&-1}}},function(e,t,n){"use strict";var r=n(18),o=n(34);e.exports=function(e,t,n){t in e?r.f(e,t,o(0,n)):e[t]=n}},function(e,t,n){var r=n(33),o=n(56),i=n(41);e.exports=function(e){var t=r(e),n=o.f;if(n)for(var a,s=n(e),l=i.f,u=0;s.length>u;)l.call(e,a=s[u++])&&t.push(a);return t}},function(e,t,n){e.exports=n(17).document&&document.documentElement},function(e,t,n){var r=n(28),o=n(13)("iterator"),i=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||i[o]===e)}},function(e,t,n){var r=n(50);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){var r=n(20);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(i){var a=e["return"];throw void 0!==a&&r(a.call(e)),i}}},function(e,t,n){"use strict";var r=n(55),o=n(34),i=n(57),a={};n(27)(a,n(13)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=r(a,{next:o(1,n)}),i(e,t+" Iterator")}},function(e,t,n){var r=n(13)("iterator"),o=!1;try{var i=[7][r]();i["return"]=function(){o=!0},Array.from(i,function(){throw 2})}catch(a){}e.exports=function(e,t){if(!t&&!o)return!1;var n=!1;try{var i=[7],a=i[r]();a.next=function(){return{done:n=!0}},i[r]=function(){return a},e(i)}catch(s){}return n}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){var r=n(33),o=n(24);e.exports=function(e,t){for(var n,i=o(e),a=r(i),s=a.length,l=0;s>l;)if(i[n=a[l++]]===t)return n}},function(e,t,n){var r=n(42)("meta"),o=n(32),i=n(23),a=n(18).f,s=0,l=Object.isExtensible||function(){return!0},u=!n(31)(function(){return l(Object.preventExtensions({}))}),c=function(e){a(e,r,{value:{i:"O"+ ++s,w:{}}})},d=function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,r)){if(!l(e))return"F";if(!t)return"E";c(e)}return e[r].i},f=function(e,t){if(!i(e,r)){if(!l(e))return!0;if(!t)return!1;c(e)}return e[r].w},p=function(e){return u&&h.NEED&&l(e)&&!i(e,r)&&c(e),e},h=e.exports={KEY:r,NEED:!1,fastKey:d,getWeak:f,onFreeze:p}},function(e,t,n){"use strict";var r=n(33),o=n(56),i=n(41),a=n(61),s=n(93),l=Object.assign;e.exports=!l||n(31)(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=l({},e)[n]||Object.keys(l({},t)).join("")!=r})?function(e,t){for(var n=a(e),l=arguments.length,u=1,c=o.f,d=i.f;l>u;)for(var f,p=s(arguments[u++]),h=c?r(p).concat(c(p)):r(p),m=h.length,v=0;m>v;)d.call(p,f=h[v++])&&(n[f]=p[f]);return n}:l},function(e,t,n){var r=n(18),o=n(20),i=n(33);e.exports=n(21)?Object.defineProperties:function(e,t){o(e);for(var n,a=i(t),s=a.length,l=0;s>l;)r.f(e,n=a[l++],t[n]);return e}},function(e,t,n){var r=n(24),o=n(96).f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],s=function(e){try{return o(e)}catch(t){return a.slice()}};e.exports.f=function(e){return a&&"[object Window]"==i.call(e)?s(e):o(r(e))}},function(e,t,n){var r=n(23),o=n(61),i=n(58)("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=o(e),r(e,i)?e[i]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},function(e,t,n){var r=n(32),o=n(20),i=function(e,t){if(o(e),!r(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,r){try{r=n(51)(Function.call,n(95).f(Object.prototype,"__proto__").set,2),r(e,[]),t=!(e instanceof Array)}catch(o){t=!0}return function(e,n){return i(e,n),t?e.__proto__=n:r(e,n),e}}({},!1):void 0),check:i}},function(e,t,n){var r=n(60),o=n(52);e.exports=function(e){return function(t,n){var i,a,s=String(o(t)),l=r(n),u=s.length;return l<0||l>=u?e?"":void 0:(i=s.charCodeAt(l),i<55296||i>56319||l+1===u||(a=s.charCodeAt(l+1))<56320||a>57343?e?s.charAt(l):i:e?s.slice(l,l+2):(i-55296<<10)+(a-56320)+65536)}}},function(e,t,n){var r=n(60),o=Math.max,i=Math.min;e.exports=function(e,t){return e=r(e),e<0?o(e+t,0):i(e,t)}},function(e,t,n){var r=n(20),o=n(100);e.exports=n(12).getIterator=function(e){var t=o(e);if("function"!=typeof t)throw TypeError(e+" is not iterable!");return r(t.call(e))}},function(e,t,n){var r=n(90),o=n(13)("iterator"),i=n(28);e.exports=n(12).isIterable=function(e){var t=Object(e);return void 0!==t[o]||"@@iterator"in t||i.hasOwnProperty(r(t))}},function(e,t,n){"use strict";var r=n(51),o=n(22),i=n(61),a=n(288),s=n(286),l=n(99),u=n(283),c=n(100);o(o.S+o.F*!n(290)(function(e){Array.from(e)}),"Array",{from:function(e){var t,n,o,d,f=i(e),p="function"==typeof this?this:Array,h=arguments.length,m=h>1?arguments[1]:void 0,v=void 0!==m,y=0,g=c(f);if(v&&(m=r(m,h>2?arguments[2]:void 0,2)),void 0==g||p==Array&&s(g))for(t=l(f.length),n=new p(t);t>y;y++)u(n,y,v?m(f[y],y):f[y]);else for(d=g.call(f),n=new p;!(o=d.next()).done;y++)u(n,y,v?a(d,m,[o.value,y],!0):o.value);return n.length=y,n}})},function(e,t,n){"use strict";var r=n(281),o=n(291),i=n(28),a=n(24);e.exports=n(94)(Array,"Array",function(e,t){this._t=a(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,o(1)):"keys"==t?o(0,n):"values"==t?o(0,e[n]):o(0,[n,e[n]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},function(e,t,n){var r=n(22);r(r.S+r.F,"Object",{assign:n(294)})},function(e,t,n){var r=n(22);r(r.S,"Object",{create:n(55)})},function(e,t,n){var r=n(22);r(r.S+r.F*!n(21),"Object",{defineProperty:n(18).f})},function(e,t,n){var r=n(22);r(r.S,"Object",{setPrototypeOf:n(298).set})},function(e,t){},function(e,t,n){"use strict";var r=n(17),o=n(23),i=n(21),a=n(22),s=n(98),l=n(293).KEY,u=n(31),c=n(59),d=n(57),f=n(42),p=n(13),h=n(64),m=n(63),v=n(292),y=n(284),g=n(287),b=n(20),_=n(24),T=n(62),C=n(34),x=n(55),w=n(296),P=n(95),S=n(18),E=n(33),O=P.f,M=S.f,k=w.f,N=r.Symbol,D=r.JSON,R=D&&D.stringify,I="prototype",j=p("_hidden"),A=p("toPrimitive"),L={}.propertyIsEnumerable,W=c("symbol-registry"),V=c("symbols"),H=c("op-symbols"),F=Object[I],Y="function"==typeof N,B=r.QObject,z=!B||!B[I]||!B[I].findChild,U=i&&u(function(){return 7!=x(M({},"a",{get:function(){return M(this,"a",{value:7}).a}})).a})?function(e,t,n){var r=O(F,t);r&&delete F[t],M(e,t,n),r&&e!==F&&M(F,t,r)}:M,G=function(e){var t=V[e]=x(N[I]);return t._k=e,t},X=Y&&"symbol"==typeof N.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof N},K=function(e,t,n){return e===F&&K(H,t,n),b(e),t=T(t,!0),b(n),o(V,t)?(n.enumerable?(o(e,j)&&e[j][t]&&(e[j][t]=!1),n=x(n,{enumerable:C(0,!1)})):(o(e,j)||M(e,j,C(1,{})),e[j][t]=!0),U(e,t,n)):M(e,t,n)},q=function(e,t){b(e);for(var n,r=y(t=_(t)),o=0,i=r.length;i>o;)K(e,n=r[o++],t[n]);return e},Z=function(e,t){return void 0===t?x(e):q(x(e),t)},Q=function(e){var t=L.call(this,e=T(e,!0));return!(this===F&&o(V,e)&&!o(H,e))&&(!(t||!o(this,e)||!o(V,e)||o(this,j)&&this[j][e])||t)},$=function(e,t){if(e=_(e),t=T(t,!0),e!==F||!o(V,t)||o(H,t)){var n=O(e,t);return!n||!o(V,t)||o(e,j)&&e[j][t]||(n.enumerable=!0),n}},J=function(e){for(var t,n=k(_(e)),r=[],i=0;n.length>i;)o(V,t=n[i++])||t==j||t==l||r.push(t);return r},ee=function(e){for(var t,n=e===F,r=k(n?H:_(e)),i=[],a=0;r.length>a;)!o(V,t=r[a++])||n&&!o(F,t)||i.push(V[t]);return i};Y||(N=function(){if(this instanceof N)throw TypeError("Symbol is not a constructor!");var e=f(arguments.length>0?arguments[0]:void 0),t=function(n){this===F&&t.call(H,n),o(this,j)&&o(this[j],e)&&(this[j][e]=!1),U(this,e,C(1,n))};return i&&z&&U(F,e,{configurable:!0,set:t}),G(e)},s(N[I],"toString",function(){return this._k}),P.f=$,S.f=K,n(96).f=w.f=J,n(41).f=Q,n(56).f=ee,i&&!n(54)&&s(F,"propertyIsEnumerable",Q,!0),h.f=function(e){return G(p(e))}),a(a.G+a.W+a.F*!Y,{Symbol:N});for(var te="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ne=0;te.length>ne;)p(te[ne++]);for(var te=E(p.store),ne=0;te.length>ne;)m(te[ne++]);a(a.S+a.F*!Y,"Symbol",{"for":function(e){return o(W,e+="")?W[e]:W[e]=N(e)},keyFor:function(e){if(X(e))return v(W,e);throw TypeError(e+" is not a symbol!")},useSetter:function(){z=!0},useSimple:function(){z=!1}}),a(a.S+a.F*!Y,"Object",{create:Z,defineProperty:K,defineProperties:q,getOwnPropertyDescriptor:$,getOwnPropertyNames:J,getOwnPropertySymbols:ee}),D&&a(a.S+a.F*(!Y||u(function(){var e=N();return"[null]"!=R([e])||"{}"!=R({a:e})||"{}"!=R(Object(e))})),"JSON",{stringify:function(e){if(void 0!==e&&!X(e)){for(var t,n,r=[e],o=1;arguments.length>o;)r.push(arguments[o++]);return t=r[1],"function"==typeof t&&(n=t),!n&&g(t)||(t=function(e,t){if(n&&(t=n.call(this,e,t)),!X(t))return t}),r[1]=t,R.apply(D,r)}}}),N[I][A]||n(27)(N[I],A,N[I].valueOf),d(N,"Symbol"),d(Math,"Math",!0),d(r.JSON,"JSON",!0)},function(e,t,n){n(63)("asyncIterator")},function(e,t,n){n(63)("observable")},function(e,t){function n(e){return!!e&&"object"==typeof e}function r(e,t){var n=null==e?void 0:e[t];return s(n)?n:void 0}function o(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=y}function i(e){return a(e)&&h.call(e)==u}function a(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function s(e){return null!=e&&(i(e)?m.test(f.call(e)):n(e)&&c.test(e))}var l="[object Array]",u="[object Function]",c=/^\[object .+?Constructor\]$/,d=Object.prototype,f=Function.prototype.toString,p=d.hasOwnProperty,h=d.toString,m=RegExp("^"+f.call(p).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),v=r(Array,"isArray"),y=9007199254740991,g=v||function(e){return n(e)&&o(e.length)&&h.call(e)==l};e.exports=g},function(e,t,n){function r(e){var t=e.getDefaultProps;t&&(e.defaultProps=t(),delete e.getDefaultProps)}function o(e){function t(e){var t=e.state||{};s(t,n.call(e)),e.state=t}var n=e.getInitialState,r=e.componentWillMount;n&&(r?e.componentWillMount=function(){t(this),r.call(this)}:e.componentWillMount=function(){t(this)},delete e.getInitialState)}function i(e,t){r(t),o(t);var n={},s={};Object.keys(t).forEach(function(e){"mixins"!==e&&"statics"!==e&&("function"==typeof t[e]?n[e]=t[e]:s[e]=t[e])}),l(e.prototype,n);var u=function(e,t,n){if(!e)return t;if(!t)return e;var r={};return Object.keys(e).forEach(function(n){t[n]||(r[n]=e[n])}),Object.keys(t).forEach(function(n){e[n]?r[n]=function(){return t[n].apply(this,arguments)&&e[n].apply(this,arguments)}:r[n]=t[n]}),r};return a({childContextTypes:u,contextTypes:u,propTypes:a.MANY_MERGED_LOOSE,defaultProps:a.MANY_MERGED_LOOSE})(e,s),t.statics&&Object.getOwnPropertyNames(t.statics).forEach(function(n){var r=e[n],o=t.statics[n];if(void 0!==r&&void 0!==o)throw new TypeError("Cannot mixin statics because statics."+n+" and Component."+n+" are defined.");e[n]=void 0!==r?r:o}),t.mixins&&t.mixins.reverse().forEach(i.bind(null,e)),e}var a=n(256),s=n(11),l=a({componentDidMount:a.MANY,componentWillMount:a.MANY,componentWillReceiveProps:a.MANY,shouldComponentUpdate:a.ONCE,componentWillUpdate:a.MANY,componentDidUpdate:a.MANY,componentWillUnmount:a.MANY,getChildContext:a.MANY_MERGED});e.exports=function(){var e=l;return e.onClass=function(e,t){return t=s({},t),i(e,t)},e.decorate=function(t){return function(n){return e.onClass(n,t)}},e}()},function(e,t){function n(e){return o(e)&&h.call(e,"callee")&&(!v.call(e,"callee")||m.call(e)==c)}function r(e){return null!=e&&a(e.length)&&!i(e)}function o(e){return l(e)&&r(e)}function i(e){var t=s(e)?m.call(e):"";return t==d||t==f}function a(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=u}function s(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function l(e){return!!e&&"object"==typeof e}var u=9007199254740991,c="[object Arguments]",d="[object Function]",f="[object GeneratorFunction]",p=Object.prototype,h=p.hasOwnProperty,m=p.toString,v=p.propertyIsEnumerable;e.exports=n},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(26),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(15),m=r(h),v=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e=this.props,t=e.prefixCls,n=e.disabled,r=(0,i["default"])(e,["prefixCls","disabled"]);return p["default"].createElement(m["default"],{disabled:n,activeClassName:t+"-handler-active"},p["default"].createElement("span",r))},t}(f.Component);v.propTypes={prefixCls:f.PropTypes.string,disabled:f.PropTypes.bool},t["default"]=v,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){}function i(e){e.preventDefault()}Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=r(a),l=n(7),u=r(l),c=n(1),d=r(c),f=n(5),p=r(f),h=n(318),m=r(h),v=n(316),y=r(v),g=d["default"].createClass({displayName:"InputNumber",propTypes:{focusOnUpDown:c.PropTypes.bool,onChange:c.PropTypes.func,onKeyDown:c.PropTypes.func,onKeyUp:c.PropTypes.func,prefixCls:c.PropTypes.string,disabled:c.PropTypes.bool,onFocus:c.PropTypes.func,onBlur:c.PropTypes.func,readOnly:c.PropTypes.bool,max:c.PropTypes.number,min:c.PropTypes.number,step:c.PropTypes.oneOfType([c.PropTypes.number,c.PropTypes.string]),upHandler:c.PropTypes.node,downHandler:c.PropTypes.node},mixins:[m["default"]],getDefaultProps:function(){return{focusOnUpDown:!0,prefixCls:"rc-input-number"}},componentDidMount:function(){this.componentDidUpdate()},componentDidUpdate:function(){this.props.focusOnUpDown&&this.state.focused&&document.activeElement!==this.refs.input&&this.focus()},onKeyDown:function b(e){38===e.keyCode?this.up(e):40===e.keyCode&&this.down(e);var b=this.props.onKeyDown;if(b){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];b.apply(void 0,[e].concat(n))}},onKeyUp:function _(e){this.stop();var _=this.props.onKeyUp;if(_){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];_.apply(void 0,[e].concat(n))}},getValueFromEvent:function(e){return e.target.value},focus:function(){this.refs.input.focus()},render:function(){var e,t=(0,u["default"])({},this.props),n=t.prefixCls,r=t.disabled,a=t.readOnly,l=(0,p["default"])((e={},(0,s["default"])(e,n,!0),(0,s["default"])(e,t.className,!!t.className),(0,s["default"])(e,n+"-disabled",r),(0,s["default"])(e,n+"-focused",this.state.focused),e)),c="",f="",h=this.state.value;if(isNaN(h))c=n+"-handler-up-disabled",f=n+"-handler-down-disabled";else{var m=Number(h);m>=t.max&&(c=n+"-handler-up-disabled"),m<=t.min&&(f=n+"-handler-down-disabled")}var v=!t.readOnly&&!t.disabled,g=void 0;return g=this.state.focused?this.state.inputValue:this.toPrecisionAsStep(this.state.value),void 0===g&&(g=""),d["default"].createElement("div",{className:l,style:t.style},d["default"].createElement("div",{className:n+"-handler-wrap"},d["default"].createElement(y["default"],{ref:"up",disabled:!!c||r||a,prefixCls:n,unselectable:"unselectable",onTouchStart:v&&!c?this.up:o,onTouchEnd:this.stop,onMouseDown:v&&!c?this.up:o,onMouseUp:this.stop,onMouseLeave:this.stop,className:n+"-handler "+n+"-handler-up "+c},this.props.upHandler||d["default"].createElement("span",{unselectable:"unselectable",className:n+"-handler-up-inner",onClick:i})),d["default"].createElement(y["default"],{ref:"down",disabled:!!f||r||a,prefixCls:n,unselectable:"unselectable",onTouchStart:v&&!f?this.down:o,onTouchEnd:this.stop,onMouseDown:v&&!f?this.down:o,onMouseUp:this.stop,onMouseLeave:this.stop,className:n+"-handler "+n+"-handler-down "+f},this.props.downHandler||d["default"].createElement("span",{unselectable:"unselectable",className:n+"-handler-down-inner",onClick:i}))),d["default"].createElement("div",{className:n+"-input-wrap"},d["default"].createElement("input",{type:t.type,placeholder:t.placeholder,onClick:t.onClick,className:n+"-input",autoComplete:"off",onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,autoFocus:t.autoFocus,readOnly:t.readOnly,disabled:t.disabled,max:t.max,min:t.min,name:t.name,onChange:this.onChange,ref:"input",value:g})))}});t["default"]=g,e.exports=t["default"]},function(e,t){"use strict";function n(){}Object.defineProperty(t,"__esModule",{value:!0});var r=200,o=600;t["default"]={getDefaultProps:function(){return{max:1/0,min:-(1/0),step:1,style:{},defaultValue:"",onChange:n,onKeyDown:n,onFocus:n,onBlur:n}},getInitialState:function(){var e=void 0,t=this.props;return e="value"in t?t.value:t.defaultValue,e=this.toNumber(e),{inputValue:this.toPrecisionAsStep(e),value:e,focused:t.autoFocus}},componentWillReceiveProps:function(e){if("value"in e){var t=this.toNumber(e.value);this.setState({inputValue:e.value,value:t})}},componentWillUnmount:function(){this.stop()},onChange:function(e){var t=this.getValueFromEvent(e).trim();this.setState({inputValue:t}),this.props.onChange(this.toNumber(t))},onFocus:function(){var e;this.setState({focused:!0}),(e=this.props).onFocus.apply(e,arguments)},onBlur:function(e){for(var t=this,n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];this.setState({focused:!1});var i=this.getCurrentValidValue(this.getValueFromEvent(e).trim());this.setValue(i,function(){var n;(n=t.props).onBlur.apply(n,[e].concat(r))})},getCurrentValidValue:function(e){var t=e,n=this.props;return""===t?t="":this.isNotCompleteNumber(t)?t=this.state.value:(t=Number(t),t<n.min&&(t=n.min),t>n.max&&(t=n.max)),this.toNumber(t)},setValue:function(e,t){var n=this.isNotCompleteNumber(parseFloat(e,10))?void 0:parseFloat(e,10),r=n!==this.state.value;"value"in this.props?this.setState({inputValue:this.toPrecisionAsStep(this.state.value)},t):this.setState({value:e,inputValue:this.toPrecisionAsStep(e)},t),r&&this.props.onChange(n)},getPrecision:function(e){var t=e.toString();if(t.indexOf("e-")>=0)return parseInt(t.slice(t.indexOf("e-")+1),10);var n=0;return t.indexOf(".")>=0&&(n=t.length-t.indexOf(".")-1),n},getMaxPrecision:function(e){var t=this.props.step,n=this.getPrecision(t);if(!e)return n;var r=this.getPrecision(e);return r>n?r:n},getPrecisionFactor:function(e){var t=this.getMaxPrecision(e);return Math.pow(10,t)},toPrecisionAsStep:function(e){if(this.isNotCompleteNumber(e)||""===e)return e;var t=Math.abs(this.getMaxPrecision(e));return t?Number(e).toFixed(t):e.toString()},isNotCompleteNumber:function(e){return isNaN(e)||""===e||e.toString().indexOf(".")===e.toString().length-1},toNumber:function(e){return this.isNotCompleteNumber(e)?e:Number(e)},upStep:function(e){var t=this.props,n=t.step,r=t.min,o=this.getPrecisionFactor(e),i=Math.abs(this.getMaxPrecision(e)),a=void 0;return a="number"==typeof e?((o*e+o*n)/o).toFixed(i):r===-(1/0)?n:r,this.toNumber(a)},downStep:function(e){var t=this.props,n=t.step,r=t.min,o=this.getPrecisionFactor(e),i=Math.abs(this.getMaxPrecision(e)),a=void 0;return a="number"==typeof e?((o*e-o*n)/o).toFixed(i):r===-(1/0)?-n:r,this.toNumber(a)},step:function(e,t){t&&t.preventDefault();var n=this.props;if(!n.disabled){var r=this.getCurrentValidValue(this.state.inputValue);if(!this.isNotCompleteNumber(r)){var o=this[e+"Step"](r);o>n.max||o<n.min||(this.setValue(o),this.setState({focused:!0}))}}},stop:function(){this.autoStepTimer&&clearTimeout(this.autoStepTimer)},down:function(e,t){var n=this;e.persist&&e.persist(),this.stop(),this.step("down",e),this.autoStepTimer=setTimeout(function(){n.down(e,!0)},t?r:o)},up:function(e,t){var n=this;e.persist&&e.persist(),this.stop(),this.step("up",e),this.autoStepTimer=setTimeout(function(){n.up(e,!0)},t?r:o)}},e.exports=t["default"]},function(e,t,n){function r(e){return function(t){return null==t?void 0:t[e]}}function o(e){return null!=e&&a(g(e))}function i(e,t){return e="number"==typeof e||p.test(e)?+e:-1,t=null==t?y:t,e>-1&&e%1==0&&e<t}function a(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=y}function s(e){for(var t=u(e),n=t.length,r=n&&e.length,o=!!r&&a(r)&&(f(e)||d(e)),s=-1,l=[];++s<n;){var c=t[s];(o&&i(c,r)||m.call(e,c))&&l.push(c)}return l}function l(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function u(e){if(null==e)return[];l(e)||(e=Object(e));var t=e.length;t=t&&a(t)&&(f(e)||d(e))&&t||0;for(var n=e.constructor,r=-1,o="function"==typeof n&&n.prototype===e,s=Array(t),u=t>0;++r<t;)s[r]=r+"";for(var c in e)u&&i(c,t)||"constructor"==c&&(o||!m.call(e,c))||s.push(c);return s}var c=n(331),d=n(315),f=n(313),p=/^\d+$/,h=Object.prototype,m=h.hasOwnProperty,v=c(Object,"keys"),y=9007199254740991,g=r("length"),b=v?function(e){var t=null==e?void 0:e.constructor;return"function"==typeof t&&t.prototype===e||"function"!=typeof e&&o(e)?s(e):l(e)?v(e):[]}:s;e.exports=b},function(e,t){"use strict";var n={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229};n.isTextModifyingKeyEvent=function(e){var t=e.keyCode;if(e.altKey&&!e.ctrlKey||e.metaKey||t>=n.F1&&t<=n.F12)return!1;switch(t){case n.ALT:case n.CAPS_LOCK:case n.CONTEXT_MENU:case n.CTRL:case n.DOWN:case n.END:case n.ESC:case n.HOME:case n.INSERT:case n.LEFT:case n.MAC_FF_META:case n.META:case n.NUMLOCK:case n.NUM_CENTER:case n.PAGE_DOWN:case n.PAGE_UP:case n.PAUSE:case n.PRINT_SCREEN:case n.RIGHT:case n.SHIFT:case n.UP:case n.WIN_KEY:case n.WIN_KEY_RIGHT:return!1;default:return!0}},n.isCharacterKey=function(e){if(e>=n.ZERO&&e<=n.NINE)return!0;if(e>=n.NUM_ZERO&&e<=n.NUM_MULTIPLY)return!0;if(e>=n.A&&e<=n.Z)return!0;if(window.navigation.userAgent.indexOf("WebKit")!==-1&&0===e)return!0;switch(e){case n.SPACE:case n.QUESTION_MARK:case n.NUM_PLUS:case n.NUM_MINUS:case n.NUM_PERIOD:case n.NUM_DIVISION:case n.SEMICOLON:case n.DASH:case n.EQUALS:case n.COMMA:case n.PERIOD:case n.SLASH:case n.APOSTROPHE:case n.SINGLE_QUOTE:case n.OPEN_SQUARE_BRACKET:case n.BACKSLASH:case n.CLOSE_SQUARE_BRACKET:return!0;default:return!1}},e.exports=n},function(e,t){"use strict";function n(){var e=arguments;return function(){for(var t=0;t<e.length;t++)e[t]&&e[t].apply&&e[t].apply(this,arguments)}}e.exports=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){var e=document.createElement("div");return document.body.appendChild(e),e}function i(e){function t(e,t,n){(!c||e._component||c(e))&&(e._container||(e._container=p(e)),l["default"].unstable_renderSubtreeIntoContainer(e,d(e,t),e._container,function(){e._component=this,n&&n.call(this)}))}function n(e){if(e._container){var t=e._container;l["default"].unmountComponentAtNode(t),t.parentNode.removeChild(t),e._container=null}}var r=e.autoMount,i=void 0===r||r,s=e.autoDestroy,u=void 0===s||s,c=e.isVisible,d=e.getComponent,f=e.getContainer,p=void 0===f?o:f,h=void 0;return i&&(h=a({},h,{componentDidMount:function(){t(this)},componentDidUpdate:function(){t(this)}})),i&&u||(h=a({},h,{renderComponent:function(e,n){t(this,e,n)}})),h=u?a({},h,{componentWillUnmount:function(){n(this)}}):a({},h,{removeContainer:function(){n(this)}})}Object.defineProperty(t,"__esModule",{value:!0});var a=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"]=i;var s=n(9),l=r(s);e.exports=t["default"]},function(e,t){"use strict";function n(e){if(e||void 0===r){var t=document.createElement("div");t.style.width="100%",t.style.height="200px";var n=document.createElement("div"),o=n.style;o.position="absolute",o.top=0,o.left=0,o.pointerEvents="none",o.visibility="hidden",o.width="200px",o.height="150px",o.overflow="hidden",n.appendChild(t),document.body.appendChild(n);var i=t.offsetWidth;n.style.overflow="scroll";var a=t.offsetWidth;i===a&&(a=n.clientWidth),document.body.removeChild(n),r=i-a}return r}var r=void 0;e.exports=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);
return n}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},a=n(1),s=r(a),l=n(325),u=n(254),c=r(u),d=s["default"].createClass({displayName:"Tooltip",propTypes:{trigger:a.PropTypes.any,children:a.PropTypes.any,defaultVisible:a.PropTypes.bool,visible:a.PropTypes.bool,placement:a.PropTypes.string,transitionName:a.PropTypes.string,animation:a.PropTypes.any,onVisibleChange:a.PropTypes.func,afterVisibleChange:a.PropTypes.func,overlay:a.PropTypes.oneOfType([s["default"].PropTypes.node,s["default"].PropTypes.func]).isRequired,overlayStyle:a.PropTypes.object,overlayClassName:a.PropTypes.string,prefixCls:a.PropTypes.string,mouseEnterDelay:a.PropTypes.number,mouseLeaveDelay:a.PropTypes.number,getTooltipContainer:a.PropTypes.func,destroyTooltipOnHide:a.PropTypes.bool,align:a.PropTypes.object,arrowContent:a.PropTypes.any},getDefaultProps:function(){return{prefixCls:"rc-tooltip",mouseEnterDelay:0,destroyTooltipOnHide:!1,mouseLeaveDelay:.1,align:{},placement:"right",trigger:["hover"],arrowContent:null}},getPopupElement:function(){var e=this.props,t=e.arrowContent,n=e.overlay,r=e.prefixCls;return[s["default"].createElement("div",{className:r+"-arrow",key:"arrow"},t),s["default"].createElement("div",{className:r+"-inner",key:"content"},"function"==typeof n?n():n)]},getPopupDomNode:function(){return this.refs.trigger.getPopupDomNode()},render:function(){var e=this.props,t=e.overlayClassName,n=e.trigger,r=e.mouseEnterDelay,a=e.mouseLeaveDelay,u=e.overlayStyle,d=e.prefixCls,f=e.children,p=e.onVisibleChange,h=e.transitionName,m=e.animation,v=e.placement,y=e.align,g=e.destroyTooltipOnHide,b=e.defaultVisible,_=e.getTooltipContainer,T=o(e,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer"]),C=i({},T);return"visible"in this.props&&(C.popupVisible=this.props.visible),s["default"].createElement(c["default"],i({popupClassName:t,ref:"trigger",prefixCls:d,popup:this.getPopupElement,action:n,builtinPlacements:l.placements,popupPlacement:v,popupAlign:y,getPopupContainer:_,onPopupVisibleChange:p,popupTransitionName:h,popupAnimation:m,defaultPopupVisible:b,destroyPopupOnHide:g,mouseLeaveDelay:a,popupStyle:u,mouseEnterDelay:r},C),f)}});t["default"]=d,e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={adjustX:1,adjustY:1},r=[0,0],o=t.placements={left:{points:["cr","cl"],overflow:n,offset:[-4,0],targetOffset:r},right:{points:["cl","cr"],overflow:n,offset:[4,0],targetOffset:r},top:{points:["bc","tc"],overflow:n,offset:[0,-4],targetOffset:r},bottom:{points:["tc","bc"],overflow:n,offset:[0,4],targetOffset:r},topLeft:{points:["bl","tl"],overflow:n,offset:[0,-4],targetOffset:r},leftTop:{points:["tr","tl"],overflow:n,offset:[-4,0],targetOffset:r},topRight:{points:["br","tr"],overflow:n,offset:[0,-4],targetOffset:r},rightTop:{points:["tl","tr"],overflow:n,offset:[4,0],targetOffset:r},bottomRight:{points:["tr","br"],overflow:n,offset:[0,4],targetOffset:r},rightBottom:{points:["bl","br"],overflow:n,offset:[4,0],targetOffset:r},bottomLeft:{points:["tl","bl"],overflow:n,offset:[0,4],targetOffset:r},leftBottom:{points:["br","bl"],overflow:n,offset:[-4,0],targetOffset:r}};t["default"]=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={getDefaultProps:function(){return{prefixCls:"rmc-multi-picker",pickerPrefixCls:"rmc-picker",onValueChange:function(){},disabled:!1}},getValue:function(){var e=this.props,t=e.children,n=e.selectedValue;return n&&n.length?n:t?t.map(function(e){var t=e.props.children;return t&&t[0]&&t[0].value}):[]},onValueChange:function(e,t){var n=this.getValue().concat();n[e]=t,this.props.onValueChange(n,e)}},e.exports=t["default"]},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(6),i=r(o),a=n(1),s=r(a),l=n(5),u=r(l),c=n(76),d=r(c),f=n(328),p=r(f),h=n(330),m=r(h),v=s["default"].createClass({displayName:"Picker",mixins:[p["default"]],getDefaultProps:function(){return{prefixCls:"rmc-picker",pure:!0,onValueChange:function(){}}},getInitialState:function(){var e=void 0,t=this.props,n=t.selectedValue,r=t.defaultSelectedValue,o=t.children;return void 0!==n?e=n:void 0!==r?e=r:o&&o.length&&(e=o[0].value),{selectedValue:e}},componentDidMount:function(){this.itemHeight=this.refs.indicator.offsetHeight,this.refs.content.style.padding=3*this.itemHeight+"px 0",this.zscroller=new d["default"](this.refs.content,{scrollingX:!1,snapping:!0,penetrationDeceleration:.1,minVelocityToKeepDecelerating:.5,scrollingComplete:this.scrollingComplete}),this.zscroller.setDisabled(this.props.disabled),this.zscroller.scroller.setSnapSize(0,this.itemHeight),this.select(this.state.selectedValue)},componentWillReceiveProps:function(e){"selectedValue"in e&&this.setState({selectedValue:e.selectedValue}),this.zscroller.setDisabled(e.disabled)},shouldComponentUpdate:function(e,t){return this.state.selectedValue!==t.selectedValue||!(0,m["default"])(this.props.children,e.children,this.props.pure)},componentDidUpdate:function(){this.zscroller.reflow(),this.select(this.state.selectedValue)},componentWillUnmount:function(){this.zscroller.destroy()},scrollTo:function(e){this.zscroller.scroller.scrollTo(0,e)},fireValueChange:function(e){e!==this.state.selectedValue&&("selectedValue"in this.props||this.setState({selectedValue:e}),this.props.onValueChange(e))},scrollingComplete:function(){var e=this.zscroller.scroller.getValues(),t=e.top;t>=0&&this.doScrollingComplete(t)},getChildMember:function(e,t){return e[t]},getValue:function(){return this.props.selectedValue||this.props.children&&this.props.children[0]&&this.props.children[0].value},toChildrenArray:function(e){return e},render:function(){var e,t=this.props,n=t.children,r=t.prefixCls,o=t.className,a=t.itemStyle,l=t.indicatorStyle,c=this.state.selectedValue,d=r+"-item",f=d+" "+r+"-item-selected",p=n.map(function(e){return s["default"].createElement("div",{style:a,className:c===e.value?f:d,key:e.value},e.label)}),h=(e={},(0,i["default"])(e,o,!!o),(0,i["default"])(e,r,!0),e);return s["default"].createElement("div",{className:(0,u["default"])(h)},s["default"].createElement("div",{className:r+"-mask"}),s["default"].createElement("div",{className:r+"-indicator",ref:"indicator",style:l}),s["default"].createElement("div",{className:r+"-content",ref:"content"},p))}});t["default"]=v,e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={select:function(e){for(var t=this.toChildrenArray(this.props.children),n=0,r=t.length;n<r;n++)if(this.getChildMember(t[n],"value")===e)return void this.selectByIndex(n);this.selectByIndex(0)},selectByIndex:function(e){e<0||e>=this.toChildrenArray(this.props.children).length||!this.itemHeight||this.scrollTo(e*this.itemHeight)},doScrollingComplete:function(e){var t=e/this.itemHeight,n=Math.floor(t);t=t-n>.5?n+1:n;var r=this.toChildrenArray(this.props.children);t=Math.min(t,r.length-1);var o=r[t];o?this.fireValueChange(this.getChildMember(o,"value")):console.warn&&console.warn("child not found",r,t)}},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){}Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),a=r(i),s=n(1),l=r(s);t["default"]={getDefaultProps:function(){return{onVisibleChange:o,okText:"Ok",pickerValueProp:"selectedValue",pickerValueChangeProp:"onValueChange",dismissText:"Dismiss",title:"",onOk:o,onDismiss:o}},getInitialState:function(){return{pickerValue:null,visible:this.props.visible||!1}},componentWillReceiveProps:function(e){"visible"in e&&this.setVisibleState(e.visible)},onPickerChange:function(e){if(this.state.pickerValue!==e){this.setState({pickerValue:e});var t=this.props,n=t.picker,r=t.pickerValueChangeProp;n&&n.props[r]&&n.props[r](e)}},saveRef:function(e){this.picker=e},setVisibleState:function(e){this.setState({visible:e}),e||this.setState({pickerValue:null})},fireVisibleChange:function(e){this.state.visible!==e&&("visible"in this.props||this.setVisibleState(e),this.props.onVisibleChange(e))},getRender:function(){var e=this.props,t=e.children;if(!t)return this.getModal();var n=this.props,r=n.WrapComponent,o=n.disabled,i=t,a={};return o||(a[e.triggerType]=this.onTriggerClick),l["default"].createElement(r,{style:e.wrapStyle},l["default"].cloneElement(i,a),this.getModal())},onTriggerClick:function(e){var t=this.props.children,n=t.props||{};n[this.props.triggerType]&&n[this.props.triggerType](e),this.fireVisibleChange(!this.state.visible)},onOk:function(){this.props.onOk(this.picker&&this.picker.getValue()),this.fireVisibleChange(!1)},getContent:function(){if(this.props.picker){var e;return l["default"].cloneElement(this.props.picker,(e={},(0,a["default"])(e,this.props.pickerValueProp,this.state.pickerValue||this.props.value),(0,a["default"])(e,this.props.pickerValueChangeProp,this.onPickerChange),(0,a["default"])(e,"ref",this.saveRef),e))}return this.props.content},onDismiss:function(){this.props.onDismiss(),this.fireVisibleChange(!1)},hide:function(){this.fireVisibleChange(!1)}},e.exports=t["default"]},function(e,t){"use strict";function n(e){return!e||!e.length}function r(e,t,r){if(n(e)&&n(t))return!0;if(r)return e===t;if(e.length!==t.length)return!1;for(var o=e.length,i=0;i<o;i++)if(e[i].value!==t[i].value||e[i].label!==t[i].label)return!1;return!0}Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyArray=n,t["default"]=r},function(e,t){function n(e){return!!e&&"object"==typeof e}function r(e,t){var n=null==e?void 0:e[t];return a(n)?n:void 0}function o(e){return i(e)&&f.call(e)==s}function i(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function a(e){return null!=e&&(o(e)?p.test(c.call(e)):n(e)&&l.test(e))}var s="[object Function]",l=/^\[object .+?Constructor\]$/,u=Object.prototype,c=Function.prototype.toString,d=u.hasOwnProperty,f=u.toString,p=RegExp("^"+c.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=r},function(e,t){"use strict";function n(e,t){for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";function r(e,t,n){return!o(e.props,t)||!o(e.state,n)}var o=n(39),i={shouldComponentUpdate:function(e,t){return r(this,e,t)}};e.exports=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){var e=document.createElement("div");return document.body.appendChild(e),e}function i(e){function t(e,t,n){if(!c||e._component||c(e)){e._container||(e._container=p(e));var r=void 0;r=e.getComponent?e.getComponent(t):d(e,t),l["default"].unstable_renderSubtreeIntoContainer(e,r,e._container,function(){e._component=this,n&&n.call(this)})}}function n(e){if(e._container){var t=e._container;l["default"].unmountComponentAtNode(t),t.parentNode.removeChild(t),e._container=null}}var r=e.autoMount,i=void 0===r||r,s=e.autoDestroy,u=void 0===s||s,c=e.isVisible,d=e.getComponent,f=e.getContainer,p=void 0===f?o:f,h=void 0;return i&&(h=a({},h,{componentDidMount:function(){t(this)},componentDidUpdate:function(){t(this)}})),i&&u||(h=a({},h,{renderComponent:function(e,n){t(this,e,n)}})),h=u?a({},h,{componentWillUnmount:function(){n(this)}}):a({},h,{removeContainer:function(){n(this)}})}Object.defineProperty(t,"__esModule",{value:!0});var a=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"]=i;var s=n(9),l=r(s);e.exports=t["default"]},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),a=n(103),s=r(a),l=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},u=i["default"].createClass({displayName:"PopupCascader",getDefaultProps:function(){return{pickerValueProp:"value",pickerValueChangeProp:"onChange"}},onOk:function c(e){var t=this.props,n=t.onChange,c=t.onOk;n&&n(e),c&&c(e)},render:function(){return i["default"].createElement(s["default"],l({picker:this.props.cascader},this.props,{onOk:this.onOk}))}});t["default"]=u,e.exports=t["default"]},function(e,t){(function(t){function n(e,t){return null==e?void 0:e[t]}function r(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(n){}return t}function o(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function i(){this.__data__=ve?ve(null):{}}function a(e){return this.has(e)&&delete this.__data__[e]}function s(e){var t=this.__data__;if(ve){var n=t[e];return n===B?void 0:n}return ce.call(t,e)?t[e]:void 0}function l(e){var t=this.__data__;return ve?void 0!==t[e]:ce.call(t,e)}function u(e,t){var n=this.__data__;return n[e]=ve&&void 0===t?B:t,this}function c(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function d(){this.__data__=[]}function f(e){var t=this.__data__,n=C(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():he.call(t,n,1),!0}function p(e){var t=this.__data__,n=C(t,e);return n<0?void 0:t[n][1]}function h(e){return C(this.__data__,e)>-1}function m(e,t){var n=this.__data__,r=C(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}function v(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function y(){this.__data__={hash:new o,map:new(me||c),string:new o}}function g(e){return E(this,e)["delete"](e)}function b(e){return E(this,e).get(e)}function _(e){return E(this,e).has(e)}function T(e,t){return E(this,e).set(e,t),this}function C(e,t){for(var n=e.length;n--;)if(j(e[n][0],t))return n;return-1}function x(e,t){t=M(t,e)?[t]:S(t);for(var n=0,r=t.length;null!=e&&n<r;)e=e[D(t[n++])];return n&&n==r?e:void 0}function w(e){if(!L(e)||N(e))return!1;var t=A(e)||r(e)?fe:ee;return t.test(R(e))}function P(e){if("string"==typeof e)return e;if(V(e))return ge?ge.call(e):"";var t=e+"";return"0"==t&&1/e==-z?"-0":t}function S(e){return _e(e)?e:be(e)}function E(e,t){var n=e.__data__;return k(t)?n["string"==typeof t?"string":"hash"]:n.map}function O(e,t){var r=n(e,t);return w(r)?r:void 0}function M(e,t){if(_e(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!V(e))||(q.test(e)||!K.test(e)||null!=t&&e in Object(t))}function k(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function N(e){return!!le&&le in e}function D(e){if("string"==typeof e||V(e))return e;var t=e+"";return"0"==t&&1/e==-z?"-0":t}function R(e){if(null!=e){try{return ue.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function I(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(Y);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a),a};return n.cache=new(I.Cache||v),n}function j(e,t){return e===t||e!==e&&t!==t}function A(e){var t=L(e)?de.call(e):"";return t==U||t==G}function L(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function W(e){return!!e&&"object"==typeof e}function V(e){return"symbol"==typeof e||W(e)&&de.call(e)==X}function H(e){return null==e?"":P(e)}function F(e,t,n){var r=null==e?void 0:x(e,t);return void 0===r?n:r}var Y="Expected a function",B="__lodash_hash_undefined__",z=1/0,U="[object Function]",G="[object GeneratorFunction]",X="[object Symbol]",K=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,q=/^\w*$/,Z=/^\./,Q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$=/[\\^$.*+?()[\]{}|]/g,J=/\\(\\)?/g,ee=/^\[object .+?Constructor\]$/,te="object"==typeof t&&t&&t.Object===Object&&t,ne="object"==typeof self&&self&&self.Object===Object&&self,re=te||ne||Function("return this")(),oe=Array.prototype,ie=Function.prototype,ae=Object.prototype,se=re["__core-js_shared__"],le=function(){var e=/[^.]+$/.exec(se&&se.keys&&se.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ue=ie.toString,ce=ae.hasOwnProperty,de=ae.toString,fe=RegExp("^"+ue.call(ce).replace($,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pe=re.Symbol,he=oe.splice,me=O(re,"Map"),ve=O(Object,"create"),ye=pe?pe.prototype:void 0,ge=ye?ye.toString:void 0;o.prototype.clear=i,o.prototype["delete"]=a,o.prototype.get=s,o.prototype.has=l,o.prototype.set=u,c.prototype.clear=d,c.prototype["delete"]=f,c.prototype.get=p,c.prototype.has=h,c.prototype.set=m,v.prototype.clear=y,v.prototype["delete"]=g,v.prototype.get=b,v.prototype.has=_,v.prototype.set=T;var be=I(function(e){e=H(e);var t=[];return Z.test(e)&&t.push(""),e.replace(Q,function(e,n,r,o){t.push(r?o.replace(J,"$1"):n||e)}),t});I.Cache=v;var _e=Array.isArray;e.exports=F}).call(t,function(){return this}())},function(e,t,n){"use strict";function r(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 i(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 a(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 s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(1),u=r(l),c=n(9),d=r(c),f=n(105),p=r(f),h=function(e){function t(e){o(this,t);var n=i(this,Object.getPrototypeOf(t).call(this,e));return n.updateOffset=function(e){var t=e.inherited,r=e.offset;n.channel.update(function(e){e.inherited=t+r})},n.channel=new p["default"]({inherited:0,offset:0,node:null}),n}return a(t,e),s(t,[{key:"getChildContext",value:function(){return{"sticky-channel":this.channel}}},{key:"componentWillMount",value:function(){var e=this.context["sticky-channel"];e&&e.subscribe(this.updateOffset)}},{key:"componentDidMount",value:function(){var e=d["default"].findDOMNode(this);this.channel.update(function(t){t.node=e})}},{key:"componentWillUnmount",value:function(){this.channel.update(function(e){e.node=null});var e=this.context["sticky-channel"];e&&e.unsubscribe(this.updateOffset)}},{key:"render",value:function(){return u["default"].createElement("div",this.props,this.props.children)}}]),t}(u["default"].Component);h.contextTypes={"sticky-channel":u["default"].PropTypes.any},h.childContextTypes={"sticky-channel":u["default"].PropTypes.any},t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Channel=t.StickyContainer=t.Sticky=void 0;var o=n(339),i=r(o),a=n(337),s=r(a),l=n(105),u=r(l);t.Sticky=i["default"],t.StickyContainer=s["default"],t.Channel=u["default"],t["default"]=i["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(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 n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(1),d=r(c),f=n(9),p=r(f),h=function(e){function t(e){i(this,t);var n=a(this,Object.getPrototypeOf(t).call(this,e));return n.updateContext=function(e){var t=e.inherited,r=e.node;n.containerNode=r,n.setState({containerOffset:t,distanceFromBottom:n.getDistanceFromBottom()})},n.recomputeState=function(){var e=n.isSticky(),t=n.getHeight(),r=n.getWidth(),o=n.getXOffset(),i=n.getDistanceFromBottom(),a=n.state.isSticky!==e;n.setState({isSticky:e,height:t,width:r,xOffset:o,distanceFromBottom:i}),a&&(n.channel&&n.channel.update(function(t){t.offset=e?n.state.height:0}),n.props.onStickyStateChange(e))},n.state={},n}return s(t,e),u(t,[{key:"componentWillMount",value:function(){this.channel=this.context["sticky-channel"],this.channel.subscribe(this.updateContext)}},{key:"componentDidMount",value:function(){this.on(["resize","scroll","touchstart","touchmove","touchend","pageshow","load"],this.recomputeState),this.recomputeState()}},{key:"componentWillReceiveProps",value:function(){this.recomputeState()}},{key:"componentWillUnmount",value:function(){this.off(["resize","scroll","touchstart","touchmove","touchend","pageshow","load"],this.recomputeState),this.channel.unsubscribe(this.updateContext)}},{key:"getXOffset",value:function(){return this.refs.placeholder.getBoundingClientRect().left}},{key:"getWidth",value:function(){return this.refs.placeholder.getBoundingClientRect().width}},{key:"getHeight",value:function(){return p["default"].findDOMNode(this.refs.children).getBoundingClientRect().height}},{key:"getDistanceFromTop",value:function(){return this.refs.placeholder.getBoundingClientRect().top}},{key:"getDistanceFromBottom",value:function(){return this.containerNode?this.containerNode.getBoundingClientRect().bottom:0}},{key:"isSticky",value:function(){if(!this.props.isActive)return!1;var e=this.getDistanceFromTop(),t=this.getDistanceFromBottom(),n=this.state.containerOffset-this.props.topOffset,r=this.state.containerOffset+this.props.bottomOffset;return e<=n&&t>=r}},{key:"on",value:function(e,t){e.forEach(function(e){window.addEventListener(e,t)})}},{key:"off",value:function(e,t){e.forEach(function(e){window.removeEventListener(e,t)})}},{key:"shouldComponentUpdate",value:function(e,t){var n=this,r=Object.keys(this.props);if(Object.keys(e).length!=r.length)return!0;var o=r.every(function(t){return e.hasOwnProperty(t)&&e[t]===n.props[t]});if(!o)return!0;var i=this.state;if(t.isSticky!==i.isSticky)return!0;if(i.isSticky){if(t.height!==i.height)return!0;if(t.width!==i.width)return!0;if(t.xOffset!==i.xOffset)return!0;if(t.containerOffset!==i.containerOffset)return!0;if(t.distanceFromBottom!==i.distanceFromBottom)return!0}return!1}},{key:"render",value:function(){var e={paddingBottom:0},t=this.props.className,n=l({},{transform:"translateZ(0)"},this.props.style);if(this.state.isSticky){var r={position:"fixed",top:this.state.containerOffset,left:this.state.xOffset,width:this.state.width},i=this.state.distanceFromBottom-this.state.height-this.props.bottomOffset;this.state.containerOffset>i&&(r.top=i),e.paddingBottom=this.state.height,t+=" "+this.props.stickyClassName,n=l({},n,r,this.props.stickyStyle)}var a=this.props,s=(a.topOffset,a.isActive,a.stickyClassName,a.stickyStyle,a.bottomOffset,a.onStickyStateChange,o(a,["topOffset","isActive","stickyClassName","stickyStyle","bottomOffset","onStickyStateChange"]));return d["default"].createElement("div",null,d["default"].createElement("div",{ref:"placeholder",style:e}),d["default"].createElement("div",l({},s,{ref:"children",className:t,style:n}),this.props.children))}}]),t}(d["default"].Component);h.propTypes={isActive:d["default"].PropTypes.bool,className:d["default"].PropTypes.string,style:d["default"].PropTypes.object,stickyClassName:d["default"].PropTypes.string,stickyStyle:d["default"].PropTypes.object,topOffset:d["default"].PropTypes.number,bottomOffset:d["default"].PropTypes.number,onStickyStateChange:d["default"].PropTypes.func},h.defaultProps={isActive:!0,className:"",style:{},stickyClassName:"sticky",stickyStyle:{},topOffset:0,bottomOffset:0,onStickyStateChange:function(){}},h.contextTypes={"sticky-channel":d["default"].PropTypes.any},t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";function r(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}return e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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 a(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):r(e,t))}Object.defineProperty(t,"__esModule",{value:!0});var s=n(1),l=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t}(s.Component);l.propTypes={className:s.PropTypes.string,colSpan:s.PropTypes.number,title:s.PropTypes.node,dataIndex:s.PropTypes.string,width:s.PropTypes.oneOfType([s.PropTypes.number,s.PropTypes.string]),fixed:s.PropTypes.oneOf([!0,"left","right"]),render:s.PropTypes.func,onCellClick:s.PropTypes.func},t["default"]=l,e.exports=t["default"]},function(e,t,n){"use strict";function r(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}return e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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 a(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):r(e,t))}Object.defineProperty(t,"__esModule",{value:!0});var s=n(1),l=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t}(s.Component);l.propTypes={title:s.PropTypes.node},l.isTableColumnGroup=!0,t["default"]=l,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=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(1),l=r(s),u=function(){function e(t,n){i(this,e),this._cached={},this.columns=t||this.normalize(n)}return e.prototype.isAnyColumnsFixed=function(){var e=this;return this._cache("isAnyColumnsFixed",function(){return e.columns.some(function(e){return!!e.fixed})})},e.prototype.isAnyColumnsLeftFixed=function(){var e=this;return this._cache("isAnyColumnsLeftFixed",function(){return e.columns.some(function(e){return"left"===e.fixed||e.fixed===!0})})},e.prototype.isAnyColumnsRightFixed=function(){var e=this;return this._cache("isAnyColumnsRightFixed",function(){return e.columns.some(function(e){return"right"===e.fixed})})},e.prototype.leftColumns=function(){var e=this;return this._cache("leftColumns",function(){return e.groupedColumns().filter(function(e){return"left"===e.fixed||e.fixed===!0})})},e.prototype.rightColumns=function(){var e=this;return this._cache("rightColumns",function(){return e.groupedColumns().filter(function(e){return"right"===e.fixed})})},e.prototype.leafColumns=function(){var e=this;return this._cache("leafColumns",function(){return e._leafColumns(e.columns)})},e.prototype.leftLeafColumns=function(){var e=this;return this._cache("leftLeafColumns",function(){return e._leafColumns(e.leftColumns())})},e.prototype.rightLeafColumns=function(){var e=this;return this._cache("rightLeafColumns",function(){return e._leafColumns(e.rightColumns())})},e.prototype.groupedColumns=function(){var e=this;return this._cache("groupedColumns",function(){var t=function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];o[t]=o[t]||[];var i=[],s=function(e){var n=o.length-t;e&&!e.children&&n>1&&(!e.rowSpan||e.rowSpan<n)&&(e.rowSpan=n)};return e.forEach(function(l,u){var c=a({},l);o[t].push(c),r.colSpan=r.colSpan||0,c.children&&c.children.length>0?(c.children=n(c.children,t+1,c,o),r.colSpan=r.colSpan+c.colSpan):r.colSpan++;for(var d=0;d<o[t].length-1;++d)s(o[t][d]);u+1===e.length&&s(c),i.push(c)}),i};return t(e.columns)})},e.prototype.normalize=function(e){var t=this,n=[];return l["default"].Children.forEach(e,function(e){if(l["default"].isValidElement(e)){var r=a({},e.props);e.key&&(r.key=e.key),e.type.isTableColumnGroup&&(r.children=t.normalize(r.children)),n.push(r)}}),n},e.prototype.reset=function(e,t){this.columns=e||this.normalize(t),this._cached={}},e.prototype._cache=function(e,t){return e in this._cached?this._cached[e]:(this._cached[e]=t(),this._cached[e])},e.prototype._leafColumns=function(e){var t=this,n=[];return e.forEach(function(e){e.children?n.push.apply(n,o(t._leafColumns(e.children))):n.push(e)}),n},e}();t["default"]=u,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}return e}function i(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):o(e,t))}Object.defineProperty(t,"__esModule",{value:!0});var l=n(1),u=r(l),c=n(39),d=r(c),f=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.shouldComponentUpdate=function(e){return!(0,d["default"])(e,this.props)},t.prototype.render=function(){var e=this.props,t=e.expandable,n=e.prefixCls,r=e.onExpand,o=e.needIndentSpaced,i=e.expanded,a=e.record;if(t){var s=i?"expanded":"collapsed";return u["default"].createElement("span",{
className:n+"-expand-icon "+n+"-"+s,onClick:function(e){return r(!i,a,e)}})}return o?u["default"].createElement("span",{className:n+"-expand-icon "+n+"-spaced"}):null},t}(u["default"].Component);f.propTypes={record:l.PropTypes.object,prefixCls:l.PropTypes.string,expandable:l.PropTypes.any,expanded:l.PropTypes.bool,needIndentSpaced:l.PropTypes.bool,onExpand:l.PropTypes.func},t["default"]=f,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}return e}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}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):o(e,t))}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},c=n(1),d=r(c),f=n(347),p=r(f),h=n(346),m=r(h),v=n(350),y=n(39),g=r(y),b=n(45),_=r(b),T=n(342),C=r(T),x=n(348),w=r(x),P=n(83),S=r(P),E=function(e){function t(n){a(this,t);var r=s(this,e.call(this,n));r.onExpanded=function(e,t,n,o){n&&(n.preventDefault(),n.stopPropagation());var i=r.findExpandedRow(t);if("undefined"==typeof i||e){if(!i&&e){var a=r.getExpandedRows().concat();a.push(r.getRowKey(t,o)),r.onExpandedRowsChange(a)}}else r.onRowDestroy(t,o);r.props.onExpand(e,t)},r.onRowDestroy=function(e,t){var n=r.getExpandedRows().concat(),o=r.getRowKey(e,t),i=-1;n.forEach(function(e,t){e===o&&(i=t)}),i!==-1&&n.splice(i,1),r.onExpandedRowsChange(n)},r.syncFixedTableRowHeight=function(){var e=r.tableNode.getBoundingClientRect();if(!(void 0!==e.height&&e.height<=0)){var t=r.props.prefixCls,n=r.refs.headTable?r.refs.headTable.querySelectorAll("thead"):r.refs.bodyTable.querySelectorAll("thead"),o=r.refs.bodyTable.querySelectorAll("."+t+"-row")||[],i=[].map.call(n,function(e){return e.getBoundingClientRect().height||"auto"}),a=[].map.call(o,function(e){return e.getBoundingClientRect().height||"auto"});(0,g["default"])(r.state.fixedColumnsHeadRowsHeight,i)&&(0,g["default"])(r.state.fixedColumnsBodyRowsHeight,a)||r.setState({fixedColumnsHeadRowsHeight:i,fixedColumnsBodyRowsHeight:a})}},r.detectScrollTarget=function(e){r.scrollTarget!==e.currentTarget&&(r.scrollTarget=e.currentTarget)},r.handleBodyScroll=function(e){if(e.target===r.scrollTarget){var t=r.props.scroll,n=void 0===t?{}:t,o=r.refs,i=o.headTable,a=o.bodyTable,s=o.fixedColumnsBodyLeft,l=o.fixedColumnsBodyRight;n.x&&e.target.scrollLeft!==r.lastScrollLeft&&(e.target===a&&i?i.scrollLeft=e.target.scrollLeft:e.target===i&&a&&(a.scrollLeft=e.target.scrollLeft),0===e.target.scrollLeft?r.setScrollPosition("left"):e.target.scrollLeft+1>=e.target.children[0].getBoundingClientRect().width-e.target.getBoundingClientRect().width?r.setScrollPosition("right"):"middle"!==r.scrollPosition&&r.setScrollPosition("middle")),n.y&&(s&&e.target!==s&&(s.scrollTop=e.target.scrollTop),l&&e.target!==l&&(l.scrollTop=e.target.scrollTop),a&&e.target!==a&&(a.scrollTop=e.target.scrollTop)),r.lastScrollLeft=e.target.scrollLeft}},r.handleRowHover=function(e,t){r.store.setState({currentHoverKey:e?t:null})};var o=[],l=[].concat(i(n.data));if(r.columnManager=new C["default"](n.columns,n.children),r.store=(0,w["default"])({currentHoverKey:null}),r.setScrollPosition("left"),n.defaultExpandAllRows)for(var u=0;u<l.length;u++){var c=l[u];o.push(r.getRowKey(c,u)),l=l.concat(c[n.childrenColumnName]||[])}else o=n.expandedRowKeys||n.defaultExpandedRowKeys;return r.state={expandedRowKeys:o,currentHoverKey:null,fixedColumnsHeadRowsHeight:[],fixedColumnsBodyRowsHeight:[]},r}return l(t,e),t.prototype.componentDidMount=function(){this.columnManager.isAnyColumnsFixed()&&(this.syncFixedTableRowHeight(),this.debouncedSyncFixedTableRowHeight=(0,v.debounce)(this.syncFixedTableRowHeight,150),this.resizeEvent=(0,_["default"])(window,"resize",this.debouncedSyncFixedTableRowHeight))},t.prototype.componentWillReceiveProps=function(e){"expandedRowKeys"in e&&this.setState({expandedRowKeys:e.expandedRowKeys}),e.columns&&e.columns!==this.props.columns?this.columnManager.reset(e.columns):e.children!==this.props.children&&this.columnManager.reset(null,e.children)},t.prototype.componentDidUpdate=function(e){this.columnManager.isAnyColumnsFixed()&&this.syncFixedTableRowHeight(),e.data.length>0&&0===this.props.data.length&&this.hasScrollX()&&this.resetScrollX()},t.prototype.componentWillUnmount=function(){this.resizeEvent&&this.resizeEvent.remove(),this.debouncedSyncFixedTableRowHeight&&this.debouncedSyncFixedTableRowHeight.cancel()},t.prototype.onExpandedRowsChange=function(e){this.props.expandedRowKeys||this.setState({expandedRowKeys:e}),this.props.onExpandedRowsChange(e)},t.prototype.getRowKey=function(e,t){var n=this.props.rowKey,r="function"==typeof n?n(e,t):e[n];return(0,v.warningOnce)(void 0!==r,"Each record in table should have a unique `key` prop,or set `rowKey` to an unique primary key."),void 0===r?t:r},t.prototype.getExpandedRows=function(){return this.props.expandedRowKeys||this.state.expandedRowKeys},t.prototype.getHeader=function(e,t){var n=this.props,r=n.showHeader,o=n.expandIconAsCell,i=n.prefixCls,a=this.getHeaderRows(e);o&&"right"!==t&&a[0].unshift({key:"rc-table-expandIconAsCell",className:i+"-expand-icon-th",title:"",rowSpan:a.length});var s=t?this.getHeaderRowStyle(e,a):null;return r?d["default"].createElement(m["default"],{prefixCls:i,rows:a,rowStyle:s}):null},t.prototype.getHeaderRows=function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments[2];return r=r||[],r[n]=r[n]||[],e.forEach(function(e){if(e.rowSpan&&r.length<e.rowSpan)for(;r.length<e.rowSpan;)r.push([]);var o={key:e.key,className:e.className||"",children:e.title};e.children&&t.getHeaderRows(e.children,n+1,r),"colSpan"in e&&(o.colSpan=e.colSpan),"rowSpan"in e&&(o.rowSpan=e.rowSpan),0!==o.colSpan&&r[n].push(o)}),r.filter(function(e){return e.length>0})},t.prototype.getExpandedRow=function(e,t,n,r,o){var i=this.props,a=i.prefixCls,s=i.expandIconAsCell,l=void 0;l="left"===o?this.columnManager.leftLeafColumns().length:"right"===o?this.columnManager.rightLeafColumns().length:this.columnManager.leafColumns().length;var u=[{key:"extra-row",render:function(){return{props:{colSpan:l},children:"right"!==o?t:" "}}}];return s&&"right"!==o&&u.unshift({key:"expand-icon-placeholder",render:function(){return null}}),d["default"].createElement(p["default"],{columns:u,visible:n,className:r,key:e+"-extra-row",prefixCls:a+"-expanded-row",indent:1,expandable:!1,store:this.store})},t.prototype.getRowsByData=function(e,t,n,r,o){for(var i=this.props,a=i.childrenColumnName,s=i.expandedRowRender,l=i.expandRowByClick,c=this.state.fixedColumnsBodyRowsHeight,f=[],h=i.rowClassName,m=i.rowRef,v=i.expandedRowClassName,y=i.data.some(function(e){return e[a]}),g=i.onRowClick,b=i.onRowDoubleClick,_="right"!==o&&i.expandIconAsCell,T="right"!==o?i.expandIconColumnIndex:-1,C=0;C<e.length;C++){var x=e[C],w=this.getRowKey(x,C),P=x[a],S=this.isRowExpanded(x,C),E=void 0;s&&S&&(E=s(x,C,n));var O=h(x,C,n),M={};this.columnManager.isAnyColumnsFixed()&&(M.onHover=this.handleRowHover);var k=o&&c[C]?c[C]:null,N=void 0;N="left"===o?this.columnManager.leftLeafColumns():"right"===o?this.columnManager.rightLeafColumns():this.columnManager.leafColumns(),f.push(d["default"].createElement(p["default"],u({indent:n,indentSize:i.indentSize,needIndentSpaced:y,className:O,record:x,expandIconAsCell:_,onDestroy:this.onRowDestroy,index:C,visible:t,expandRowByClick:l,onExpand:this.onExpanded,expandable:P||s,expanded:S,prefixCls:i.prefixCls+"-row",childrenColumnName:a,columns:N,expandIconColumnIndex:T,onRowClick:g,onRowDoubleClick:b,height:k},M,{key:w,hoverKey:w,ref:m(x,C,n),store:this.store})));var D=t&&S;E&&S&&f.push(this.getExpandedRow(w,E,D,v(x,C,n),o)),P&&(f=f.concat(this.getRowsByData(P,D,n+1,r,o)))}return f},t.prototype.getRows=function(e,t){return this.getRowsByData(this.props.data,!0,0,e,t)},t.prototype.getColGroup=function(e,t){var n=[];this.props.expandIconAsCell&&"right"!==t&&n.push(d["default"].createElement("col",{className:this.props.prefixCls+"-expand-icon-col",key:"rc-table-expand-icon-col"}));var r=void 0;return r="left"===t?this.columnManager.leftLeafColumns():"right"===t?this.columnManager.rightLeafColumns():this.columnManager.leafColumns(),n=n.concat(r.map(function(e){return d["default"].createElement("col",{key:e.key,style:{width:e.width,minWidth:e.width}})})),d["default"].createElement("colgroup",null,n)},t.prototype.getLeftFixedTable=function(){return this.getTable({columns:this.columnManager.leftColumns(),fixed:"left"})},t.prototype.getRightFixedTable=function(){return this.getTable({columns:this.columnManager.rightColumns(),fixed:"right"})},t.prototype.getTable=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.columns,r=t.fixed,o=this.props,i=o.prefixCls,a=o.scroll,s=void 0===a?{}:a,l=o.getBodyWrapper,c=this.props.useFixedHeader,f=u({},this.props.bodyStyle),p={},h="";if((s.x||r)&&(h=i+"-fixed",f.overflowX=f.overflowX||"auto"),s.y){r?f.height=f.height||s.y:f.maxHeight=f.maxHeight||s.y,f.overflowY=f.overflowY||"scroll",c=!0;var m=(0,v.measureScrollbar)();m>0&&((r?f:p).marginBottom="-"+m+"px",(r?f:p).paddingBottom="0px")}var y=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a={};!r&&s.x&&(s.x===!0?a.tableLayout="fixed":a.width=s.x);var u=o?l(d["default"].createElement("tbody",{className:i+"-tbody"},e.getRows(n,r))):null;return d["default"].createElement("table",{className:h,style:a},e.getColGroup(n,r),t?e.getHeader(n,r):null,u)},g=void 0;c&&(g=d["default"].createElement("div",{key:"headTable",className:i+"-header",ref:r?null:"headTable",style:p,onMouseOver:this.detectScrollTarget,onTouchStart:this.detectScrollTarget,onScroll:this.handleBodyScroll},y(!0,!1)));var b=d["default"].createElement("div",{key:"bodyTable",className:i+"-body",style:f,ref:"bodyTable",onMouseOver:this.detectScrollTarget,onTouchStart:this.detectScrollTarget,onScroll:this.handleBodyScroll},y(!c));if(r&&n.length){var _=void 0;"left"===n[0].fixed||n[0].fixed===!0?_="fixedColumnsBodyLeft":"right"===n[0].fixed&&(_="fixedColumnsBodyRight"),delete f.overflowX,delete f.overflowY,b=d["default"].createElement("div",{key:"bodyTable",className:i+"-body-outer",style:u({},f)},d["default"].createElement("div",{className:i+"-body-inner",ref:_,onMouseOver:this.detectScrollTarget,onTouchStart:this.detectScrollTarget,onScroll:this.handleBodyScroll},y(!c)))}return[g,b]},t.prototype.getTitle=function(){var e=this.props,t=e.title,n=e.prefixCls;return t?d["default"].createElement("div",{className:n+"-title"},t(this.props.data)):null},t.prototype.getFooter=function(){var e=this.props,t=e.footer,n=e.prefixCls;return t?d["default"].createElement("div",{className:n+"-footer"},t(this.props.data)):null},t.prototype.getEmptyText=function(){var e=this.props,t=e.emptyText,n=e.prefixCls,r=e.data;return r.length?null:d["default"].createElement("div",{className:n+"-placeholder"},t())},t.prototype.getHeaderRowStyle=function(e,t){var n=this.state.fixedColumnsHeadRowsHeight,r=n[0];return r&&e?"auto"===r?{height:"auto"}:{height:r/t.length}:null},t.prototype.setScrollPosition=function(e){if(this.scrollPosition=e,this.tableNode){var t=this.props.prefixCls;(0,S["default"])(this.tableNode).remove(new RegExp("^"+t+"-scroll-position-.+$")).add(t+"-scroll-position-"+e)}},t.prototype.resetScrollX=function(){this.refs.headTable&&(this.refs.headTable.scrollLeft=0),this.refs.bodyTable&&(this.refs.bodyTable.scrollLeft=0)},t.prototype.findExpandedRow=function(e,t){var n=this,r=this.getExpandedRows().filter(function(r){return r===n.getRowKey(e,t)});return r[0]},t.prototype.isRowExpanded=function(e,t){return"undefined"!=typeof this.findExpandedRow(e,t)},t.prototype.hasScrollX=function(){var e=this.props.scroll,t=void 0===e?{}:e;return"x"in t},t.prototype.render=function(){var e=this,t=this.props,n=t.prefixCls,r=t.prefixCls;t.className&&(r+=" "+t.className),(t.useFixedHeader||t.scroll&&t.scroll.y)&&(r+=" "+n+"-fixed-header"),r+=" "+n+"-scroll-position-"+this.scrollPosition;var o=this.columnManager.isAnyColumnsFixed()||t.scroll.x||t.scroll.y,i=this.columnManager.isAnyColumnsLeftFixed()||this.columnManager.isAnyColumnsRightFixed();return i?d["default"].createElement("div",{ref:function(t){return e.tableNode=t},className:r,style:t.style},this.getTitle(),d["default"].createElement("div",{className:n+"-content"},this.columnManager.isAnyColumnsLeftFixed()&&d["default"].createElement("div",{className:n+"-fixed-left"},this.getLeftFixedTable()),d["default"].createElement("div",{className:o?n+"-scroll":""},this.getTable({columns:this.columnManager.groupedColumns()}),this.getEmptyText(),this.getFooter()),this.columnManager.isAnyColumnsRightFixed()&&d["default"].createElement("div",{className:n+"-fixed-right"},this.getRightFixedTable()))):d["default"].createElement("div",{ref:function(t){return e.tableNode=t},className:r,style:t.style},this.getTitle(),d["default"].createElement("div",{className:n+"-content"},this.getTable({columns:this.columnManager.groupedColumns()}),this.getEmptyText(),this.getFooter()))},t}(d["default"].Component);E.propTypes={data:c.PropTypes.array,expandIconAsCell:c.PropTypes.bool,defaultExpandAllRows:c.PropTypes.bool,expandedRowKeys:c.PropTypes.array,defaultExpandedRowKeys:c.PropTypes.array,useFixedHeader:c.PropTypes.bool,columns:c.PropTypes.array,prefixCls:c.PropTypes.string,bodyStyle:c.PropTypes.object,style:c.PropTypes.object,rowKey:c.PropTypes.oneOfType([c.PropTypes.string,c.PropTypes.func]),rowClassName:c.PropTypes.func,expandedRowClassName:c.PropTypes.func,childrenColumnName:c.PropTypes.string,onExpand:c.PropTypes.func,onExpandedRowsChange:c.PropTypes.func,indentSize:c.PropTypes.number,onRowClick:c.PropTypes.func,onRowDoubleClick:c.PropTypes.func,expandIconColumnIndex:c.PropTypes.number,showHeader:c.PropTypes.bool,title:c.PropTypes.func,footer:c.PropTypes.func,emptyText:c.PropTypes.func,scroll:c.PropTypes.object,rowRef:c.PropTypes.func,getBodyWrapper:c.PropTypes.func,children:c.PropTypes.node},E.defaultProps={data:[],useFixedHeader:!1,expandIconAsCell:!1,defaultExpandAllRows:!1,defaultExpandedRowKeys:[],rowKey:"key",rowClassName:function(){return""},expandedRowClassName:function(){return""},onExpand:function(){},onExpandedRowsChange:function(){},onRowClick:function(){},onRowDoubleClick:function(){},prefixCls:"rc-table",bodyStyle:{},style:{},childrenColumnName:"children",indentSize:15,expandIconColumnIndex:0,showHeader:!0,scroll:{},rowRef:function(){return null},getBodyWrapper:function(e){return e},emptyText:function(){return"No Data"}},t["default"]=E,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}return e}function i(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):o(e,t))}Object.defineProperty(t,"__esModule",{value:!0});var l=n(1),u=r(l),c=n(336),d=r(c),f=function(e){function t(){var n,r,o;i(this,t);for(var s=arguments.length,l=Array(s),u=0;u<s;u++)l[u]=arguments[u];return n=r=a(this,e.call.apply(e,[this].concat(l))),r.handleClick=function(e){var t=r.props,n=t.record,o=t.column.onCellClick;o&&o(n,e)},o=n,a(r,o)}return s(t,e),t.prototype.isInvalidRenderCellText=function(e){return e&&!u["default"].isValidElement(e)&&"[object Object]"===Object.prototype.toString.call(e)},t.prototype.render=function n(){var e=this.props,t=e.record,r=e.indentSize,o=e.prefixCls,i=e.indent,a=e.index,s=e.expandIcon,l=e.column,c=l.dataIndex,n=l.render,f=l.className,p=void 0===f?"":f,h=void 0;h="number"==typeof c?(0,d["default"])(t,c):c&&0!==c.length?(0,d["default"])(t,c):t;var m=void 0,v=void 0,y=void 0;n&&(h=n(h,t,a),this.isInvalidRenderCellText(h)&&(m=h.props||{},y=m.rowSpan,v=m.colSpan,h=h.children)),this.isInvalidRenderCellText(h)&&(h=null);var g=s?u["default"].createElement("span",{style:{paddingLeft:r*i+"px"},className:o+"-indent indent-level-"+i}):null;return 0===y||0===v?null:u["default"].createElement("td",{colSpan:v,rowSpan:y,className:p,onClick:this.handleClick},g,s,h)},t}(u["default"].Component);f.propTypes={record:l.PropTypes.object,prefixCls:l.PropTypes.string,index:l.PropTypes.number,indent:l.PropTypes.number,indentSize:l.PropTypes.number,column:l.PropTypes.object,expandIcon:l.PropTypes.node},t["default"]=f,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}return e}function i(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):o(e,t))}Object.defineProperty(t,"__esModule",{value:!0});var l=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(1),c=r(u),d=n(39),f=r(d),p=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.shouldComponentUpdate=function(e){return!(0,f["default"])(e,this.props)},t.prototype.render=function(){var e=this.props,t=e.prefixCls,n=e.rowStyle,r=e.rows;return c["default"].createElement("thead",{className:t+"-thead"},r.map(function(e,t){return c["default"].createElement("tr",{key:t,style:n},e.map(function(e,t){return c["default"].createElement("th",l({},e,{key:t}))}))}))},t}(c["default"].Component);p.propTypes={prefixCls:u.PropTypes.string,rowStyle:u.PropTypes.object,rows:u.PropTypes.array},t["default"]=p,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}return e}function i(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):o(e,t))}Object.defineProperty(t,"__esModule",{value:!0});var l=n(1),u=r(l),c=n(345),d=r(c),f=n(343),p=r(f),h=function(e){function t(){var n,r,o;i(this,t);for(var s=arguments.length,l=Array(s),u=0;u<s;u++)l[u]=arguments[u];return n=r=a(this,e.call.apply(e,[this].concat(l))),r.state={hovered:!1},r.onRowClick=function(e){var t=r.props,n=t.record,o=t.index,i=t.onRowClick,a=t.expandable,s=t.expandRowByClick,l=t.expanded,u=t.onExpand;a&&s&&u(!l,n,e,o),i(n,o,e)},r.onRowDoubleClick=function(e){var t=r.props,n=t.record,o=t.index,i=t.onRowDoubleClick;i(n,o,e)},r.onMouseEnter=function(){var e=r.props,t=e.onHover,n=e.hoverKey;t(!0,n)},r.onMouseLeave=function(){var e=r.props,t=e.onHover,n=e.hoverKey;t(!1,n)},o=n,a(r,o)}return s(t,e),t.prototype.componentDidMount=function(){var e=this,t=this.props,n=t.store,r=t.hoverKey;this.unsubscribe=n.subscribe(function(){n.getState().currentHoverKey===r?e.setState({hovered:!0}):e.state.hovered===!0&&e.setState({hovered:!1})})},t.prototype.componentWillUnmount=function(){var e=this.props,t=e.record,n=e.onDestroy,r=e.index;n(t,r),this.unsubscribe&&this.unsubscribe()},t.prototype.render=function(){var e=this.props,t=e.prefixCls,n=e.columns,r=e.record,o=e.height,i=e.visible,a=e.index,s=e.expandIconColumnIndex,l=e.expandIconAsCell,c=e.expanded,f=e.expandRowByClick,h=e.expandable,m=e.onExpand,v=e.needIndentSpaced,y=e.indent,g=e.indentSize,b=this.props.className;this.state.hovered&&(b+=" "+t+"-hover");for(var _=[],T=u["default"].createElement(p["default"],{expandable:h,prefixCls:t,onExpand:m,needIndentSpaced:v,expanded:c,record:r}),C=0;C<n.length;C++){l&&0===C&&_.push(u["default"].createElement("td",{className:t+"-expand-icon-cell",key:"rc-table-expand-icon-cell"},T));var x=!l&&!f&&C===s;_.push(u["default"].createElement(d["default"],{prefixCls:t,record:r,indentSize:g,indent:y,index:a,column:n[C],key:n[C].key,expandIcon:x?T:null}))}var w={height:o};return i||(w.display="none"),u["default"].createElement("tr",{onClick:this.onRowClick,onDoubleClick:this.onRowDoubleClick,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,className:t+" "+b+" "+t+"-level-"+y,style:w},_)},t}(u["default"].Component);h.propTypes={onDestroy:l.PropTypes.func,onRowClick:l.PropTypes.func,onRowDoubleClick:l.PropTypes.func,record:l.PropTypes.object,prefixCls:l.PropTypes.string,expandIconColumnIndex:l.PropTypes.number,onHover:l.PropTypes.func,columns:l.PropTypes.array,height:l.PropTypes.oneOfType([l.PropTypes.string,l.PropTypes.number]),visible:l.PropTypes.bool,index:l.PropTypes.number,hoverKey:l.PropTypes.any,expanded:l.PropTypes.bool,expandable:l.PropTypes.any,onExpand:l.PropTypes.func,needIndentSpaced:l.PropTypes.bool,className:l.PropTypes.string,indent:l.PropTypes.number,indentSize:l.PropTypes.number,expandIconAsCell:l.PropTypes.bool,expandRowByClick:l.PropTypes.bool,store:l.PropTypes.object.isRequired},h.defaultProps={onRowClick:function(){},onRowDoubleClick:function(){},onDestroy:function(){},expandIconColumnIndex:0,expandRowByClick:!1,onHover:function(){}},t["default"]=h,e.exports=t["default"]},function(e,t){"use strict";function n(e){function t(e){i=r({},i,e);for(var t=0;t<a.length;t++)a[t]()}function n(){return i}function o(e){return a.push(e),function(){var t=a.indexOf(e);a.splice(t,1)}}var i=e,a=[];return{setState:t,getState:n,subscribe:o}}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"]=n,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(344),o=n(340),i=n(341);r.Column=o,r.ColumnGroup=i,e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){if("undefined"==typeof document||"undefined"==typeof window)return 0;if(u)return u;var e=document.createElement("div");for(var t in c)c.hasOwnProperty(t)&&(e.style[t]=c[t]);document.body.appendChild(e);var n=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),u=n}function i(e,t,n){function r(){var r=this,i=arguments;i[0]&&i[0].persist&&i[0].persist();var a=function(){o=null,n||e.apply(r,i)},s=n&&!o;clearTimeout(o),o=setTimeout(a,t),s&&e.apply(r,i)}var o=void 0;return r.cancel=function(){o&&(clearTimeout(o),o=null)},r}function a(e,t,n){d[t]||((0,l["default"])(e,t,n),d[t]=!e)}Object.defineProperty(t,"__esModule",{value:!0}),t.measureScrollbar=o,t.debounce=i,t.warningOnce=a;var s=n(66),l=r(s),u=void 0,c={position:"absolute",top:"-9999px",width:"50px",height:"50px",overflow:"scroll"},d={}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return e.clone().endOf("month").date()}function i(e){return e<10?"0"+e:e+""}Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),s=r(a),l=n(44),u=r(l),c=n(88),d=r(c),f=n(353),p=r(f),h={fontSize:20},m="datetime",v="date",y="time",g="month",b="year",_=s["default"].createClass({displayName:"DatePicker",getDefaultProps:function(){return{prefixCls:"rmc-date-picker",pickerPrefixCls:"rmc-picker",locale:p["default"],mode:v,minuteStep:1,onDateChange:function(){}}},getInitialState:function(){return{date:this.props.date||this.props.defaultDate}},componentWillReceiveProps:function(e){"date"in e&&this.setState({date:e.date||e.defaultDate})},onValueChange:function(e,t){var n=parseInt(e[t],10),r=this.props,o=r.mode,i=this.getDate().clone();if(o===m||o===v||o===b||o===g)switch(t){case 0:i.year(n);break;case 1:i.month(n);break;case 2:i.date(n);break;case 3:i.hour(n);break;case 4:i.minute(n)}else switch(t){case 0:i.hour(n);break;case 1:i.minute(n)}i=this.clipDate(i),"date"in r||this.setState({date:i}),r.onDateChange(i)},getDefaultMinDate:function(){return this.defaultMinDate||(this.defaultMinDate=this.getGregorianCalendar([2e3,1,1,0,0,0])),this.defaultMinDate},getDefaultMaxDate:function(){return this.defaultMaxDate||(this.defaultMaxDate=this.getGregorianCalendar([2030,1,1,23,59,59])),this.defaultMaxDate},getDate:function(){return this.state.date||this.getDefaultMinDate()},getValue:function(){return this.getDate()},getMinYear:function(){return this.getMinDate().year()},getMaxYear:function(){return this.getMaxDate().year()},getMinMonth:function(){return this.getMinDate().month()},getMaxMonth:function(){return this.getMaxDate().month()},getMinDay:function(){return this.getMinDate().date()},getMaxDay:function(){return this.getMaxDate().date()},getMinHour:function(){return this.getMinDate().hour()},getMaxHour:function(){return this.getMaxDate().hour()},getMinMinute:function(){return this.getMinDate().minute()},getMaxMinute:function(){return this.getMaxDate().minute()},getMinDate:function(){return this.props.minDate||this.getDefaultMinDate()},getMaxDate:function(){return this.props.maxDate||this.getDefaultMaxDate()},getDateData:function(){for(var e=this.props,t=e.locale,n=e.formatMonth,r=e.formatDay,i=e.mode,a=this.getDate(),s=a.year(),l=a.month(),u=this.getMinYear(),c=this.getMaxYear(),d=this.getMinMonth(),f=this.getMaxMonth(),p=this.getMinDay(),h=this.getMaxDay(),m=[],v=u;v<=c;v++)m.push({value:v+"",label:v+t.year+""});var y={key:"year",props:{children:m}};if(i===b)return[y];var _=[],T=0,C=11;u===s&&(T=d),c===s&&(C=f);for(var x=T;x<=C;x++){var w=n?n(x,a):x+1+t.month+"";_.push({value:x+"",label:w})}var P={key:"month",props:{children:_}};if(i===g)return[y,P];var S=[],E=1,O=o(a);u===s&&d===l&&(E=p),c===s&&f===l&&(O=h);for(var M=E;M<=O;M++){var k=r?r(M,a):M+t.day+"";S.push({value:M+"",label:k})}return[y,P,{key:"day",props:{children:S}}]},getTimeData:function(){var e=0,t=23,n=0,r=59,o=this.props,a=o.mode,s=o.locale,l=o.minuteStep,u=this.getDate(),c=this.getMinMinute(),d=this.getMaxMinute(),f=this.getMinHour(),p=this.getMaxHour(),h=u.hour();if(a===m){var v=u.year(),y=u.month(),g=u.date(),b=this.getMinYear(),_=this.getMaxYear(),T=this.getMinMonth(),C=this.getMaxMonth(),x=this.getMinDay(),w=this.getMaxDay();b===v&&T===y&&x===g&&(e=f,f===h&&(n=c)),_===v&&C===y&&w===g&&(t=p,p===h&&(r=d))}else e=f,f===h&&(n=c),t=p,p===h&&(r=d);for(var P=[],S=e;S<=t;S++)P.push({value:S+"",label:s.hour?S+s.hour+"":i(S)});for(var E=[],O=n;O<=r;O+=l)E.push({value:O+"",label:s.minute?O+s.minute+"":i(O)});return[{key:"hours",props:{children:P}},{key:"minutes",props:{children:E}}]},getGregorianCalendar:function(e){return(0,d["default"])(e)},clipDate:function(e){var t=this.props.mode,n=this.getMinDate(),r=this.getMaxDate();if(t===m){if(e.isBefore(n))return n.clone();if(e.isAfter(r))return r.clone()}else if(t===v){if(e.isBefore(n,"day"))return n.clone();if(e.isAfter(r,"day"))return r.clone()}else{var o=r.hour(),i=r.minute(),a=n.hour(),s=n.minute(),l=e.hour(),u=e.minute();if(l<a||l===a&&u<s)return n.clone();if(l>o||l===o&&u>i)return r.clone()}return e},getValueCols:function(){var e=this.props.mode,t=this.getDate(),n=[],r=[];return e===b?{cols:this.getDateData(),value:[t.year()+""]}:e===g?{cols:this.getDateData(),value:[t.year()+"",t.month()+""]}:(e!==m&&e!==v||(n=this.getDateData(),r=[t.year()+"",t.month()+"",t.date()+""]),e!==m&&e!==y||(n=n.concat(this.getTimeData()),r=r.concat([t.hour()+"",t.minute()+""])),{value:r,cols:n})},render:function(){var e=this.getValueCols(),t=e.value,n=e.cols,r=this.props,o=r.mode,i=r.prefixCls,a=r.pickerPrefixCls,l=r.rootNativeProps,c=r.className;return s["default"].createElement(u["default"],{rootNativeProps:l,className:c,prefixCls:i,pickerPrefixCls:a,pickerItemStyle:"undefined"==typeof window&&"datetime"===o?h:void 0,selectedValue:t,onValueChange:this.onValueChange},n)}});t["default"]=_,e.exports=t["default"]},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),a=n(103),s=r(a),l=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},u=i["default"].createClass({displayName:"PopupDatePicker",getDefaultProps:function(){return{pickerValueProp:"date",pickerValueChangeProp:"onDateChange"}},onOk:function c(e){var t=this.props,n=t.onChange,c=t.onOk;n&&n(e),c&&c(e)},render:function(){return i["default"].createElement(s["default"],l({picker:this.props.datePicker,value:this.props.date},this.props,{onOk:this.onOk}))}});t["default"]=u,e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={year:"",month:"",day:"",hour:"",minute:""},e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={year:"\u5e74",month:"\u6708",day:"\u65e5",hour:"\u65f6",minute:"\u5206"},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),a=o(i),s=n(124),l=o(s),u=n(7),c=o(u),d=n(2),f=o(d),p=n(4),h=o(p),m=n(3),v=o(m),y=n(1),g=o(y),b=n(5),_=o(b),T=n(107),C=o(T),x=n(108),w=o(x),P=n(67),S=r(P),E=function(e){function t(n){(0,f["default"])(this,t);var r=(0,h["default"])(this,e.call(this,n));r.onEnd=function(){r.setState({handle:null}),r.removeDocumentEvents(),r.props.onAfterChange(r.getValue())};var o=n.count,i=n.min,a=n.max,s=Array.apply(null,Array(o+1)).map(function(){return i}),l="defaultValue"in n?n.defaultValue:s,u=void 0!==n.value?n.value:l,c=u.map(function(e){return r.trimAlignValue(e)}),d=c[0]===a?0:c.length-1;return r.state={handle:null,recent:d,bounds:c},r}return(0,v["default"])(t,e),t.prototype.componentWillReceiveProps=function(e){var t=this;
if("value"in e||"min"in e||"max"in e){var n=this.state.bounds,r=e.value||n,o=r.map(function(n){return t.trimAlignValue(n,e)});o.every(function(e,t){return e===n[t]})||(this.setState({bounds:o}),n.some(function(t){return S.isValueOutOfRange(t,e)})&&this.props.onChange(o))}},t.prototype.onChange=function(e){var t=this.props,n=!("value"in t);n?this.setState(e):void 0!==e.handle&&this.setState({handle:e.handle});var r=(0,c["default"])({},this.state,e),o=r.bounds;t.onChange(o)},t.prototype.onStart=function(e){var t=this.props,n=this.state,r=this.getValue();t.onBeforeChange(r);var o=this.calcValueByPos(e);this.startValue=o,this.startPosition=e;var i=this.getClosestBound(o),a=this.getBoundNeedMoving(o,i);this.setState({handle:a,recent:a});var s=r[a];if(o!==s){var u=[].concat((0,l["default"])(n.bounds));u[a]=o,this.onChange({bounds:u})}},t.prototype.onMove=function(e,t){S.pauseEvent(e);var n=this.props,r=this.state,o=this.calcValueByPos(t),i=r.bounds[r.handle];if(o!==i){var a=[].concat((0,l["default"])(r.bounds));a[r.handle]=o;var s=r.handle;if(n.pushable!==!1){var u=r.bounds[s];this.pushSurroundingHandles(a,s,u)}else n.allowCross&&(a.sort(function(e,t){return e-t}),s=a.indexOf(o));this.onChange({handle:s,bounds:a})}},t.prototype.getValue=function(){return this.state.bounds},t.prototype.getClosestBound=function(e){for(var t=this.state.bounds,n=0,r=1;r<t.length-1;++r)e>t[r]&&(n=r);return Math.abs(t[n+1]-e)<Math.abs(t[n]-e)&&(n+=1),n},t.prototype.getBoundNeedMoving=function(e,t){var n=this.state,r=n.bounds,o=n.recent,i=t,a=r[t+1]===r[t];return a&&(i=o),a&&e!==r[t+1]&&(i=e<r[t+1]?t:t+1),i},t.prototype.getLowerBound=function(){return this.state.bounds[0]},t.prototype.getUpperBound=function(){var e=this.state.bounds;return e[e.length-1]},t.prototype.getPoints=function(){var e=this.props,t=e.marks,n=e.step,r=e.min,o=e.max,i=this._getPointsCache;if(!i||i.marks!==t||i.step!==n){var a=(0,c["default"])({},t);if(null!==n)for(var s=r;s<=o;s+=n)a[s]=s;var l=Object.keys(a).map(parseFloat);l.sort(function(e,t){return e-t}),this._getPointsCache={marks:t,step:n,points:l}}return this._getPointsCache.points},t.prototype.pushSurroundingHandles=function(e,t,n){var r=this.props.pushable,o=e[t],i=0;if(e[t+1]-o<r&&(i=1),o-e[t-1]<r&&(i=-1),0!==i){var a=t+i,s=i*(e[a]-o);this.pushHandle(e,a,i,r-s)||(e[t]=n)}},t.prototype.pushHandle=function(e,t,n,r){for(var o=e[t],i=e[t];n*(i-o)<r;){if(!this.pushHandleOnePoint(e,t,n))return e[t]=o,!1;i=e[t]}return!0},t.prototype.pushHandleOnePoint=function(e,t,n){var r=this.getPoints(),o=r.indexOf(e[t]),i=o+n;if(i>=r.length||i<0)return!1;var a=t+n,s=r[i],l=this.props.pushable,u=n*(e[a]-s);return!!this.pushHandle(e,a,n,l-u)&&(e[t]=s,!0)},t.prototype.trimAlignValue=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,c["default"])({},this.props,t),r=S.ensureValueInRange(e,n),o=this.ensureValueNotConflict(r,n);return S.ensureValuePrecision(o,n)},t.prototype.ensureValueNotConflict=function(e,t){var n=t.allowCross,r=this.state||{},o=r.handle,i=r.bounds;if(!n&&null!=o){if(o>0&&e<=i[o-1])return i[o-1];if(o<i.length-1&&e>=i[o+1])return i[o+1]}return e},t.prototype.render=function(){var e=this,t=this.state,n=t.handle,r=t.bounds,o=this.props,i=o.prefixCls,s=o.vertical,l=o.included,u=o.handle,c=r.map(function(t){return e.calcOffset(t)}),d=i+"-handle",f=r.map(function(t,r){var o;return u({className:(0,_["default"])((o={},(0,a["default"])(o,d,!0),(0,a["default"])(o,d+"-"+(r+1),!0),o)),vertical:s,offset:c[r],value:t,dragging:n===r,index:r,ref:function(t){return e.saveHandle(r,t)}})}),p=r.slice(0,-1).map(function(e,t){var n,r=t+1,o=(0,_["default"])((n={},(0,a["default"])(n,i+"-track",!0),(0,a["default"])(n,i+"-track-"+r,!0),n));return g["default"].createElement(C["default"],{className:o,vertical:s,included:l,offset:c[r-1],length:c[r]-c[r-1],key:r})});return{tracks:p,handles:f}},t}(g["default"].Component);E.displayName="Range",E.propTypes={defaultValue:y.PropTypes.arrayOf(y.PropTypes.number),value:y.PropTypes.arrayOf(y.PropTypes.number),count:y.PropTypes.number,pushable:y.PropTypes.oneOfType([y.PropTypes.bool,y.PropTypes.number]),allowCross:y.PropTypes.bool},E.defaultProps={count:1,allowCross:!0,pushable:!1},t["default"]=(0,w["default"])(E),e.exports=t["default"]},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(7),a=o(i),s=n(2),l=o(s),u=n(4),c=o(u),d=n(3),f=o(d),p=n(1),h=o(p),m=n(107),v=o(m),y=n(108),g=o(y),b=n(67),_=r(b),T=function(e){function t(n){(0,l["default"])(this,t);var r=(0,c["default"])(this,e.call(this,n));r.onEnd=function(){r.setState({dragging:!1}),r.removeDocumentEvents(),r.props.onAfterChange(r.getValue())};var o=void 0!==n.defaultValue?n.defaultValue:n.min,i=void 0!==n.value?n.value:o;return r.state={value:r.trimAlignValue(i),dragging:!1},r}return(0,f["default"])(t,e),t.prototype.componentWillReceiveProps=function(e){if("value"in e||"min"in e||"max"in e){var t=this.state.value,n=void 0!==e.value?e.value:t,r=this.trimAlignValue(n,e);r!==t&&(this.setState({value:r}),_.isValueOutOfRange(n,e)&&this.props.onChange(r))}},t.prototype.onChange=function(e){var t=this.props,n=!("value"in t);n&&this.setState(e);var r=e.value;t.onChange(r)},t.prototype.onStart=function(e){this.setState({dragging:!0});var t=this.props,n=this.getValue();t.onBeforeChange(n);var r=this.calcValueByPos(e);this.startValue=r,this.startPosition=e,r!==n&&this.onChange({value:r})},t.prototype.onMove=function(e,t){_.pauseEvent(e);var n=this.state,r=this.calcValueByPos(t),o=n.value;r!==o&&this.onChange({value:r})},t.prototype.getValue=function(){return this.state.value},t.prototype.getLowerBound=function(){return this.props.min},t.prototype.getUpperBound=function(){return this.state.value},t.prototype.trimAlignValue=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,a["default"])({},this.props,t),r=_.ensureValueInRange(e,n);return _.ensureValuePrecision(r,n)},t.prototype.render=function(){var e=this,t=this.props,n=t.prefixCls,r=t.vertical,o=t.included,i=t.handle,a=this.state,s=a.value,l=a.dragging,u=this.calcOffset(s),c=i({className:n+"-handle",vertical:r,offset:u,value:s,dragging:l,ref:function(t){return e.saveHandle(0,t)}}),d=h["default"].createElement(v["default"],{className:n+"-track",vertical:r,included:o,offset:0,length:u});return{tracks:d,handles:c}},t}(h["default"].Component);T.displayName="Slider",T.propTypes={defaultValue:p.PropTypes.number,value:p.PropTypes.number},T.defaultProps={},t["default"]=(0,g["default"])(T),e.exports=t["default"]},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(7),i=r(o),a=n(38),s=r(a),l=n(6),u=r(l),c=n(1),d=r(c),f=n(5),p=r(f),h=function(e){var t=e.className,n=e.vertical,r=e.marks,o=e.included,a=e.upperBound,l=e.lowerBound,c=e.max,f=e.min,h=Object.keys(r),m=h.length,v=100/(m-1),y=.9*v,g=c-f,b=h.map(parseFloat).sort(function(e,t){return e-t}).map(function(e){var c,h=!o&&e===a||o&&e<=a&&e>=l,m=(0,p["default"])((c={},(0,u["default"])(c,t+"-text",!0),(0,u["default"])(c,t+"-text-active",h),c)),v={marginBottom:"-50%",bottom:(e-f)/g*100+"%"},b={width:y+"%",marginLeft:-y/2+"%",left:(e-f)/g*100+"%"},_=n?v:b,T=r[e],C="object"===("undefined"==typeof T?"undefined":(0,s["default"])(T))&&!d["default"].isValidElement(T),x=C?T.label:T,w=C?(0,i["default"])({},_,T.style):_;return d["default"].createElement("span",{className:m,style:w,key:e},x)});return d["default"].createElement("div",{className:t},b)};t["default"]=h,e.exports=t["default"]},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(6),i=r(o),a=n(1),s=r(a),l=n(5),u=r(l),c=n(66),d=r(c),f=function(e,t,n,r,o,i){(0,d["default"])(!n||r>0,"`Slider[step]` should be a positive number in order to make Slider[dots] work.");var a=Object.keys(t).map(parseFloat);if(n)for(var s=o;s<=i;s+=r)a.indexOf(s)>=0||a.push(s);return a},p=function(e){var t=e.prefixCls,n=e.vertical,r=e.marks,o=e.dots,a=e.step,l=e.included,c=e.lowerBound,d=e.upperBound,p=e.max,h=e.min,m=p-h,v=f(n,r,o,a,h,p).map(function(e){var r,o=Math.abs(e-h)/m*100+"%",a=n?{bottom:o}:{left:o},f=!l&&e===d||l&&e<=d&&e>=c,p=(0,u["default"])((r={},(0,i["default"])(r,t+"-dot",!0),(0,i["default"])(r,t+"-dot-active",f),r));return s["default"].createElement("span",{className:p,style:a,key:e})});return s["default"].createElement("div",{className:t+"-step"},v)};t["default"]=p,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return function(t){function n(e){(0,f["default"])(this,n);var r=(0,h["default"])(this,t.call(this,e));return r.handleTooltipVisibleChange=function(e,t){r.setState({visibles:(0,c["default"])({},r.state.visibles,(0,l["default"])({},e,t))})},r.handleWithTooltip=function(e){var t=e.value,n=e.dragging,o=e.index,i=(0,a["default"])(e,["value","dragging","index"]);return g["default"].createElement(_["default"],{prefixCls:"rc-slider-tooltip",overlay:t,visible:r.state.visibles[o]||n,onVisibleChange:function(e){return r.handleTooltipVisibleChange(o,e)},placement:"top",key:o},g["default"].createElement(C["default"],i))},r.state={visibles:{}},r}return(0,v["default"])(n,t),n.prototype.render=function(){return g["default"].createElement(e,(0,c["default"])({},this.props,{handle:this.handleWithTooltip}))},n}(g["default"].Component)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(26),a=r(i),s=n(6),l=r(s),u=n(7),c=r(u),d=n(2),f=r(d),p=n(4),h=r(p),m=n(3),v=r(m);t["default"]=o;var y=n(1),g=r(y),b=n(102),_=r(b),T=n(106),C=r(T);e.exports=t["default"]},function(e,t,n){"use strict";var r=n(128);r.keys().forEach(function(e){r(e)}),e.exports=n(389),"undefined"!=typeof console&&console.warn&&console.warn("You are using prebuilt antd-mobile,\nplease use https://github.com/ant-design/babel-plugin-import to reduce app bundle size.")},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(2),i=r(o),a=n(4),s=r(a),l=n(3),u=r(l),c=n(1),d=r(c),f=n(249),p=r(f),h=function(e){function t(){return(0,i["default"])(this,t),(0,s["default"])(this,e.apply(this,arguments))}return(0,u["default"])(t,e),t.prototype.render=function(){return d["default"].createElement(p["default"],this.props)},t}(d["default"].Component);t["default"]=h,h.Panel=f.Panel,h.defaultProps={prefixCls:"am-accordion"},e.exports=t["default"]},[480,176],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){}function i(e,t,n){function r(){if(_){d["default"].unmountComponentAtNode(_),_.parentNode.removeChild(_),_=null;var e=S.indexOf(r);e!==-1&&S.splice(e,1)}}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=n(e,t);o&&o.then?o.then(function(){r()}):r()}var i,a=(0,b["default"])({},{prefixCls:"am-action-sheet",cancelButtonText:"\u53d6\u6d88"},t),l=a.prefixCls,c=a.className,f=a.transitionName,h=a.maskTransitionName,v=a.maskClosable,g=void 0===v||v,_=document.createElement("div");document.body.appendChild(_),S.push(r);var C=a.title,E=a.message,O=a.options,M=a.destructiveButtonIndex,k=a.cancelButtonIndex,N=a.cancelButtonText,D=[C?u["default"].createElement("h3",{key:"0",className:l+"-title"},C):null,E?u["default"].createElement("div",{key:"1",className:l+"-message"},E):null],R=null,I="normal";switch(e){case w:I="normal",R=u["default"].createElement("div",(0,T["default"])(a),D,u["default"].createElement("div",{className:l+"-button-list"},O.map(function(e,t){var n,r=(n={},(0,s["default"])(n,l+"-button-list-item",!0),(0,s["default"])(n,l+"-destructive-button",M===t),(0,s["default"])(n,l+"-cancel-button",k===t),n),i={className:(0,m["default"])(r),onClick:function(){return o(t)}},a=u["default"].createElement(x["default"],{key:t,activeClassName:l+"-button-list-item-active"},u["default"].createElement("div",i,e));return k!==t&&M!==t||(a=u["default"].createElement(x["default"],{key:t,activeClassName:l+"-button-list-item-active"},u["default"].createElement("div",i,e,k===t?u["default"].createElement("span",{className:l+"-cancel-button-mask"}):null))),a})));break;case P:I="share";var j=O.length&&Array.isArray(O[0])||!1,A=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return u["default"].createElement("div",{className:l+"-share-list-item",key:t,onClick:function(){return o(t,n)}},u["default"].createElement("div",{className:l+"-share-list-item-icon"},e.iconName?u["default"].createElement(y["default"],{type:e.iconName}):e.icon),u["default"].createElement("div",{className:l+"-share-list-item-title"},e.title))};R=u["default"].createElement("div",(0,T["default"])(a),D,u["default"].createElement("div",{className:l+"-share"},j?O.map(function(e,t){return u["default"].createElement("div",{key:t,className:l+"-share-list"},e.map(function(e,n){return A(e,n,t)}))}):u["default"].createElement("div",{className:l+"-share-list"},O.map(function(e,t){return A(e,t)})),u["default"].createElement(x["default"],{activeClassName:l+"-share-cancel-button-active"},u["default"].createElement("div",{className:l+"-share-cancel-button",onClick:function(){return o(-1)}},N))))}var L=(0,m["default"])((i={},(0,s["default"])(i,c,!!c),(0,s["default"])(i,l+"-"+I,!0),i));return d["default"].render(u["default"].createElement(p["default"],{visible:!0,title:"",footer:"",prefixCls:l,className:L,transitionName:f||"am-slide-up",maskTransitionName:h||"am-fade",onClose:r,maskClosable:g,wrapProps:a.wrapProps||{}},R),_),{close:r}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=r(a),l=n(1),u=r(l),c=n(9),d=r(c),f=n(48),p=r(f),h=n(5),m=r(h),v=n(14),y=r(v),g=n(11),b=r(g),_=n(46),T=r(_),C=n(15),x=r(C),w="NORMAL",P="SHARE",S=[];t["default"]={showActionSheetWithOptions:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;i(w,e,t)},showShareActionSheetWithOptions:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;i(P,e,t)},close:function(){S.forEach(function(e){return e()})}},e.exports=t["default"]},[481,177],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(6),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(5),m=r(h),v=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t,n=this.props,r=n.prefixCls,o=n.className,a=n.animating,s=n.toast,l=n.size,u=n.color,c=n.text,d=(0,m["default"])((e={},(0,i["default"])(e,""+r,!0),(0,i["default"])(e,r+"-lg","large"===l),(0,i["default"])(e,r+"-sm","small"===l),(0,i["default"])(e,o,!!o),(0,i["default"])(e,r+"-toast",!!s),e)),f=(0,m["default"])((t={},(0,i["default"])(t,r+"-spinner",!0),(0,i["default"])(t,r+"-spinner-lg",!!s||"large"===l),(0,i["default"])(t,r+"-spinner-white",!!s||"white"===u),t));return a?s?p["default"].createElement("div",{className:d},p["default"].createElement("div",{className:r+"-content"},p["default"].createElement("span",{className:f}),c&&p["default"].createElement("span",{className:r+"-toast"},c))):p["default"].createElement("div",{className:d},p["default"].createElement("span",{className:f}),c&&p["default"].createElement("span",{className:r+"-tip"},c)):null},t}(p["default"].Component);t["default"]=v,v.defaultProps={prefixCls:"am-activity-indicator",animating:!0,size:"small",color:"gray",panelColor:"rgba(34,34,34,0.6)",toast:!1},e.exports=t["default"]},[480,178],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),i=r(o),a=n(6),s=r(a),l=n(2),u=r(l),c=n(4),d=r(c),f=n(3),p=r(f),h=n(1),m=r(h),v=n(5),y=r(v),g=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&(n[r[o]]=e[r[o]]);return n},b=function(e){function t(){return(0,u["default"])(this,t),(0,d["default"])(this,e.apply(this,arguments))}return(0,p["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,r=t.className,o=g(t,["prefixCls","className"]),a=(0,y["default"])((e={},(0,s["default"])(e,n+"-body",!0),(0,s["default"])(e,r,r),e));return m["default"].createElement("div",(0,i["default"])({className:a},o))},t}(m["default"].Component);t["default"]=b,b.defaultProps={prefixCls:"am-card"},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),i=r(o),a=n(6),s=r(a),l=n(2),u=r(l),c=n(4),d=r(c),f=n(3),p=r(f),h=n(1),m=r(h),v=n(5),y=r(v),g=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&(n[r[o]]=e[r[o]]);return n},b=function(e){function t(){return(0,u["default"])(this,t),(0,d["default"])(this,e.apply(this,arguments))}return(0,p["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,r=t.content,o=t.className,a=t.extra,l=g(t,["prefixCls","content","className","extra"]),u=(0,y["default"])((e={},(0,s["default"])(e,n+"-footer",!0),(0,s["default"])(e,o,o),e));return m["default"].createElement("div",(0,i["default"])({className:u},l),m["default"].createElement("div",{className:n+"-footer-content"},r),a&&m["default"].createElement("div",{className:n+"-footer-extra"},a))},t}(m["default"].Component);t["default"]=b,b.defaultProps={prefixCls:"am-card"},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),i=r(o),a=n(6),s=r(a),l=n(2),u=r(l),c=n(4),d=r(c),f=n(3),p=r(f),h=n(1),m=r(h),v=n(5),y=r(v),g=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&(n[r[o]]=e[r[o]]);return n},b=function(e){function t(){return(0,u["default"])(this,t),(0,d["default"])(this,e.apply(this,arguments))}return(0,p["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,r=t.className,o=t.title,a=t.thumb,l=t.thumbStyle,u=t.extra,c=g(t,["prefixCls","className","title","thumb","thumbStyle","extra"]),d=(0,y["default"])((e={},(0,s["default"])(e,n+"-header",!0),(0,s["default"])(e,r,r),e));return m["default"].createElement("div",(0,i["default"])({className:d},c),m["default"].createElement("div",{className:n+"-header-content"},a?m["default"].createElement("img",{style:l,src:a}):null,o),u?m["default"].createElement("div",{className:n+"-header-extra"},u):null)},t}(m["default"].Component);t["default"]=b,b.defaultProps={prefixCls:"am-card",thumbStyle:{}},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),i=r(o),a=n(6),s=r(a),l=n(2),u=r(l),c=n(4),d=r(c),f=n(3),p=r(f),h=n(1),m=r(h),v=n(5),y=r(v),g=n(369),b=r(g),_=n(367),T=r(_),C=n(368),x=r(C),w=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&(n[r[o]]=e[r[o]]);return n},P=function(e){function t(){return(0,u["default"])(this,t),(0,d["default"])(this,e.apply(this,arguments))}return(0,p["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,r=t.full,o=t.className,a=w(t,["prefixCls","full","className"]),l=(0,y["default"])((e={},(0,s["default"])(e,n,!0),(0,s["default"])(e,n+"-full",r),(0,s["default"])(e,o,o),e));return m["default"].createElement("div",(0,i["default"])({className:l},a))},t}(m["default"].Component);t["default"]=P,P.defaultProps={prefixCls:"am-card",full:!1},P.Header=b["default"],P.Body=T["default"],P.Footer=x["default"],e.exports=t["default"]},[480,181],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),i=r(o),a=n(6),s=r(a),l=n(2),u=r(l),c=n(4),d=r(c),f=n(3),p=r(f),h=n(1),m=r(h),v=n(5),y=r(v),g=n(70),b=r(g),_=n(46),T=r(_),C=n(19),x=r(C),w=function(e){function t(){return(0,u["default"])(this,t),(0,d["default"])(this,e.apply(this,arguments))}return(0,p["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,r=t.style,o=t.className,a=(0,y["default"])((e={},(0,s["default"])(e,n+"-agree",!0),(0,s["default"])(e,o,o),e));return m["default"].createElement("div",(0,i["default"])({},(0,T["default"])(this.props),{className:a,style:r}),m["default"].createElement(b["default"],(0,i["default"])({},(0,x["default"])(this.props,["style"]),{className:n+"-agree-label"})))},t}(m["default"].Component);t["default"]=w,w.defaultProps={prefixCls:"am-checkbox"},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var i=n(7),a=r(i),s=n(6),l=r(s),u=n(2),c=r(u),d=n(4),f=r(d),p=n(3),h=r(p),m=n(1),v=r(m),y=n(5),g=r(y),b=n(29),_=r(b),T=n(70),C=r(T),x=n(19),w=r(x),P=_["default"].Item,S=function(e){function t(){return(0,c["default"])(this,t),(0,f["default"])(this,e.apply(this,arguments))}return(0,h["default"])(t,e),t.prototype.render=function(){var e,t=this,n=this.props,r=n.prefixCls,i=n.listPrefixCls,s=n.className,u=n.children,c=n.disabled,d=n.checkboxProps,f=void 0===d?{}:d,p=(0,g["default"])((e={},(0,l["default"])(e,r+"-item",!0),(0,l["default"])(e,r+"-item-disabled",c===!0),(0,l["default"])(e,s,s),e)),h=(0,w["default"])(this.props,["listPrefixCls","onChange","disabled","checkboxProps"]);c?delete h.onClick:h.onClick=h.onClick||o;var m={};return["name","defaultChecked","checked","onChange","disabled"].forEach(function(e){e in t.props&&(m[e]=t.props[e])}),v["default"].createElement(P,(0,a["default"])({},h,{prefixCls:i,className:p,thumb:v["default"].createElement(C["default"],(0,a["default"])({},f,m))}),u)},t}(v["default"].Component);t["default"]=S,S.defaultProps={prefixCls:"am-checkbox",listPrefixCls:"am-list"},e.exports=t["default"]},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(70),i=r(o),a=n(373),s=r(a),l=n(372),u=r(l);i["default"].CheckboxItem=s["default"],i["default"].AgreeItem=u["default"],t["default"]=i["default"],e.exports=t["default"]},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(359),i=r(o);t["default"]=i["default"],e.exports=t["default"]},[483,184],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){return(0,T["default"])({prefixCls:"am-picker",pickerPrefixCls:"am-picker-col",popupPrefixCls:"am-picker-popup"},(0,b.getProps)())}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var i=n(7),a=r(i),s=n(2),l=r(s),u=n(4),c=r(u),d=n(3),f=r(d),p=n(1),h=r(p),m=n(352),v=r(m),y=n(351),g=r(y),b=n(380),_=n(11),T=r(_),C=n(109),x=function(e){function t(){return(0,l["default"])(this,t),(0,c["default"])(this,e.apply(this,arguments))}return(0,f["default"])(t,e),t.prototype.render=function(){var e=this.props,t=this.context,r=e.children,o=e.value,i=e.defaultDate,s=e.extra,l=e.popupPrefixCls,u=(0,C.getComponentLocale)(e,t,"DatePicker",function(){return n(378)}),c=(0,C.getLocaleCode)(t),d=u.okText,f=u.dismissText,p=u.DatePickerLocale;c&&(o&&o.locale(c),i&&i.locale(c));var m=h["default"].createElement(g["default"],{locale:p,minDate:e.minDate,maxDate:e.maxDate,mode:e.mode,pickerPrefixCls:e.pickerPrefixCls,prefixCls:e.prefixCls,defaultDate:o||i});return h["default"].createElement(v["default"],(0,a["default"])({datePicker:m,WrapComponent:"div",transitionName:"am-slide-up",maskTransitionName:"am-fade"},e,{prefixCls:l,date:o||i,dismissText:f,okText:d}),r&&h["default"].cloneElement(r,{extra:o?(0,b.formatFn)(this,o):s}))},t}(h["default"].Component);t["default"]=x,x.defaultProps=o(),x.contextTypes={antLocale:h["default"].PropTypes.object},e.exports=t["default"]},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(354),i=r(o);t["default"]={okText:"\u786e\u5b9a",dismissText:"\u53d6\u6d88",DatePickerLocale:i["default"]},e.exports=t["default"]},function(e,t,n){"use strict";n(117)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=void 0;return t="time"===e?"HH:mm":"datetime"===e?"YYYY-MM-DD HH:mm":"YYYY-MM-DD"}function i(e,t){var n=e.props.format,r="undefined"==typeof n?"undefined":(0,l["default"])(n);return"string"===r?t.format(r):"function"===r?n(t):t.format(o(e.props.mode))}function a(){return{mode:"datetime",extra:"\u8bf7\u9009\u62e9",defaultDate:(0,c["default"])(),onChange:function(){},title:""}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(38),l=r(s);t.formatFn=i,t.getProps=a;var u=n(88),c=r(u)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(2),i=r(o),a=n(4),s=r(a),l=n(3),u=r(l),c=n(1),d=r(c),f=n(166),p=r(f),h=function(e){function t(){return(0,i["default"])(this,t),(0,s["default"])(this,e.apply(this,arguments))}return(0,u["default"])(t,e),t.prototype.render=function(){return d["default"].createElement(p["default"],this.props)},t}(d["default"].Component);t["default"]=h,h.defaultProps={prefixCls:"am-drawer",enableDragHandle:!1},e.exports=t["default"]},[480,185],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(6),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(5),m=r(h),v=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.direction,r=t.wrap,o=t.justify,a=t.align,s=t.alignContent,l=t.className,u=t.children,c=t.prefixCls,d=t.style,f=t.onClick,h=(0,m["default"])((e={},(0,i["default"])(e,c,!0),(0,i["default"])(e,c+"-dir-row","row"===n),(0,i["default"])(e,c+"-dir-row-reverse","row-reverse"===n),(0,i["default"])(e,c+"-dir-column","column"===n),(0,i["default"])(e,c+"-dir-column-reverse","column-reverse"===n),(0,i["default"])(e,c+"-nowrap","nowrap"===r),(0,i["default"])(e,c+"-wrap","wrap"===r),(0,i["default"])(e,c+"-wrap-reverse","wrap-reverse"===r),(0,i["default"])(e,c+"-justify-start","start"===o),(0,i["default"])(e,c+"-justify-end","end"===o),(0,i["default"])(e,c+"-justify-center","center"===o),(0,i["default"])(e,c+"-justify-between","between"===o),(0,i["default"])(e,c+"-justify-around","around"===o),(0,i["default"])(e,c+"-align-top","top"===a||"start"===a),(0,i["default"])(e,c+"-align-middle","middle"===a||"center"===a),(0,i["default"])(e,c+"-align-bottom","bottom"===a||"end"===a),(0,i["default"])(e,c+"-align-baseline","baseline"===a),(0,i["default"])(e,c+"-align-stretch","stretch"===a),(0,i["default"])(e,c+"-align-content-start","start"===s),(0,i["default"])(e,c+"-align-content-end","end"===s),(0,i["default"])(e,c+"-align-content-center","center"===s),(0,i["default"])(e,c+"-align-content-between","between"===s),(0,i["default"])(e,c+"-align-content-around","around"===s),(0,i["default"])(e,c+"-align-content-stretch","stretch"===s),(0,i["default"])(e,l,l),e));return p["default"].createElement("div",{className:h,style:d,onClick:f},u)},t}(p["default"].Component);t["default"]=v,v.defaultProps={prefixCls:"am-flexbox",align:"center",onClick:function(){}},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(6),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(5),m=r(h),v=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.children,r=t.className,o=t.prefixCls,a=t.style,s=t.onClick,l=(0,m["default"])((e={},(0,i["default"])(e,o+"-item",!0),(0,i["default"])(e,r,r),e));return p["default"].createElement("div",{className:l,style:a,onClick:s},n)},t}(p["default"].Component);t["default"]=v,v.defaultProps={prefixCls:"am-flexbox"},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(6),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(5),m=r(h),v=n(35),y=r(v),g=n(112),b=r(g),_=function(e){function t(){(0,s["default"])(this,t);var n=(0,u["default"])(this,e.apply(this,arguments));return n.clientWidth=document.documentElement.clientWidth,n}return(0,d["default"])(t,e),t.prototype.render=function(){for(var e,t=this,n=this.props,r=n.prefixCls,o=n.className,a=n.data,s=n.hasLine,l=n.columnNum,u=n.isCarousel,c=n.carouselMaxRow,d=n.onClick,f=void 0===d?function(){}:d,h=a&&a.length||0,v=Math.ceil(h/l),g=this.props.renderItem||function(e){return p["default"].createElement("div",{className:r+"-item-contain column-num-"+l,style:{height:t.clientWidth/l+"px"}},p["default"].isValidElement(e.icon)?e.icon:p["default"].createElement("img",{className:r+"-icon",src:e.icon}),p["default"].createElement("div",{className:r+"-text"},e.text))},_=[],T=0;T<v;T++){for(var C=[],x=function(e){var t=T*l+e;if(t<h){var n=a&&a[t];C.push(p["default"].createElement(y["default"].Item,{key:"griditem-"+t,className:r+"-item",onClick:function(){return f(n,t)}},g(n,t)))}else C.push(p["default"].createElement(y["default"].Item,{key:"griditem-"+t}))},w=0;w<l;w++)x(w);_.push(p["default"].createElement(y["default"],{justify:"center",align:"stretch",key:"gridline-"+T},C))}var P=Math.ceil(v/c),S=[];if(u&&P>1)for(var E=0;E<P;E++){for(var O=[],M=0;M<c;M++){var k=E*c+M;k<v?O.push(_[k]):O.push(p["default"].createElement("div",{key:"gridline-"+k}))}S.push(p["default"].createElement("div",{key:"pageitem-"+E,className:r+"-carousel-page"},O))}return p["default"].createElement("div",{className:(0,m["default"])((e={},(0,i["default"])(e,r,!0),(0,i["default"])(e,r+"-line",s),(0,i["default"])(e,o,o),e))},u&&P>1?p["default"].createElement(b["default"],{initialSlideWidth:this.clientWidth},S):_)},t}(p["default"].Component);t["default"]=_,_.defaultProps={data:[],hasLine:!0,isCarousel:!1,columnNum:4,carouselMaxRow:2,prefixCls:"am-grid"},e.exports=t["default"]},function(e,t,n){"use strict";n(8),n(36),n(113),n(187)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var i=n(6),a=r(i),s=n(2),l=r(s),u=n(4),c=r(u),d=n(3),f=r(d),p=n(1),h=r(p),m=n(5),v=r(m),y=n(122),g=r(y),b=n(35),_=r(b),T=n(119),C=r(T),x=n(15),w=r(x),P=function(e){function t(){(0,l["default"])(this,t);var n=(0,c["default"])(this,e.apply(this,arguments));return n.getOrientation=function(e,t){if(/iphone|ipad/i.test(navigator.userAgent)){var n=new FileReader;n.onload=function(e){var n=new DataView(e.target.result);if(65496!==n.getUint16(0,!1))return t(-2);for(var r=n.byteLength,o=2;o<r;){
var i=n.getUint16(o,!1);if(o+=2,65505===i){var a=n.getUint32(o+=2,!1);if(1165519206!==a)return t(-1);var s=18761===n.getUint16(o+=6,!1);o+=n.getUint32(o+4,s);var l=n.getUint16(o,s);o+=2;for(var u=0;u<l;u++)if(274===n.getUint16(o+12*u,s))return t(n.getUint16(o+12*u+8,s))}else{if(65280!==(65280&i))break;o+=n.getUint16(o,!1)}}return t(-1)},n.readAsArrayBuffer(e.slice(0,65536))}else t("-1")},n.removeImage=function(e){var t=[],r=n.props.files,o=void 0===r?[]:r;o.forEach(function(n,r){e!==r&&t.push(n)}),n.props.onChange&&n.props.onChange(t,"remove",e)},n.addImage=function(e){var t=n.props.files,r=void 0===t?[]:t,o=r.concat(e);n.props.onChange&&n.props.onChange(o,"add")},n.onImageClick=function(e){n.props.onImageClick&&n.props.onImageClick(e,n.props.files)},n.onFileChange=function(){var e=n.refs.fileSelectorInput;if(e.files&&e.files.length){var t=e.files[0],r=new FileReader;r.onload=function(r){var o=r.target.result;if(!o)return void C["default"].fail("\u56fe\u7247\u83b7\u53d6\u5931\u8d25");var i=1;n.getOrientation(t,function(r){r>0&&(i=r),n.addImage({url:o,orientation:i,file:t}),e.value=""})},r.readAsDataURL(t)}},n}return(0,f["default"])(t,e),t.prototype.render=function(){var e,t=this,n=this.props,r=n.prefixCls,o=n.style,i=n.className,s=n.files,l=void 0===s?[]:s,u=n.selectable,c=n.onAddImageClick,d=window.devicePixelRatio||1,f=[],p=(document.documentElement.clientWidth-18*d-6*d*3)/4,m=(0,v["default"])((e={},(0,a["default"])(e,""+r,!0),(0,a["default"])(e,i,i),e)),y={width:p+"px",height:p+"px"};l.forEach(function(e,n){f.push(h["default"].createElement("div",{key:n,className:r+"-item",style:y},h["default"].createElement("div",{className:r+"-item-remove",onClick:function(){t.removeImage(n)}}),h["default"].createElement("div",{className:r+"-item-content",onClick:function(){t.onImageClick(n)},style:{backgroundImage:"url("+e.url+")"}})))});var b=h["default"].createElement(w["default"],{activeClassName:r+"-upload-btn-active"},h["default"].createElement("div",{className:r+"-item "+r+"-upload-btn",style:y,onClick:c},h["default"].createElement("input",{style:y,ref:"fileSelectorInput",type:"file",accept:"image/jpg,image/jpeg,image/png,image/gif",onChange:function(){t.onFileChange()}})));return h["default"].createElement("div",{className:m,style:o},h["default"].createElement("div",{className:r+"-list"},h["default"].createElement(g["default"],{size:"md"},h["default"].createElement(_["default"],{wrap:"wrap"},f,u&&b))))},t}(h["default"].Component);t["default"]=P,P.defaultProps={prefixCls:"am-image-picker",files:[],onChange:o,onImageClick:o,onAddImageClick:o,selectable:!0},e.exports=t["default"]},function(e,t,n){"use strict";n(8),n(123),n(36),n(120),n(189)},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(361);Object.defineProperty(t,"Accordion",{enumerable:!0,get:function(){return r(o)["default"]}});var i=n(363);Object.defineProperty(t,"ActionSheet",{enumerable:!0,get:function(){return r(i)["default"]}});var a=n(365);Object.defineProperty(t,"ActivityIndicator",{enumerable:!0,get:function(){return r(a)["default"]}});var s=n(110);Object.defineProperty(t,"Badge",{enumerable:!0,get:function(){return r(s)["default"]}});var l=n(68);Object.defineProperty(t,"Button",{enumerable:!0,get:function(){return r(l)["default"]}});var u=n(370);Object.defineProperty(t,"Card",{enumerable:!0,get:function(){return r(u)["default"]}});var c=n(112);Object.defineProperty(t,"Carousel",{enumerable:!0,get:function(){return r(c)["default"]}});var d=n(374);Object.defineProperty(t,"Checkbox",{enumerable:!0,get:function(){return r(d)["default"]}});var f=n(377);Object.defineProperty(t,"DatePicker",{enumerable:!0,get:function(){return r(f)["default"]}});var p=n(381);Object.defineProperty(t,"Drawer",{enumerable:!0,get:function(){return r(p)["default"]}});var h=n(35);Object.defineProperty(t,"Flex",{enumerable:!0,get:function(){return r(h)["default"]}});var m=n(385);Object.defineProperty(t,"Grid",{enumerable:!0,get:function(){return r(m)["default"]}});var v=n(14);Object.defineProperty(t,"Icon",{enumerable:!0,get:function(){return r(v)["default"]}});var y=n(387);Object.defineProperty(t,"ImagePicker",{enumerable:!0,get:function(){return r(y)["default"]}});var g=n(390);Object.defineProperty(t,"InputItem",{enumerable:!0,get:function(){return r(g)["default"]}});var b=n(29);Object.defineProperty(t,"List",{enumerable:!0,get:function(){return r(b)["default"]}});var _=n(393);Object.defineProperty(t,"ListView",{enumerable:!0,get:function(){return r(_)["default"]}});var T=n(399);Object.defineProperty(t,"Menu",{enumerable:!0,get:function(){return r(T)["default"]}});var C=n(402);Object.defineProperty(t,"Modal",{enumerable:!0,get:function(){return r(C)["default"]}});var x=n(405);Object.defineProperty(t,"NavBar",{enumerable:!0,get:function(){return r(x)["default"]}});var w=n(408);Object.defineProperty(t,"NoticeBar",{enumerable:!0,get:function(){return r(w)["default"]}});var P=n(410);Object.defineProperty(t,"Pagination",{enumerable:!0,get:function(){return r(P)["default"]}});var S=n(414);Object.defineProperty(t,"Picker",{enumerable:!0,get:function(){return r(S)["default"]}});var E=n(413);Object.defineProperty(t,"PickerView",{enumerable:!0,get:function(){return r(E)["default"]}});var O=n(418);Object.defineProperty(t,"Popover",{enumerable:!0,get:function(){return r(O)["default"]}});var M=n(420);Object.defineProperty(t,"Popup",{enumerable:!0,get:function(){return r(M)["default"]}});var k=n(422);Object.defineProperty(t,"Progress",{enumerable:!0,get:function(){return r(k)["default"]}});var N=n(425);Object.defineProperty(t,"Radio",{enumerable:!0,get:function(){return r(N)["default"]}});var D=n(428);Object.defineProperty(t,"RefreshControl",{enumerable:!0,get:function(){return r(D)["default"]}});var R=n(430);Object.defineProperty(t,"Result",{enumerable:!0,get:function(){return r(R)["default"]}});var I=n(433);Object.defineProperty(t,"SearchBar",{enumerable:!0,get:function(){return r(I)["default"]}});var j=n(435);Object.defineProperty(t,"SegmentedControl",{enumerable:!0,get:function(){return r(j)["default"]}});var A=n(437);Object.defineProperty(t,"Slider",{enumerable:!0,get:function(){return r(A)["default"]}});var L=n(426);Object.defineProperty(t,"Range",{enumerable:!0,get:function(){return r(L)["default"]}});var W=n(375);Object.defineProperty(t,"createTooltip",{enumerable:!0,get:function(){return r(W)["default"]}});var V=n(439);Object.defineProperty(t,"Stepper",{enumerable:!0,get:function(){return r(V)["default"]}});var H=n(441);Object.defineProperty(t,"Steps",{enumerable:!0,get:function(){return r(H)["default"]}});var F=n(443);Object.defineProperty(t,"SwipeAction",{enumerable:!0,get:function(){return r(F)["default"]}});var Y=n(445);Object.defineProperty(t,"Switch",{enumerable:!0,get:function(){return r(Y)["default"]}});var B=n(448);Object.defineProperty(t,"TabBar",{enumerable:!0,get:function(){return r(B)["default"]}});var z=n(450);Object.defineProperty(t,"Table",{enumerable:!0,get:function(){return r(z)["default"]}});var U=n(452);Object.defineProperty(t,"Tabs",{enumerable:!0,get:function(){return r(U)["default"]}});var G=n(454);Object.defineProperty(t,"Tag",{enumerable:!0,get:function(){return r(G)["default"]}});var X=n(456);Object.defineProperty(t,"Text",{enumerable:!0,get:function(){return r(X)["default"]}});var K=n(458);Object.defineProperty(t,"TextareaItem",{enumerable:!0,get:function(){return r(K)["default"]}});var q=n(119);Object.defineProperty(t,"Toast",{enumerable:!0,get:function(){return r(q)["default"]}});var Z=n(121);Object.defineProperty(t,"View",{enumerable:!0,get:function(){return r(Z)["default"]}});var Q=n(461);Object.defineProperty(t,"WhiteSpace",{enumerable:!0,get:function(){return r(Q)["default"]}});var $=n(122);Object.defineProperty(t,"WingBlank",{enumerable:!0,get:function(){return r($)["default"]}});var J=n(396);Object.defineProperty(t,"LocaleProvider",{enumerable:!0,get:function(){return r(J)["default"]}})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){}function i(e){return"undefined"==typeof e||null===e?"":e}Object.defineProperty(t,"__esModule",{value:!0});var a=n(7),s=r(a),l=n(6),u=r(l),c=n(2),d=r(c),f=n(4),p=r(f),h=n(3),m=r(h),v=n(1),y=r(v),g=n(5),b=r(g),_=n(19),T=r(_),C=function(e){function t(n){(0,d["default"])(this,t);var r=(0,p["default"])(this,e.call(this,n));return r.onInputChange=function(e){var t=e.target.value,n=r.props,o=n.onChange,i=n.type;switch(i){case"text":break;case"bankCard":t=t.replace(/\D/g,""),t=t.replace(/\D/g,"").replace(/(....)(?=.)/g,"$1 ");break;case"phone":t=t.replace(/\D/g,"").substring(0,11);var a=t.length;a>3&&a<8?t=t.substr(0,3)+" "+t.substr(3):a>=8&&(t=t.substr(0,3)+" "+t.substr(3,4)+" "+t.substr(7));break;case"number":t=t.replace(/\D/g,"");break;case"password":}o&&o(t)},r.onInputBlur=function(e){r.debounceTimeout=setTimeout(function(){r.setState({focus:!1})},200),"focused"in r.props||r.setState({focused:!1});var t=e.target.value;r.props.onBlur&&r.props.onBlur(t)},r.onInputFocus=function(e){r.debounceTimeout&&(clearTimeout(r.debounceTimeout),r.debounceTimeout=null),"focused"in r.props||r.setState({focused:!0}),r.setState({focus:!0});var t=e.target.value;r.props.onFocus&&r.props.onFocus(t),"input"===document.activeElement.tagName.toLowerCase()&&(r.scrollIntoViewTimeout=setTimeout(function(){try{document.activeElement.scrollIntoViewIfNeeded()}catch(e){}},0))},r.onExtraClick=function(e){r.props.onExtraClick&&r.props.onExtraClick(e)},r.onErrorClick=function(e){r.props.onErrorClick&&r.props.onErrorClick(e)},r.clearInput=function(){"password"!==r.props.type&&r.props.updatePlaceholder&&r.setState({placeholder:r.props.value}),r.props.onChange&&r.props.onChange("")},r.state={focused:n.focused||!1,placeholder:n.placeholder},r}return(0,m["default"])(t,e),t.prototype.componentWillReceiveProps=function(e){"placeholder"in e&&!e.updatePlaceholder&&this.setState({placeholder:e.placeholder}),"focused"in e&&this.setState({focused:e.focused})},t.prototype.componentWillUnmount=function(){this.debounceTimeout&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=null),this.scrollIntoViewTimeout&&(clearTimeout(this.scrollIntoViewTimeout),this.scrollIntoViewTimeout=null)},t.prototype.componentDidMount=function(){(this.props.autoFocus||this.state.focused)&&this.refs.input.focus()},t.prototype.componentDidUpdate=function(){this.state.focused&&this.refs.input.focus()},t.prototype.render=function(){var e,t,n=this.props,r=n.prefixCls,o=n.prefixListCls,a=n.type,l=n.value,c=n.defaultValue,d=n.name,f=n.editable,p=n.disabled,h=n.style,m=n.clear,v=n.children,g=n.error,_=n.className,C=n.extra,x=n.labelNumber,w=n.maxLength,P=(0,T["default"])(this.props,["prefixCls","prefixListCls","editable","style","focused","clear","children","error","className","extra","labelNumber","onExtraClick","onErrorClick","updatePlaceholder"]),S=this.state,E=S.placeholder,O=S.focus,M=(0,b["default"])((e={},(0,u["default"])(e,o+"-item",!0),(0,u["default"])(e,r+"-item",!0),(0,u["default"])(e,r+"-disabled",p),(0,u["default"])(e,r+"-error",g),(0,u["default"])(e,r+"-focus",O),(0,u["default"])(e,r+"-android",O),(0,u["default"])(e,_,_),e)),k=(0,b["default"])((t={},(0,u["default"])(t,r+"-label",!0),(0,u["default"])(t,r+"-label-2",2===x),(0,u["default"])(t,r+"-label-3",3===x),(0,u["default"])(t,r+"-label-4",4===x),(0,u["default"])(t,r+"-label-5",5===x),(0,u["default"])(t,r+"-label-6",6===x),(0,u["default"])(t,r+"-label-7",7===x),t)),N=(0,b["default"])((0,u["default"])({},r+"-control",!0)),D="text";"bankCard"===a||"phone"===a?D="tel":"password"===a?D="password":"text"!==a&&(D=a);var R=void 0;R="value"in this.props?{value:i(l)}:{defaultValue:c};var I=void 0;return"number"===a&&(I={pattern:"[0-9]*"}),y["default"].createElement("div",{className:M,style:h},v?y["default"].createElement("div",{className:k},v):null,y["default"].createElement("div",{className:N},y["default"].createElement("input",(0,s["default"])({ref:"input"},I,P,R,{type:D,maxLength:w,name:d,placeholder:E,onChange:this.onInputChange,onBlur:this.onInputBlur,onFocus:this.onInputFocus,readOnly:!f,disabled:p}))),m&&f&&!p&&l&&l.length>0?y["default"].createElement("div",{className:r+"-clear",onClick:this.clearInput}):null,g?y["default"].createElement("div",{className:r+"-error-extra",onClick:this.onErrorClick}):null,""!==C?y["default"].createElement("div",{className:r+"-extra",onClick:this.onExtraClick},C):null)},t}(y["default"].Component);C.defaultProps={prefixCls:"am-input",prefixListCls:"am-list",type:"text",editable:!0,disabled:!1,placeholder:"",clear:!1,onChange:o,onBlur:o,onFocus:o,extra:"",onExtraClick:o,error:!1,onErrorClick:o,labelNumber:5,updatePlaceholder:!1},t["default"]=C,e.exports=t["default"]},[482,190],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(49),m=r(h),v=n(115),y=r(v),g=m["default"].IndexedList,b=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e=this.props,t=e.prefixCls,n=e.listPrefixCls,r=(0,y["default"])(this.props,!0),o=r.restProps,a=r.extraProps;return p["default"].createElement(g,(0,i["default"])({ref:"indexedList",sectionHeaderClassName:t+"-section-header "+n+"-body",sectionBodyClassName:t+"-section-body "+n+"-body"},o,a),this.props.children)},t}(p["default"].Component);t["default"]=b,b.defaultProps={prefixCls:"am-indexed-list",listPrefixCls:"am-list",listViewPrefixCls:"am-list-view"},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(49),m=r(h),v=n(115),y=r(v),g=n(392),b=r(g),_=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e=(0,y["default"])(this.props,!1),t=e.restProps,n=e.extraProps,r=this.props,o=r.useZscroller,a=r.refreshControl;return a&&(o=!0),p["default"].createElement(m["default"],(0,i["default"])({ref:"listview"},t,n,{useZscroller:o}))},t}(p["default"].Component);t["default"]=_,_.defaultProps={prefixCls:"am-list-view",listPrefixCls:"am-list"},_.DataSource=m["default"].DataSource,_.IndexedList=b["default"],e.exports=t["default"]},[482,191],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Brief=void 0;var o=n(7),i=r(o),a=n(6),s=r(a),l=n(2),u=r(l),c=n(4),d=r(c),f=n(3),p=r(f),h=n(1),m=r(h),v=n(5),y=r(v),g=n(15),b=r(g),_=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&(n[r[o]]=e[r[o]]);return n},T=t.Brief=function(e){function t(){return(0,u["default"])(this,t),(0,d["default"])(this,e.apply(this,arguments))}return(0,p["default"])(t,e),t.prototype.render=function(){return m["default"].createElement("div",{className:"am-list-brief",style:this.props.style},this.props.children)},t}(m["default"].Component),C=function(e){function t(){return(0,u["default"])(this,t),(0,d["default"])(this,e.apply(this,arguments))}return(0,p["default"])(t,e),t.prototype.render=function(){var e,t,n,r=this.props,o=r.prefixCls,a=r.className,l=r.activeStyle,u=r.error,c=r.align,d=r.wrap,f=r.disabled,p=r.children,h=r.multipleLine,v=r.thumb,g=r.extra,T=r.arrow,C=r.onClick,x=_(r,["prefixCls","className","activeStyle","error","align","wrap","disabled","children","multipleLine","thumb","extra","arrow","onClick"]),w=(e={},(0,s["default"])(e,a,a),(0,s["default"])(e,o+"-item",!0),(0,s["default"])(e,o+"-item-disabled",f),(0,s["default"])(e,o+"-item-error",u),(0,s["default"])(e,o+"-item-top","top"===c),(0,s["default"])(e,o+"-item-middle","middle"===c),(0,s["default"])(e,o+"-item-bottom","bottom"===c),e),P=(0,y["default"])((t={},(0,s["default"])(t,o+"-line",!0),(0,s["default"])(t,o+"-line-multiple",h),(0,s["default"])(t,o+"-line-wrap",d),t)),S=(0,y["default"])((n={},(0,s["default"])(n,o+"-arrow",!0),(0,s["default"])(n,o+"-arrow-horizontal","horizontal"===T),(0,s["default"])(n,o+"-arrow-vertical","down"===T||"up"===T),(0,s["default"])(n,o+"-arrow-vertical-up","up"===T),n)),E=m["default"].createElement("div",(0,i["default"])({},x,{className:(0,y["default"])(w)}),v?m["default"].createElement("div",{className:o+"-thumb"},"string"==typeof v?m["default"].createElement("img",{src:v}):v):null,m["default"].createElement("div",{className:P},void 0!==p&&m["default"].createElement("div",{className:o+"-content"},p),void 0!==g&&m["default"].createElement("div",{className:o+"-extra"},g),T&&m["default"].createElement("div",{className:S})));return m["default"].createElement(b["default"],{disabled:f||!C,onPress:C,activeStyle:l,activeClassName:o+"-item-active"},E)},t}(m["default"].Component);C.defaultProps={prefixCls:"am-list",align:"middle",error:!1,multipleLine:!1,wrap:!1},C.Brief=T,t["default"]=C},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(2),i=r(o),a=n(4),s=r(a),l=n(3),u=r(l),c=n(1),d=r(c),f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},p=function(e){function t(){return(0,i["default"])(this,t),(0,s["default"])(this,e.apply(this,arguments))}return(0,u["default"])(t,e),t.prototype.getChildContext=function(){return{antLocale:f({},this.props.locale,{exist:!0})}},t.prototype.render=function(){return d["default"].Children.only(this.props.children)},t}(d["default"].Component);t["default"]=p,p.propTypes={locale:d["default"].PropTypes.object},p.childContextTypes={antLocale:d["default"].PropTypes.object},e.exports=t["default"]},[483,193],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(6),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(5),m=r(h),v=n(29),y=r(v),g=n(72),b=r(g),_=function(e){function t(n){(0,s["default"])(this,t);var r=(0,u["default"])(this,e.call(this,n));return r.onClick=function(e){r.setState({selItem:[e]}),r.props.onSel&&r.props.onSel(e)},r.state={selItem:n.selItem},r}return(0,d["default"])(t,e),t.prototype.componentWillReceiveProps=function(e){e.subMenuData!==this.props.subMenuData&&this.setState({selItem:e.selItem})},t.prototype.render=function(){var e=this,t=this.props,n=t.subMenuPrefixCls,r=t.radioPrefixCls,o=t.subMenuData,a=this.state.selItem,s=function(e){return a.length>0&&a[0].value===e.value};return p["default"].createElement(y["default"],{style:{paddingTop:0},className:n},o.map(function(t,o){var a;return p["default"].createElement(y["default"].Item,{className:(0,m["default"])((a={},(0,i["default"])(a,r+"-item",!0),(0,i["default"])(a,n+"-item-selected",s(t)),(0,i["default"])(a,n+"-item-disabled",t.disabled),a)),key:o,extra:p["default"].createElement(b["default"],{checked:s(t),disabled:t.disabled,onChange:function(){return e.onClick(t)}})},t.label)}))},t}(p["default"].Component);t["default"]=_,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(6),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(5),m=r(h),v=n(11),y=r(v),g=n(29),b=r(g),_=n(35),T=r(_),C=n(398),x=r(C),w=function(e){function t(n){(0,s["default"])(this,t);var r=(0,u["default"])(this,e.call(this,n));return r.onClickFirstLevelItem=function(e){r.setState({firstLevelSelectValue:e.value}),e.isLeaf&&r.props.onChange&&r.props.onChange([e.value])},r.onClickSubMenuItem=function(e){var t=r.props,n=t.level,o=t.onChange;setTimeout(function(){o&&o(2===n?[r.state.firstLevelSelectValue,e.value]:[e.value])},300)},r.state={firstLevelSelectValue:r.getNewFsv(n)},r}return(0,d["default"])(t,e),t.prototype.componentWillReceiveProps=function(e){e.value!==this.props.value&&this.setState({firstLevelSelectValue:this.getNewFsv(e)})},t.prototype.getNewFsv=function(e){var t=e.value,n=e.data;return t&&t.length?t[0]:n[0].isLeaf?"":n[0].value},t.prototype.render=function(){var e,t=this,n=this.props,r=n.className,o=n.style,a=n.height,s=n.data,l=void 0===s?[]:s,u=n.prefixCls,c=n.value,d=n.level,f=this.state.firstLevelSelectValue,h=l[0].children||[];2!==d?h=l:f&&(h=l.filter(function(e){return e.value===f})[0].children||[]);var v=c&&c.length&&c[c.length-1],g=h.filter(function(e){return e.value===v}),_={height:Math.round(a||document.documentElement.clientHeight/2)+"px",overflowY:"scroll"};return p["default"].createElement("div",{className:(0,m["default"])((e={},(0,i["default"])(e,u,!0),(0,i["default"])(e,r,!!r),e)),style:(0,y["default"])({},o,_)},p["default"].createElement(T["default"],{align:"top"},2===d?p["default"].createElement(T["default"].Item,{style:_},p["default"].createElement(b["default"],null,l.map(function(e,n){return p["default"].createElement(b["default"].Item,{className:e.value===f?u+"-selected":"",onClick:function(){return t.onClickFirstLevelItem(e)},key:"listitem-1-"+n},e.label)}))):null,p["default"].createElement(T["default"].Item,{style:_},p["default"].createElement(x["default"],{subMenuPrefixCls:this.props.subMenuPrefixCls,radioPrefixCls:this.props.radioPrefixCls,subMenuData:h,selItem:g,onSel:this.onClickSubMenuItem}))))},t}(p["default"].Component);t["default"]=w,w.defaultProps={prefixCls:"am-menu",subMenuPrefixCls:"am-sub-menu",radioPrefixCls:"am-radio",data:[],level:2,onChange:function(){}},e.exports=t["default"]},function(e,t,n){"use strict";n(8),n(114),n(36),n(25),n(118),n(194)},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(){function e(){s["default"].unmountComponentAtNode(a),a.parentNode.removeChild(a)}var t=arguments.length<=0?void 0:arguments[0],n=arguments.length<=1?void 0:arguments[1],r=(arguments.length<=2?void 0:arguments[2])||[{text:"\u786e\u5b9a"}];if(t||n){var o="am-modal",a=document.createElement("div");document.body.appendChild(a);var l=r.map(function(t){var n=t.onPress||function(){};return t.onPress=function(){var t=n();t&&t.then?t.then(function(){e()}):e()},t});s["default"].render(i["default"].createElement(u["default"],{visible:!0,transparent:!0,prefixCls:o,title:t,transitionName:"am-zoom",closable:!1,maskClosable:!1,footer:l,maskTransitionName:"am-fade"},i["default"].createElement("div",{style:{zoom:1,overflow:"hidden"}},n)),a)}};var o=n(1),i=r(o),a=n(9),s=r(a),l=n(71),u=r(l);e.exports=t["default"]},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(71),i=r(o),a=n(401),s=r(a),l=n(403),u=r(l);i["default"].alert=s["default"],i["default"].prompt=u["default"],t["default"]=i["default"],e.exports=t["default"]},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(){function e(e){var t=e.target,n=t.getAttribute("type");p[n]=t.value}function t(){s["default"].unmountComponentAtNode(y),y.parentNode.removeChild(y)}function n(e){var t=p.text||"",n=p.password||"";return"login-password"===d?e(t,n):e("secure-text"===d?n:t)}for(var r=arguments.length,o=Array(r),a=0;a<r;a++)o[a]=arguments[a];if(o&&o[2]){var l="am-modal",c=o[0],d=o[3]||"default",f=o[4]||"",p={},h=void 0,m=function(e){setTimeout(function(){e&&e.focus()},500)};switch(d){case"login-password":h=i["default"].createElement("div",null,i["default"].createElement("div",{className:l+"-input"},i["default"].createElement("input",{type:"text",defaultValue:f,ref:function(e){return m(e)},onChange:e})),i["default"].createElement("div",{className:l+"-input"},i["default"].createElement("input",{type:"password",defaultValue:"",onChange:e})));break;case"secure-text":h=i["default"].createElement("div",null,i["default"].createElement("div",{className:l+"-input"},i["default"].createElement("input",{type:"password",defaultValue:"",ref:function(e){return m(e)},onChange:e})));break;case"plain-text":case"default":default:h=i["default"].createElement("div",null,i["default"].createElement("div",{className:l+"-input"},i["default"].createElement("input",{type:"text",defaultValue:f,ref:function(e){return m(e)},onChange:e})))}var v=i["default"].createElement("div",null,o[1],h),y=document.createElement("div");document.body.appendChild(y);var g=void 0;g="function"==typeof o[2]?[{text:"\u53d6\u6d88"},{text:"\u786e\u5b9a",onPress:function(){n(o[2])}}]:o[2].map(function(e){return{text:e.text,onPress:function(){if(e.onPress)return n(e.onPress)}}});var b=g.map(function(e){var n=e.onPress||function(){};return e.onPress=function(){var e=n();e&&e.then?e.then(function(){t()}):t()},e});s["default"].render(i["default"].createElement(u["default"],{visible:!0,transparent:!0,prefixCls:l,title:c,closable:!1,maskClosable:!1,transitionName:"am-zoom",footer:b,maskTransitionName:"am-fade"},i["default"].createElement("div",{style:{zoom:1,overflow:"hidden"}},v)),y)}};var o=n(1),i=r(o),a=n(9),s=r(a),l=n(71),u=r(l);e.exports=t["default"]},[480,195],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),i=r(o),a=n(6),s=r(a),l=n(37),u=r(l),c=n(2),d=r(c),f=n(4),p=r(f),h=n(3),m=r(h),v=n(1),y=r(v),g=n(5),b=r(g),_=n(14),T=r(_),C=n(47),x=r(C),w=function(e){function t(){return(0,d["default"])(this,t),(0,p["default"])(this,e.apply(this,arguments))}return(0,m["default"])(t,e),t.prototype.render=function(){var e,t=(0,x["default"])(this.props,["prefixCls","children","mode","className","iconName","leftContent","rightContent","onLeftClick"]),n=(0,u["default"])(t,2),r=n[0],o=r.prefixCls,a=r.children,l=r.mode,c=r.className,d=r.iconName,f=r.leftContent,p=r.rightContent,h=r.onLeftClick,m=n[1],v=(0,b["default"])((e={},(0,s["default"])(e,c,c),(0,s["default"])(e,o,!0),(0,s["default"])(e,o+"-"+l,!0),e));return y["default"].createElement("div",(0,i["default"])({},m,{className:v}),y["default"].createElement("div",{className:o+"-left",onClick:h},d?y["default"].createElement("span",{className:o+"-left-icon"},y["default"].createElement(T["default"],{type:d})):null,y["default"].createElement("span",{className:o+"-left-content"},f)),y["default"].createElement("div",{className:o+"-title"},a),y["default"].createElement("div",{className:o+"-right"},p))},t}(y["default"].Component);t["default"]=w,w.defaultProps={prefixCls:"am-navbar",mode:"dark",iconName:"left",onLeftClick:function(){}},e.exports=t["default"]},[481,196],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),a=n(9),s=r(a),l=n(11),u=r(l),c=i["default"].createClass({displayName:"Marquee",getDefaultProps:function(){return{text:"",loop:!1,leading:500,trailing:800,fps:40,className:""}},getInitialState:function(){return{animatedWidth:0,overflowWidth:0}},componentDidMount:function(){this._measureText(),this._startAnimation()},componentDidUpdate:function(){this._measureText(),this._marqueeTimer||this._startAnimation()},componentWillUnmount:function(){clearTimeout(this._marqueeTimer)},render:function(){var e=this.props,t=e.prefixCls,n=e.className,r=e.text,o=(0,u["default"])({position:"relative",right:this.state.animatedWidth,whiteSpace:"nowrap",display:"inline-block"},this.props.style);return i["default"].createElement("div",{className:t+"-marquee-wrap "+n,style:{overflow:"hidden"}},i["default"].createElement("div",{ref:"text",className:t+"-marquee",style:o},r," "))},_startAnimation:function(){var e=this;clearTimeout(this._marqueeTimer);var t=1/this.props.fps*1e3,n=0===this.state.animatedWidth,r=n?this.props.leading:t,o=function i(){var n=e.state.overflowWidth,r=e.state.animatedWidth+1,o=r>n;if(o){if(!e.props.loop)return;r=0}o&&e.props.trailing?e._marqueeTimer=setTimeout(function(){e.setState({animatedWidth:r}),e._marqueeTimer=setTimeout(i,t)},e.props.trailing):(e.setState({animatedWidth:r}),e._marqueeTimer=setTimeout(i,t))};0!==this.state.overflowWidth&&(this._marqueeTimer=setTimeout(o,r))},_measureText:function(){var e=s["default"].findDOMNode(this),t=s["default"].findDOMNode(this.refs.text);if(e&&t){var n=e.offsetWidth,r=t.offsetWidth,o=r-n;o!==this.state.overflowWidth&&this.setState({overflowWidth:o})}}});t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),i=r(o),a=n(6),s=r(a),l=n(37),u=r(l),c=n(2),d=r(c),f=n(4),p=r(f),h=n(3),m=r(h),v=n(1),y=r(v),g=n(11),b=r(g),_=n(5),T=r(_),C=n(47),x=r(C),w=n(14),P=r(w),S=n(407),E=r(S),O=function(e){function t(n){(0,d["default"])(this,t);var r=(0,p["default"])(this,e.call(this,n));return r.onClick=function(){var e=r.props,t=e.mode,n=e.onClick;n&&n(),"closable"===t&&r.setState({show:!1})},r.state={show:!0},r}return(0,m["default"])(t,e),t.prototype.render=function(){var e,t=(0,x["default"])(this.props,["mode","icon","onClick","children","className","prefixCls","marqueeProps"]),n=(0,u["default"])(t,2),r=n[0],o=r.mode,a=r.icon,l=r.onClick,c=r.children,d=r.className,f=r.prefixCls,p=r.marqueeProps,h=n[1],m={},v=null;"closable"===o?v=y["default"].createElement("div",{className:f+"-operation",onClick:this.onClick},y["default"].createElement(P["default"],{type:"cross",size:"md"})):("link"===o&&(v=y["default"].createElement("div",{className:f+"-operation"},y["default"].createElement(P["default"],{type:"right",size:"md"}))),m.onClick=l);var g=(0,T["default"])((e={},(0,s["default"])(e,f,!0),(0,s["default"])(e,d,!!d),e)),_=(0,b["default"])({},{loop:!1,leading:500,trailing:800,fps:40,style:{}},p);return this.state.show?y["default"].createElement("div",(0,i["default"])({className:g},h,m),a?y["default"].createElement("div",{className:f+"-icon"}," ",a," "):null,y["default"].createElement("div",{className:f+"-content"},y["default"].createElement(E["default"],(0,i["default"])({prefixCls:f,text:c},_))),v):null},t}(y["default"].Component);t["default"]=O,O.defaultProps={prefixCls:"am-notice-bar",mode:"",icon:y["default"].createElement(P["default"],{type:n(149),size:"xxs"}),onClick:function(){}},e.exports=t["default"]},[481,197],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(6),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(5),m=r(h),v=n(68),y=r(v),g=n(35),b=r(g),_=n(109),T=function(e){function t(n){(0,s["default"])(this,t);var r=(0,u["default"])(this,e.call(this,n));return r.state={current:n.current},r}return(0,d["default"])(t,e),t.prototype.componentWillReceiveProps=function(e){this.setState({current:e.current})},t.prototype.onChange=function(e){this.setState({current:e}),this.props.onChange&&this.props.onChange(e)},t.prototype.render=function(){var e,t=this,r=this.props,o=r.prefixCls,a=r.className,s=r.style,l=r.mode,u=r.total,c=r.simple,d=this.state.current,f=(0,_.getComponentLocale)(this.props,this.context,"Pagination",function(){return n(411)}),h=f.prevText,v=f.nextText,g=p["default"].createElement(b["default"],null,p["default"].createElement(b["default"].Item,{className:o+"-wrap-btn "+o+"-wrap-btn-prev"},p["default"].createElement(y["default"],{inline:!0,disabled:d<=0,onClick:function(){return t.onChange(d-1)}},h)),this.props.children?p["default"].createElement(b["default"].Item,null,this.props.children):!c&&p["default"].createElement(b["default"].Item,{
className:o+"-wrap"},p["default"].createElement("span",{className:"active"},d+1),"/",p["default"].createElement("span",null,u)),p["default"].createElement(b["default"].Item,{className:o+"-wrap-btn "+o+"-wrap-btn-next"},p["default"].createElement(y["default"],{inline:!0,disabled:d>=u-1,onClick:function(){return t.onChange(t.state.current+1)}},v)));if("number"===l)g=p["default"].createElement("div",{className:o+"-wrap"},p["default"].createElement("span",{className:"active"},d+1),"/",p["default"].createElement("span",null,u));else if("pointer"===l){for(var T=[],C=0;C<u;C++){var x;T.push(p["default"].createElement("div",{key:"dot-"+C,className:(0,m["default"])((x={},(0,i["default"])(x,o+"-wrap-dot",!0),(0,i["default"])(x,o+"-wrap-dot-active",C===d),x))},p["default"].createElement("span",null)))}g=p["default"].createElement("div",{className:o+"-wrap"},T)}return p["default"].createElement("div",{className:(0,m["default"])((e={},(0,i["default"])(e,a,a),(0,i["default"])(e,o,!0),e)),style:s},g)},t}(p["default"].Component);t["default"]=T,T.defaultProps={prefixCls:"am-pagination",mode:"button",current:0,simple:!1,onChange:function(){}},T.contextTypes={antLocale:p["default"].PropTypes.object},e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={prevText:"\u4e0a\u4e00\u9875",nextText:"\u4e0b\u4e00\u9875"},e.exports=t["default"]},function(e,t,n){"use strict";n(8),n(69),n(36),n(198)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){return{prefixCls:"am-picker",pickerPrefixCls:"am-picker-col",cols:3,cascade:!0,value:[],onChange:function(){}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var i=n(2),a=r(i),s=n(4),l=r(s),u=n(3),c=r(u),d=n(1),f=r(d),p=n(104),h=r(p),m=n(44),v=r(m),y=function(e){function t(){return(0,a["default"])(this,t),(0,l["default"])(this,e.apply(this,arguments))}return(0,c["default"])(t,e),t.prototype.render=function(){var e=this.props,t=void 0;return t=e.cascade?f["default"].createElement(h["default"],{prefixCls:e.prefixCls,pickerPrefixCls:e.pickerPrefixCls,data:e.data,value:e.value,onChange:e.onChange,cols:e.cols}):f["default"].createElement(v["default"],{prefixCls:e.prefixCls,selectedValue:e.value,onValueChange:e.onChange,pickerPrefixCls:e.pickerPrefixCls},e.data.map(function(e){return{props:{children:e}}}))},t}(f["default"].Component);t["default"]=y,y.defaultProps=o(),e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){var e=function(e){return e.join(",")};return{triggerType:"onClick",prefixCls:"am-picker",pickerPrefixCls:"am-picker-col",popupPrefixCls:"am-picker-popup",format:e,cols:3,cascade:!0,value:[],extra:"\u8bf7\u9009\u62e9",okText:"\u786e\u5b9a",dismissText:"\u53d6\u6d88",title:"",styles:w["default"]}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var i=n(7),a=r(i),s=n(2),l=r(s),u=n(4),c=r(u),d=n(3),f=r(d),p=n(1),h=r(p),m=n(335),v=r(m),y=n(104),g=r(y),b=n(44),_=r(b),T=n(82),C=r(T),x=n(416),w=r(x),P=n(415),S=r(P),E=function(e){function t(){(0,l["default"])(this,t);var n=(0,c["default"])(this,e.apply(this,arguments));return n.getSel=function(){var e=n.props.value||[],t=void 0;return t=n.props.cascade?(0,C["default"])(n.props.data,function(t,n){return t.value===e[n]}):e.map(function(e,t){return n.props.data[t].filter(function(t){return t.value===e})[0]}),n.props.format&&n.props.format(t.map(function(e){return e.label}))},n}return(0,f["default"])(t,e),t.prototype.render=function(){var e=this.props,t=e.children,n=e.value,r=e.extra,o=e.okText,i=e.dismissText,s=e.popupPrefixCls,l=e.cascade,u=void 0,c={};return l?u=h["default"].createElement(g["default"],{prefixCls:e.prefixCls,pickerPrefixCls:e.pickerPrefixCls,data:e.data,cols:e.cols,onChange:e.onPickerChange}):(u=h["default"].createElement(_["default"],{prefixCls:e.prefixCls,pickerPrefixCls:e.pickerPrefixCls},e.data.map(function(e){return{props:{children:e}}})),c={pickerValueProp:"selectedValue",pickerValueChangeProp:"onValueChange"}),h["default"].createElement(v["default"],(0,a["default"])({cascader:u},S["default"],e,{prefixCls:s,value:n,dismissText:i,okText:o},c),h["default"].cloneElement(t,{extra:this.getSel()||r}))},t}(h["default"].Component);t["default"]=E,E.defaultProps=o(),e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={WrapComponent:"div",transitionName:"am-slide-up",maskTransitionName:"am-fade"},e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),i=r(o),a=n(6),s=r(a),l=n(2),u=r(l),c=n(4),d=r(c),f=n(3),p=r(f),h=n(1),m=r(h),v=n(5),y=r(v),g=n(15),b=r(g),_=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&(n[r[o]]=e[r[o]]);return n},T=function(e){function t(){return(0,u["default"])(this,t),(0,d["default"])(this,e.apply(this,arguments))}return(0,p["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.children,r=t.className,o=t.prefixCls,a=t.icon,l=t.disabled,u=t.firstItem,c=t.activeStyle,d=t.onClick,f=_(t,["children","className","prefixCls","icon","disabled","firstItem","activeStyle","onClick"]),p=(e={},(0,s["default"])(e,r,!!r),(0,s["default"])(e,o+"-item",!0),(0,s["default"])(e,o+"-item-disabled",l),e),h=o+"-item-active ";return u&&(h+=o+"-item-fix-active-arrow"),m["default"].createElement(b["default"],{disabled:l,activeClassName:h,activeStyle:c,onPress:d},m["default"].createElement("div",(0,i["default"])({className:(0,y["default"])(p)},f),m["default"].createElement("div",{className:o+"-item-container"},a?m["default"].createElement("span",{className:o+"-item-icon"},a):null,m["default"].createElement("span",{className:o+"-item-content"},n))))},t}(m["default"].Component);t["default"]=T,T.defaultProps={prefixCls:"am-popover",disabled:!1},T.myName="PopoverItem",e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e,t){return e};return h["default"].Children.map(e,function(e,n){var r=t(e,n);return r&&r.props&&r.props.children?h["default"].cloneElement(r,{},o(r.props.children,t)):r})}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var i=n(7),a=r(i),s=n(2),l=r(s),u=n(4),c=r(u),d=n(3),f=r(d),p=n(1),h=r(p),m=n(102),v=r(m),y=n(417),g=r(y),b=function(e){function t(){return(0,l["default"])(this,t),(0,c["default"])(this,e.apply(this,arguments))}return(0,f["default"])(t,e),t.prototype.render=function(){var e=this.props,t=e.overlay,n=e.onSelect,r=void 0===n?function(){}:n,i=o(t,function(e,t){var n={firstItem:!1};return e&&e.type&&"PopoverItem"===e.type.myName&&!e.props.disabled?(n.onClick=function(){return r(e,t)},n.firstItem=0===t,h["default"].cloneElement(e,n)):e});return h["default"].createElement(v["default"],(0,a["default"])({},this.props,{overlay:i}))},t}(h["default"].Component);t["default"]=b,b.defaultProps={prefixCls:"am-popover",placement:"bottomRight",popupAlign:{overflow:{adjustY:0,adjustX:0}},trigger:["click"]},b.Item=g["default"],e.exports=t["default"]},[480,201],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){function r(){v&&(c["default"].unmountComponentAtNode(v),v.parentNode.removeChild(v),v=null),o(e)}var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(e){},i=(0,h["default"])({},{prefixCls:"am-popup",animationType:"slide-down"},t),a=i.prefixCls,s=i.transitionName,u=i.maskTransitionName,d=i.maskClosable,p=void 0===d||d,m=i.animationType,v=document.createElement("div");document.body.appendChild(v);var y="am-slide-down";"slide-up"===m&&(y="am-slide-up");var g={onClick:function(e){if(e.preventDefault(),p)if(i.onMaskClose&&"function"==typeof i.onMaskClose){var t=i.onMaskClose();t&&t.then?t.then(function(){r()}):r()}else r()}};return c["default"].render(l["default"].createElement(f["default"],{prefixCls:a,visible:!0,title:"",footer:"",className:a+"-"+m,transitionName:s||y,maskTransitionName:u||"am-fade",maskClosable:p,wrapProps:i.wrapProps||{},maskProps:i.maskProps||g},n),v),{instanceId:e,close:r}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var i=n(2),a=r(i),s=n(1),l=r(s),u=n(9),c=r(u),d=n(48),f=r(d),p=n(11),h=r(p),m={defaultInstance:null,instances:[]},v=1,y=function g(){(0,a["default"])(this,g)};t["default"]=y,y.newInstance=function(){var e=void 0;return{show:function(t,n){e=o(v++,n,t,function(e){for(var t=0;t<m.instances.length;t++)if(m.instances[t].instanceId===e)return void m.instances.splice(t,1)}),m.instances.push(e)},hide:function(){e.close()}}},y.show=function(e,t){y.hide(),m.defaultInstance=o("0",t,e,function(e){"0"===e&&(m.defaultInstance=null)})},y.hide=function(){m.defaultInstance&&m.defaultInstance.close()},e.exports=t["default"]},[480,202],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(6),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(5),m=r(h),v=n(11),y=r(v),g=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.componentWillReceiveProps=function(){this.noAppearTransition=!0},t.prototype.componentDidMount=function(){var e=this;this.props.appearTransition&&setTimeout(function(){e.refs.bar.style.width=e.props.percent+"%"},10)},t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,r=t.position,o=t.unfilled,a=t.style,s=void 0===a?{}:a,l={width:this.noAppearTransition||!this.props.appearTransition?this.props.percent+"%":0,height:0},u=(0,m["default"])((e={},(0,i["default"])(e,n+"-outer",!0),(0,i["default"])(e,n+"-fixed-outer","fixed"===r),(0,i["default"])(e,n+"-hide-outer","hide"===o),e));return p["default"].createElement("div",{className:u},p["default"].createElement("div",{ref:"bar",className:n+"-bar",style:(0,y["default"])({},s,l)}))},t}(p["default"].Component);t["default"]=g,g.defaultProps={prefixCls:"am-progress",percent:0,position:"fixed",unfilled:"show",appearTransition:!1},e.exports=t["default"]},[480,203],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var i=n(7),a=r(i),s=n(6),l=r(s),u=n(2),c=r(u),d=n(4),f=r(d),p=n(3),h=r(p),m=n(1),v=r(m),y=n(5),g=r(y),b=n(29),_=r(b),T=n(72),C=r(T),x=n(19),w=r(x),P=_["default"].Item,S=function(e){function t(){return(0,c["default"])(this,t),(0,f["default"])(this,e.apply(this,arguments))}return(0,h["default"])(t,e),t.prototype.render=function(){var e,t=this,n=this.props,r=n.prefixCls,i=n.listPrefixCls,s=n.className,u=n.children,c=n.disabled,d=n.radioProps,f=void 0===d?{}:d,p=(0,g["default"])((e={},(0,l["default"])(e,r+"-item",!0),(0,l["default"])(e,r+"-item-disabled",c===!0),(0,l["default"])(e,s,s),e)),h=(0,w["default"])(this.props,["listPrefixCls","onChange","disabled","radioProps"]);c?delete h.onClick:h.onClick=h.onClick||o;var m={};return["name","defaultChecked","checked","onChange","disabled"].forEach(function(e){e in t.props&&(m[e]=t.props[e])}),v["default"].createElement(P,(0,a["default"])({},h,{prefixCls:i,className:p,extra:v["default"].createElement(C["default"],(0,a["default"])({},f,m))}),u)},t}(v["default"].Component);t["default"]=S,S.defaultProps={prefixCls:"am-radio",listPrefixCls:"am-list"},e.exports=t["default"]},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(72),i=r(o),a=n(424),s=r(a);i["default"].RadioItem=s["default"],t["default"]=i["default"],e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(2),i=r(o),a=n(4),s=r(a),l=n(3),u=r(l),c=n(1),d=r(c),f=n(355),p=r(f),h=function(e){function t(){return(0,i["default"])(this,t),(0,s["default"])(this,e.apply(this,arguments))}return(0,u["default"])(t,e),t.prototype.render=function(){return d["default"].createElement("div",{className:this.props.prefixCls+"-wrapper"},d["default"].createElement(p["default"],this.props))},t}(d["default"].Component);t["default"]=h,h.defaultProps={prefixCls:"am-slider"},e.exports=t["default"]},[480,205],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),a=n(49),s=r(a),l=n(14),u=r(l),c=n(11),d=r(c);s["default"].RefreshControl.defaultProps=(0,d["default"])({},s["default"].RefreshControl.defaultProps,{prefixCls:"am-refresh-control",icon:[i["default"].createElement("div",{key:"0",className:"am-refresh-control-pull"},i["default"].createElement("span",null,"\u4e0b\u62c9\u53ef\u4ee5\u5237\u65b0")),i["default"].createElement("div",{key:"1",className:"am-refresh-control-release"},i["default"].createElement("span",null,"\u677e\u5f00\u7acb\u5373\u5237\u65b0"))],loading:i["default"].createElement(u["default"],{type:"loading"}),refreshing:!1,distanceToRefresh:25*(window.devicePixelRatio||2)}),t["default"]=s["default"].RefreshControl,e.exports=t["default"]},[481,206],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(6),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(68),m=r(h),v=n(5),y=r(v),g=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,r=t.className,o=t.img,a=t.imgUrl,s=t.title,l=t.message,u=t.buttonText,c=t.buttonClick,d=t.buttonType,f=(0,y["default"])((e={},(0,i["default"])(e,""+n,!0),(0,i["default"])(e,r,r),e)),h=null;return o?h=p["default"].createElement("div",{className:n+"-pic"},o):a&&(h=p["default"].createElement("div",{className:n+"-pic",style:{backgroundImage:"url("+a+")"}})),p["default"].createElement("div",{className:f},h,s?p["default"].createElement("div",{className:n+"-title"},s):null,l?p["default"].createElement("div",{className:n+"-message"},l):null,u?p["default"].createElement("div",{className:n+"-button"},p["default"].createElement(m["default"],{type:d,onClick:c},u)):null)},t}(p["default"].Component);t["default"]=g,g.defaultProps={prefixCls:"am-result",buttonType:"",buttonClick:function(){}},e.exports=t["default"]},function(e,t,n){"use strict";n(8),n(69),n(207)},function(e,t){"use strict";function n(){}Object.defineProperty(t,"__esModule",{value:!0});t.defaultProps={prefixCls:"am-search",placeholder:"",onSubmit:n,onChange:n,onFocus:n,onBlur:n,onClear:n,showCancelButton:!1,cancelText:"\u53d6\u6d88",disabled:!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"]=void 0;var o=n(6),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(5),m=r(h),v=n(432),y=function(e){function t(n){(0,s["default"])(this,t);var r=(0,u["default"])(this,e.call(this,n));r.onSubmit=function(e){e.preventDefault(),r.props.onSubmit&&r.props.onSubmit(r.state.value)},r.onChange=function(e){var t=e.target.value;"value"in r.props||r.setState({value:t}),r.props.onChange&&r.props.onChange(t)},r.onFocus=function(){r.setState({focus:!0}),r.firstFocus=!0,"focused"in r.props||r.setState({focused:!0}),r.props.onFocus&&r.props.onFocus(),"input"===document.activeElement.tagName.toLowerCase()&&(r.scrollIntoViewTimeout=setTimeout(function(){try{document.activeElement.scrollIntoViewIfNeeded()}catch(e){}},0))},r.onBlur=function(){r.setState({focus:!1}),"focused"in r.props||r.setState({focused:!1}),r.props.onBlur&&r.props.onBlur()},r.onClear=function(){"value"in r.props||r.setState({value:""}),r.refs.searchInput.focus(),r.props.onClear&&r.props.onClear(""),r.props.onChange&&r.props.onChange("")},r.onCancel=function(){r.props.onCancel?r.props.onCancel(r.state.value):r.onClear(),r.refs.searchInput.blur()};var o=void 0;return o="value"in n?n.value||"":"defaultValue"in n?n.defaultValue:"",r.state={value:o,focus:!1,focused:n.focused||!1},r}return(0,d["default"])(t,e),t.prototype.componentDidMount=function(){var e=window.getComputedStyle(this.refs.rightBtn);this.rightBtnInitMarginleft=e["margin-left"],(this.props.autoFocus||this.state.focused)&&this.refs.searchInput.focus(),this.componentDidUpdate()},t.prototype.componentDidUpdate=function(){this.refs.searchInputContainer.className.indexOf(this.props.prefixCls+"-start")>-1?(this.refs.syntheticPh.style.width=this.refs.syntheticPhContainer.offsetWidth+"px",this.props.showCancelButton||(this.refs.rightBtn.style.marginRight=0)):(this.refs.syntheticPh.style.width="100%",this.props.showCancelButton||(this.refs.rightBtn.style.marginRight="-"+(this.refs.rightBtn.offsetWidth+parseInt(this.rightBtnInitMarginleft,10))+"px")),this.state.focused&&this.refs.searchInput.focus()},t.prototype.componentWillReceiveProps=function(e){"value"in e&&this.setState({value:e.value}),"focused"in e&&this.setState({focused:e.focused})},t.prototype.componentWillUnmount=function(){this.scrollIntoViewTimeout&&(clearTimeout(this.scrollIntoViewTimeout),this.scrollIntoViewTimeout=null)},t.prototype.render=function(){var e,t,n,r=this.props,o=r.prefixCls,a=r.showCancelButton,s=r.disabled,l=r.placeholder,u=r.cancelText,c=r.className,d=this.state,f=d.value,h=d.focus,v=(0,m["default"])((e={},(0,i["default"])(e,""+o,!0),(0,i["default"])(e,o+"-start",h||f&&f.length>0),(0,i["default"])(e,c,c),e)),y=(0,m["default"])((t={},(0,i["default"])(t,o+"-clear",!0),(0,i["default"])(t,o+"-clear-show",h&&f&&f.length>0),t)),g=(0,m["default"])((n={},(0,i["default"])(n,o+"-cancel",!0),(0,i["default"])(n,o+"-cancel-show",a||h||f&&f.length>0),(0,i["default"])(n,o+"-cancel-anim",this.firstFocus),n));return p["default"].createElement("form",{onSubmit:this.onSubmit,className:v,ref:"searchInputContainer"},p["default"].createElement("div",{className:o+"-input"},p["default"].createElement("div",{className:o+"-synthetic-ph",ref:"syntheticPh"},p["default"].createElement("span",{className:o+"-synthetic-ph-container",ref:"syntheticPhContainer"},p["default"].createElement("i",{className:o+"-synthetic-ph-icon"}),p["default"].createElement("span",{className:o+"-synthetic-ph-placeholder",style:{visibility:l&&!f?"visible":"hidden"}},l))),p["default"].createElement("input",{type:"search",className:o+"-value",value:f,disabled:s,placeholder:l,onChange:this.onChange,onFocus:this.onFocus,onBlur:this.onBlur,ref:"searchInput"}),p["default"].createElement("a",{onClick:this.onClear,className:y})),p["default"].createElement("div",{className:g,onClick:this.onCancel,ref:"rightBtn"},u))},t}(p["default"].Component);t["default"]=y,y.defaultProps=v.defaultProps,e.exports=t["default"]},[480,208],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(6),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(5),m=r(h),v=n(15),y=r(v),g=function(e){function t(n){(0,s["default"])(this,t);var r=(0,u["default"])(this,e.call(this,n));return r.state={selectedIndex:n.selectedIndex},r}return(0,d["default"])(t,e),t.prototype.componentWillReceiveProps=function(e){e.selectedIndex!==this.state.selectedIndex&&this.setState({selectedIndex:e.selectedIndex})},t.prototype.onClick=function(e,t,n){var r=this.props,o=r.disabled,i=r.onChange,a=r.onValueChange;o||this.state.selectedIndex===t||(e.nativeEvent=e.nativeEvent?e.nativeEvent:{},e.nativeEvent.selectedSegmentIndex=t,e.nativeEvent.value=n,i&&i(e),a&&a(n),this.setState({selectedIndex:t}))},t.prototype.renderSegmentItem=function(e,t,n){var r,o=this,a=this.props,s=a.prefixCls,l=a.disabled,u=a.tintColor,c=(0,m["default"])((r={},(0,i["default"])(r,s+"-item",!0),(0,i["default"])(r,s+"-item-selected",n),r)),d={color:n?"#fff":u,backgroundColor:n?u:"#fff",borderColor:u};return p["default"].createElement(y["default"],{key:e,disabled:l,activeClassName:s+"-item-active",onPress:l?void 0:function(n){return o.onClick(n,e,t)}},p["default"].createElement("div",{className:c,style:d},p["default"].createElement("div",{className:s+"-item-inner"}),t))},t.prototype.render=function(){var e,t=this,n=this.props,r=n.className,o=n.prefixCls,a=n.style,s=n.disabled,l=n.values,u=void 0===l?[]:l,c=(0,m["default"])((e={},(0,i["default"])(e,r,!!r),(0,i["default"])(e,""+o,!0),(0,i["default"])(e,o+"-disabled",s),e));return p["default"].createElement("div",{className:c,style:a},u.map(function(e,n){return t.renderSegmentItem(n,e,n===t.state.selectedIndex)}))},t}(p["default"].Component);t["default"]=g,g.defaultProps={prefixCls:"am-segment",selectedIndex:0,disabled:!1,values:[],onChange:function(){},onValueChange:function(){},style:{}},e.exports=t["default"]},[480,209],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(2),i=r(o),a=n(4),s=r(a),l=n(3),u=r(l),c=n(1),d=r(c),f=n(356),p=r(f),h=function(e){function t(){return(0,i["default"])(this,t),(0,s["default"])(this,e.apply(this,arguments))}return(0,u["default"])(t,e),t.prototype.render=function(){return d["default"].createElement("div",{className:this.props.prefixCls+"-wrapper"},d["default"].createElement(p["default"],this.props))},t}(d["default"].Component);t["default"]=h,h.defaultProps={prefixCls:"am-slider"},e.exports=t["default"]},[483,210],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),i=r(o),a=n(6),s=r(a),l=n(37),u=r(l),c=n(2),d=r(c),f=n(4),p=r(f),h=n(3),m=r(h),v=n(1),y=r(v),g=n(5),b=r(g),_=n(47),T=r(_),C=n(317),x=r(C),w=n(14),P=r(w),S=function(e){function t(){return(0,d["default"])(this,t),(0,p["default"])(this,e.apply(this,arguments))}return(0,m["default"])(t,e),t.prototype.render=function(){var e,t=(0,T["default"])(this.props,["className","showNumber"]),r=(0,u["default"])(t,2),o=r[0],a=o.className,l=o.showNumber,c=r[1],d=(0,b["default"])((e={},(0,s["default"])(e,a,!!a),(0,s["default"])(e,"showNumber",!!l),e));return y["default"].createElement(x["default"],(0,i["default"])({},c,{ref:"inputNumber",className:d,upHandler:y["default"].createElement(P["default"],{type:n(151),size:"xxs"}),downHandler:y["default"].createElement(P["default"],{type:n(150),size:"xxs"})}))},t}(y["default"].Component);t["default"]=S,S.defaultProps={prefixCls:"am-stepper",step:1,readOnly:!1,showNumber:!1,focusOnUpDown:!1},e.exports=t["default"]},[480,211],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(264),m=r(h),v=n(14),y=r(v),g=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.componentDidMount=function(){this.componentDidUpdate()},t.prototype.componentDidUpdate=function(){"horizontal"===this.props.direction&&this.stepRefs.forEach(function(e){e.refs.tail&&(e.refs.tail.style.left=e.refs.main.offsetWidth/2+"px")})},t.prototype.render=function(){var e=this;this.stepRefs=[];var t=this.props,n=t.children,r=t.current,o=t.status,a=p["default"].Children.map(n,function(t,i){var a=t.props.className;i<n.length-1&&"error"===n[i+1].props.status&&(a=a?a+" error-tail":"error-tail");var s=t.props.icon;return s||(i<r?s="check-circle-o":i>r&&(s="ellipsis",a=a?a+" ellipsis-item":"ellipsis-item"),("error"===o&&i===r||"error"===t.props.status)&&(s="cross-circle-o")),s="string"==typeof s?p["default"].createElement(y["default"],{type:s}):s,p["default"].cloneElement(t,{icon:s,className:a,ref:function(t){return e.stepRefs[i]=t}})});return p["default"].createElement(m["default"],(0,i["default"])({ref:"rcSteps"},this.props),a)},t}(p["default"].Component);t["default"]=g,g.Step=m["default"].Step,g.defaultProps={prefixCls:"am-steps",iconPrefix:"ant",labelPlacement:"vertical",direction:"vertical",current:0},e.exports=t["default"]},[481,212],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(6),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(231),m=r(h),v=n(5),y=r(v),g=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.className,r=t.prefixCls,o=t.left,a=void 0===o?[]:o,s=t.right,l=void 0===s?[]:s,u=t.autoClose,c=t.disabled,d=t.onOpen,f=t.onClose,h=t.children,v=(0,y["default"])((e={},(0,i["default"])(e,""+r,1),(0,i["default"])(e,n,!!n),e));return a.length||l.length?p["default"].createElement("div",{className:v},p["default"].createElement(m["default"],{prefixCls:r,left:a,right:l,autoClose:u,disabled:c,onOpen:d,onClose:f},h)):p["default"].createElement("div",{className:v},h)},t}(p["default"].Component);g.defaultProps={prefixCls:"am-swipe",title:"\u8bf7\u786e\u8ba4\u64cd\u4f5c",autoClose:!1,disabled:!1,left:[],right:[],onOpen:function(){},onClose:function(){}},t["default"]=g,e.exports=t["default"]},[480,214],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),i=r(o),a=n(6),s=r(a),l=n(2),u=r(l),c=n(4),d=r(c),f=n(3),p=r(f),h=n(1),m=r(h),v=n(5),y=r(v),g=function(e){function t(){(0,u["default"])(this,t);var n=(0,d["default"])(this,e.apply(this,arguments));return n.onChange=function(e){var t=e.target.checked;n.props.onChange&&n.props.onChange(t)},n}return(0,p["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,r=t.style,o=t.name,a=t.checked,l=t.disabled,u=t.className,c=(0,y["default"])((e={},(0,s["default"])(e,""+n,!0),(0,s["default"])(e,u,u),(0,s["default"])(e,n+"-android",!!navigator.userAgent.match(/Android/i)),e));return m["default"].createElement("label",{className:c,style:r},m["default"].createElement("input",(0,i["default"])({type:"checkbox",name:o,className:n+"-checkbox"},l?{disabled:"disabled"}:"",{checked:a,onChange:this.onChange})),m["default"].createElement("div",{className:"checkbox"}))},t}(m["default"].Component);t["default"]=g,g.defaultProps={prefixCls:"am-switch",name:"",checked:!1,disabled:!1,onChange:function(){}},e.exports=t["default"]},[480,215],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(2),i=r(o),a=n(4),s=r(a),l=n(3),u=r(l),c=n(1),d=r(c),f=n(110),p=r(f),h=function(e){function t(){(0,i["default"])(this,t);var n=(0,s["default"])(this,e.apply(this,arguments));return n.renderIcon=function(){var e=n.props,t=e.dot,r=e.badge,o=e.selected,i=e.selectedIcon,a=e.icon,s=e.title,l=e.prefixCls,u=o?i:a,c=d["default"].isValidElement(u)?u:d["default"].createElement("img",{className:l+"-image",src:u.uri||u,alt:s});return r?d["default"].createElement(p["default"],{text:r,className:l+"-badge tab-badge"}," ",c," "):t?d["default"].createElement(p["default"],{dot:!0,className:l+"-badge tab-dot"},c):c},n}return(0,u["default"])(t,e),t.prototype.render=function(){var e=this.props,t=e.title,n=e.prefixCls,r=e.selected,o=e.unselectedTintColor,i=e.tintColor,a=r?i:o;return d["default"].createElement("div",this.props.dataAttrs,d["default"].createElement("div",{className:n+"-icon",style:{color:a}},this.renderIcon()),d["default"].createElement("p",{className:n+"-title",style:{color:r?i:o}},t))},t}(d["default"].Component);t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Item=void 0;var o=n(2),i=r(o),a=n(4),s=r(a),l=n(3),u=r(l),c=n(1),d=r(c),f=n(127),p=r(f),h=n(447),m=r(h),v=n(73),y=r(v),g=n(478),b=r(g),_=n(46),T=r(_),C=t.Item=function(e){function t(){return(0,i["default"])(this,t),(0,s["default"])(this,e.apply(this,arguments))}return(0,u["default"])(t,e),t.prototype.render=function(){return null},t}(d["default"].Component),x=function(e){function t(){(0,i["default"])(this,t);var n=(0,s["default"])(this,e.apply(this,arguments));return n.onChange=function(e){d["default"].Children.forEach(n.props.children,function(t){t.key===e&&t.props.onPress&&t.props.onPress()})},n.renderTabBar=function(){var e=n.props,t=e.barTintColor,r=e.hidden,o=e.prefixCls,i=r?o+"-bar-hidden":"";return d["default"].createElement(b["default"],{className:i,style:{backgroundColor:t}})},n.renderTabContent=function(){return d["default"].createElement(y["default"],{animated:!1})},n}return(0,u["default"])(t,e),t.prototype.render=function(){var e=this,t=void 0,n=[];d["default"].Children.forEach(this.props.children,function(e){e.props.selected&&(t=e.key),n.push(e)});var r=this.props,o=r.tintColor,i=r.unselectedTintColor,a=n.map(function(t){var n=t.props,r=d["default"].createElement(m["default"],{prefixCls:e.props.prefixCls+"-tab",badge:n.badge,dot:n.dot,selected:n.selected,icon:n.icon,selectedIcon:n.selectedIcon,title:n.title,tintColor:o,unselectedTintColor:i,dataAttrs:(0,T["default"])(n)});return d["default"].createElement(f.TabPane,{placeholder:e.props.placeholder,tab:r,key:t.key},n.children)});return d["default"].createElement(p["default"],{renderTabBar:this.renderTabBar,renderTabContent:this.renderTabContent,tabBarPosition:"bottom",prefixCls:this.props.prefixCls,activeKey:t,onChange:this.onChange},a)},t}(d["default"].Component);x.defaultProps={prefixCls:"am-tab-bar",barTintColor:"white",tintColor:"#108ee9",hidden:!1,unselectedTintColor:"#888",placeholder:"\u6b63\u5728\u52a0\u8f7d"},x.Item=C,t["default"]=x},function(e,t,n){"use strict";n(8),n(216),n(111)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(11),m=r(h),v=n(349),y=r(v),g=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e=this.props,t=e.prefixCls,n=e.columns,r=e.dataSource,o=e.direction,a=e.scrollX,s=e.titleFixed,l=(0,m["default"])({},this.props,{data:r}),u=void 0;return o&&"vertical"!==o?"horizon"===o?(n[0].className=t+"-horizonTitle",u=p["default"].createElement(y["default"],(0,i["default"])({},l,{columns:n,showHeader:!1,scroll:{x:a}}))):"mix"===o&&(n[0].className=t+"-horizonTitle",u=p["default"].createElement(y["default"],(0,i["default"])({},l,{columns:n,scroll:{x:a}}))):u=s?p["default"].createElement(y["default"],(0,i["default"])({},l,{columns:n,scroll:{x:!0},showHeader:!1})):p["default"].createElement(y["default"],(0,i["default"])({},l,{columns:n,scroll:{x:a}})),u},t}(p["default"].Component);t["default"]=g,g.defaultProps={dataSource:[],prefixCls:"am-table"},e.exports=t["default"]},[480,217],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(7),i=r(o),a=n(6),s=r(a),l=n(1),u=r(l),c=n(127),d=r(c),f=n(5),p=r(f),h=n(477),m=r(h),v=n(73),y=r(v),g=n(474),b=r(g),_=n(11),T=r(_),C=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},x=u["default"].createClass({displayName:"Tabs",statics:{TabPane:c.TabPane},getDefaultProps:function(){
return{prefixCls:"am-tabs",animated:!0,swipeable:!0,tabBarPosition:"top",hammerOptions:{},onChange:function(){},onTabClick:function(){}}},getInitialState:function(){var e=this.props,t=e.activeKey,n=e.defaultActiveKey,r=e.children,o=t||n||r[0].props.key,i=r.findIndex(function(e){return e.key===o});return{viewportStartTabIndex:r.length>5&&i>=3?i-2:0}},renderTabBar:function(){var e=this.props;return u["default"].createElement(b["default"],{onTabClick:this.handleTabClick,inkBarAnimated:e.animated})},renderTabContent:function(){var e=this.props,t=e.animated,n=e.swipeable,r=e.hammerOptions;return n?u["default"].createElement(m["default"],{animated:t,hammerOptions:r}):u["default"].createElement(y["default"],{animated:t})},getChildren:function(){var e=this.props.children,t=this.state.viewportStartTabIndex;return e.slice(t,t+5)},handleTabClick:function(e){this.setState({viewportStartTabIndex:this.getStartTabIndex(e)}),this.props.onTabClick(e)},handleTabChange:function(e){this.setState({viewportStartTabIndex:this.getStartTabIndex(e)}),this.props.onChange(e)},getStartTabIndex:function(e){var t=this.props.children,n=this.state.viewportStartTabIndex,r=t.findIndex(function(t){return t.key===e});return t.length<5?0:r===n&&n>0?n-1:r===n+4&&n+4<t.length-1?n+1:n},getClassName:function(){var e,t=this.state.viewportStartTabIndex,n=this.props.children.length,r=(0,p["default"])((e={},(0,s["default"])(e,this.props.prefixCls+"-leftpage",n>5&&t>0),(0,s["default"])(e,this.props.prefixCls+"-rightpage",n>5&&t+4<n-1),e));return r},render:function(){var e=C({},this.props,{onChange:this.handleTabChange,children:this.getChildren(),className:(0,T["default"])(this.getClassName(),this.props.className)});return u["default"].createElement(d["default"],(0,i["default"])({renderTabBar:this.renderTabBar,renderTabContent:this.renderTabContent},e))}});t["default"]=x,e.exports=t["default"]},[480,218],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),i=r(o),a=n(6),s=r(a),l=n(2),u=r(l),c=n(4),d=r(c),f=n(3),p=r(f),h=n(1),m=r(h),v=n(5),y=r(v),g=n(14),b=r(g),_=n(46),T=r(_),C=function(e){function t(n){(0,u["default"])(this,t);var r=(0,d["default"])(this,e.call(this,n));return r.onClick=function(){var e=r.props,t=e.disabled,n=e.onChange;if(!t){var o=r.state.selected;r.setState({selected:!o},function(){n&&n(!o)})}},r.onTagClose=function(){r.props.onClose&&r.props.onClose(),r.setState({closed:!0},r.props.afterClose)},r.state={selected:n.selected,closed:!1},r}return(0,p["default"])(t,e),t.prototype.componentWillReceiveProps=function(e){this.props.selected!==e.selected&&this.setState({selected:e.selected})},t.prototype.render=function(){var e,t=this.props,n=t.children,r=t.className,o=t.prefixCls,a=t.disabled,l=t.closable,u=t.small,c=t.style,d=(0,y["default"])((e={},(0,s["default"])(e,r,!!r),(0,s["default"])(e,""+o,!0),(0,s["default"])(e,o+"-normal",!a&&(!this.state.selected||u||l)),(0,s["default"])(e,o+"-small",u),(0,s["default"])(e,o+"-active",this.state.selected&&!a&&!u&&!l),(0,s["default"])(e,o+"-disabled",a),(0,s["default"])(e,o+"-closable",l),e)),f=!l||a||u?null:m["default"].createElement("div",{className:o+"-close",onClick:this.onTagClose},m["default"].createElement(b["default"],{type:"cross-circle",size:"xs"}));return this.state.closed?null:m["default"].createElement("div",(0,i["default"])({},(0,T["default"])(this.props),{className:d,onClick:this.onClick,style:c}),m["default"].createElement("div",{className:o+"-text"},n),f)},t}(m["default"].Component);t["default"]=C,C.defaultProps={prefixCls:"am-tag",disabled:!1,selected:!1,closable:!1,small:!1,onChange:function(){},onClose:function(){},afterClose:function(){}},e.exports=t["default"]},[481,219],function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(2),i=r(o),a=n(4),s=r(a),l=n(3),u=r(l),c=n(1),d=r(c),f=n(121),p=r(f),h=function(e){function t(){return(0,i["default"])(this,t),(0,s["default"])(this,e.apply(this,arguments))}return(0,u["default"])(t,e),t.prototype.render=function(){return d["default"].createElement(p["default"],this.props)},t}(d["default"].Component);t["default"]=h,h.defaultProps={Component:"span"},e.exports=t["default"]},function(e,t){"use strict"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){}function i(e){return"undefined"==typeof e||null===e?"":e}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var a=n(7),s=r(a),l=n(6),u=r(l),c=n(2),d=r(c),f=n(4),p=r(f),h=n(3),m=r(h),v=n(1),y=r(v),g=n(5),b=r(g),_=n(19),T=r(_),C=function(e){function t(n){(0,d["default"])(this,t);var r=(0,p["default"])(this,e.call(this,n));return r.onChange=function(e){var t=e.target.value,n=r.props.onChange;n&&n(t),r.componentDidUpdate()},r.onBlur=function(e){r.debounceTimeout=setTimeout(function(){r.setState({focus:!1})},100),"focused"in r.props||r.setState({focused:!1});var t=e.target.value;r.props.onBlur&&r.props.onBlur(t)},r.onFocus=function(e){r.debounceTimeout&&(clearTimeout(r.debounceTimeout),r.debounceTimeout=null),"focused"in r.props||r.setState({focused:!0}),r.setState({focus:!0});var t=e.target.value;r.props.onFocus&&r.props.onFocus(t),"textarea"===document.activeElement.tagName.toLowerCase()&&(r.scrollIntoViewTimeout=setTimeout(function(){try{document.activeElement.scrollIntoViewIfNeeded()}catch(e){}},0))},r.onErrorClick=function(){r.props.onErrorClick&&r.props.onErrorClick()},r.clearInput=function(){r.props.onChange&&r.props.onChange("")},r.state={focus:!1,focused:n.focused||!1},r}return(0,m["default"])(t,e),t.prototype.componentDidMount=function(){this.componentDidUpdate(),(this.props.autoFocus||this.state.focused)&&this.refs.textarea.focus()},t.prototype.componentDidUpdate=function(){if(this.props.autoHeight){var e=this.refs.textarea;e.style.height="",e.style.height=e.scrollHeight+"px"}this.state.focused&&this.refs.textarea.focus()},t.prototype.componentWillReceiveProps=function(e){"focused"in e&&this.setState({focused:e.focused})},t.prototype.componentWillUnmount=function(){this.debounceTimeout&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=null),this.scrollIntoViewTimeout&&(clearTimeout(this.scrollIntoViewTimeout),this.scrollIntoViewTimeout=null)},t.prototype.render=function(){var e,t,n=this.props,r=n.prefixCls,o=n.prefixListCls,a=n.style,l=n.title,c=n.value,d=n.defaultValue,f=n.clear,p=n.rows,h=n.count,m=n.editable,v=n.disabled,g=n.error,_=n.className,C=n.labelNumber,x=n.autoHeight,w=(0,T["default"])(this.props,["prefixCls","prefixListCls","editable","style","clear","children","error","className","count","labelNumber","title","onErrorClick","autoHeight","autoFocus","focused"]),P=void 0;P="value"in this.props?{value:i(c)}:{defaultValue:d};var S=this.state.focus,E=(0,b["default"])((e={},(0,u["default"])(e,o+"-item",!0),(0,u["default"])(e,r+"-item",!0),(0,u["default"])(e,r+"-disabled",v),(0,u["default"])(e,r+"-item-single-line",1===p&&!x),(0,u["default"])(e,r+"-error",g),(0,u["default"])(e,r+"-focus",S),(0,u["default"])(e,_,_),e)),O=(0,b["default"])((t={},(0,u["default"])(t,r+"-label",!0),(0,u["default"])(t,r+"-label-2",2===C),(0,u["default"])(t,r+"-label-3",3===C),(0,u["default"])(t,r+"-label-4",4===C),(0,u["default"])(t,r+"-label-5",5===C),(0,u["default"])(t,r+"-label-6",6===C),(0,u["default"])(t,r+"-label-7",7===C),t));return y["default"].createElement("div",{className:E,style:a},l?y["default"].createElement("div",{className:O},l):null,y["default"].createElement("div",{className:r+"-control"},y["default"].createElement("textarea",(0,s["default"])({ref:"textarea",maxLength:h},w,P,{onChange:this.onChange,onBlur:this.onBlur,onFocus:this.onFocus,readOnly:!m}))),f&&m&&c&&c.length>0?y["default"].createElement("div",{className:r+"-clear",onClick:this.clearInput,onTouchStart:this.clearInput}):null,g?y["default"].createElement("div",{className:r+"-error-extra",onClick:this.onErrorClick}):null,h>0&&p>1?y["default"].createElement("span",{className:r+"-count"},y["default"].createElement("span",null,c?c.length:0),"/",h):null)},t}(y["default"].Component);t["default"]=C,C.defaultProps={prefixCls:"am-textarea",prefixListCls:"am-list",autoHeight:!1,editable:!0,disabled:!1,placeholder:"",clear:!1,rows:1,onChange:o,onBlur:o,onFocus:o,onErrorClick:o,error:!1,labelNumber:5},e.exports=t["default"]},[482,220],457,function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(6),i=r(o),a=n(2),s=r(a),l=n(4),u=r(l),c=n(3),d=r(c),f=n(1),p=r(f),h=n(5),m=r(h),v=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,r=t.size,o=t.className,a=t.style,s=t.onClick,l=(0,m["default"])((e={},(0,i["default"])(e,""+n,!0),(0,i["default"])(e,n+"-"+r,!0),(0,i["default"])(e,o,!!o),e));return p["default"].createElement("div",{className:l,style:a,onClick:s})},t}(p["default"].Component);t["default"]=v,v.defaultProps={prefixCls:"am-whitespace",size:"md"},e.exports=t["default"]},[480,222],function(e,t,n){e.exports={"default":n(271),__esModule:!0}},function(e,t,n){e.exports={"default":n(272),__esModule:!0}},function(e,t,n){e.exports={"default":n(273),__esModule:!0}},function(e,t,n){e.exports={"default":n(274),__esModule:!0}},function(e,t,n){e.exports={"default":n(275),__esModule:!0}},function(e,t,n){e.exports={"default":n(276),__esModule:!0}},function(e,t,n){e.exports={"default":n(277),__esModule:!0}},function(e,t,n){e.exports={"default":n(278),__esModule:!0}},function(e,t,n){e.exports={"default":n(279),__esModule:!0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){}function i(e,t){var n=e["page"+(t?"Y":"X")+"Offset"],r="scroll"+(t?"Top":"Left");if("number"!=typeof n){var o=e.document;n=o.documentElement[r],"number"!=typeof n&&(n=o.body[r])}return n}function a(e,t){var n=e.style;["Webkit","Moz","Ms","ms"].forEach(function(e){n[e+"TransformOrigin"]=t}),n.transformOrigin=t}function s(e){var t=e.getBoundingClientRect(),n={left:t.left,top:t.top},r=e.ownerDocument,o=r.defaultView||r.parentWindow;return n.left+=i(o),n.top+=i(o,!0),n}Object.defineProperty(t,"__esModule",{value:!0});var l=n(1),u=r(l),c=n(9),d=r(c),f=n(320),p=r(f),h=n(40),m=r(h),v=n(473),y=r(v),g=n(323),b=r(g),_=n(11),T=r(_),C=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},x=0,w=0,P=u["default"].createClass({displayName:"Dialog",getDefaultProps:function(){return{afterClose:o,className:"",mask:!0,visible:!1,keyboard:!0,closable:!0,maskClosable:!0,prefixCls:"rc-dialog",onClose:o}},componentWillMount:function(){this.inTransition=!1,this.titleId="rcDialogTitle"+x++},componentDidMount:function(){this.componentDidUpdate({})},componentDidUpdate:function(e){var t=this.props,n=this.props.mousePosition;if(t.visible){if(!e.visible){this.openTime=Date.now(),this.lastOutSideFocusNode=document.activeElement,this.addScrollingEffect(),this.refs.wrap.focus();var r=d["default"].findDOMNode(this.refs.dialog);if(n){var o=s(r);a(r,n.x-o.left+"px "+(n.y-o.top)+"px")}else a(r,"")}}else if(e.visible&&(this.inTransition=!0,t.mask&&this.lastOutSideFocusNode)){try{this.lastOutSideFocusNode.focus()}catch(i){this.lastOutSideFocusNode=null}this.lastOutSideFocusNode=null}},componentWillUnmount:function(){(this.props.visible||this.inTransition)&&this.removeScrollingEffect()},onAnimateLeave:function(){this.refs.wrap&&(this.refs.wrap.style.display="none"),this.inTransition=!1,this.removeScrollingEffect(),this.props.afterClose()},onMaskClick:function(e){Date.now()-this.openTime<300||e.target===e.currentTarget&&this.close(e)},onKeyDown:function(e){var t=this.props;if(t.keyboard&&e.keyCode===p["default"].ESC&&this.close(e),t.visible&&e.keyCode===p["default"].TAB){var n=document.activeElement,r=this.refs.wrap,o=this.refs.sentinel;e.shiftKey?n===r&&o.focus():n===this.refs.sentinel&&r.focus()}},getDialogElement:function(){var e=this.props,t=e.closable,n=e.prefixCls,r={};void 0!==e.width&&(r.width=e.width),void 0!==e.height&&(r.height=e.height);var o=void 0;e.footer&&(o=u["default"].createElement("div",{className:n+"-footer",ref:"footer"},e.footer));var i=void 0;e.title&&(i=u["default"].createElement("div",{className:n+"-header",ref:"header"},u["default"].createElement("div",{className:n+"-title",id:this.titleId},e.title)));var a=void 0;t&&(a=u["default"].createElement("button",{onClick:this.close,"aria-label":"Close",className:n+"-close"},u["default"].createElement("span",{className:n+"-close-x"})));var s=(0,T["default"])({},e.style,r),l=this.getTransitionName(),c=u["default"].createElement(y["default"],{key:"dialog-element",role:"document",ref:"dialog",style:s,className:n+" "+(e.className||""),visible:e.visible},u["default"].createElement("div",{className:n+"-content"},a,i,u["default"].createElement("div",C({className:n+"-body",style:e.bodyStyle,ref:"body"},e.bodyProps),e.children),o),u["default"].createElement("div",{tabIndex:0,ref:"sentinel",style:{width:0,height:0,overflow:"hidden"}},"sentinel"));return u["default"].createElement(m["default"],{key:"dialog",showProp:"visible",onLeave:this.onAnimateLeave,transitionName:l,component:"",transitionAppear:!0},c)},getZIndexStyle:function(){var e={},t=this.props;return void 0!==t.zIndex&&(e.zIndex=t.zIndex),e},getWrapStyle:function(){return(0,T["default"])({},this.getZIndexStyle(),this.props.wrapStyle)},getMaskStyle:function(){return(0,T["default"])({},this.getZIndexStyle(),this.props.maskStyle)},getMaskElement:function(){var e=this.props,t=void 0;if(e.mask){var n=this.getMaskTransitionName();t=u["default"].createElement(y["default"],C({style:this.getMaskStyle(),key:"mask",className:e.prefixCls+"-mask",hiddenClassName:e.prefixCls+"-mask-hidden",visible:e.visible},e.maskProps)),n&&(t=u["default"].createElement(m["default"],{key:"mask",showProp:"visible",transitionAppear:!0,component:"",transitionName:n},t))}return t},getMaskTransitionName:function(){var e=this.props,t=e.maskTransitionName,n=e.maskAnimation;return!t&&n&&(t=e.prefixCls+"-"+n),t},getTransitionName:function(){var e=this.props,t=e.transitionName,n=e.animation;return!t&&n&&(t=e.prefixCls+"-"+n),t},getElement:function(e){return this.refs[e]},setScrollbar:function(){this.bodyIsOverflowing&&void 0!==this.scrollbarWidth&&(document.body.style.paddingRight=this.scrollbarWidth+"px")},addScrollingEffect:function(){w++,1===w&&(this.checkScrollbar(),this.setScrollbar(),document.body.style.overflow="hidden")},removeScrollingEffect:function(){w--,0===w&&(document.body.style.overflow="",this.resetScrollbar())},close:function(e){this.props.onClose(e)},checkScrollbar:function(){var e=window.innerWidth;if(!e){var t=document.documentElement.getBoundingClientRect();e=t.right-Math.abs(t.left)}this.bodyIsOverflowing=document.body.clientWidth<e,this.bodyIsOverflowing&&(this.scrollbarWidth=(0,b["default"])())},resetScrollbar:function(){document.body.style.paddingRight=""},adjustDialog:function(){if(this.refs.wrap&&void 0!==this.scrollbarWidth){var e=this.refs.wrap.scrollHeight>document.documentElement.clientHeight;this.refs.wrap.style.paddingLeft=(!this.bodyIsOverflowing&&e?this.scrollbarWidth:"")+"px",this.refs.wrap.style.paddingRight=(this.bodyIsOverflowing&&!e?this.scrollbarWidth:"")+"px"}},resetAdjustments:function(){this.refs.wrap&&(this.refs.wrap.style.paddingLeft=this.refs.wrap.style.paddingLeft="")},render:function(){var e=this.props,t=e.prefixCls,n=e.maskClosable,r=this.getWrapStyle();return e.visible&&(r.display=null),u["default"].createElement("div",null,this.getMaskElement(),u["default"].createElement("div",C({tabIndex:-1,onKeyDown:this.onKeyDown,className:t+"-wrap "+(e.wrapClassName||""),ref:"wrap",onClick:n?this.onMaskClick:void 0,role:"dialog","aria-labelledby":e.title?this.titleId:null,style:r},e.wrapProps),this.getDialogElement()))}});t["default"]=P,e.exports=t["default"]},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),a=n(11),s=r(a),l=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},u=i["default"].createClass({displayName:"LazyRenderBox",shouldComponentUpdate:function(e){return!!e.hiddenClassName||!!e.visible},render:function(){var e=this.props.className;this.props.hiddenClassName&&!this.props.visible&&(e+=" "+this.props.hiddenClassName);var t=(0,s["default"])({},this.props);return delete t.hiddenClassName,delete t.visible,t.className=e,i["default"].createElement("div",l({},t))}});t["default"]=u,e.exports=t["default"]},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),a=n(475),s=r(a),l=n(125),u=r(l),c=i["default"].createClass({displayName:"InkTabBar",mixins:[u["default"],s["default"]],render:function(){var e=this.getInkBarNode(),t=this.getTabs();return this.getRootNode([e,t])}});t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n=e["page"+(t?"Y":"X")+"Offset"],r="scroll"+(t?"Top":"Left");if("number"!=typeof n){var o=e.document;n=o.documentElement[r],"number"!=typeof n&&(n=o.body[r])}return n}function i(e){var t=void 0,n=void 0,r=void 0,i=e.ownerDocument,a=i.body,s=i&&i.documentElement;t=e.getBoundingClientRect(),n=t.left,r=t.top,n-=s.clientLeft||a.clientLeft||0,r-=s.clientTop||a.clientTop||0;var l=i.defaultView||i.parentWindow;return n+=o(l),r+=o(l,!0),{left:n,top:r}}function a(e,t){var n=e.refs,r=n.nav||n.root,o=i(r),a=n.inkBar,s=n.activeTab,l=a.style,c=e.props.tabBarPosition;if(t&&(l.display="none"),s){var d=s,f=i(d),p=(0,u.isTransformSupported)(l);if("top"===c||"bottom"===c){var h=f.left-o.left;p?((0,u.setTransform)(l,"translate3d("+h+"px,0,0)"),l.width=d.offsetWidth+"px",l.height=""):(l.left=h+"px",l.top="",l.bottom="",l.right=r.offsetWidth-h-d.offsetWidth+"px")}else{var m=f.top-o.top;p?((0,u.setTransform)(l,"translate3d(0,"+m+"px,0)"),l.height=d.offsetHeight+"px",l.width=""):(l.left="",l.right="",l.top=m+"px",l.bottom=r.offsetHeight-m-d.offsetHeight+"px")}}l.display=s?"block":"none"}Object.defineProperty(t,"__esModule",{value:!0});var s=n(6),l=r(s);t.getScroll=o;var u=n(74),c=n(1),d=r(c),f=n(5),p=r(f);t["default"]={getDefaultProps:function(){return{inkBarAnimated:!0}},componentDidUpdate:function(){a(this)},componentDidMount:function(){a(this,!0)},getInkBarNode:function(){var e,t=this.props,n=t.prefixCls,r=t.styles,o=t.inkBarAnimated,i=n+"-ink-bar",a=(0,p["default"])((e={},(0,l["default"])(e,i,!0),(0,l["default"])(e,o?i+"-animated":i+"-no-animated",!0),e));return d["default"].createElement("div",{style:r.inkBar,className:a,key:"inkBar",ref:"inkBar"})}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={LEFT:37,UP:38,RIGHT:39,DOWN:40},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.maxIndex,n=e.startIndex,r=e.delta,o=e.viewSize,i=n+-r/o;return i<0?i=Math.exp(i*y)-1:i>t&&(i=t+1-Math.exp((t-i)*y)),i}function i(e){var t=(0,v.isVertical)(this.props.tabBarPosition)?e.deltaY:e.deltaX,n=o({maxIndex:this.maxIndex,viewSize:this.viewSize,startIndex:this.startIndex,delta:t}),r=t<0?Math.floor(n+1):Math.floor(n);if(r<0?r=0:r>this.maxIndex&&(r=this.maxIndex),!this.children[r].props.disabled)return n}Object.defineProperty(t,"__esModule",{value:!0});var a=n(7),s=r(a),l=n(73),u=r(l),c=n(1),d=r(c),f=n(77),p=r(f),h=n(9),m=r(h),v=n(74),y=.6,g=d["default"].createClass({displayName:"SwipeableTabContent",propTypes:{tabBarPosition:c.PropTypes.string,onChange:c.PropTypes.func,children:c.PropTypes.any,hammerOptions:c.PropTypes.any,animated:c.PropTypes.bool,activeKey:c.PropTypes.string},getDefaultProps:function(){return{animated:!0}},componentDidMount:function(){this.rootNode=m["default"].findDOMNode(this)},onPanStart:function(){var e=this.props,t=e.tabBarPosition,n=e.children,r=e.activeKey,o=e.animated,i=this.startIndex=(0,v.getActiveIndex)(n,r);i!==-1&&(o&&(0,v.setTransition)(this.rootNode.style,"none"),this.startDrag=!0,this.children=(0,v.toArray)(n),this.maxIndex=this.children.length-1,this.viewSize=(0,v.isVertical)(t)?this.rootNode.offsetHeight:this.rootNode.offsetWidth)},onPan:function(e){if(this.startDrag){var t=this.props.tabBarPosition,n=i.call(this,e);void 0!==n&&(0,v.setTransform)(this.rootNode.style,(0,v.getTransformByIndex)(n,t))}},onPanEnd:function(e){this.startDrag&&this.end(e)},onSwipe:function(e){this.end(e,!0)},end:function(e,t){var n=this.props,r=n.tabBarPosition,o=n.animated;this.startDrag=!1,o&&(0,v.setTransition)(this.rootNode.style,"");var a=i.call(this,e),s=this.startIndex;if(void 0!==a)if(a<0)s=0;else if(a>this.maxIndex)s=this.maxIndex;else if(t){var l=(0,v.isVertical)(r)?e.deltaY:e.deltaX;s=l<0?Math.ceil(a):Math.floor(a)}else{var u=Math.floor(a);s=a-u>.6?u+1:u}this.children[s].props.disabled||(this.startIndex===s?o&&(0,v.setTransform)(this.rootNode.style,(0,v.getTransformByIndex)(s,this.props.tabBarPosition)):this.props.onChange((0,v.getActiveKey)(this.props.children,s)))},render:function(){var e=this.props,t=e.tabBarPosition,n=e.hammerOptions,r=e.animated,o={};(0,v.isVertical)(t)&&(o={vertical:!0});var i={onSwipe:this.onSwipe,onPanStart:this.onPanStart};return r!==!1&&(i=(0,s["default"])({},i,{onPan:this.onPan,onPanEnd:this.onPanEnd})),d["default"].createElement(p["default"],(0,s["default"])({},i,o,{options:n}),d["default"].createElement(u["default"],this.props))}});t["default"]=g,e.exports=t["default"]},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),a=n(125),s=r(a),l=i["default"].createClass({displayName:"TabBar",mixins:[s["default"]],render:function(){var e=this.getTabs();return this.getRootNode(e)}});t["default"]=l,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){}function i(e){var t=void 0;return u["default"].Children.forEach(e.children,function(e){!e||t||e.props.disabled||(t=e.key)}),t}Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=r(a),l=n(1),u=r(l),c=n(476),d=r(c),f=n(126),p=r(f),h=n(5),m=r(h),v=u["default"].createClass({displayName:"Tabs",propTypes:{destroyInactiveTabPane:l.PropTypes.bool,renderTabBar:l.PropTypes.func.isRequired,renderTabContent:l.PropTypes.func.isRequired,onChange:l.PropTypes.func,children:l.PropTypes.any,prefixCls:l.PropTypes.string,className:l.PropTypes.string,tabBarPosition:l.PropTypes.string,style:l.PropTypes.object},getDefaultProps:function(){return{prefixCls:"rc-tabs",destroyInactiveTabPane:!1,onChange:o,tabBarPosition:"top",style:{}}},getInitialState:function(){var e=this.props,t=void 0;return t="activeKey"in e?e.activeKey:"defaultActiveKey"in e?e.defaultActiveKey:i(e),{activeKey:t}},componentWillReceiveProps:function(e){"activeKey"in e&&this.setState({activeKey:e.activeKey})},onTabClick:function(e){this.tabBar.props.onTabClick&&this.tabBar.props.onTabClick(e),this.setActiveKey(e)},onNavKeyDown:function(e){var t=e.keyCode;if(t===d["default"].RIGHT||t===d["default"].DOWN){e.preventDefault();var n=this.getNextActiveKey(!0);this.onTabClick(n)}else if(t===d["default"].LEFT||t===d["default"].UP){e.preventDefault();var r=this.getNextActiveKey(!1);this.onTabClick(r)}},setActiveKey:function(e){this.state.activeKey!==e&&("activeKey"in this.props||this.setState({activeKey:e}),this.props.onChange(e))},getNextActiveKey:function(e){var t=this.state.activeKey,n=[];u["default"].Children.forEach(this.props.children,function(t){t&&!t.props.disabled&&(e?n.push(t):n.unshift(t))});var r=n.length,o=r&&n[0].key;return n.forEach(function(e,i){e.key===t&&(o=i===r-1?n[0].key:n[i+1].key)}),o},render:function(){var e,t=this.props,n=t.prefixCls,r=t.tabBarPosition,o=t.className,i=t.renderTabContent,a=t.renderTabBar,l=(0,m["default"])((e={},(0,s["default"])(e,n,1),(0,s["default"])(e,n+"-"+r,1),(0,s["default"])(e,o,!!o),e));this.tabBar=a();var c=[u["default"].cloneElement(this.tabBar,{prefixCls:n,key:"tabBar",onKeyDown:this.onNavKeyDown,tabBarPosition:r,onTabClick:this.onTabClick,panels:t.children,activeKey:this.state.activeKey}),u["default"].cloneElement(i(),{prefixCls:n,tabBarPosition:r,activeKey:this.state.activeKey,destroyInactiveTabPane:t.destroyInactiveTabPane,children:t.children,onChange:this.setActiveKey,key:"tabContent"})];return"bottom"===r&&c.reverse(),u["default"].createElement("div",{className:l,style:t.style},c)}});v.TabPane=p["default"],t["default"]=v,e.exports=t["default"]},function(e,t,n,r){"use strict";n(8),n(r)},function(e,t,n,r){"use strict";n(8),n(16),n(r)},function(e,t,n,r){"use strict";n(8),n(25),n(r)},function(e,t,n,r){"use strict";n(r)}]))});
//# sourceMappingURL=antd-mobile.min.js.map
|
assets/js/jquery.min.js
|
fahrul98/ci-furqan
|
/*! jQuery v1.12.4 | (c) jQuery Foundation | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="1.12.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(!l.ownFirst)for(b in a)return k.call(a,b);for(b in a);return void 0===b||k.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(h)return h.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=e.call(arguments,2),d=function(){return a.apply(b||this,c.concat(e.call(arguments)))},d.guid=a.guid=a.guid||n.guid++,d):void 0},now:function(){return+new Date},support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,aa=/'|\\/g,ba=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ca=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},da=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(ea){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fa(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==x&&9!==x&&11!==x)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==x&&(o=$.exec(a)))if(f=o[1]){if(9===x){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(w&&(j=w.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(o[2])return H.apply(d,b.getElementsByTagName(a)),d;if((f=o[3])&&c.getElementsByClassName&&b.getElementsByClassName)return H.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==x)w=b,s=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(aa,"\\$&"):b.setAttribute("id",k=u),r=g(a),h=r.length,l=V.test(k)?"#"+k:"[id='"+k+"']";while(h--)r[h]=l+" "+qa(r[h]);s=r.join(","),w=_.test(a)&&oa(b.parentNode)||b}if(s)try{return H.apply(d,w.querySelectorAll(s)),d}catch(y){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function ga(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ha(a){return a[u]=!0,a}function ia(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ja(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function ka(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function la(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function na(a){return ha(function(b){return b=+b,ha(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function oa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fa.support={},f=fa.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fa.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ia(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ia(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(n.getElementsByClassName),c.getById=ia(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(n.querySelectorAll))&&(ia(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ia(function(a){var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ia(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return ka(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?ka(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},fa.matches=function(a,b){return fa(a,null,null,b)},fa.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fa(b,n,null,[a]).length>0},fa.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fa.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fa.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fa.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fa.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fa.selectors={cacheLength:50,createPseudo:ha,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ba,ca),a[3]=(a[3]||a[4]||a[5]||"").replace(ba,ca),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fa.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fa.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ba,ca).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fa.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fa.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ha(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ha(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?ha(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ha(function(a){return function(b){return fa(a,b).length>0}}),contains:ha(function(a){return a=a.replace(ba,ca),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ha(function(a){return V.test(a||"")||fa.error("unsupported lang: "+a),a=a.replace(ba,ca).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:na(function(){return[0]}),last:na(function(a,b){return[b-1]}),eq:na(function(a,b,c){return[0>c?c+b:c]}),even:na(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:na(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:na(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:na(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=la(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=ma(b);function pa(){}pa.prototype=d.filters=d.pseudos,d.setFilters=new pa,g=fa.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=R.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=S.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(Q," ")}),h=h.slice(c.length));for(g in d.filter)!(e=W[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fa.error(a):z(a,i).slice(0)};function qa(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function ra(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(j=b[u]||(b[u]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===w&&h[1]===f)return k[2]=h[2];if(i[d]=k,k[2]=a(b,c,g))return!0}}}function sa(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ta(a,b,c){for(var d=0,e=b.length;e>d;d++)fa(a,b[d],c);return c}function ua(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function va(a,b,c,d,e,f){return d&&!d[u]&&(d=va(d)),e&&!e[u]&&(e=va(e,f)),ha(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ta(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ua(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ua(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ua(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function wa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ra(function(a){return a===b},h,!0),l=ra(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ra(sa(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return va(i>1&&sa(m),i>1&&qa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wa(a.slice(i,e)),f>e&&wa(a=a.slice(e)),f>e&&qa(a))}m.push(c)}return sa(m)}function xa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=F.call(i));u=ua(u)}H.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&fa.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ha(f):f}return h=fa.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xa(e,d)),f.selector=a}return f},i=fa.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ba,ca),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ba,ca),_.test(j[0].type)&&oa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qa(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||_.test(a)&&oa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ia(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ia(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ja("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ia(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ja("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ia(function(a){return null==a.getAttribute("disabled")})||ja(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fa}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.uniqueSort=n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},v=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},w=n.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,y=/^.[^:#\[\.,]*$/;function z(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(y.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return n.inArray(a,b)>-1!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;e>b;b++)if(n.contains(d[b],this))return!0}));for(b=0;e>b;b++)n.find(a,d[b],c);return c=this.pushStack(e>1?n.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(z(this,a||[],!1))},not:function(a){return this.pushStack(z(this,a||[],!0))},is:function(a){return!!z(this,"string"==typeof a&&w.test(a)?n(a):a||[],!1).length}});var A,B=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=n.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||A,"string"==typeof a){if(e="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:B.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),x.test(e[1])&&n.isPlainObject(b))for(e in b)n.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}if(f=d.getElementById(e[2]),f&&f.parentNode){if(f.id!==e[2])return A.find(a);this.length=1,this[0]=f}return this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof c.ready?c.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};C.prototype=n.fn,A=n(d);var D=/^(?:parents|prev(?:Until|All))/,E={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({has:function(a){var b,c=n(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(n.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=w.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?n.inArray(this[0],n(a)):n.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.uniqueSort(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function F(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return u(a,"parentNode")},parentsUntil:function(a,b,c){return u(a,"parentNode",c)},next:function(a){return F(a,"nextSibling")},prev:function(a){return F(a,"previousSibling")},nextAll:function(a){return u(a,"nextSibling")},prevAll:function(a){return u(a,"previousSibling")},nextUntil:function(a,b,c){return u(a,"nextSibling",c)},prevUntil:function(a,b,c){return u(a,"previousSibling",c)},siblings:function(a){return v((a.parentNode||{}).firstChild,a)},children:function(a){return v(a.firstChild)},contents:function(a){return n.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(E[a]||(e=n.uniqueSort(e)),D.test(a)&&(e=e.reverse())),this.pushStack(e)}});var G=/\S+/g;function H(a){var b={};return n.each(a.match(G)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?H(a):n.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){n.each(b,function(b,c){n.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==n.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return n.each(arguments,function(a,b){var c;while((c=n.inArray(b,f,c))>-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?n.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=!0,c||j.disable(),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function J(){d.addEventListener?(d.removeEventListener("DOMContentLoaded",K),a.removeEventListener("load",K)):(d.detachEvent("onreadystatechange",K),a.detachEvent("onload",K))}function K(){(d.addEventListener||"load"===a.event.type||"complete"===d.readyState)&&(J(),n.ready())}n.ready.promise=function(b){if(!I)if(I=n.Deferred(),"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll)a.setTimeout(n.ready);else if(d.addEventListener)d.addEventListener("DOMContentLoaded",K),a.addEventListener("load",K);else{d.attachEvent("onreadystatechange",K),a.attachEvent("onload",K);var c=!1;try{c=null==a.frameElement&&d.documentElement}catch(e){}c&&c.doScroll&&!function f(){if(!n.isReady){try{c.doScroll("left")}catch(b){return a.setTimeout(f,50)}J(),n.ready()}}()}return I.promise(b)},n.ready.promise();var L;for(L in n(l))break;l.ownFirst="0"===L,l.inlineBlockNeedsLayout=!1,n(function(){var a,b,c,e;c=d.getElementsByTagName("body")[0],c&&c.style&&(b=d.createElement("div"),e=d.createElement("div"),e.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(e).appendChild(b),"undefined"!=typeof b.style.zoom&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",l.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(e))}),function(){var a=d.createElement("div");l.deleteExpando=!0;try{delete a.test}catch(b){l.deleteExpando=!1}a=null}();var M=function(a){var b=n.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b},N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(O,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}n.data(a,b,c)}else c=void 0;
}return c}function Q(a){var b;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function R(a,b,d,e){if(M(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),"object"!=typeof b&&"function"!=typeof b||(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[n.camelCase(b)])):f=g,f}}function S(a,b,c){if(M(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=void 0)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?n.cache[a[n.expando]]:a[n.expando],!!a&&!Q(a)},data:function(a,b,c){return R(a,b,c)},removeData:function(a,b){return S(a,b)},_data:function(a,b,c){return R(a,b,c,!0)},_removeData:function(a,b){return S(a,b,!0)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?P(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=n._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}}),function(){var a;l.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,e;return c=d.getElementsByTagName("body")[0],c&&c.style?(b=d.createElement("div"),e=d.createElement("div"),e.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(e).appendChild(b),"undefined"!=typeof b.style.zoom&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(d.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(e),a):void 0}}();var T=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,U=new RegExp("^(?:([+-])=|)("+T+")([a-z%]*)$","i"),V=["Top","Right","Bottom","Left"],W=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)};function X(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return n.css(a,b,"")},i=h(),j=c&&c[3]||(n.cssNumber[b]?"":"px"),k=(n.cssNumber[b]||"px"!==j&&+i)&&U.exec(n.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,n.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var Y=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)Y(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},Z=/^(?:checkbox|radio)$/i,$=/<([\w:-]+)/,_=/^$|\/(?:java|ecma)script/i,aa=/^\s+/,ba="abbr|article|aside|audio|bdi|canvas|data|datalist|details|dialog|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|picture|progress|section|summary|template|time|video";function ca(a){var b=ba.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}!function(){var a=d.createElement("div"),b=d.createDocumentFragment(),c=d.createElement("input");a.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",l.leadingWhitespace=3===a.firstChild.nodeType,l.tbody=!a.getElementsByTagName("tbody").length,l.htmlSerialize=!!a.getElementsByTagName("link").length,l.html5Clone="<:nav></:nav>"!==d.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,b.appendChild(c),l.appendChecked=c.checked,a.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!a.cloneNode(!0).lastChild.defaultValue,b.appendChild(a),c=d.createElement("input"),c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),a.appendChild(c),l.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!!a.addEventListener,a[n.expando]=1,l.attributes=!a.getAttribute(n.expando)}();var da={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:l.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]};da.optgroup=da.option,da.tbody=da.tfoot=da.colgroup=da.caption=da.thead,da.th=da.td;function ea(a,b){var c,d,e=0,f="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||n.nodeName(d,b)?f.push(d):n.merge(f,ea(d,b));return void 0===b||b&&n.nodeName(a,b)?n.merge([a],f):f}function fa(a,b){for(var c,d=0;null!=(c=a[d]);d++)n._data(c,"globalEval",!b||n._data(b[d],"globalEval"))}var ga=/<|&#?\w+;/,ha=/<tbody/i;function ia(a){Z.test(a.type)&&(a.defaultChecked=a.checked)}function ja(a,b,c,d,e){for(var f,g,h,i,j,k,m,o=a.length,p=ca(b),q=[],r=0;o>r;r++)if(g=a[r],g||0===g)if("object"===n.type(g))n.merge(q,g.nodeType?[g]:g);else if(ga.test(g)){i=i||p.appendChild(b.createElement("div")),j=($.exec(g)||["",""])[1].toLowerCase(),m=da[j]||da._default,i.innerHTML=m[1]+n.htmlPrefilter(g)+m[2],f=m[0];while(f--)i=i.lastChild;if(!l.leadingWhitespace&&aa.test(g)&&q.push(b.createTextNode(aa.exec(g)[0])),!l.tbody){g="table"!==j||ha.test(g)?"<table>"!==m[1]||ha.test(g)?0:i:i.firstChild,f=g&&g.childNodes.length;while(f--)n.nodeName(k=g.childNodes[f],"tbody")&&!k.childNodes.length&&g.removeChild(k)}n.merge(q,i.childNodes),i.textContent="";while(i.firstChild)i.removeChild(i.firstChild);i=p.lastChild}else q.push(b.createTextNode(g));i&&p.removeChild(i),l.appendChecked||n.grep(ea(q,"input"),ia),r=0;while(g=q[r++])if(d&&n.inArray(g,d)>-1)e&&e.push(g);else if(h=n.contains(g.ownerDocument,g),i=ea(p.appendChild(g),"script"),h&&fa(i),c){f=0;while(g=i[f++])_.test(g.type||"")&&c.push(g)}return i=null,p}!function(){var b,c,e=d.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(l[b]=c in a)||(e.setAttribute(c,"t"),l[b]=e.attributes[c].expando===!1);e=null}();var ka=/^(?:input|select|textarea)$/i,la=/^key/,ma=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,na=/^(?:focusinfocus|focusoutblur)$/,oa=/^([^.]*)(?:\.(.+)|)/;function pa(){return!0}function qa(){return!1}function ra(){try{return d.activeElement}catch(a){}}function sa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)sa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=qa;else if(!e)return a;return 1===f&&(g=e,e=function(a){return n().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=n.guid++)),a.each(function(){n.event.add(this,b,e,d,c)})}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=n.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return"undefined"==typeof n||a&&n.event.triggered===a.type?void 0:n.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(G)||[""],h=b.length;while(h--)f=oa.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=n.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=n.event.special[o]||{},l=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},i),(m=g[o])||(m=g[o]=[],m.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,l):m.push(l),n.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n.hasData(a)&&n._data(a);if(r&&(k=r.events)){b=(b||"").match(G)||[""],j=b.length;while(j--)if(h=oa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;while(f--)g=m[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(k)&&(delete r.handle,n._removeData(a,"events"))}},trigger:function(b,c,e,f){var g,h,i,j,l,m,o,p=[e||d],q=k.call(b,"type")?b.type:b,r=k.call(b,"namespace")?b.namespace.split("."):[];if(i=m=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!na.test(q+n.event.triggered)&&(q.indexOf(".")>-1&&(r=q.split("."),q=r.shift(),r.sort()),h=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=r.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:n.makeArray(c,[b]),l=n.event.special[q]||{},f||!l.trigger||l.trigger.apply(e,c)!==!1)){if(!f&&!l.noBubble&&!n.isWindow(e)){for(j=l.delegateType||q,na.test(j+q)||(i=i.parentNode);i;i=i.parentNode)p.push(i),m=i;m===(e.ownerDocument||d)&&p.push(m.defaultView||m.parentWindow||a)}o=0;while((i=p[o++])&&!b.isPropagationStopped())b.type=o>1?j:l.bindType||q,g=(n._data(i,"events")||{})[b.type]&&n._data(i,"handle"),g&&g.apply(i,c),g=h&&i[h],g&&g.apply&&M(i)&&(b.result=g.apply(i,c),b.result===!1&&b.preventDefault());if(b.type=q,!f&&!b.isDefaultPrevented()&&(!l._default||l._default.apply(p.pop(),c)===!1)&&M(e)&&h&&e[q]&&!n.isWindow(e)){m=e[h],m&&(e[h]=null),n.event.triggered=q;try{e[q]()}catch(s){}n.event.triggered=void 0,m&&(e[h]=m)}return b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,d,f,g,h=[],i=e.call(arguments),j=(n._data(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())a.rnamespace&&!a.rnamespace.test(g.namespace)||(a.handleObj=g,a.data=g.data,d=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>-1:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[n.expando])return a;var b,c,e,f=a.type,g=a,h=this.fixHooks[f];h||(this.fixHooks[f]=h=ma.test(f)?this.mouseHooks:la.test(f)?this.keyHooks:{}),e=h.props?this.props.concat(h.props):this.props,a=new n.Event(g),b=e.length;while(b--)c=e[b],a[c]=g[c];return a.target||(a.target=g.srcElement||d),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,h.filter?h.filter(a,g):a},props:"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,e,f,g=b.button,h=b.fromElement;return null==a.pageX&&null!=b.clientX&&(e=a.target.ownerDocument||d,f=e.documentElement,c=e.body,a.pageX=b.clientX+(f&&f.scrollLeft||c&&c.scrollLeft||0)-(f&&f.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(f&&f.scrollTop||c&&c.scrollTop||0)-(f&&f.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&h&&(a.relatedTarget=h===a.target?b.toElement:h),a.which||void 0===g||(a.which=1&g?1:2&g?3:4&g?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==ra()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===ra()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return n.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c){var d=n.extend(new n.Event,c,{type:a,isSimulated:!0});n.event.trigger(d,null,b),d.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=d.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)}:function(a,b,c){var d="on"+b;a.detachEvent&&("undefined"==typeof a[d]&&(a[d]=null),a.detachEvent(d,c))},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?pa:qa):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={constructor:n.Event,isDefaultPrevented:qa,isPropagationStopped:qa,isImmediatePropagationStopped:qa,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=pa,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=pa,a&&!this.isSimulated&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=pa,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||n.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),l.submit||(n.event.special.submit={setup:function(){return n.nodeName(this,"form")?!1:void n.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=n.nodeName(b,"input")||n.nodeName(b,"button")?n.prop(b,"form"):void 0;c&&!n._data(c,"submit")&&(n.event.add(c,"submit._submit",function(a){a._submitBubble=!0}),n._data(c,"submit",!0))})},postDispatch:function(a){a._submitBubble&&(delete a._submitBubble,this.parentNode&&!a.isTrigger&&n.event.simulate("submit",this.parentNode,a))},teardown:function(){return n.nodeName(this,"form")?!1:void n.event.remove(this,"._submit")}}),l.change||(n.event.special.change={setup:function(){return ka.test(this.nodeName)?("checkbox"!==this.type&&"radio"!==this.type||(n.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._justChanged=!0)}),n.event.add(this,"click._change",function(a){this._justChanged&&!a.isTrigger&&(this._justChanged=!1),n.event.simulate("change",this,a)})),!1):void n.event.add(this,"beforeactivate._change",function(a){var b=a.target;ka.test(b.nodeName)&&!n._data(b,"change")&&(n.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||n.event.simulate("change",this.parentNode,a)}),n._data(b,"change",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return n.event.remove(this,"._change"),!ka.test(this.nodeName)}}),l.focusin||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a))};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=n._data(d,b);e||d.addEventListener(a,c,!0),n._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=n._data(d,b)-1;e?n._data(d,b,e):(d.removeEventListener(a,c,!0),n._removeData(d,b))}}}),n.fn.extend({on:function(a,b,c,d){return sa(this,a,b,c,d)},one:function(a,b,c,d){return sa(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=qa),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});var ta=/ jQuery\d+="(?:null|\d+)"/g,ua=new RegExp("<(?:"+ba+")[\\s/>]","i"),va=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,wa=/<script|<style|<link/i,xa=/checked\s*(?:[^=]|=\s*.checked.)/i,ya=/^true\/(.*)/,za=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Aa=ca(d),Ba=Aa.appendChild(d.createElement("div"));function Ca(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function Da(a){return a.type=(null!==n.find.attr(a,"type"))+"/"+a.type,a}function Ea(a){var b=ya.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Fa(a,b){if(1===b.nodeType&&n.hasData(a)){var c,d,e,f=n._data(a),g=n._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)n.event.add(b,c,h[c][d])}g.data&&(g.data=n.extend({},g.data))}}function Ga(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!l.noCloneEvent&&b[n.expando]){e=n._data(b);for(d in e.events)n.removeEvent(b,d,e.handle);b.removeAttribute(n.expando)}"script"===c&&b.text!==a.text?(Da(b).text=a.text,Ea(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),l.html5Clone&&a.innerHTML&&!n.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&Z.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}}function Ha(a,b,c,d){b=f.apply([],b);var e,g,h,i,j,k,m=0,o=a.length,p=o-1,q=b[0],r=n.isFunction(q);if(r||o>1&&"string"==typeof q&&!l.checkClone&&xa.test(q))return a.each(function(e){var f=a.eq(e);r&&(b[0]=q.call(this,e,f.html())),Ha(f,b,c,d)});if(o&&(k=ja(b,a[0].ownerDocument,!1,a,d),e=k.firstChild,1===k.childNodes.length&&(k=e),e||d)){for(i=n.map(ea(k,"script"),Da),h=i.length;o>m;m++)g=k,m!==p&&(g=n.clone(g,!0,!0),h&&n.merge(i,ea(g,"script"))),c.call(a[m],g,m);if(h)for(j=i[i.length-1].ownerDocument,n.map(i,Ea),m=0;h>m;m++)g=i[m],_.test(g.type||"")&&!n._data(g,"globalEval")&&n.contains(j,g)&&(g.src?n._evalUrl&&n._evalUrl(g.src):n.globalEval((g.text||g.textContent||g.innerHTML||"").replace(za,"")));k=e=null}return a}function Ia(a,b,c){for(var d,e=b?n.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||n.cleanData(ea(d)),d.parentNode&&(c&&n.contains(d.ownerDocument,d)&&fa(ea(d,"script")),d.parentNode.removeChild(d));return a}n.extend({htmlPrefilter:function(a){return a.replace(va,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h,i=n.contains(a.ownerDocument,a);if(l.html5Clone||n.isXMLDoc(a)||!ua.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(Ba.innerHTML=a.outerHTML,Ba.removeChild(f=Ba.firstChild)),!(l.noCloneEvent&&l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(d=ea(f),h=ea(a),g=0;null!=(e=h[g]);++g)d[g]&&Ga(e,d[g]);if(b)if(c)for(h=h||ea(a),d=d||ea(f),g=0;null!=(e=h[g]);g++)Fa(e,d[g]);else Fa(a,f);return d=ea(f,"script"),d.length>0&&fa(d,!i&&ea(a,"script")),d=h=e=null,f},cleanData:function(a,b){for(var d,e,f,g,h=0,i=n.expando,j=n.cache,k=l.attributes,m=n.event.special;null!=(d=a[h]);h++)if((b||M(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)m[e]?n.event.remove(d,e):n.removeEvent(d,e,g.handle);j[f]&&(delete j[f],k||"undefined"==typeof d.removeAttribute?d[i]=void 0:d.removeAttribute(i),c.push(f))}}}),n.fn.extend({domManip:Ha,detach:function(a){return Ia(this,a,!0)},remove:function(a){return Ia(this,a)},text:function(a){return Y(this,function(a){return void 0===a?n.text(this):this.empty().append((this[0]&&this[0].ownerDocument||d).createTextNode(a))},null,a,arguments.length)},append:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.appendChild(a)}})},prepend:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&n.cleanData(ea(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&n.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return Y(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(ta,""):void 0;if("string"==typeof a&&!wa.test(a)&&(l.htmlSerialize||!ua.test(a))&&(l.leadingWhitespace||!aa.test(a))&&!da[($.exec(a)||["",""])[1].toLowerCase()]){a=n.htmlPrefilter(a);try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ea(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ha(this,arguments,function(b){var c=this.parentNode;n.inArray(this,a)<0&&(n.cleanData(ea(this)),c&&c.replaceChild(b,this))},a)}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=0,e=[],f=n(a),h=f.length-1;h>=d;d++)c=d===h?this:this.clone(!0),n(f[d])[b](c),g.apply(e,c.get());return this.pushStack(e)}});var Ja,Ka={HTML:"block",BODY:"block"};function La(a,b){var c=n(b.createElement(a)).appendTo(b.body),d=n.css(c[0],"display");return c.detach(),d}function Ma(a){var b=d,c=Ka[a];return c||(c=La(a,b),"none"!==c&&c||(Ja=(Ja||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Ja[0].contentWindow||Ja[0].contentDocument).document,b.write(),b.close(),c=La(a,b),Ja.detach()),Ka[a]=c),c}var Na=/^margin/,Oa=new RegExp("^("+T+")(?!px)[a-z%]+$","i"),Pa=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e},Qa=d.documentElement;!function(){var b,c,e,f,g,h,i=d.createElement("div"),j=d.createElement("div");if(j.style){j.style.cssText="float:left;opacity:.5",l.opacity="0.5"===j.style.opacity,l.cssFloat=!!j.style.cssFloat,j.style.backgroundClip="content-box",j.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===j.style.backgroundClip,i=d.createElement("div"),i.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",j.innerHTML="",i.appendChild(j),l.boxSizing=""===j.style.boxSizing||""===j.style.MozBoxSizing||""===j.style.WebkitBoxSizing,n.extend(l,{reliableHiddenOffsets:function(){return null==b&&k(),f},boxSizingReliable:function(){return null==b&&k(),e},pixelMarginRight:function(){return null==b&&k(),c},pixelPosition:function(){return null==b&&k(),b},reliableMarginRight:function(){return null==b&&k(),g},reliableMarginLeft:function(){return null==b&&k(),h}});function k(){var k,l,m=d.documentElement;m.appendChild(i),j.style.cssText="-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",b=e=h=!1,c=g=!0,a.getComputedStyle&&(l=a.getComputedStyle(j),b="1%"!==(l||{}).top,h="2px"===(l||{}).marginLeft,e="4px"===(l||{width:"4px"}).width,j.style.marginRight="50%",c="4px"===(l||{marginRight:"4px"}).marginRight,k=j.appendChild(d.createElement("div")),k.style.cssText=j.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",k.style.marginRight=k.style.width="0",j.style.width="1px",g=!parseFloat((a.getComputedStyle(k)||{}).marginRight),j.removeChild(k)),j.style.display="none",f=0===j.getClientRects().length,f&&(j.style.display="",j.innerHTML="<table><tr><td></td><td>t</td></tr></table>",j.childNodes[0].style.borderCollapse="separate",k=j.getElementsByTagName("td"),k[0].style.cssText="margin:0;border:0;padding:0;display:none",f=0===k[0].offsetHeight,f&&(k[0].style.display="",k[1].style.display="none",f=0===k[0].offsetHeight)),m.removeChild(i)}}}();var Ra,Sa,Ta=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ra=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)},Sa=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ra(a),g=c?c.getPropertyValue(b)||c[b]:void 0,""!==g&&void 0!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),c&&!l.pixelMarginRight()&&Oa.test(g)&&Na.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f),void 0===g?g:g+""}):Qa.currentStyle&&(Ra=function(a){return a.currentStyle},Sa=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ra(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Oa.test(g)&&!Ta.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Ua(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Va=/alpha\([^)]*\)/i,Wa=/opacity\s*=\s*([^)]*)/i,Xa=/^(none|table(?!-c[ea]).+)/,Ya=new RegExp("^("+T+")(.*)$","i"),Za={position:"absolute",visibility:"hidden",display:"block"},$a={letterSpacing:"0",fontWeight:"400"},_a=["Webkit","O","Moz","ms"],ab=d.createElement("div").style;function bb(a){if(a in ab)return a;var b=a.charAt(0).toUpperCase()+a.slice(1),c=_a.length;while(c--)if(a=_a[c]+b,a in ab)return a}function cb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=n._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&W(d)&&(f[g]=n._data(d,"olddisplay",Ma(d.nodeName)))):(e=W(d),(c&&"none"!==c||!e)&&n._data(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function db(a,b,c){var d=Ya.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function eb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+V[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+V[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+V[f]+"Width",!0,e))):(g+=n.css(a,"padding"+V[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+V[f]+"Width",!0,e)));return g}function fb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ra(a),g=l.boxSizing&&"border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Sa(a,b,f),(0>e||null==e)&&(e=a.style[b]),Oa.test(e))return e;d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+eb(a,b,c||(g?"border":"content"),d,f)+"px"}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Sa(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":l.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;if(b=n.cssProps[h]||(n.cssProps[h]=bb(h)||h),g=n.cssHooks[b]||n.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=U.exec(c))&&e[1]&&(c=X(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(n.cssNumber[h]?"":"px")),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=bb(h)||h),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Sa(a,b,d)),"normal"===f&&b in $a&&(f=$a[b]),""===c||c?(e=parseFloat(f),c===!0||isFinite(e)?e||0:f):f}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?Xa.test(n.css(a,"display"))&&0===a.offsetWidth?Pa(a,Za,function(){return fb(a,b,d)}):fb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ra(a);return db(a,c,d?eb(a,b,d,l.boxSizing&&"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),l.opacity||(n.cssHooks.opacity={get:function(a,b){return Wa.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=n.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===n.trim(f.replace(Va,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Va.test(f)?f.replace(Va,e):f+" "+e)}}),n.cssHooks.marginRight=Ua(l.reliableMarginRight,function(a,b){return b?Pa(a,{display:"inline-block"},Sa,[a,"marginRight"]):void 0}),n.cssHooks.marginLeft=Ua(l.reliableMarginLeft,function(a,b){return b?(parseFloat(Sa(a,"marginLeft"))||(n.contains(a.ownerDocument,a)?a.getBoundingClientRect().left-Pa(a,{
marginLeft:0},function(){return a.getBoundingClientRect().left}):0))+"px":void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+V[d]+b]=f[d]||f[d-2]||f[0];return e}},Na.test(a)||(n.cssHooks[a+b].set=db)}),n.fn.extend({css:function(a,b){return Y(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Ra(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return cb(this,!0)},hide:function(){return cb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){W(this)?n(this).show():n(this).hide()})}});function gb(a,b,c,d,e){return new gb.prototype.init(a,b,c,d,e)}n.Tween=gb,gb.prototype={constructor:gb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||n.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=gb.propHooks[this.prop];return a&&a.get?a.get(this):gb.propHooks._default.get(this)},run:function(a){var b,c=gb.propHooks[this.prop];return this.options.duration?this.pos=b=n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):gb.propHooks._default.set(this),this}},gb.prototype.init.prototype=gb.prototype,gb.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[n.cssProps[a.prop]]&&!n.cssHooks[a.prop]?a.elem[a.prop]=a.now:n.style(a.elem,a.prop,a.now+a.unit)}}},gb.propHooks.scrollTop=gb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},n.fx=gb.prototype.init,n.fx.step={};var hb,ib,jb=/^(?:toggle|show|hide)$/,kb=/queueHooks$/;function lb(){return a.setTimeout(function(){hb=void 0}),hb=n.now()}function mb(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=V[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function nb(a,b,c){for(var d,e=(qb.tweeners[b]||[]).concat(qb.tweeners["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ob(a,b,c){var d,e,f,g,h,i,j,k,m=this,o={},p=a.style,q=a.nodeType&&W(a),r=n._data(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,m.always(function(){m.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=n.css(a,"display"),k="none"===j?n._data(a,"olddisplay")||Ma(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(l.inlineBlockNeedsLayout&&"inline"!==Ma(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",l.shrinkWrapBlocks()||m.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],jb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(o))"inline"===("none"===j?Ma(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=n._data(a,"fxshow",{}),f&&(r.hidden=!q),q?n(a).show():m.done(function(){n(a).hide()}),m.done(function(){var b;n._removeData(a,"fxshow");for(b in o)n.style(a,b,o[b])});for(d in o)g=nb(q?r[d]:0,d,m),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function pb(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function qb(a,b,c){var d,e,f=0,g=qb.prefilters.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=hb||lb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{},easing:n.easing._default},c),originalProperties:b,originalOptions:c,startTime:hb||lb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(pb(k,j.opts.specialEasing);g>f;f++)if(d=qb.prefilters[f].call(j,a,k,j.opts))return n.isFunction(d.stop)&&(n._queueHooks(j.elem,j.opts.queue).stop=n.proxy(d.stop,d)),d;return n.map(k,nb,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(qb,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return X(c.elem,a,U.exec(b),c),c}]},tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.match(G);for(var c,d=0,e=a.length;e>d;d++)c=a[d],qb.tweeners[c]=qb.tweeners[c]||[],qb.tweeners[c].unshift(b)},prefilters:[ob],prefilter:function(a,b){b?qb.prefilters.unshift(a):qb.prefilters.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,null!=d.queue&&d.queue!==!0||(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(W).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=qb(this,n.extend({},a),f);(e||n._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=n._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&kb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=n._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(mb(b,!0),a,d,e)}}),n.each({slideDown:mb("show"),slideUp:mb("hide"),slideToggle:mb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=n.timers,c=0;for(hb=n.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||n.fx.stop(),hb=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){ib||(ib=a.setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){a.clearInterval(ib),ib=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(b,c){return b=n.fx?n.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a,b=d.createElement("input"),c=d.createElement("div"),e=d.createElement("select"),f=e.appendChild(d.createElement("option"));c=d.createElement("div"),c.setAttribute("className","t"),c.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=c.getElementsByTagName("a")[0],b.setAttribute("type","checkbox"),c.appendChild(b),a=c.getElementsByTagName("a")[0],a.style.cssText="top:1px",l.getSetAttribute="t"!==c.className,l.style=/top/.test(a.getAttribute("style")),l.hrefNormalized="/a"===a.getAttribute("href"),l.checkOn=!!b.value,l.optSelected=f.selected,l.enctype=!!d.createElement("form").enctype,e.disabled=!0,l.optDisabled=!f.disabled,b=d.createElement("input"),b.setAttribute("value",""),l.input=""===b.getAttribute("value"),b.value="t",b.setAttribute("type","radio"),l.radioValue="t"===b.value}();var rb=/\r/g,sb=/[\x20\t\r\n\f]+/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(rb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a)).replace(sb," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],(c.selected||i===e)&&(l.optDisabled?!c.disabled:null===c.getAttribute("disabled"))&&(!c.parentNode.disabled||!n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)if(d=e[g],n.inArray(n.valHooks.option.get(d),f)>-1)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>-1:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var tb,ub,vb=n.expr.attrHandle,wb=/^(?:checked|selected)$/i,xb=l.getSetAttribute,yb=l.input;n.fn.extend({attr:function(a,b){return Y(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),e=n.attrHooks[b]||(n.expr.match.bool.test(b)?ub:tb)),void 0!==c?null===c?void n.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=n.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(G);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)?yb&&xb||!wb.test(c)?a[d]=!1:a[n.camelCase("default-"+c)]=a[d]=!1:n.attr(a,c,""),a.removeAttribute(xb?c:d)}}),ub={set:function(a,b,c){return b===!1?n.removeAttr(a,c):yb&&xb||!wb.test(c)?a.setAttribute(!xb&&n.propFix[c]||c,c):a[n.camelCase("default-"+c)]=a[c]=!0,c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=vb[b]||n.find.attr;yb&&xb||!wb.test(b)?vb[b]=function(a,b,d){var e,f;return d||(f=vb[b],vb[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,vb[b]=f),e}:vb[b]=function(a,b,c){return c?void 0:a[n.camelCase("default-"+b)]?b.toLowerCase():null}}),yb&&xb||(n.attrHooks.value={set:function(a,b,c){return n.nodeName(a,"input")?void(a.defaultValue=b):tb&&tb.set(a,b,c)}}),xb||(tb={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},vb.id=vb.name=vb.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},n.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:tb.set},n.attrHooks.contenteditable={set:function(a,b,c){tb.set(a,""===b?!1:b,c)}},n.each(["width","height"],function(a,b){n.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),l.style||(n.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var zb=/^(?:input|select|textarea|button|object)$/i,Ab=/^(?:a|area)$/i;n.fn.extend({prop:function(a,b){return Y(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return a=n.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),n.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&n.isXMLDoc(a)||(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=n.find.attr(a,"tabindex");return b?parseInt(b,10):zb.test(a.nodeName)||Ab.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),l.hrefNormalized||n.each(["href","src"],function(a,b){n.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this}),l.enctype||(n.propFix.enctype="encoding");var Bb=/[\t\r\n\f]/g;function Cb(a){return n.attr(a,"class")||""}n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,Cb(this)))});if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=Cb(c),d=1===c.nodeType&&(" "+e+" ").replace(Bb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=n.trim(d),e!==h&&n.attr(c,"class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,Cb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=Cb(c),d=1===c.nodeType&&(" "+e+" ").replace(Bb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=n.trim(d),e!==h&&n.attr(c,"class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):n.isFunction(a)?this.each(function(c){n(this).toggleClass(a.call(this,c,Cb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=n(this),f=a.match(G)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=Cb(this),b&&n._data(this,"__className__",b),n.attr(this,"class",b||a===!1?"":n._data(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+Cb(c)+" ").replace(Bb," ").indexOf(b)>-1)return!0;return!1}}),n.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(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Db=a.location,Eb=n.now(),Fb=/\?/,Gb=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;n.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=n.trim(b+"");return e&&!n.trim(e.replace(Gb,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():n.error("Invalid JSON: "+b)},n.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new a.DOMParser,c=d.parseFromString(b,"text/xml")):(c=new a.ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||n.error("Invalid XML: "+b),c};var Hb=/#.*$/,Ib=/([?&])_=[^&]*/,Jb=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Kb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Lb=/^(?:GET|HEAD)$/,Mb=/^\/\//,Nb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Ob={},Pb={},Qb="*/".concat("*"),Rb=Db.href,Sb=Nb.exec(Rb.toLowerCase())||[];function Tb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(G)||[];if(n.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Ub(a,b,c,d){var e={},f=a===Pb;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Vb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&n.extend(!0,a,c),a}function Wb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Xb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Rb,type:"GET",isLocal:Kb.test(Sb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Qb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Vb(Vb(a,n.ajaxSettings),b):Vb(n.ajaxSettings,a)},ajaxPrefilter:Tb(Ob),ajaxTransport:Tb(Pb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var d,e,f,g,h,i,j,k,l=n.ajaxSetup({},c),m=l.context||l,o=l.context&&(m.nodeType||m.jquery)?n(m):n.event,p=n.Deferred(),q=n.Callbacks("once memory"),r=l.statusCode||{},s={},t={},u=0,v="canceled",w={readyState:0,getResponseHeader:function(a){var b;if(2===u){if(!k){k={};while(b=Jb.exec(g))k[b[1].toLowerCase()]=b[2]}b=k[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===u?g:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return u||(a=t[c]=t[c]||a,s[a]=b),this},overrideMimeType:function(a){return u||(l.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>u)for(b in a)r[b]=[r[b],a[b]];else w.always(a[w.status]);return this},abort:function(a){var b=a||v;return j&&j.abort(b),y(0,b),this}};if(p.promise(w).complete=q.add,w.success=w.done,w.error=w.fail,l.url=((b||l.url||Rb)+"").replace(Hb,"").replace(Mb,Sb[1]+"//"),l.type=c.method||c.type||l.method||l.type,l.dataTypes=n.trim(l.dataType||"*").toLowerCase().match(G)||[""],null==l.crossDomain&&(d=Nb.exec(l.url.toLowerCase()),l.crossDomain=!(!d||d[1]===Sb[1]&&d[2]===Sb[2]&&(d[3]||("http:"===d[1]?"80":"443"))===(Sb[3]||("http:"===Sb[1]?"80":"443")))),l.data&&l.processData&&"string"!=typeof l.data&&(l.data=n.param(l.data,l.traditional)),Ub(Ob,l,c,w),2===u)return w;i=n.event&&l.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!Lb.test(l.type),f=l.url,l.hasContent||(l.data&&(f=l.url+=(Fb.test(f)?"&":"?")+l.data,delete l.data),l.cache===!1&&(l.url=Ib.test(f)?f.replace(Ib,"$1_="+Eb++):f+(Fb.test(f)?"&":"?")+"_="+Eb++)),l.ifModified&&(n.lastModified[f]&&w.setRequestHeader("If-Modified-Since",n.lastModified[f]),n.etag[f]&&w.setRequestHeader("If-None-Match",n.etag[f])),(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&w.setRequestHeader("Content-Type",l.contentType),w.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+("*"!==l.dataTypes[0]?", "+Qb+"; q=0.01":""):l.accepts["*"]);for(e in l.headers)w.setRequestHeader(e,l.headers[e]);if(l.beforeSend&&(l.beforeSend.call(m,w,l)===!1||2===u))return w.abort();v="abort";for(e in{success:1,error:1,complete:1})w[e](l[e]);if(j=Ub(Pb,l,c,w)){if(w.readyState=1,i&&o.trigger("ajaxSend",[w,l]),2===u)return w;l.async&&l.timeout>0&&(h=a.setTimeout(function(){w.abort("timeout")},l.timeout));try{u=1,j.send(s,y)}catch(x){if(!(2>u))throw x;y(-1,x)}}else y(-1,"No Transport");function y(b,c,d,e){var k,s,t,v,x,y=c;2!==u&&(u=2,h&&a.clearTimeout(h),j=void 0,g=e||"",w.readyState=b>0?4:0,k=b>=200&&300>b||304===b,d&&(v=Wb(l,w,d)),v=Xb(l,v,w,k),k?(l.ifModified&&(x=w.getResponseHeader("Last-Modified"),x&&(n.lastModified[f]=x),x=w.getResponseHeader("etag"),x&&(n.etag[f]=x)),204===b||"HEAD"===l.type?y="nocontent":304===b?y="notmodified":(y=v.state,s=v.data,t=v.error,k=!t)):(t=y,!b&&y||(y="error",0>b&&(b=0))),w.status=b,w.statusText=(c||y)+"",k?p.resolveWith(m,[s,y,w]):p.rejectWith(m,[w,y,t]),w.statusCode(r),r=void 0,i&&o.trigger(k?"ajaxSuccess":"ajaxError",[w,l,k?s:t]),q.fireWith(m,[w,y]),i&&(o.trigger("ajaxComplete",[w,l]),--n.active||n.event.trigger("ajaxStop")))}return w},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax(n.extend({url:a,type:b,dataType:e,data:c,success:d},n.isPlainObject(a)&&a))}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){if(n.isFunction(a))return this.each(function(b){n(this).wrapAll(a.call(this,b))});if(this[0]){var b=n(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return n.isFunction(a)?this.each(function(b){n(this).wrapInner(a.call(this,b))}):this.each(function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}});function Yb(a){return a.style&&a.style.display||n.css(a,"display")}function Zb(a){if(!n.contains(a.ownerDocument||d,a))return!0;while(a&&1===a.nodeType){if("none"===Yb(a)||"hidden"===a.type)return!0;a=a.parentNode}return!1}n.expr.filters.hidden=function(a){return l.reliableHiddenOffsets()?a.offsetWidth<=0&&a.offsetHeight<=0&&!a.getClientRects().length:Zb(a)},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var $b=/%20/g,_b=/\[\]$/,ac=/\r?\n/g,bc=/^(?:submit|button|image|reset|file)$/i,cc=/^(?:input|select|textarea|keygen)/i;function dc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||_b.test(a)?d(a,e):dc(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)dc(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)dc(c,a[c],b,e);return d.join("&").replace($b,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&cc.test(this.nodeName)&&!bc.test(a)&&(this.checked||!Z.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(ac,"\r\n")}}):{name:b.name,value:c.replace(ac,"\r\n")}}).get()}}),n.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return this.isLocal?ic():d.documentMode>8?hc():/^(get|post|head|put|delete|options)$/i.test(this.type)&&hc()||ic()}:hc;var ec=0,fc={},gc=n.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in fc)fc[a](void 0,!0)}),l.cors=!!gc&&"withCredentials"in gc,gc=l.ajax=!!gc,gc&&n.ajaxTransport(function(b){if(!b.crossDomain||l.cors){var c;return{send:function(d,e){var f,g=b.xhr(),h=++ec;if(g.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(f in b.xhrFields)g[f]=b.xhrFields[f];b.mimeType&&g.overrideMimeType&&g.overrideMimeType(b.mimeType),b.crossDomain||d["X-Requested-With"]||(d["X-Requested-With"]="XMLHttpRequest");for(f in d)void 0!==d[f]&&g.setRequestHeader(f,d[f]+"");g.send(b.hasContent&&b.data||null),c=function(a,d){var f,i,j;if(c&&(d||4===g.readyState))if(delete fc[h],c=void 0,g.onreadystatechange=n.noop,d)4!==g.readyState&&g.abort();else{j={},f=g.status,"string"==typeof g.responseText&&(j.text=g.responseText);try{i=g.statusText}catch(k){i=""}f||!b.isLocal||b.crossDomain?1223===f&&(f=204):f=j.text?200:404}j&&e(f,i,j,g.getAllResponseHeaders())},b.async?4===g.readyState?a.setTimeout(c):g.onreadystatechange=fc[h]=c:c()},abort:function(){c&&c(void 0,!0)}}}});function hc(){try{return new a.XMLHttpRequest}catch(b){}}function ic(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=d.head||n("head")[0]||d.documentElement;return{send:function(e,f){b=d.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||f(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var jc=[],kc=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=jc.pop()||n.expando+"_"+Eb++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(kc.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&kc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(kc,"$1"+e):b.jsonp!==!1&&(b.url+=(Fb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?n(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,jc.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||d;var e=x.exec(a),f=!c&&[];return e?[b.createElement(e[1])]:(e=ja([a],b,f),f&&f.length&&n(f).remove(),n.merge([],e.childNodes))};var lc=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&lc)return lc.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=n.trim(a.slice(h,a.length)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};function mc(a){return n.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&n.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,n.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,n.contains(b,e)?("undefined"!=typeof e.getBoundingClientRect&&(d=e.getBoundingClientRect()),c=mc(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===n.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(c=a.offset()),c.top+=n.css(a[0],"borderTopWidth",!0),c.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-n.css(d,"marginTop",!0),left:b.left-c.left-n.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Qa})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);n.fn[a]=function(d){return Y(this,function(a,d,e){var f=mc(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?n(f).scrollLeft():e,c?e:n(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Ua(l.pixelPosition,function(a,c){return c?(c=Sa(a,b),Oa.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({
padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return Y(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var nc=a.jQuery,oc=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=oc),b&&a.jQuery===n&&(a.jQuery=nc),n},b||(a.jQuery=a.$=n),n});
|
ajax/libs/react-native-web/0.11.7/vendor/react-native/VirtualizedSectionList/index.js
|
cdnjs/cdnjs
|
function _extends() { _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; }; return _extends.apply(this, arguments); }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
*/
import React from 'react';
import View from '../../../exports/View';
import VirtualizedList from '../VirtualizedList';
import invariant from 'fbjs/lib/invariant';
/**
* Right now this just flattens everything into one list and uses VirtualizedList under the
* hood. The only operation that might not scale well is concatting the data arrays of all the
* sections when new props are received, which should be plenty fast for up to ~10,000 items.
*/
var VirtualizedSectionList =
/*#__PURE__*/
function (_React$PureComponent) {
_inheritsLoose(VirtualizedSectionList, _React$PureComponent);
var _proto = VirtualizedSectionList.prototype;
_proto.scrollToLocation = function scrollToLocation(params) {
var index = params.itemIndex + 1;
for (var ii = 0; ii < params.sectionIndex; ii++) {
index += this.props.sections[ii].data.length + 2;
}
var toIndexParams = _objectSpread({}, params, {
index: index
});
this._listRef.scrollToIndex(toIndexParams);
};
_proto.getListRef = function getListRef() {
return this._listRef;
};
_proto._subExtractor = function _subExtractor(index) {
var itemIndex = index;
var defaultKeyExtractor = this.props.keyExtractor;
for (var ii = 0; ii < this.props.sections.length; ii++) {
var section = this.props.sections[ii];
var key = section.key || String(ii);
itemIndex -= 1; // The section adds an item for the header
if (itemIndex >= section.data.length + 1) {
itemIndex -= section.data.length + 1; // The section adds an item for the footer.
} else if (itemIndex === -1) {
return {
section: section,
key: key + ':header',
index: null,
header: true,
trailingSection: this.props.sections[ii + 1]
};
} else if (itemIndex === section.data.length) {
return {
section: section,
key: key + ':footer',
index: null,
header: false,
trailingSection: this.props.sections[ii + 1]
};
} else {
var keyExtractor = section.keyExtractor || defaultKeyExtractor;
return {
section: section,
key: key + ':' + keyExtractor(section.data[itemIndex], itemIndex),
index: itemIndex,
leadingItem: section.data[itemIndex - 1],
leadingSection: this.props.sections[ii - 1],
trailingItem: section.data[itemIndex + 1],
trailingSection: this.props.sections[ii + 1]
};
}
}
};
_proto._getSeparatorComponent = function _getSeparatorComponent(index, info) {
info = info || this._subExtractor(index);
if (!info) {
return null;
}
var ItemSeparatorComponent = info.section.ItemSeparatorComponent || this.props.ItemSeparatorComponent;
var SectionSeparatorComponent = this.props.SectionSeparatorComponent;
var isLastItemInList = index === this.state.childProps.getItemCount() - 1;
var isLastItemInSection = info.index === info.section.data.length - 1;
if (SectionSeparatorComponent && isLastItemInSection) {
return SectionSeparatorComponent;
}
if (ItemSeparatorComponent && !isLastItemInSection && !isLastItemInList) {
return ItemSeparatorComponent;
}
return null;
};
_proto._computeState = function _computeState(props) {
var offset = props.ListHeaderComponent ? 1 : 0;
var stickyHeaderIndices = [];
var itemCount = props.sections.reduce(function (v, section) {
stickyHeaderIndices.push(v + offset);
return v + section.data.length + 2; // Add two for the section header and footer.
}, 0);
return {
childProps: _objectSpread({}, props, {
renderItem: this._renderItem,
ItemSeparatorComponent: undefined,
// Rendered with renderItem
data: props.sections,
getItemCount: function getItemCount() {
return itemCount;
},
getItem: getItem,
keyExtractor: this._keyExtractor,
onViewableItemsChanged: props.onViewableItemsChanged ? this._onViewableItemsChanged : undefined,
stickyHeaderIndices: props.stickySectionHeadersEnabled ? stickyHeaderIndices : undefined
})
};
};
function VirtualizedSectionList(props, context) {
var _this;
_this = _React$PureComponent.call(this, props, context) || this;
_this._keyExtractor = function (item, index) {
var info = _this._subExtractor(index);
return info && info.key || String(index);
};
_this._convertViewable = function (viewable) {
invariant(viewable.index != null, 'Received a broken ViewToken');
var info = _this._subExtractor(viewable.index);
if (!info) {
return null;
}
var keyExtractor = info.section.keyExtractor || _this.props.keyExtractor;
return _objectSpread({}, viewable, {
index: info.index,
/* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.63 was deployed. To see the error delete this
* comment and run Flow. */
key: keyExtractor(viewable.item, info.index),
section: info.section
});
};
_this._onViewableItemsChanged = function (_ref) {
var viewableItems = _ref.viewableItems,
changed = _ref.changed;
if (_this.props.onViewableItemsChanged) {
_this.props.onViewableItemsChanged({
viewableItems: viewableItems.map(_this._convertViewable, _assertThisInitialized(_assertThisInitialized(_this))).filter(Boolean),
changed: changed.map(_this._convertViewable, _assertThisInitialized(_assertThisInitialized(_this))).filter(Boolean)
});
}
};
_this._renderItem = function (_ref2) {
var item = _ref2.item,
index = _ref2.index;
var info = _this._subExtractor(index);
if (!info) {
return null;
}
var infoIndex = info.index;
if (infoIndex == null) {
var section = info.section;
if (info.header === true) {
var renderSectionHeader = _this.props.renderSectionHeader;
return renderSectionHeader ? renderSectionHeader({
section: section
}) : null;
} else {
var renderSectionFooter = _this.props.renderSectionFooter;
return renderSectionFooter ? renderSectionFooter({
section: section
}) : null;
}
} else {
var renderItem = info.section.renderItem || _this.props.renderItem;
var SeparatorComponent = _this._getSeparatorComponent(index, info);
invariant(renderItem, 'no renderItem!');
return React.createElement(ItemWithSeparator, {
SeparatorComponent: SeparatorComponent,
LeadingSeparatorComponent: infoIndex === 0 ? _this.props.SectionSeparatorComponent : undefined,
cellKey: info.key,
index: infoIndex,
item: item,
leadingItem: info.leadingItem,
leadingSection: info.leadingSection,
onUpdateSeparator: _this._onUpdateSeparator,
prevCellKey: (_this._subExtractor(index - 1) || {}).key,
ref: function ref(_ref3) {
_this._cellRefs[info.key] = _ref3;
},
renderItem: renderItem,
section: info.section,
trailingItem: info.trailingItem,
trailingSection: info.trailingSection
});
}
};
_this._onUpdateSeparator = function (key, newProps) {
var ref = _this._cellRefs[key];
ref && ref.updateSeparatorProps(newProps);
};
_this._cellRefs = {};
_this._captureRef = function (ref) {
/* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This comment
* suppresses an error when upgrading Flow's support for React. To see the
* error delete this comment and run Flow. */
_this._listRef = ref;
};
_this.state = _this._computeState(props);
return _this;
}
_proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) {
this.setState(this._computeState(nextProps));
};
_proto.render = function render() {
return React.createElement(VirtualizedList, _extends({}, this.state.childProps, {
ref: this._captureRef
}));
};
return VirtualizedSectionList;
}(React.PureComponent);
VirtualizedSectionList.defaultProps = _objectSpread({}, VirtualizedList.defaultProps, {
data: []
});
var ItemWithSeparator =
/*#__PURE__*/
function (_React$Component) {
_inheritsLoose(ItemWithSeparator, _React$Component);
function ItemWithSeparator() {
var _this2;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this2 = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_this2.state = {
separatorProps: {
highlighted: false,
leadingItem: _this2.props.item,
leadingSection: _this2.props.leadingSection,
section: _this2.props.section,
trailingItem: _this2.props.trailingItem,
trailingSection: _this2.props.trailingSection
},
leadingSeparatorProps: {
highlighted: false,
leadingItem: _this2.props.leadingItem,
leadingSection: _this2.props.leadingSection,
section: _this2.props.section,
trailingItem: _this2.props.item,
trailingSection: _this2.props.trailingSection
}
};
_this2._separators = {
highlight: function highlight() {
['leading', 'trailing'].forEach(function (s) {
return _this2._separators.updateProps(s, {
highlighted: true
});
});
},
unhighlight: function unhighlight() {
['leading', 'trailing'].forEach(function (s) {
return _this2._separators.updateProps(s, {
highlighted: false
});
});
},
updateProps: function updateProps(select, newProps) {
var _this2$props = _this2.props,
LeadingSeparatorComponent = _this2$props.LeadingSeparatorComponent,
cellKey = _this2$props.cellKey,
prevCellKey = _this2$props.prevCellKey;
if (select === 'leading' && LeadingSeparatorComponent) {
_this2.setState(function (state) {
return {
leadingSeparatorProps: _objectSpread({}, state.leadingSeparatorProps, newProps)
};
});
} else {
_this2.props.onUpdateSeparator(select === 'leading' && prevCellKey || cellKey, newProps);
}
}
};
return _this2;
}
var _proto2 = ItemWithSeparator.prototype;
_proto2.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(props) {
var _this3 = this;
this.setState(function (state) {
return {
separatorProps: _objectSpread({}, _this3.state.separatorProps, {
leadingItem: props.item,
leadingSection: props.leadingSection,
section: props.section,
trailingItem: props.trailingItem,
trailingSection: props.trailingSection
}),
leadingSeparatorProps: _objectSpread({}, _this3.state.leadingSeparatorProps, {
leadingItem: props.leadingItem,
leadingSection: props.leadingSection,
section: props.section,
trailingItem: props.item,
trailingSection: props.trailingSection
})
};
});
};
_proto2.updateSeparatorProps = function updateSeparatorProps(newProps) {
this.setState(function (state) {
return {
separatorProps: _objectSpread({}, state.separatorProps, newProps)
};
});
};
_proto2.render = function render() {
var _this$props = this.props,
LeadingSeparatorComponent = _this$props.LeadingSeparatorComponent,
SeparatorComponent = _this$props.SeparatorComponent,
item = _this$props.item,
index = _this$props.index,
section = _this$props.section;
var element = this.props.renderItem({
item: item,
index: index,
section: section,
separators: this._separators
});
var leadingSeparator = LeadingSeparatorComponent && React.createElement(LeadingSeparatorComponent, this.state.leadingSeparatorProps);
var separator = SeparatorComponent && React.createElement(SeparatorComponent, this.state.separatorProps);
return leadingSeparator || separator ? React.createElement(View, null, leadingSeparator, element, separator) : element;
};
return ItemWithSeparator;
}(React.Component);
function getItem(sections, index) {
if (!sections) {
return null;
}
var itemIdx = index - 1;
for (var ii = 0; ii < sections.length; ii++) {
if (itemIdx === -1 || itemIdx === sections[ii].data.length) {
// We intend for there to be overflow by one on both ends of the list.
// This will be for headers and footers. When returning a header or footer
// item the section itself is the item.
return sections[ii];
} else if (itemIdx < sections[ii].data.length) {
// If we are in the bounds of the list's data then return the item.
return sections[ii].data[itemIdx];
} else {
itemIdx -= sections[ii].data.length + 2; // Add two for the header and footer
}
}
return null;
}
export default VirtualizedSectionList;
|
examples/github-explorer/containers/repos-list.js
|
hetmann/sass-redux-router
|
import React, { Component } from 'react';
import { connect } from 'react-redux';
import Card from 'material-ui/Card/Card';
import CardHeader from 'material-ui/Card/CardHeader';
import CardTitle from 'material-ui/Card/CardTitle';
import CardText from 'material-ui/Card/CardText';
import Search from './search';
import List from './list';
import { fetchRepos } from '../modules/repos/actions';
class Repos extends Component {
componentWillMount() {
const { dispatch } = this.props;
dispatch(fetchRepos());
}
render() {
const { info, repos, results, query } = this.props;
return (
<Card>
<CardHeader
title={info.name}
subtitle={info.username}
avatar={info.avatar_url}
/>
<CardTitle title="Github Explorer" />
<Search/>
<CardText>
<List items={query.length ? results : repos} />
</CardText>
</Card>
);
}
}
function mapStateToProps({ userInformation, repos }) {
return {
info: userInformation.get('info'),
repos: repos.get('all').toJS(),
results: repos.get('results').toJS(),
query: repos.get('query')
}
}
const ConnectedRepos = connect(mapStateToProps)(Repos);
export default ConnectedRepos;
|
actor-apps/app-web/src/app/components/sidebar/ContactsSectionItem.react.js
|
Jeremy-Meng/actor-platform
|
import React from 'react';
import ReactMixin from 'react-mixin';
import addons from 'react/addons';
import DialogActionCreators from 'actions/DialogActionCreators';
import AvatarItem from 'components/common/AvatarItem.react';
const {addons: { PureRenderMixin }} = addons;
@ReactMixin.decorate(PureRenderMixin)
class ContactsSectionItem extends React.Component {
static propTypes = {
contact: React.PropTypes.object
};
constructor(props) {
super(props);
}
openNewPrivateCoversation = () => {
DialogActionCreators.selectDialogPeerUser(this.props.contact.uid);
}
render() {
const contact = this.props.contact;
return (
<li className="sidebar__list__item row" onClick={this.openNewPrivateCoversation}>
<AvatarItem image={contact.avatar}
placeholder={contact.placeholder}
size="small"
title={contact.name}/>
<div className="col-xs">
<span className="title">
{contact.name}
</span>
</div>
</li>
);
}
}
export default ContactsSectionItem;
|
src/components/Welcome.js
|
kangarang/mp-react
|
import React from 'react'
export default props => {
const styles = {
title: {
padding: '0 1em',
border: '3px solid white',
color: '#303030'
},
header: {
color: '#f5ff82',
fontWeight: '300'
}
}
return (
<div style={styles.title}>
<h2 style={styles.header}>
Connect with other users based on your music taste and other preferences
</h2>
<p>
Sign in with Facebook to set up your own profile,
</p>
<p>
or use the demo profile to explore the app (full functionality)
</p>
<br />
<p>
Then, use the top-right Menu bar to navigate about the site and match with other users
</p>
<br />
<p>
For best results, import your favorite artists from your
{' '}
<a
target="_blank"
href="https://accounts.spotify.com/en/authorize?utf8=%E2%9C%93&client_id=ab17781c92324fc8ae01c6796d97285d&response_type=token&scope=user-library-read%20user-follow-read%20playlist-read-private&redirect_uri=https:%2F%2Fwww.songkick.com%2Ftaste_imports%2Fspotify">
Spotify
</a>
{' '}
account into your
{' '}
<a target="_blank" href="https://accounts.songkick.com/signup/">
Songkick
</a>
{' '}
account
</p>
<br />
</div>
)
}
|
src/index.js
|
Junicus/fcc-localweather
|
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import AsyncApp from './containers/AsyncApp';
import store from './store';
import registerServiceWorker from './registerServiceWorker';
import './index.css';
ReactDOM.render(
<Provider store={store}>
<AsyncApp />
</Provider>, document.getElementById('root'));
registerServiceWorker();
|
app/javascript/mastodon/features/standalone/compose/index.js
|
honpya/taketodon
|
import React from 'react';
import ComposeFormContainer from '../../compose/containers/compose_form_container';
import NotificationsContainer from '../../ui/containers/notifications_container';
import LoadingBarContainer from '../../ui/containers/loading_bar_container';
import ModalContainer from '../../ui/containers/modal_container';
export default class Compose extends React.PureComponent {
render () {
return (
<div>
<ComposeFormContainer />
<NotificationsContainer />
<ModalContainer />
<LoadingBarContainer className='loading-bar' />
</div>
);
}
}
|
src/renderers/dom/shared/DOMProperty.js
|
pze/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.
*
* @providesModule DOMProperty
* @typechecks static-only
*/
'use strict';
var invariant = require('invariant');
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.
*
* DOMAttributeNamespaces: object mapping React attribute name to the DOM
* attribute namespace URL. (Attribute names not specified use no namespace.)
*
* DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
* Property names not specified use the normalized name.
*
* DOMMutationMethods: Properties that require special mutation methods. If
* `value` is undefined, the mutation method should unset the property.
*
* @param {object} domPropertyConfig the config as described above.
*/
injectDOMPropertyConfig: function(domPropertyConfig) {
var Injection = DOMPropertyInjection;
var Properties = domPropertyConfig.Properties || {};
var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
if (domPropertyConfig.isCustomAttribute) {
DOMProperty._isCustomAttributeFunctions.push(
domPropertyConfig.isCustomAttribute
);
}
for (var propName in Properties) {
invariant(
!DOMProperty.properties.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
);
var lowerCased = propName.toLowerCase();
var propConfig = Properties[propName];
var propertyInfo = {
attributeName: lowerCased,
attributeNamespace: null,
propertyName: propName,
mutationMethod: null,
mustUseAttribute: checkMask(propConfig, Injection.MUST_USE_ATTRIBUTE),
mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS),
hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
hasPositiveNumericValue:
checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
hasOverloadedBooleanValue:
checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE),
};
invariant(
!propertyInfo.mustUseAttribute || !propertyInfo.mustUseProperty,
'DOMProperty: Cannot require using both attribute and property: %s',
propName
);
invariant(
propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects,
'DOMProperty: Properties that have side effects must use property: %s',
propName
);
invariant(
propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue +
propertyInfo.hasOverloadedBooleanValue <= 1,
'DOMProperty: Value can be one of boolean, overloaded boolean, or ' +
'numeric value, but not a combination: %s',
propName
);
if (__DEV__) {
DOMProperty.getPossibleStandardName[lowerCased] = propName;
}
if (DOMAttributeNames.hasOwnProperty(propName)) {
var attributeName = DOMAttributeNames[propName];
propertyInfo.attributeName = attributeName;
if (__DEV__) {
DOMProperty.getPossibleStandardName[attributeName] = propName;
}
}
if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
}
if (DOMPropertyNames.hasOwnProperty(propName)) {
propertyInfo.propertyName = DOMPropertyNames[propName];
}
if (DOMMutationMethods.hasOwnProperty(propName)) {
propertyInfo.mutationMethod = DOMMutationMethods[propName];
}
DOMProperty.properties[propName] = propertyInfo;
}
},
};
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',
/**
* Map from property "standard name" to an object with info about how to set
* the property in the DOM. Each object contains:
*
* attributeName:
* Used when rendering markup or with `*Attribute()`.
* attributeNamespace
* propertyName:
* Used on DOM node instances. (This includes properties that mutate due to
* external factors.)
* mutationMethod:
* If non-null, used instead of the property or `setAttribute()` after
* initial render.
* mustUseAttribute:
* Whether the property must be accessed and mutated using `*Attribute()`.
* (This includes anything that fails `<propName> in <element>`.)
* mustUseProperty:
* Whether the property must be accessed and mutated as an object property.
* hasSideEffects:
* Whether or not setting a value causes side effects such as triggering
* resources to be loaded or text selection changes. If true, we read from
* the DOM before updating to ensure that the value is only set if it has
* changed.
* hasBooleanValue:
* Whether the property should be removed when set to a falsey value.
* hasNumericValue:
* Whether the property must be numeric or parse as a numeric and should be
* removed when set to a falsey value.
* hasPositiveNumericValue:
* Whether the property must be positive numeric or parse as a positive
* numeric and should be removed when set to a falsey value.
* hasOverloadedBooleanValue:
* Whether the property can be used as a flag as well as with a value.
* Removed when strictly equal to false; present without a value when
* strictly equal to true; present with a value otherwise.
*/
properties: {},
/**
* Mapping from lowercase property names to the properly cased version, used
* to warn in the case of missing properties. Available only in __DEV__.
* @type {Object}
*/
getPossibleStandardName: __DEV__ ? {} : null,
/**
* 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;
|
examples/0-basic/src/components/App.js
|
chikara-chan/react-power
|
import React from 'react'
import styles from './App.scss'
function App() {
return (
<div>
<h1 className={styles.title}>React Power</h1>
</div>
)
}
export default App
|
tests/components/area-series-tests.js
|
Apercu/react-vis
|
import test from 'tape';
import React from 'react';
import {mount} from 'enzyme';
import XYPlot from 'plot/xy-plot';
import AreaSeries from 'plot/series/area-series';
import {testRenderWithProps, GENERIC_XYPLOT_SERIES_PROPS} from '../test-utils';
import AreaChartElevated from '../../showcase/plot/area-chart-elevated';
import AreaChart from '../../showcase/plot/area-chart';
testRenderWithProps(AreaSeries, GENERIC_XYPLOT_SERIES_PROPS);
const AREA_PROPS = {
className: 'area-chart-example',
color: '#12939a',
data: [
{x: 1, y: 5, y0: 6},
{x: 2, y: 20, y0: 11},
{x: 3, y: 10, y0: 9}
]
};
test('AreaSeries: basic rendering', t => {
const $ = mount(
<XYPlot width={300} height={300}>
<AreaSeries {...AREA_PROPS}/>
</XYPlot>
);
t.equal($.find('.rv-xy-plot__series').length, 1, 'should find the right number of series');
t.equal($.find('.rv-xy-plot__series path').length, 1, 'should find the right number of series');
t.equal($.find('.area-chart-example').length, 1, 'should find the right number of custom named series');
$.setProps({children: (<AreaSeries {...{...AREA_PROPS, data: null}}/>)});
t.equal($.find('.rv-xy-plot__series').length, 0, 'should find the right number of series');
t.equal($.find('.rv-xy-plot__series path').length, 0, 'should find the right number of series');
t.equal($.find('.area-chart-example').length, 0, 'should find the right number of custom named series');
t.end();
});
test('AreaSeries: Showcase Example - AreaChart', t => {
const $ = mount(<AreaChart />);
t.equal($.find('.rv-xy-plot__series').length, 1, 'should find the right number of series');
t.equal($.find('path.rv-xy-plot__series').length, 1, 'should find the right number of series');
t.equal($.find('.area-series-example').length, 1, 'should find the right number of custom named series');
t.end();
});
test('AreaSeries: Showcase Example - AreaChartElevated', t => {
const $ = mount(<AreaChartElevated />);
t.equal($.find('.rv-xy-plot__series').length, 5, 'should find the right number of series');
t.equal($.find('path.rv-xy-plot__series').length, 3, 'should find the right number of pathes');
t.equal($.find('.area-elevated-series-1').length, 1, 'should find the first custom component correctly');
t.equal($.find('.area-elevated-series-2').length, 1, 'should find the second custom component correctly');
t.end();
});
|
src/svg-icons/navigation/more-horiz.js
|
xmityaz/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let NavigationMoreHoriz = (props) => (
<SvgIcon {...props}>
<path d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>
</SvgIcon>
);
NavigationMoreHoriz = pure(NavigationMoreHoriz);
NavigationMoreHoriz.displayName = 'NavigationMoreHoriz';
NavigationMoreHoriz.muiName = 'SvgIcon';
export default NavigationMoreHoriz;
|
jenkins-design-language/src/js/components/material-ui/svg-icons/action/settings-input-composite.js
|
alvarolobato/blueocean-plugin
|
import React from 'react';
import SvgIcon from '../../SvgIcon';
const ActionSettingsInputComposite = (props) => (
<SvgIcon {...props}>
<path d="M5 2c0-.55-.45-1-1-1s-1 .45-1 1v4H1v6h6V6H5V2zm4 14c0 1.3.84 2.4 2 2.82V23h2v-4.18c1.16-.41 2-1.51 2-2.82v-2H9v2zm-8 0c0 1.3.84 2.4 2 2.82V23h2v-4.18C6.16 18.4 7 17.3 7 16v-2H1v2zM21 6V2c0-.55-.45-1-1-1s-1 .45-1 1v4h-2v6h6V6h-2zm-8-4c0-.55-.45-1-1-1s-1 .45-1 1v4H9v6h6V6h-2V2zm4 14c0 1.3.84 2.4 2 2.82V23h2v-4.18c1.16-.41 2-1.51 2-2.82v-2h-6v2z"/>
</SvgIcon>
);
ActionSettingsInputComposite.displayName = 'ActionSettingsInputComposite';
ActionSettingsInputComposite.muiName = 'SvgIcon';
export default ActionSettingsInputComposite;
|
ajax/libs/jquery.fancytree/2.18.0/jquery.fancytree-all.min.js
|
CyrusSUEN/cdnjs
|
/*! jQuery Fancytree Plugin - 2.18.0 - 2016-05-02T19:34
* https://github.com/mar10/fancytree
* Copyright (c) 2016 Martin Wendt; Licensed MIT */
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
define( [ "jquery" ], factory );
} else {
factory( jQuery );
}
}(function( $ ) {
!function(a,b,c,d){"use strict";function e(b,c){b||(c=c?": "+c:"",a.error("Fancytree assertion failed"+c))}function f(a,c){var d,e,f=b.console?b.console[a]:null;if(f)try{f.apply(b.console,c)}catch(g){for(e="",d=0;d<c.length;d++)e+=c[d];f(e)}}function g(a){return!(!a.tree||a.statusNodeType===d)}function h(b,c,d,e){var f,g,h,i=a.map(a.trim(b).split("."),function(a){return parseInt(a,10)}),j=a.map(Array.prototype.slice.call(arguments,1),function(a){return parseInt(a,10)});for(f=0;f<j.length;f++)if(g=i[f]||0,h=j[f]||0,g!==h)return g>h;return!0}function i(a,b,c,d,e){var f=function(){var c=b[a],f=d[a],g=b.ext[e],h=function(){return c.apply(b,arguments)},i=function(a){return c.apply(b,a)};return function(){var a=b._local,c=b._super,d=b._superApply;try{return b._local=g,b._super=h,b._superApply=i,f.apply(b,arguments)}finally{b._local=a,b._super=c,b._superApply=d}}}();return f}function j(b,c,d,e){for(var f in d)"function"==typeof d[f]?"function"==typeof b[f]?b[f]=i(f,b,c,d,e):"_"===f.charAt(0)?b.ext[e][f]=i(f,b,c,d,e):a.error("Could not override tree."+f+". Use prefix '_' to create tree."+e+"._"+f):"options"!==f&&(b.ext[e][f]=d[f])}function k(b,c){return b===d?a.Deferred(function(){this.resolve()}).promise():a.Deferred(function(){this.resolveWith(b,c)}).promise()}function l(b,c){return b===d?a.Deferred(function(){this.reject()}).promise():a.Deferred(function(){this.rejectWith(b,c)}).promise()}function m(a,b){return function(){a.resolveWith(b)}}function n(b){var c=a.extend({},b.data()),d=c.json;return delete c.fancytree,delete c.uiFancytree,d&&(delete c.json,c=a.extend(c,d)),c}function o(a){return(""+a).replace(x,function(a){return z[a]})}function p(a){return a=a.toLowerCase(),function(b){return b.title.toLowerCase().indexOf(a)>=0}}function q(a){var b=new RegExp("^"+a,"i");return function(a){return b.test(a.title)}}function r(b,c){var d,f,g,h;for(this.parent=b,this.tree=b.tree,this.ul=null,this.li=null,this.statusNodeType=null,this._isLoading=!1,this._error=null,this.data={},d=0,f=F.length;f>d;d++)g=F[d],this[g]=c[g];c.data&&a.extend(this.data,c.data);for(g in c)G[g]||a.isFunction(c[g])||I[g]||(this.data[g]=c[g]);null==this.key?this.tree.options.defaultKey?(this.key=this.tree.options.defaultKey(this),e(this.key,"defaultKey() must return a unique key")):this.key="_"+v._nextNodeKey++:this.key=""+this.key,c.active&&(e(null===this.tree.activeNode,"only one active node allowed"),this.tree.activeNode=this),c.selected&&(this.tree.lastSelectedNode=this),h=c.children,h?h.length?this._setChildren(h):this.children=this.lazy?[]:null:this.children=null,this.tree._callHook("treeRegisterNode",this.tree,!0,this)}function s(b){this.widget=b,this.$div=b.element,this.options=b.options,this.options&&(a.isFunction(this.options.lazyload)&&!a.isFunction(this.options.lazyLoad)&&(this.options.lazyLoad=function(){return v.warn("The 'lazyload' event is deprecated since 2014-02-25. Use 'lazyLoad' (with uppercase L) instead."),b.options.lazyload.apply(this,arguments)}),a.isFunction(this.options.loaderror)&&a.error("The 'loaderror' event was renamed since 2014-07-03. Use 'loadError' (with uppercase E) instead."),this.options.fx!==d&&v.warn("The 'fx' options was replaced by 'toggleEffect' since 2014-11-30.")),this.ext={},this.data=n(this.$div),this._id=a.ui.fancytree._nextId++,this._ns=".fancytree-"+this._id,this.activeNode=null,this.focusNode=null,this._hasFocus=null,this.lastSelectedNode=null,this.systemFocusElement=null,this.lastQuicksearchTerm="",this.lastQuicksearchTime=0,this.statusClassPropName="span",this.ariaPropName="li",this.nodeContainerAttrName="li",this.$div.find(">ul.fancytree-container").remove();var c,e={tree:this};this.rootNode=new r(e,{title:"root",key:"root_"+this._id,children:null,expanded:!0}),this.rootNode.parent=null,c=a("<ul>",{"class":"ui-fancytree fancytree-container fancytree-plain"}).appendTo(this.$div),this.$container=c,this.rootNode.ul=c[0],null==this.options.debugLevel&&(this.options.debugLevel=v.debugLevel),this.$container.attr("tabindex",this.options.tabindex),this.options.aria&&this.$container.attr("role","tree").attr("aria-multiselectable",!0)}if(a.ui&&a.ui.fancytree)return void a.ui.fancytree.warn("Fancytree: ignored duplicate include");var t,u,v=null,w=new RegExp(/\.|\//),x=/[&<>"'\/]/g,y="$recursive_request",z={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},A={16:!0,17:!0,18:!0},B={8:"backspace",9:"tab",10:"return",13:"return",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",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:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},C={0:"",1:"left",2:"middle",3:"right"},D="active expanded focus folder hideCheckbox lazy selected unselectable".split(" "),E={},F="expanded extraClasses folder hideCheckbox icon key lazy refKey selected statusNodeType title tooltip unselectable".split(" "),G={},H={},I={active:!0,children:!0,data:!0,focus:!0};for(t=0;t<D.length;t++)E[D[t]]=!0;for(t=0;t<F.length;t++)u=F[t],G[u]=!0,u!==u.toLowerCase()&&(H[u.toLowerCase()]=u);e(a.ui,"Fancytree requires jQuery UI (http://jqueryui.com)"),r.prototype={_findDirectChild:function(a){var b,c,d=this.children;if(d)if("string"==typeof a){for(b=0,c=d.length;c>b;b++)if(d[b].key===a)return d[b]}else{if("number"==typeof a)return this.children[a];if(a.parent===this)return a}return null},_setChildren:function(a){e(a&&(!this.children||0===this.children.length),"only init supported"),this.children=[];for(var b=0,c=a.length;c>b;b++)this.children.push(new r(this,a[b]))},addChildren:function(b,c){var d,f,g,h=null,i=[];for(a.isPlainObject(b)&&(b=[b]),this.children||(this.children=[]),d=0,f=b.length;f>d;d++)i.push(new r(this,b[d]));return h=i[0],null==c?this.children=this.children.concat(i):(c=this._findDirectChild(c),g=a.inArray(c,this.children),e(g>=0,"insertBefore must be an existing child"),this.children.splice.apply(this.children,[g,0].concat(i))),(!this.parent||this.parent.ul||this.tr)&&this.render(),3===this.tree.options.selectMode&&this.fixSelection3FromEndNodes(),h},addClass:function(a){return this.toggleClass(a,!0)},addNode:function(a,b){switch(b!==d&&"over"!==b||(b="child"),b){case"after":return this.getParent().addChildren(a,this.getNextSibling());case"before":return this.getParent().addChildren(a,this);case"firstChild":var c=this.children?this.children[0]:null;return this.addChildren(a,c);case"child":case"over":return this.addChildren(a)}e(!1,"Invalid mode: "+b)},addPagingNode:function(b,c){var d,e;if(c=c||"child",b===!1){for(d=this.children.length-1;d>=0;d--)e=this.children[d],"paging"===e.statusNodeType&&this.removeChild(e);return void(this.partload=!1)}return b=a.extend({title:this.tree.options.strings.moreData,statusNodeType:"paging",icon:!1},b),this.partload=!0,this.addNode(b,c)},appendSibling:function(a){return this.addNode(a,"after")},applyPatch:function(b){if(null===b)return this.remove(),k(this);var c,d,e,f={children:!0,expanded:!0,parent:!0};for(c in b)e=b[c],f[c]||a.isFunction(e)||(G[c]?this[c]=e:this.data[c]=e);return b.hasOwnProperty("children")&&(this.removeChildren(),b.children&&this._setChildren(b.children)),this.isVisible()&&(this.renderTitle(),this.renderStatus()),d=b.hasOwnProperty("expanded")?this.setExpanded(b.expanded):k(this)},collapseSiblings:function(){return this.tree._callHook("nodeCollapseSiblings",this)},copyTo:function(a,b,c){return a.addNode(this.toDict(!0,c),b)},countChildren:function(a){var b,c,d,e=this.children;if(!e)return 0;if(d=e.length,a!==!1)for(b=0,c=d;c>b;b++)d+=e[b].countChildren();return d},debug:function(a){this.tree.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),f("log",arguments))},discard:function(){return this.warn("FancytreeNode.discard() is deprecated since 2014-02-16. Use .resetLazy() instead."),this.resetLazy()},discardMarkup:function(a){var b=a?"nodeRemoveMarkup":"nodeRemoveChildMarkup";this.tree._callHook(b,this)},findAll:function(b){b=a.isFunction(b)?b:p(b);var c=[];return this.visit(function(a){b(a)&&c.push(a)}),c},findFirst:function(b){b=a.isFunction(b)?b:p(b);var c=null;return this.visit(function(a){return b(a)?(c=a,!1):void 0}),c},_changeSelectStatusAttrs:function(a){var b=!1;switch(a){case!1:b=this.selected||this.partsel,this.selected=!1,this.partsel=!1;break;case!0:b=!this.selected||!this.partsel,this.selected=!0,this.partsel=!0;break;case d:b=this.selected||!this.partsel,this.selected=!1,this.partsel=!0;break;default:e(!1,"invalid state: "+a)}return b&&this.renderStatus(),b},fixSelection3AfterClick:function(){var a=this.isSelected();this.visit(function(b){b._changeSelectStatusAttrs(a)}),this.fixSelection3FromEndNodes()},fixSelection3FromEndNodes:function(){function a(b){var c,e,f,g,h,i,j,k=b.children;if(k&&k.length){for(i=!0,j=!1,c=0,e=k.length;e>c;c++)f=k[c],g=a(f),g!==!1&&(j=!0),g!==!0&&(i=!1);h=i?!0:j?d:!1}else h=!!b.selected;return b._changeSelectStatusAttrs(h),h}e(3===this.tree.options.selectMode,"expected selectMode 3"),a(this),this.visitParents(function(a){var b,c,e,f,g=a.children,h=!0,i=!1;for(b=0,c=g.length;c>b;b++)e=g[b],(e.selected||e.partsel)&&(i=!0),e.unselectable||e.selected||(h=!1);f=h?!0:i?d:!1,a._changeSelectStatusAttrs(f)})},fromDict:function(b){for(var c in b)G[c]?this[c]=b[c]:"data"===c?a.extend(this.data,b.data):a.isFunction(b[c])||I[c]||(this.data[c]=b[c]);b.children&&(this.removeChildren(),this.addChildren(b.children)),this.renderTitle()},getChildren:function(){return this.hasChildren()===d?d:this.children},getFirstChild:function(){return this.children?this.children[0]:null},getIndex:function(){return a.inArray(this,this.parent.children)},getIndexHier:function(b,c){b=b||".";var d,e=[];return a.each(this.getParentList(!1,!0),function(a,b){d=""+(b.getIndex()+1),c&&(d=("0000000"+d).substr(-c)),e.push(d)}),e.join(b)},getKeyPath:function(a){var b=[],c=this.tree.options.keyPathSeparator;return this.visitParents(function(a){a.parent&&b.unshift(a.key)},!a),c+b.join(c)},getLastChild:function(){return this.children?this.children[this.children.length-1]:null},getLevel:function(){for(var a=0,b=this.parent;b;)a++,b=b.parent;return a},getNextSibling:function(){if(this.parent){var a,b,c=this.parent.children;for(a=0,b=c.length-1;b>a;a++)if(c[a]===this)return c[a+1]}return null},getParent:function(){return this.parent},getParentList:function(a,b){for(var c=[],d=b?this:this.parent;d;)(a||d.parent)&&c.unshift(d),d=d.parent;return c},getPrevSibling:function(){if(this.parent){var a,b,c=this.parent.children;for(a=1,b=c.length;b>a;a++)if(c[a]===this)return c[a-1]}return null},getSelectedNodes:function(a){var b=[];return this.visit(function(c){return c.selected&&(b.push(c),a===!0)?"skip":void 0}),b},hasChildren:function(){return this.lazy?null==this.children?d:0===this.children.length?!1:1===this.children.length&&this.children[0].isStatusNode()?d:!0:!(!this.children||!this.children.length)},hasFocus:function(){return this.tree.hasFocus()&&this.tree.focusNode===this},info:function(a){this.tree.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),f("info",arguments))},isActive:function(){return this.tree.activeNode===this},isChildOf:function(a){return this.parent&&this.parent===a},isDescendantOf:function(a){if(!a||a.tree!==this.tree)return!1;for(var b=this.parent;b;){if(b===a)return!0;b=b.parent}return!1},isExpanded:function(){return!!this.expanded},isFirstSibling:function(){var a=this.parent;return!a||a.children[0]===this},isFolder:function(){return!!this.folder},isLastSibling:function(){var a=this.parent;return!a||a.children[a.children.length-1]===this},isLazy:function(){return!!this.lazy},isLoaded:function(){return!this.lazy||this.hasChildren()!==d},isLoading:function(){return!!this._isLoading},isRoot:function(){return this.isRootNode()},isPartload:function(){return!!this.partload},isRootNode:function(){return this.tree.rootNode===this},isSelected:function(){return!!this.selected},isStatusNode:function(){return!!this.statusNodeType},isPagingNode:function(){return"paging"===this.statusNodeType},isTopLevel:function(){return this.tree.rootNode===this.parent},isUndefined:function(){return this.hasChildren()===d},isVisible:function(){var a,b,c=this.getParentList(!1,!1);for(a=0,b=c.length;b>a;a++)if(!c[a].expanded)return!1;return!0},lazyLoad:function(a){return this.warn("FancytreeNode.lazyLoad() is deprecated since 2014-02-16. Use .load() instead."),this.load(a)},load:function(a){var b,c,d=this;return e(this.isLazy(),"load() requires a lazy node"),a||this.isUndefined()?(this.isLoaded()&&this.resetLazy(),c=this.tree._triggerNodeEvent("lazyLoad",this),c===!1?k(this):(e("boolean"!=typeof c,"lazyLoad event must return source in data.result"),b=this.tree._callHook("nodeLoadChildren",this,c),this.expanded&&b.always(function(){d.render()}),b)):k(this)},makeVisible:function(b){var c,d=this,e=[],f=new a.Deferred,g=this.getParentList(!1,!1),h=g.length,i=!(b&&b.noAnimation===!0),j=!(b&&b.scrollIntoView===!1);for(c=h-1;c>=0;c--)e.push(g[c].setExpanded(!0,b));return a.when.apply(a,e).done(function(){j?d.scrollIntoView(i).done(function(){f.resolve()}):f.resolve()}),f.promise()},moveTo:function(b,c,f){c===d||"over"===c?c="child":"firstChild"===c&&(b.children&&b.children.length?(c="before",b=b.children[0]):c="child");var g,h=this.parent,i="child"===c?b:b.parent;if(this!==b){if(this.parent?i.isDescendantOf(this)&&a.error("Cannot move a node to its own descendant"):a.error("Cannot move system root"),1===this.parent.children.length){if(this.parent===i)return;this.parent.children=this.parent.lazy?[]:null,this.parent.expanded=!1}else g=a.inArray(this,this.parent.children),e(g>=0,"invalid source parent"),this.parent.children.splice(g,1);if(this.parent=i,i.hasChildren())switch(c){case"child":i.children.push(this);break;case"before":g=a.inArray(b,i.children),e(g>=0,"invalid target parent"),i.children.splice(g,0,this);break;case"after":g=a.inArray(b,i.children),e(g>=0,"invalid target parent"),i.children.splice(g+1,0,this);break;default:a.error("Invalid mode "+c)}else i.children=[this];f&&b.visit(f,!0),this.tree!==b.tree&&(this.warn("Cross-tree moveTo is experimantal!"),this.visit(function(a){a.tree=b.tree},!0)),h.isDescendantOf(i)||h.render(),i.isDescendantOf(h)||i===h||i.render()}},navigate:function(b,c){function d(d){if(d){try{d.makeVisible()}catch(e){}return a(d.span).is(":visible")?c===!1?d.setFocus():d.setActive():(d.debug("Navigate: skipping hidden node"),void d.navigate(b,c))}}var e,f,g,h=!0,i=a.ui.keyCode,j=null;switch(b){case i.BACKSPACE:this.parent&&this.parent.parent&&(g=d(this.parent));break;case i.LEFT:this.expanded?(this.setExpanded(!1),g=d(this)):this.parent&&this.parent.parent&&(g=d(this.parent));break;case i.RIGHT:this.expanded||!this.children&&!this.lazy?this.children&&this.children.length&&(g=d(this.children[0])):(this.setExpanded(),g=d(this));break;case i.UP:for(j=this.getPrevSibling();j&&!a(j.span).is(":visible");)j=j.getPrevSibling();for(;j&&j.expanded&&j.children&&j.children.length;)j=j.children[j.children.length-1];!j&&this.parent&&this.parent.parent&&(j=this.parent),g=d(j);break;case i.DOWN:if(this.expanded&&this.children&&this.children.length)j=this.children[0];else for(f=this.getParentList(!1,!0),e=f.length-1;e>=0;e--){for(j=f[e].getNextSibling();j&&!a(j.span).is(":visible");)j=j.getNextSibling();if(j)break}g=d(j);break;default:h=!1}return g||k()},remove:function(){return this.parent.removeChild(this)},removeChild:function(a){return this.tree._callHook("nodeRemoveChild",this,a)},removeChildren:function(){return this.tree._callHook("nodeRemoveChildren",this)},removeClass:function(a){return this.toggleClass(a,!1)},render:function(a,b){return this.tree._callHook("nodeRender",this,a,b)},renderTitle:function(){return this.tree._callHook("nodeRenderTitle",this)},renderStatus:function(){return this.tree._callHook("nodeRenderStatus",this)},replaceWith:function(b){var c,d=this.parent,f=a.inArray(this,d.children),g=this;return e(this.isPagingNode(),"replaceWith() currently requires a paging status node"),c=this.tree._callHook("nodeLoadChildren",this,b),c.done(function(a){var b=g.children;for(t=0;t<b.length;t++)b[t].parent=d;d.children.splice.apply(d.children,[f+1,0].concat(b)),g.children=null,g.remove(),d.render()}).fail(function(){g.setExpanded()}),c},resetLazy:function(){this.removeChildren(),this.expanded=!1,this.lazy=!0,this.children=d,this.renderStatus()},scheduleAction:function(b,c){this.tree.timer&&clearTimeout(this.tree.timer),this.tree.timer=null;var d=this;switch(b){case"cancel":break;case"expand":this.tree.timer=setTimeout(function(){d.tree.debug("setTimeout: trigger expand"),d.setExpanded(!0)},c);break;case"activate":this.tree.timer=setTimeout(function(){d.tree.debug("setTimeout: trigger activate"),d.setActive(!0)},c);break;default:a.error("Invalid mode "+b)}},scrollIntoView:function(f,h){h!==d&&g(h)&&(this.warn("scrollIntoView() with 'topNode' option is deprecated since 2014-05-08. Use 'options.topNode' instead."),h={topNode:h});var i,j,l,m,n=a.extend({effects:f===!0?{duration:200,queue:!1}:f,scrollOfs:this.tree.options.scrollOfs,scrollParent:this.tree.options.scrollParent||this.tree.$container,topNode:null},h),o=new a.Deferred,p=this,q=a(this.span).height(),r=a(n.scrollParent),s=n.scrollOfs.top||0,t=n.scrollOfs.bottom||0,u=r.height(),v=r.scrollTop(),w=r,x=r[0]===b,y=n.topNode||null,z=null;return a(this.span).is(":visible")?(x?(j=a(this.span).offset().top,i=y&&y.span?a(y.span).offset().top:0,w=a("html,body")):(e(r[0]!==c&&r[0]!==c.body,"scrollParent should be a simple element or `window`, not document or body."),m=r.offset().top,j=a(this.span).offset().top-m+v,i=y?a(y.span).offset().top-m+v:0,l=Math.max(0,r.innerHeight()-r[0].clientHeight),u-=l),v+s>j?z=j-s:j+q>v+u-t&&(z=j+q-u+t,y&&(e(y.isRootNode()||a(y.span).is(":visible"),"topNode must be visible"),z>i&&(z=i-s))),null!==z?n.effects?(n.effects.complete=function(){o.resolveWith(p)},w.stop(!0).animate({scrollTop:z},n.effects)):(w[0].scrollTop=z,o.resolveWith(this)):o.resolveWith(this),o.promise()):(this.warn("scrollIntoView(): node is invisible."),k())},setActive:function(a,b){return this.tree._callHook("nodeSetActive",this,a,b)},setExpanded:function(a,b){return this.tree._callHook("nodeSetExpanded",this,a,b)},setFocus:function(a){return this.tree._callHook("nodeSetFocus",this,a)},setSelected:function(a){return this.tree._callHook("nodeSetSelected",this,a)},setStatus:function(a,b,c){return this.tree._callHook("nodeSetStatus",this,a,b,c)},setTitle:function(a){this.title=a,this.renderTitle()},sortChildren:function(a,b){var c,d,e=this.children;if(e){if(a=a||function(a,b){var c=a.title.toLowerCase(),d=b.title.toLowerCase();return c===d?0:c>d?1:-1},e.sort(a),b)for(c=0,d=e.length;d>c;c++)e[c].children&&e[c].sortChildren(a,"$norender$");"$norender$"!==b&&this.render()}},toDict:function(b,c){var d,e,f,g={},h=this;if(a.each(F,function(a,b){(h[b]||h[b]===!1)&&(g[b]=h[b])}),a.isEmptyObject(this.data)||(g.data=a.extend({},this.data),a.isEmptyObject(g.data)&&delete g.data),c&&c(g,h),b&&this.hasChildren())for(g.children=[],d=0,e=this.children.length;e>d;d++)f=this.children[d],f.isStatusNode()||g.children.push(f.toDict(!0,c));return g},toggleClass:function(b,c){var e,f,g=/\S+/g,h=b.match(g)||[],i=0,j=!1,k=this[this.tree.statusClassPropName],l=" "+(this.extraClasses||"")+" ";for(k&&a(k).toggleClass(b,c);e=h[i++];)if(f=l.indexOf(" "+e+" ")>=0,c=c===d?!f:!!c)f||(l+=e+" ",j=!0);else for(;l.indexOf(" "+e+" ")>-1;)l=l.replace(" "+e+" "," ");return this.extraClasses=a.trim(l),j},toggleExpanded:function(){return this.tree._callHook("nodeToggleExpanded",this)},toggleSelected:function(){return this.tree._callHook("nodeToggleSelected",this)},toString:function(){return"<FancytreeNode(#"+this.key+", '"+this.title+"')>"},visit:function(a,b){var c,d,e=!0,f=this.children;if(b===!0&&(e=a(this),e===!1||"skip"===e))return e;if(f)for(c=0,d=f.length;d>c&&(e=f[c].visit(a,!0),e!==!1);c++);return e},visitAndLoad:function(b,c,d){var e,f,g,h=this;return b&&c===!0&&(f=b(h),f===!1||"skip"===f)?d?f:k():h.children||h.lazy?(e=new a.Deferred,g=[],h.load().done(function(){for(var c=0,d=h.children.length;d>c;c++){if(f=h.children[c].visitAndLoad(b,!0,!0),f===!1){e.reject();break}"skip"!==f&&g.push(f)}a.when.apply(this,g).then(function(){e.resolve()})}),e.promise()):k()},visitParents:function(a,b){if(b&&a(this)===!1)return!1;for(var c=this.parent;c;){if(a(c)===!1)return!1;c=c.parent}return!0},warn:function(a){Array.prototype.unshift.call(arguments,this.toString()),f("warn",arguments)}},s.prototype={_makeHookContext:function(b,c,e){var f,g;return b.node!==d?(c&&b.originalEvent!==c&&a.error("invalid args"),f=b):b.tree?(g=b.tree,f={node:b,tree:g,widget:g.widget,options:g.widget.options,originalEvent:c}):b.widget?f={node:null,tree:b,widget:b.widget,options:b.widget.options,originalEvent:c}:a.error("invalid args"),e&&a.extend(f,e),f},_callHook:function(b,c,d){var e=this._makeHookContext(c),f=this[b],g=Array.prototype.slice.call(arguments,2);return a.isFunction(f)||a.error("_callHook('"+b+"') is not a function"),g.unshift(e),f.apply(this,g)},_requireExtension:function(b,c,d,f){d=!!d;var g=this._local.name,h=this.options.extensions,i=a.inArray(b,h)<a.inArray(g,h),j=c&&null==this.ext[b],k=!j&&null!=d&&d!==i;return e(g&&g!==b,"invalid or same name"),j||k?(f||(j||c?(f="'"+g+"' extension requires '"+b+"'",k&&(f+=" to be registered "+(d?"before":"after")+" itself")):f="If used together, `"+b+"` must be registered "+(d?"before":"after")+" `"+g+"`"),a.error(f),!1):!0},activateKey:function(a){var b=this.getNodeByKey(a);return b?b.setActive():this.activeNode&&this.activeNode.setActive(!1),b},addPagingNode:function(a,b){return this.rootNode.addPagingNode(a,b)},applyPatch:function(b){var c,d,f,g,h,i,j=b.length,k=[];for(d=0;j>d;d++)f=b[d],e(2===f.length,"patchList must be an array of length-2-arrays"),g=f[0],h=f[1],i=null===g?this.rootNode:this.getNodeByKey(g),i?(c=new a.Deferred,k.push(c),i.applyPatch(h).always(m(c,i))):this.warn("could not find node with key '"+g+"'");return a.when.apply(a,k).promise()},clear:function(a){this._callHook("treeClear",this)},count:function(){return this.rootNode.countChildren()},debug:function(a){this.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),f("log",arguments))},findAll:function(a){return this.rootNode.findAll(a)},findFirst:function(a){return this.rootNode.findFirst(a)},findNextNode:function(b,c,d){var e=null,f=c.parent.children,g=null,h=function(a,b,c){var d,e,f=a.children,g=f.length,i=f[b];if(i&&c(i)===!1)return!1;if(i&&i.children&&i.expanded&&h(i,0,c)===!1)return!1;for(d=b+1;g>d;d++)if(h(a,d,c)===!1)return!1;return e=a.parent,e?h(e,e.children.indexOf(a)+1,c):h(a,0,c)};return b="string"==typeof b?q(b):b,c=c||this.getFirstChild(),h(c.parent,f.indexOf(c),function(d){return d===e?!1:(e=e||d,a(d.span).is(":visible")?b(d)&&(g=d,g!==c)?!1:void 0:void d.debug("quicksearch: skipping hidden node"))}),g},generateFormElements:function(b,c,d){d=d||{};var e,f="string"==typeof b?b:"ft_"+this._id+"[]",g="string"==typeof c?c:"ft_"+this._id+"_active",h="fancytree_result_"+this._id,i=a("#"+h),j=3===this.options.selectMode&&d.stopOnParents!==!1;i.length?i.empty():i=a("<div>",{id:h}).hide().insertAfter(this.$container),b!==!1&&(e=this.getSelectedNodes(j),a.each(e,function(b,c){i.append(a("<input>",{type:"checkbox",name:f,value:c.key,checked:!0}))})),c!==!1&&this.activeNode&&i.append(a("<input>",{type:"radio",name:g,value:this.activeNode.key,checked:!0}))},getActiveNode:function(){return this.activeNode},getFirstChild:function(){return this.rootNode.getFirstChild()},getFocusNode:function(){return this.focusNode},getNodeByKey:function(a,b){var d,e;return!b&&(d=c.getElementById(this.options.idPrefix+a))?d.ftnode?d.ftnode:null:(b=b||this.rootNode,e=null,b.visit(function(b){return b.key===a?(e=b,!1):void 0},!0),e)},getRootNode:function(){return this.rootNode},getSelectedNodes:function(a){return this.rootNode.getSelectedNodes(a)},hasFocus:function(){return!!this._hasFocus},info:function(a){this.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),f("info",arguments))},loadKeyPath:function(b,c,e){function f(a,b,d){c.call(r,b,"loading"),b.load().done(function(){r.loadKeyPath.call(r,l[a],c,b).always(m(d,r))}).fail(function(e){r.warn("loadKeyPath: error loading: "+a+" (parent: "+o+")"),c.call(r,b,"error"),d.reject()})}var g,h,i,j,k,l,n,o,p,q=this.options.keyPathSeparator,r=this;for(c=c||a.noop,a.isArray(b)||(b=[b]),l={},i=0;i<b.length;i++)for(o=e||this.rootNode,j=b[i],j.charAt(0)===q&&(j=j.substr(1)),p=j.split(q);p.length;){if(k=p.shift(),n=o._findDirectChild(k),!n){this.warn("loadKeyPath: key not found: "+k+" (parent: "+o+")"),c.call(this,k,"error");break}if(0===p.length){c.call(this,n,"ok");break}if(n.lazy&&n.hasChildren()===d){c.call(this,n,"loaded"),l[k]?l[k].push(p.join(q)):l[k]=[p.join(q)];break}c.call(this,n,"loaded"),o=n}g=[];for(k in l)n=o._findDirectChild(k),h=new a.Deferred,g.push(h),f(k,n,h);return a.when.apply(a,g).promise()},reactivate:function(a){var b,c=this.activeNode;return c?(this.activeNode=null,b=c.setActive(!0,{noFocus:!0}),a&&c.setFocus(),b):k()},reload:function(a){return this._callHook("treeClear",this),this._callHook("treeLoad",this,a)},render:function(a,b){return this.rootNode.render(a,b)},setFocus:function(a){return this._callHook("treeSetFocus",this,a)},toDict:function(a,b){var c=this.rootNode.toDict(!0,b);return a?c:c.children},toString:function(){return"<Fancytree(#"+this._id+")>"},_triggerNodeEvent:function(a,b,c,e){var f=this._makeHookContext(b,c,e),g=this.widget._trigger(a,c,f);return g!==!1&&f.result!==d?f.result:g},_triggerTreeEvent:function(a,b,c){var e=this._makeHookContext(this,b,c),f=this.widget._trigger(a,b,e);return f!==!1&&e.result!==d?e.result:f},visit:function(a){return this.rootNode.visit(a,!1)},warn:function(a){Array.prototype.unshift.call(arguments,this.toString()),f("warn",arguments)}},a.extend(s.prototype,{nodeClick:function(a){var b,c,d=a.targetType,e=a.node;if("expander"===d){if(e.isLoading())return void e.debug("Got 2nd click while loading: ignored");this._callHook("nodeToggleExpanded",a)}else if("checkbox"===d)this._callHook("nodeToggleSelected",a),a.options.focusOnSelect&&this._callHook("nodeSetFocus",a,!0);else{if(c=!1,b=!0,e.folder)switch(a.options.clickFolderMode){case 2:c=!0,b=!1;break;case 3:b=!0,c=!0}b&&(this.nodeSetFocus(a),this._callHook("nodeSetActive",a,!0)),c&&this._callHook("nodeToggleExpanded",a)}},nodeCollapseSiblings:function(a,b){var c,d,e,f=a.node;if(f.parent)for(c=f.parent.children,d=0,e=c.length;e>d;d++)c[d]!==f&&c[d].expanded&&this._callHook("nodeSetExpanded",c[d],!1,b)},nodeDblclick:function(a){"title"===a.targetType&&4===a.options.clickFolderMode&&this._callHook("nodeToggleExpanded",a),"title"===a.targetType&&a.originalEvent.preventDefault()},nodeKeydown:function(b){var c,d,e,f,g=b.originalEvent,h=b.node,i=b.tree,j=b.options,k=g.which,l=String.fromCharCode(k),m=!(g.altKey||g.ctrlKey||g.metaKey||g.shiftKey),n=a(g.target),o=!0,p=!(g.ctrlKey||!j.autoActivate);if(h||(f=this.getActiveNode()||this.getFirstChild(),f&&(f.setFocus(),h=b.node=this.focusNode,h.debug("Keydown force focus on active node"))),j.quicksearch&&m&&/\w/.test(l)&&!n.is(":input:enabled"))return d=(new Date).getTime(),d-i.lastQuicksearchTime>500&&(i.lastQuicksearchTerm=""),i.lastQuicksearchTime=d,i.lastQuicksearchTerm+=l,c=i.findNextNode(i.lastQuicksearchTerm,i.getActiveNode()),c&&c.setActive(),void g.preventDefault();switch(v.eventToString(g)){case"+":case"=":i.nodeSetExpanded(b,!0);break;case"-":i.nodeSetExpanded(b,!1);break;case"space":h.isPagingNode()?i._triggerNodeEvent("clickPaging",b,g):j.checkbox?i.nodeToggleSelected(b):i.nodeSetActive(b,!0);break;case"return":i.nodeSetActive(b,!0);break;case"backspace":case"left":case"right":case"up":case"down":e=h.navigate(g.which,p);break;default:o=!1}o&&g.preventDefault()},nodeLoadChildren:function(b,c){var d,f,g,h=b.tree,i=b.node,j=(new Date).getTime();return a.isFunction(c)&&(c=c.call(h,{type:"source"},b),e(!a.isFunction(c),"source callback must not return another function")),c.url&&(i._requestId&&i.warn("Recursive load request #"+j+" while #"+i._requestId+" is pending."),d=a.extend({},b.options.ajax,c),i._requestId=j,d.debugDelay?(f=d.debugDelay,a.isArray(f)&&(f=f[0]+Math.random()*(f[1]-f[0])),i.warn("nodeLoadChildren waiting debugDelay "+Math.round(f)+" ms ..."),d.debugDelay=!1,g=a.Deferred(function(b){setTimeout(function(){a.ajax(d).done(function(){b.resolveWith(this,arguments)}).fail(function(){b.rejectWith(this,arguments)})},f)})):g=a.ajax(d),c=new a.Deferred,g.done(function(d,e,f){var g,k;if("json"!==this.dataType&&"jsonp"!==this.dataType||"string"!=typeof d||a.error("Ajax request returned a string (did you get the JSON dataType wrong?)."),i._requestId&&i._requestId>j)return void c.rejectWith(this,[y]);if(b.options.postProcess){try{k=h._triggerNodeEvent("postProcess",b,b.originalEvent,{response:d,error:null,dataType:this.dataType})}catch(l){k={error:l,message:""+l,details:"postProcess failed"}}if(k.error)return g=a.isPlainObject(k.error)?k.error:{message:k.error},g=h._makeHookContext(i,null,g),void c.rejectWith(this,[g]);d=a.isArray(k)?k:d}else d&&d.hasOwnProperty("d")&&b.options.enableAspx&&(d="string"==typeof d.d?a.parseJSON(d.d):d.d);c.resolveWith(this,[d])}).fail(function(a,b,d){var e=h._makeHookContext(i,null,{error:a,args:Array.prototype.slice.call(arguments),message:d,details:a.status+": "+d});c.rejectWith(this,[e])})),a.isFunction(c.then)&&a.isFunction(c["catch"])&&(g=c,c=new a.Deferred,g.then(function(a){c.resolve(a)},function(a){c.reject(a)})),a.isFunction(c.promise)&&(h.nodeSetStatus(b,"loading"),c.done(function(a){h.nodeSetStatus(b,"ok"),i._requestId=null}).fail(function(a){var c;return a===y?void i.warn("Ignored response for obsolete load request #"+j+" (expected #"+i._requestId+")"):(a.node&&a.error&&a.message?c=a:(c=h._makeHookContext(i,null,{error:a,args:Array.prototype.slice.call(arguments),message:a?a.message||a.toString():""}),"[object Object]"===c.message&&(c.message="")),i.warn("Load children failed ("+c.message+")",c),void(h._triggerNodeEvent("loadError",c,null)!==!1&&h.nodeSetStatus(b,"error",c.message,c.details)))})),a.when(c).done(function(b){var c;a.isPlainObject(b)&&(e(i.isRootNode(),"source may only be an object for root nodes (expecting an array of child objects otherwise)"),e(a.isArray(b.children),"if an object is passed as source, it must contain a 'children' array (all other properties are added to 'tree.data')"),c=b,b=b.children,delete c.children,a.extend(h.data,c)),e(a.isArray(b),"expected array of children"),i._setChildren(b),h._triggerNodeEvent("loadChildren",i)})},nodeLoadKeyPath:function(a,b){},nodeRemoveChild:function(b,c){var d,f=b.node,g=b.options,h=a.extend({},b,{node:c}),i=f.children;return 1===i.length?(e(c===i[0],"invalid single child"),this.nodeRemoveChildren(b)):(this.activeNode&&(c===this.activeNode||this.activeNode.isDescendantOf(c))&&this.activeNode.setActive(!1),this.focusNode&&(c===this.focusNode||this.focusNode.isDescendantOf(c))&&(this.focusNode=null),this.nodeRemoveMarkup(h),this.nodeRemoveChildren(h),d=a.inArray(c,i),e(d>=0,"invalid child"),c.visit(function(a){a.parent=null},!0),this._callHook("treeRegisterNode",this,!1,c),g.removeNode&&g.removeNode.call(b.tree,{type:"removeNode"},h),void i.splice(d,1))},nodeRemoveChildMarkup:function(b){var c=b.node;c.ul&&(c.isRootNode()?a(c.ul).empty():(a(c.ul).remove(),c.ul=null),c.visit(function(a){a.li=a.ul=null}))},nodeRemoveChildren:function(b){var c,d=b.tree,e=b.node,f=e.children,g=b.options;f&&(this.activeNode&&this.activeNode.isDescendantOf(e)&&this.activeNode.setActive(!1),this.focusNode&&this.focusNode.isDescendantOf(e)&&(this.focusNode=null),
this.nodeRemoveChildMarkup(b),c=a.extend({},b),e.visit(function(a){a.parent=null,d._callHook("treeRegisterNode",d,!1,a),g.removeNode&&(c.node=a,g.removeNode.call(b.tree,{type:"removeNode"},c))}),e.lazy?e.children=[]:e.children=null,e.isRootNode()||(e.expanded=!1),this.nodeRenderStatus(b))},nodeRemoveMarkup:function(b){var c=b.node;c.li&&(a(c.li).remove(),c.li=null),this.nodeRemoveChildMarkup(b)},nodeRender:function(b,d,f,g,h){var i,j,k,l,m,n,o,p=b.node,q=b.tree,r=b.options,s=r.aria,t=!1,u=p.parent,v=!u,w=p.children,x=null;if(v||u.ul){if(e(v||u.ul,"parent UL must exist"),v||(p.li&&(d||p.li.parentNode!==p.parent.ul)&&(p.li.parentNode===p.parent.ul?x=p.li.nextSibling:this.debug("Unlinking "+p+" (must be child of "+p.parent+")"),this.nodeRemoveMarkup(b)),p.li?this.nodeRenderStatus(b):(t=!0,p.li=c.createElement("li"),p.li.ftnode=p,p.key&&r.generateIds&&(p.li.id=r.idPrefix+p.key),p.span=c.createElement("span"),p.span.className="fancytree-node",s&&a(p.span).attr("aria-labelledby","ftal_"+r.idPrefix+p.key),p.li.appendChild(p.span),this.nodeRenderTitle(b),r.createNode&&r.createNode.call(q,{type:"createNode"},b)),r.renderNode&&r.renderNode.call(q,{type:"renderNode"},b)),w){if(v||p.expanded||f===!0){for(p.ul||(p.ul=c.createElement("ul"),(g!==!0||h)&&p.expanded||(p.ul.style.display="none"),s&&a(p.ul).attr("role","group"),p.li?p.li.appendChild(p.ul):p.tree.$div.append(p.ul)),l=0,m=w.length;m>l;l++)o=a.extend({},b,{node:w[l]}),this.nodeRender(o,d,f,!1,!0);for(i=p.ul.firstChild;i;)k=i.ftnode,k&&k.parent!==p?(p.debug("_fixParent: remove missing "+k,i),n=i.nextSibling,i.parentNode.removeChild(i),i=n):i=i.nextSibling;for(i=p.ul.firstChild,l=0,m=w.length-1;m>l;l++)j=w[l],k=i.ftnode,j!==k?p.ul.insertBefore(j.li,k.li):i=i.nextSibling}}else p.ul&&(this.warn("remove child markup for "+p),this.nodeRemoveChildMarkup(b));v||t&&u.ul.insertBefore(p.li,x)}},nodeRenderTitle:function(b,c){var e,f,g,h,i,j,k=b.node,l=b.tree,m=b.options,n=m.aria,p=k.getLevel(),q=[];c!==d&&(k.title=c),k.span&&(p<m.minExpandLevel?(k.lazy||(k.expanded=!0),p>1&&(n?q.push("<span role='button' class='fancytree-expander fancytree-expander-fixed'></span>"):q.push("<span class='fancytree-expander fancytree-expander-fixed''></span>"))):n?q.push("<span role='button' class='fancytree-expander'></span>"):q.push("<span class='fancytree-expander'></span>"),m.checkbox&&k.hideCheckbox!==!0&&!k.isStatusNode()&&(n?q.push("<span role='checkbox' class='fancytree-checkbox'></span>"):q.push("<span class='fancytree-checkbox'></span>")),k.data.iconClass!==d&&(k.icon?a.error("'iconClass' node option is deprecated since v2.14.0: use 'icon' only instead"):(k.warn("'iconClass' node option is deprecated since v2.14.0: use 'icon' instead"),k.icon=k.data.iconClass)),a.isFunction(m.icon)?(f=m.icon.call(l,{type:"icon"},b),null==f&&(f=k.icon)):f=null!=k.icon?k.icon:m.icon,null==f?f=!0:"boolean"!=typeof f&&(f=""+f),f!==!1&&(h=n?" role='img'":"","string"==typeof f?w.test(f)?(f="/"===f.charAt(0)?f:(m.imagePath||"")+f,q.push("<img src='"+f+"' class='fancytree-icon' alt='' />")):q.push("<span "+h+" class='fancytree-custom-icon "+f+"'></span>"):q.push("<span "+h+" class='fancytree-icon'></span>")),g="",m.renderTitle&&(g=m.renderTitle.call(l,{type:"renderTitle"},b)||""),g||(j=k.tooltip?" title='"+o(k.tooltip)+"'":"",e=n?" id='ftal_"+m.idPrefix+k.key+"'":"",h=n?" role='treeitem'":"",i=m.titlesTabbable?" tabindex='0'":"",g="<span "+h+" class='fancytree-title'"+e+j+i+">"+(m.escapeTitles?o(k.title):k.title)+"</span>"),q.push(g),k.span.innerHTML=q.join(""),this.nodeRenderStatus(b),m.enhanceTitle&&(b.$title=a(">span.fancytree-title",k.span),g=m.enhanceTitle.call(l,{type:"enhanceTitle"},b)||""))},nodeRenderStatus:function(b){var c=b.node,d=b.tree,e=b.options,f=c.hasChildren(),g=c.isLastSibling(),h=e.aria,i=a(c.span).find(".fancytree-title"),j=e._classNames,k=[],l=c[d.statusClassPropName];l&&(k.push(j.node),d.activeNode===c&&k.push(j.active),d.focusNode===c?(k.push(j.focused),h&&i.attr("aria-activedescendant",!0)):h&&i.removeAttr("aria-activedescendant"),c.expanded?(k.push(j.expanded),h&&i.attr("aria-expanded",!0)):h&&i.removeAttr("aria-expanded"),c.folder&&k.push(j.folder),f!==!1&&k.push(j.hasChildren),g&&k.push(j.lastsib),c.lazy&&null==c.children&&k.push(j.lazy),c.partload&&k.push(j.partload),c.partsel&&k.push(j.partsel),c.unselectable&&k.push(j.unselectable),c._isLoading&&k.push(j.loading),c._error&&k.push(j.error),c.statusNodeType&&k.push(j.statusNodePrefix+c.statusNodeType),c.selected?(k.push(j.selected),h&&i.attr("aria-selected",!0)):h&&i.attr("aria-selected",!1),c.extraClasses&&k.push(c.extraClasses),f===!1?k.push(j.combinedExpanderPrefix+"n"+(g?"l":"")):k.push(j.combinedExpanderPrefix+(c.expanded?"e":"c")+(c.lazy&&null==c.children?"d":"")+(g?"l":"")),k.push(j.combinedIconPrefix+(c.expanded?"e":"c")+(c.folder?"f":"")),l.className=k.join(" "),c.li&&(c.li.className=g?j.lastsib:""))},nodeSetActive:function(b,c,d){d=d||{};var f,g=b.node,h=b.tree,i=b.options,j=d.noEvents===!0,m=d.noFocus===!0,n=g===h.activeNode;return c=c!==!1,n===c?k(g):c&&!j&&this._triggerNodeEvent("beforeActivate",g,b.originalEvent)===!1?l(g,["rejected"]):(c?(h.activeNode&&(e(h.activeNode!==g,"node was active (inconsistency)"),f=a.extend({},b,{node:h.activeNode}),h.nodeSetActive(f,!1),e(null===h.activeNode,"deactivate was out of sync?")),i.activeVisible&&g.makeVisible({scrollIntoView:!1}),h.activeNode=g,h.nodeRenderStatus(b),m||h.nodeSetFocus(b),j||h._triggerNodeEvent("activate",g,b.originalEvent)):(e(h.activeNode===g,"node was not active (inconsistency)"),h.activeNode=null,this.nodeRenderStatus(b),j||b.tree._triggerNodeEvent("deactivate",g,b.originalEvent)),k(g))},nodeSetExpanded:function(b,c,e){e=e||{};var f,g,h,i,j,m,n=b.node,o=b.tree,p=b.options,q=e.noAnimation===!0,r=e.noEvents===!0;if(c=c!==!1,n.expanded&&c||!n.expanded&&!c)return k(n);if(c&&!n.lazy&&!n.hasChildren())return k(n);if(!c&&n.getLevel()<p.minExpandLevel)return l(n,["locked"]);if(!r&&this._triggerNodeEvent("beforeExpand",n,b.originalEvent)===!1)return l(n,["rejected"]);if(q||n.isVisible()||(q=e.noAnimation=!0),g=new a.Deferred,c&&!n.expanded&&p.autoCollapse){j=n.getParentList(!1,!0),m=p.autoCollapse;try{for(p.autoCollapse=!1,h=0,i=j.length;i>h;h++)this._callHook("nodeCollapseSiblings",j[h],e)}finally{p.autoCollapse=m}}return g.done(function(){var a=n.getLastChild();c&&p.autoScroll&&!q&&a?a.scrollIntoView(!0,{topNode:n}).always(function(){r||b.tree._triggerNodeEvent(c?"expand":"collapse",b)}):r||b.tree._triggerNodeEvent(c?"expand":"collapse",b)}),f=function(d){var e,f,g=p.toggleEffect;if(n.expanded=c,o._callHook("nodeRender",b,!1,!1,!0),n.ul)if(e="none"!==n.ul.style.display,f=!!n.expanded,e===f)n.warn("nodeSetExpanded: UL.style.display already set");else{if(g&&!q)return void a(n.ul).toggle(g.effect,g.options,g.duration,function(){d()});n.ul.style.display=n.expanded||!parent?"":"none"}d()},c&&n.lazy&&n.hasChildren()===d?n.load().done(function(){g.notifyWith&&g.notifyWith(n,["loaded"]),f(function(){g.resolveWith(n)})}).fail(function(a){f(function(){g.rejectWith(n,["load failed ("+a+")"])})}):f(function(){g.resolveWith(n)}),g.promise()},nodeSetFocus:function(b,d){var e,f=b.tree,g=b.node;if(d=d!==!1,f.focusNode){if(f.focusNode===g&&d)return;e=a.extend({},b,{node:f.focusNode}),f.focusNode=null,this._triggerNodeEvent("blur",e),this._callHook("nodeRenderStatus",e)}d&&(this.hasFocus()||(g.debug("nodeSetFocus: forcing container focus"),this._callHook("treeSetFocus",b,!0,{calledByNode:!0})),g.makeVisible({scrollIntoView:!1}),f.focusNode=g,f.options.titlesTabbable?a(g.span).find(".fancytree-title").focus():0===a(c.activeElement).closest(".fancytree-container").length&&a(f.$container).focus(),this._triggerNodeEvent("focus",b),b.options.autoScroll&&g.scrollIntoView(),this._callHook("nodeRenderStatus",b))},nodeSetSelected:function(a,b){var c=a.node,d=a.tree,e=a.options;if(b=b!==!1,c.debug("nodeSetSelected("+b+")",a),!c.unselectable){if(c.selected&&b||!c.selected&&!b)return!!c.selected;if(this._triggerNodeEvent("beforeSelect",c,a.originalEvent)===!1)return!!c.selected;b&&1===e.selectMode?d.lastSelectedNode&&d.lastSelectedNode.setSelected(!1):3===e.selectMode&&(c.selected=b,c.fixSelection3AfterClick()),c.selected=b,this.nodeRenderStatus(a),d.lastSelectedNode=b?c:null,d._triggerNodeEvent("select",a)}},nodeSetStatus:function(b,c,d,e){function f(){var a=h.children?h.children[0]:null;if(a&&a.isStatusNode()){try{h.ul&&(h.ul.removeChild(a.li),a.li=null)}catch(b){}1===h.children.length?h.children=[]:h.children.shift()}}function g(b,c){var d=h.children?h.children[0]:null;return d&&d.isStatusNode()?(a.extend(d,b),d.statusNodeType=c,i._callHook("nodeRenderTitle",d)):(h._setChildren([b]),h.children[0].statusNodeType=c,i.render()),h.children[0]}var h=b.node,i=b.tree;switch(c){case"ok":f(),h._isLoading=!1,h._error=null,h.renderStatus();break;case"loading":h.parent||g({title:i.options.strings.loading+(d?" ("+d+")":""),checkbox:!1,tooltip:e},c),h._isLoading=!0,h._error=null,h.renderStatus();break;case"error":g({title:i.options.strings.loadError+(d?" ("+d+")":""),checkbox:!1,tooltip:e},c),h._isLoading=!1,h._error={message:d,details:e},h.renderStatus();break;case"nodata":g({title:i.options.strings.noData,checkbox:!1,tooltip:e},c),h._isLoading=!1,h._error=null,h.renderStatus();break;default:a.error("invalid node status "+c)}},nodeToggleExpanded:function(a){return this.nodeSetExpanded(a,!a.node.expanded)},nodeToggleSelected:function(a){return this.nodeSetSelected(a,!a.node.selected)},treeClear:function(a){var b=a.tree;b.activeNode=null,b.focusNode=null,b.$div.find(">ul.fancytree-container").empty(),b.rootNode.children=null},treeCreate:function(a){},treeDestroy:function(a){this.$div.find(">ul.fancytree-container").remove(),this.$source&&this.$source.removeClass("ui-helper-hidden")},treeInit:function(a){this.treeLoad(a)},treeLoad:function(b,c){var d,e,f,g=b.tree,h=b.widget.element,i=a.extend({},b,{node:this.rootNode});if(g.rootNode.children&&this.treeClear(b),c=c||this.options.source)"string"==typeof c&&a.error("Not implemented");else switch(d=h.data("type")||"html"){case"html":e=h.find(">ul:first"),e.addClass("ui-fancytree-source ui-helper-hidden"),c=a.ui.fancytree.parseHtml(e),this.data=a.extend(this.data,n(e));break;case"json":c=a.parseJSON(h.text()),c.children&&(c.title&&(g.title=c.title),c=c.children);break;default:a.error("Invalid data-type: "+d)}return f=this.nodeLoadChildren(i,c).done(function(){g.render(),3===b.options.selectMode&&g.rootNode.fixSelection3FromEndNodes(),g.activeNode&&g.options.activeVisible&&g.activeNode.makeVisible(),g._triggerTreeEvent("init",null,{status:!0})}).fail(function(){g.render(),g._triggerTreeEvent("init",null,{status:!1})})},treeRegisterNode:function(a,b,c){},treeSetFocus:function(b,c,d){c=c!==!1,c!==this.hasFocus()&&(this._hasFocus=c,!c&&this.focusNode?this.focusNode.setFocus(!1):!c||d&&d.calledByNode||a(this.$container).focus(),this.$container.toggleClass("fancytree-treefocus",c),this._triggerTreeEvent(c?"focusTree":"blurTree"))}}),a.widget("ui.fancytree",{options:{activeVisible:!0,ajax:{type:"GET",cache:!1,dataType:"json"},aria:!1,autoActivate:!0,autoCollapse:!1,autoScroll:!1,checkbox:!1,clickFolderMode:4,debugLevel:null,disabled:!1,enableAspx:!0,escapeTitles:!1,extensions:[],toggleEffect:{effect:"blind",options:{direction:"vertical",scale:"box"},duration:200},generateIds:!1,icon:!0,idPrefix:"ft_",focusOnSelect:!1,keyboard:!0,keyPathSeparator:"/",minExpandLevel:1,quicksearch:!1,scrollOfs:{top:0,bottom:0},scrollParent:null,selectMode:2,strings:{loading:"Loading…",loadError:"Load error!",moreData:"More…",noData:"No data."},tabindex:"0",titlesTabbable:!1,_classNames:{node:"fancytree-node",folder:"fancytree-folder",combinedExpanderPrefix:"fancytree-exp-",combinedIconPrefix:"fancytree-ico-",hasChildren:"fancytree-has-children",active:"fancytree-active",selected:"fancytree-selected",expanded:"fancytree-expanded",lazy:"fancytree-lazy",focused:"fancytree-focused",partload:"fancytree-partload",partsel:"fancytree-partsel",unselectable:"fancytree-unselectable",lastsib:"fancytree-lastsib",loading:"fancytree-loading",error:"fancytree-error",statusNodePrefix:"fancytree-statusnode-"},lazyLoad:null,postProcess:null},_create:function(){this.tree=new s(this),this.$source=this.source||"json"===this.element.data("type")?this.element:this.element.find(">ul:first");var b,c,f,g=this.options,h=g.extensions,i=this.tree;for(f=0;f<h.length;f++)c=h[f],b=a.ui.fancytree._extensions[c],b||a.error("Could not apply extension '"+c+"' (it is not registered, did you forget to include it?)"),this.tree.options[c]=a.extend(!0,{},b.options,this.tree.options[c]),e(this.tree.ext[c]===d,"Extension name must not exist as Fancytree.ext attribute: '"+c+"'"),this.tree.ext[c]={},j(this.tree,i,b,c),i=b;g.icons!==d&&(g.icon!==!0?a.error("'icons' tree option is deprecated since v2.14.0: use 'icon' only instead"):(this.tree.warn("'icons' tree option is deprecated since v2.14.0: use 'icon' instead"),g.icon=g.icons)),g.iconClass!==d&&(g.icon?a.error("'iconClass' tree option is deprecated since v2.14.0: use 'icon' only instead"):(this.tree.warn("'iconClass' tree option is deprecated since v2.14.0: use 'icon' instead"),g.icon=g.iconClass)),g.tabbable!==d&&(g.tabindex=g.tabbable?"0":"-1",this.tree.warn("'tabbable' tree option is deprecated since v2.17.0: use 'tabindex='"+g.tabindex+"' instead")),this.tree._callHook("treeCreate",this.tree)},_init:function(){this.tree._callHook("treeInit",this.tree),this._bind()},_setOption:function(b,c){var d=!0,e=!1;switch(b){case"aria":case"checkbox":case"icon":case"minExpandLevel":case"tabindex":this.tree._callHook("treeCreate",this.tree),e=!0;break;case"escapeTitles":e=!0;break;case"source":d=!1,this.tree._callHook("treeLoad",this.tree,c)}this.tree.debug("set option "+b+"="+c+" <"+typeof c+">"),d&&a.Widget.prototype._setOption.apply(this,arguments),e&&this.tree.render(!0,!1)},destroy:function(){this._unbind(),this.tree._callHook("treeDestroy",this.tree),a.Widget.prototype.destroy.call(this)},_unbind:function(){var b=this.tree._ns;this.element.unbind(b),this.tree.$container.unbind(b),a(c).unbind(b)},_bind:function(){var a=this,b=this.options,c=this.tree,d=c._ns;this._unbind(),c.$container.on("focusin"+d+" focusout"+d,function(a){var b=v.getNode(a),d="focusin"===a.type;b?c._callHook("nodeSetFocus",b,d):c._callHook("treeSetFocus",c,d)}).on("selectstart"+d,"span.fancytree-title",function(a){a.preventDefault()}).on("keydown"+d,function(a){if(b.disabled||b.keyboard===!1)return!0;var d,e=c.focusNode,f=c._makeHookContext(e||c,a),g=c.phase;try{return c.phase="userEvent",d=e?c._triggerNodeEvent("keydown",e,a):c._triggerTreeEvent("keydown",a),"preventNav"===d?d=!0:d!==!1&&(d=c._callHook("nodeKeydown",f)),d}finally{c.phase=g}}).on("click"+d+" dblclick"+d,function(c){if(b.disabled)return!0;var d,e=v.getEventTarget(c),f=e.node,g=a.tree,h=g.phase;if(!f)return!0;d=g._makeHookContext(f,c);try{switch(g.phase="userEvent",c.type){case"click":return d.targetType=e.type,f.isPagingNode()?g._triggerNodeEvent("clickPaging",d,c)===!0:g._triggerNodeEvent("click",d,c)===!1?!1:g._callHook("nodeClick",d);case"dblclick":return d.targetType=e.type,g._triggerNodeEvent("dblclick",d,c)===!1?!1:g._callHook("nodeDblclick",d)}}finally{g.phase=h}})},getActiveNode:function(){return this.tree.activeNode},getNodeByKey:function(a){return this.tree.getNodeByKey(a)},getRootNode:function(){return this.tree.rootNode},getTree:function(){return this.tree}}),v=a.ui.fancytree,a.extend(a.ui.fancytree,{version:"2.18.0",buildType: "production",debugLevel: 1,_nextId:1,_nextNodeKey:1,_extensions:{},_FancytreeClass:s,_FancytreeNodeClass:r,jquerySupports:{positionMyOfs:h(a.ui.version,1,9)},assert:function(a,b){return e(a,b)},debounce:function(a,b,c,d){var e;return 3===arguments.length&&"boolean"!=typeof c&&(d=c,c=!1),function(){var f=arguments;d=d||this,c&&!e&&b.apply(d,f),clearTimeout(e),e=setTimeout(function(){c||b.apply(d,f),e=null},a)}},debug:function(b){a.ui.fancytree.debugLevel>=2&&f("log",arguments)},error:function(a){f("error",arguments)},escapeHtml:o,fixPositionOptions:function(b){if((b.offset||(""+b.my+b.at).indexOf("%")>=0)&&a.error("expected new position syntax (but '%' is not supported)"),!a.ui.fancytree.jquerySupports.positionMyOfs){var c=/(\w+)([+-]?\d+)?\s+(\w+)([+-]?\d+)?/.exec(b.my),d=/(\w+)([+-]?\d+)?\s+(\w+)([+-]?\d+)?/.exec(b.at),e=(c[2]?+c[2]:0)+(d[2]?+d[2]:0),f=(c[4]?+c[4]:0)+(d[4]?+d[4]:0);b=a.extend({},b,{my:c[1]+" "+c[3],at:d[1]+" "+d[3]}),(e||f)&&(b.offset=""+e+" "+f)}return b},getEventTargetType:function(a){return this.getEventTarget(a).type},getEventTarget:function(b){var c=b&&b.target?b.target.className:"",e={node:this.getNode(b.target),type:d};return/\bfancytree-title\b/.test(c)?e.type="title":/\bfancytree-expander\b/.test(c)?e.type=e.node.hasChildren()===!1?"prefix":"expander":/\bfancytree-checkbox\b/.test(c)||/\bfancytree-radio\b/.test(c)?e.type="checkbox":/\bfancytree-icon\b/.test(c)?e.type="icon":/\bfancytree-node\b/.test(c)?e.type="title":b&&b.target&&a(b.target).closest(".fancytree-title").length&&(e.type="title"),e},getNode:function(a){if(a instanceof r)return a;for(a.selector!==d?a=a[0]:a.originalEvent!==d&&(a=a.target);a;){if(a.ftnode)return a.ftnode;a=a.parentNode}return null},getTree:function(b){var c;return b instanceof s?b:(b===d&&(b=0),"number"==typeof b?b=a(".fancytree-container").eq(b):"string"==typeof b?b=a(b).eq(0):b.selector!==d?b=b.eq(0):b.originalEvent!==d&&(b=a(b.target)),b=b.closest(":ui-fancytree"),c=b.data("ui-fancytree")||b.data("fancytree"),c?c.tree:null)},info:function(b){a.ui.fancytree.debugLevel>=1&&f("info",arguments)},eventToString:function(a){var b=a.which,c=a.type,d=[];return a.altKey&&d.push("alt"),a.ctrlKey&&d.push("ctrl"),a.metaKey&&d.push("meta"),a.shiftKey&&d.push("shift"),"click"===c||"dblclick"===c?d.push(C[a.button]+c):A[b]||d.push(B[b]||String.fromCharCode(b).toLowerCase()),d.join("+")},keyEventToString:function(a){return this.warn("keyEventToString() is deprecated: use eventToString()"),this.eventToString(a)},parseHtml:function(b){var c,e,f,g,h,i,j,k,l=b.find(">li"),m=[];return l.each(function(){var l,o,p=a(this),q=p.find(">span:first",this),r=q.length?null:p.find(">a:first"),s={tooltip:null,data:{}};for(q.length?s.title=q.html():r&&r.length?(s.title=r.html(),s.data.href=r.attr("href"),s.data.target=r.attr("target"),s.tooltip=r.attr("title")):(s.title=p.html(),h=s.title.search(/<ul/i),h>=0&&(s.title=s.title.substring(0,h))),s.title=a.trim(s.title),g=0,i=D.length;i>g;g++)s[D[g]]=d;for(c=this.className.split(" "),f=[],g=0,i=c.length;i>g;g++)e=c[g],E[e]?s[e]=!0:f.push(e);if(s.extraClasses=f.join(" "),j=p.attr("title"),j&&(s.tooltip=j),j=p.attr("id"),j&&(s.key=j),l=n(p),l&&!a.isEmptyObject(l)){for(o in H)l.hasOwnProperty(o)&&(l[H[o]]=l[o],delete l[o]);for(g=0,i=F.length;i>g;g++)j=F[g],k=l[j],null!=k&&(delete l[j],s[j]=k);a.extend(s.data,l)}b=p.find(">ul:first"),b.length?s.children=a.ui.fancytree.parseHtml(b):s.children=s.lazy?d:null,m.push(s)}),m},registerExtension:function(b){e(null!=b.name,"extensions must have a `name` property."),e(null!=b.version,"extensions must have a `version` property."),a.ui.fancytree._extensions[b.name]=b},unescapeHtml:function(a){var b=c.createElement("div");return b.innerHTML=a,0===b.childNodes.length?"":b.childNodes[0].nodeValue},warn:function(a){f("warn",arguments)}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.childcounter.min.js' */
!function(a,b){"use strict";a.ui.fancytree._FancytreeClass.prototype.countSelected=function(a){var b=this;b.options;return b.getSelectedNodes(a).length},a.ui.fancytree._FancytreeNodeClass.prototype.updateCounters=function(){var b=this,c=a("span.fancytree-childcounter",b.span),d=b.tree.options.childcounter,e=b.countChildren(d.deep);b.data.childCounter=e,!e&&d.hideZeros||b.isExpanded()&&d.hideExpanded?c.remove():(c.length||(c=a("<span class='fancytree-childcounter'/>").appendTo(a("span.fancytree-icon",b.span))),c.text(e)),!d.deep||b.isTopLevel()||b.isRoot()||b.parent.updateCounters()},a.ui.fancytree.prototype.widgetMethod1=function(a){this.tree;return a},a.ui.fancytree.registerExtension({name:"childcounter",version:"1.0.0",options:{deep:!0,hideZeros:!0,hideExpanded:!1},foo:42,_appendCounter:function(a){},treeInit:function(a){a.options,a.options.childcounter;this._superApply(arguments),this.$container.addClass("fancytree-ext-childcounter")},treeDestroy:function(a){this._superApply(arguments)},nodeRenderTitle:function(b,c){var d=b.node,e=b.options.childcounter,f=null==d.data.childCounter?d.countChildren(e.deep):+d.data.childCounter;this._superApply(arguments),!f&&e.hideZeros||d.isExpanded()&&e.hideExpanded||a("span.fancytree-icon",d.span).append(a("<span class='fancytree-childcounter'/>").text(f))},nodeSetExpanded:function(a,b,c){var d=a.tree;a.node;return this._superApply(arguments).always(function(){d.nodeRenderTitle(a)})}})}(jQuery);
/*! Extension 'jquery.fancytree.clones.min.js' */
!function(a,b,c,d){"use strict";function e(b,c){b||(c=c?": "+c:"",a.error("Assertion failed"+c))}function f(a,b){var c;for(c=a.length-1;c>=0;c--)if(a[c]===b)return a.splice(c,1),!0;return!1}function g(a,b,c){for(var d,e,f=3&a.length,g=a.length-f,h=c,i=3432918353,j=461845907,k=0;g>k;)e=255&a.charCodeAt(k)|(255&a.charCodeAt(++k))<<8|(255&a.charCodeAt(++k))<<16|(255&a.charCodeAt(++k))<<24,++k,e=(65535&e)*i+(((e>>>16)*i&65535)<<16)&4294967295,e=e<<15|e>>>17,e=(65535&e)*j+(((e>>>16)*j&65535)<<16)&4294967295,h^=e,h=h<<13|h>>>19,d=5*(65535&h)+((5*(h>>>16)&65535)<<16)&4294967295,h=(65535&d)+27492+(((d>>>16)+58964&65535)<<16);switch(e=0,f){case 3:e^=(255&a.charCodeAt(k+2))<<16;case 2:e^=(255&a.charCodeAt(k+1))<<8;case 1:e^=255&a.charCodeAt(k),e=(65535&e)*i+(((e>>>16)*i&65535)<<16)&4294967295,e=e<<15|e>>>17,e=(65535&e)*j+(((e>>>16)*j&65535)<<16)&4294967295,h^=e}return h^=a.length,h^=h>>>16,h=2246822507*(65535&h)+((2246822507*(h>>>16)&65535)<<16)&4294967295,h^=h>>>13,h=3266489909*(65535&h)+((3266489909*(h>>>16)&65535)<<16)&4294967295,h^=h>>>16,b?("0000000"+(h>>>0).toString(16)).substr(-8):h>>>0}function h(b){var c,d=a.map(b.getParentList(!1,!0),function(a){return a.refKey||a.key});return d=d.join("/"),c="id_"+g(d,!0)}a.ui.fancytree._FancytreeNodeClass.prototype.getCloneList=function(b){var c,d=this.tree,e=d.refMap[this.refKey]||null,f=d.keyMap;return e&&(c=this.key,b?e=a.map(e,function(a){return f[a]}):(e=a.map(e,function(a){return a===c?null:f[a]}),e.length<1&&(e=null))),e},a.ui.fancytree._FancytreeNodeClass.prototype.isClone=function(){var a=this.refKey||null,b=a&&this.tree.refMap[a]||null;return!!(b&&b.length>1)},a.ui.fancytree._FancytreeNodeClass.prototype.reRegister=function(b,c){b=null==b?null:""+b,c=null==c?null:""+c;var d=this.tree,e=this.key,f=this.refKey,g=d.keyMap,h=d.refMap,i=h[f]||null,j=!1;return null!=b&&b!==this.key&&(g[b]&&a.error("[ext-clones] reRegister("+b+"): already exists: "+this),delete g[e],g[b]=this,i&&(h[f]=a.map(i,function(a){return a===e?b:a})),this.key=b,j=!0),null!=c&&c!==this.refKey&&(i&&(1===i.length?delete h[f]:h[f]=a.map(i,function(a){return a===e?null:a})),h[c]?h[c].append(b):h[c]=[this.key],this.refKey=c,j=!0),j},a.ui.fancytree._FancytreeNodeClass.prototype.setRefKey=function(a){return this.reRegister(null,a)},a.ui.fancytree._FancytreeClass.prototype.getNodesByRef=function(b,c){var d=this.keyMap,e=this.refMap[b]||null;return e&&(e=c?a.map(e,function(a){var b=d[a];return b.isDescendantOf(c)?b:null}):a.map(e,function(a){return d[a]}),e.length<1&&(e=null)),e},a.ui.fancytree._FancytreeClass.prototype.changeRefKey=function(a,b){var c,d,e=this.keyMap,f=this.refMap[a]||null;if(f){for(c=0;c<f.length;c++)d=e[f[c]],d.refKey=b;delete this.refMap[a],this.refMap[b]=f}},a.ui.fancytree.registerExtension({name:"clones",version:"0.0.3",options:{highlightActiveClones:!0,highlightClones:!1},treeCreate:function(a){this._superApply(arguments),a.tree.refMap={},a.tree.keyMap={}},treeInit:function(a){this.$container.addClass("fancytree-ext-clones"),e(null==a.options.defaultKey),a.options.defaultKey=function(a){return h(a)},this._superApply(arguments)},treeClear:function(a){return a.tree.refMap={},a.tree.keyMap={},this._superApply(arguments)},treeRegisterNode:function(b,c,d){var g,h,i=b.tree,j=i.keyMap,k=i.refMap,l=d.key,m=d&&null!=d.refKey?""+d.refKey:null;return d.isStatusNode()?this._superApply(arguments):(c?(null!=j[d.key]&&a.error("clones.treeRegisterNode: node.key already exists: "+d),j[l]=d,m&&(g=k[m],g?(g.push(l),2===g.length&&b.options.clones.highlightClones&&j[g[0]].renderStatus()):k[m]=[l])):(null==j[l]&&a.error("clones.treeRegisterNode: node.key not registered: "+d.key),delete j[l],m&&(g=k[m],g&&(h=g.length,1>=h?(e(1===h),e(g[0]===l),delete k[m]):(f(g,l),2===h&&b.options.clones.highlightClones&&j[g[0]].renderStatus())))),this._superApply(arguments))},nodeRenderStatus:function(b){var c,d,e=b.node;return d=this._superApply(arguments),b.options.clones.highlightClones&&(c=a(e[b.tree.statusClassPropName]),c.length&&e.isClone()&&c.addClass("fancytree-clone")),d},nodeSetActive:function(b,c){var d,e=b.tree.statusClassPropName,f=b.node;return d=this._superApply(arguments),b.options.clones.highlightActiveClones&&f.isClone()&&a.each(f.getCloneList(!0),function(b,d){a(d[e]).toggleClass("fancytree-active-clone",c!==!1)}),d}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.dnd.min.js' */
!function(a,b,c,d){"use strict";function e(a){return 0===a?"":a>0?"+"+a:""+a}function f(){h||(a.ui.plugin.add("draggable","connectToFancytree",{start:function(b,c){var d=a(this).data("ui-draggable")||a(this).data("draggable"),e=c.helper.data("ftSourceNode")||null;return e?(d.offset.click.top=-2,d.offset.click.left=16,e.tree.ext.dnd._onDragEvent("start",e,null,b,c,d)):void 0},drag:function(b,c){var d,e,f,g=a(this).data("ui-draggable")||a(this).data("draggable"),h=c.helper.data("ftSourceNode")||null,i=c.helper.data("ftTargetNode")||null,j=a.ui.fancytree.getNode(b.target),k=h&&h.tree.options.dnd;return b.target&&!j&&(e=a(b.target).closest("div.fancytree-drag-helper,#fancytree-drop-marker").length>0)?(f=h||i||a.ui.fancytree,void f.debug("Drag event over helper: ignored.")):(c.helper.data("ftTargetNode",j),k&&k.updateHelper&&(d=h.tree._makeHookContext(h,b,{otherNode:j,ui:c,draggable:g,dropMarker:a("#fancytree-drop-marker")}),k.updateHelper.call(h.tree,h,d)),i&&i!==j&&i.tree.ext.dnd._onDragEvent("leave",i,h,b,c,g),void(j&&j.tree.options.dnd.dragDrop&&(j===i?j.tree.ext.dnd._onDragEvent("over",j,h,b,c,g):(j.tree.ext.dnd._onDragEvent("enter",j,h,b,c,g),j.tree.ext.dnd._onDragEvent("over",j,h,b,c,g)))))},stop:function(b,c){var d,e=a(this).data("ui-draggable")||a(this).data("draggable"),f=c.helper.data("ftSourceNode")||null,g=c.helper.data("ftTargetNode")||null,h="mouseup"===b.type&&1===b.which;h||(d=f||g||a.ui.fancytree,d.debug("Drag was cancelled")),g&&(h&&g.tree.ext.dnd._onDragEvent("drop",g,f,b,c,e),g.tree.ext.dnd._onDragEvent("leave",g,f,b,c,e)),f&&f.tree.ext.dnd._onDragEvent("stop",f,null,b,c,e)}}),h=!0)}function g(b){var c=b.options.dnd||null,d=b.options.glyph||null;c&&f(),c&&c.dragStart&&b.widget.element.draggable(a.extend({addClasses:!1,appendTo:b.$container,containment:!1,delay:0,distance:4,revert:!1,scroll:!0,scrollSpeed:7,scrollSensitivity:10,connectToFancytree:!0,helper:function(b){var c,e,f,g=a.ui.fancytree.getNode(b.target);return g?(f=g.tree.options.dnd,e=a(g.span),c=a("<div class='fancytree-drag-helper'><span class='fancytree-drag-helper-img' /></div>").css({zIndex:3,position:"relative"}).append(e.find("span.fancytree-title").clone()),c.data("ftSourceNode",g),d&&c.find(".fancytree-drag-helper-img").addClass(d.map.dragHelper),f.initHelper&&f.initHelper.call(g.tree,g,{node:g,tree:g.tree,originalEvent:b,ui:{helper:c}}),c):"<div>ERROR?: helper requested but sourceNode not found</div>"},start:function(a,b){var c=b.helper.data("ftSourceNode");return!!c}},b.options.dnd.draggable)),c&&c.dragDrop&&b.widget.element.droppable(a.extend({addClasses:!1,tolerance:"intersect",greedy:!1},b.options.dnd.droppable))}var h=!1,i="fancytree-drop-accept",j="fancytree-drop-after",k="fancytree-drop-before",l="fancytree-drop-over",m="fancytree-drop-reject",n="fancytree-drop-target";a.ui.fancytree.registerExtension({name:"dnd",version:"0.3.0",options:{autoExpandMS:1e3,draggable:null,droppable:null,focusOnClick:!1,preventVoidMoves:!0,preventRecursiveMoves:!0,smartRevert:!0,dragStart:null,dragStop:null,initHelper:null,updateHelper:null,dragEnter:null,dragOver:null,dragExpand:null,dragDrop:null,dragLeave:null},treeInit:function(b){var c=b.tree;this._superApply(arguments),c.options.dnd.dragStart&&c.$container.on("mousedown",function(c){if(b.options.dnd.focusOnClick){var d=a.ui.fancytree.getNode(c);d&&d.debug("Re-enable focus that was prevented by jQuery UI draggable."),setTimeout(function(){a(c.target).closest(":tabbable").focus()},10)}}),g(c)},_setDndStatus:function(b,c,d,f,g){var h=0,o="center",p=this._local,q=this.options.glyph||null,r=b?a(b.span):null,s=a(c.span);if(p.$dropMarker||(p.$dropMarker=a("<div id='fancytree-drop-marker'></div>").hide().css({"z-index":1e3}).prependTo(a(this.$div).parent()),q&&p.$dropMarker.addClass(q.map.dropMarker)),"after"===f||"before"===f||"over"===f){switch(f){case"before":o="top";break;case"after":o="bottom";break;default:h=8}p.$dropMarker.toggleClass(j,"after"===f).toggleClass(l,"over"===f).toggleClass(k,"before"===f).show().position(a.ui.fancytree.fixPositionOptions({my:"left"+e(h)+" center",at:"left "+o,of:s}))}else p.$dropMarker.hide();r&&r.toggleClass(i,g===!0).toggleClass(m,g===!1),s.toggleClass(n,"after"===f||"before"===f||"over"===f).toggleClass(j,"after"===f).toggleClass(k,"before"===f).toggleClass(i,g===!0).toggleClass(m,g===!1),d.toggleClass(i,g===!0).toggleClass(m,g===!1)},_onDragEvent:function(b,e,f,g,h,i){var j,k,l,m,n,o,p,q,r,s=this.options,t=s.dnd,u=this._makeHookContext(e,g,{otherNode:f,ui:h,draggable:i}),v=null,w=this,x=a(e.span);switch(t.smartRevert&&(i.options.revert="invalid"),b){case"start":e.isStatusNode()?v=!1:t.dragStart&&(v=t.dragStart(e,u)),v===!1?(this.debug("tree.dragStart() cancelled"),h.helper.trigger("mouseup").hide()):(t.smartRevert&&(m=e[u.tree.nodeContainerAttrName].getBoundingClientRect(),l=a(i.options.appendTo)[0].getBoundingClientRect(),i.originalPosition.left=Math.max(0,m.left-l.left),i.originalPosition.top=Math.max(0,m.top-l.top)),x.addClass("fancytree-drag-source"),a(c).on("keydown.fancytree-dnd,mousedown.fancytree-dnd",function(b){"keydown"===b.type&&b.which===a.ui.keyCode.ESCAPE?w.ext.dnd._cancelDrag():"mousedown"===b.type&&w.ext.dnd._cancelDrag()}));break;case"enter":r=t.preventRecursiveMoves&&e.isDescendantOf(f)?!1:t.dragEnter?t.dragEnter(e,u):null,v=r?a.isArray(r)?{over:a.inArray("over",r)>=0,before:a.inArray("before",r)>=0,after:a.inArray("after",r)>=0}:{over:r===!0||"over"===r,before:r===!0||"before"===r,after:r===!0||"after"===r}:!1,h.helper.data("enterResponse",v);break;case"over":p=h.helper.data("enterResponse"),q=null,p===!1||("string"==typeof p?q=p:(k=x.offset(),n={x:g.pageX-k.left,y:g.pageY-k.top},o={x:n.x/x.width(),y:n.y/x.height()},p.after&&o.y>.75?q="after":!p.over&&p.after&&o.y>.5?q="after":p.before&&o.y<=.25?q="before":!p.over&&p.before&&o.y<=.5?q="before":p.over&&(q="over"),t.preventVoidMoves&&(e===f?(this.debug(" drop over source node prevented"),q=null):"before"===q&&f&&e===f.getNextSibling()?(this.debug(" drop after source node prevented"),q=null):"after"===q&&f&&e===f.getPrevSibling()?(this.debug(" drop before source node prevented"),q=null):"over"===q&&f&&f.parent===e&&f.isLastSibling()&&(this.debug(" drop last child over own parent prevented"),q=null)),h.helper.data("hitMode",q))),"before"===q||"after"===q||!t.autoExpandMS||e.hasChildren()===!1||e.expanded||t.dragExpand&&t.dragExpand(e,u)===!1||e.scheduleAction("expand",t.autoExpandMS),q&&t.dragOver&&(u.hitMode=q,v=t.dragOver(e,u)),j=v!==!1&&null!==q,t.smartRevert&&(i.options.revert=!j),this._local._setDndStatus(f,e,h.helper,q,j);break;case"drop":q=h.helper.data("hitMode"),q&&t.dragDrop&&(u.hitMode=q,t.dragDrop(e,u));break;case"leave":e.scheduleAction("cancel"),h.helper.data("enterResponse",null),h.helper.data("hitMode",null),this._local._setDndStatus(f,e,h.helper,"out",d),t.dragLeave&&t.dragLeave(e,u);break;case"stop":x.removeClass("fancytree-drag-source"),a(c).off(".fancytree-dnd"),t.dragStop&&t.dragStop(e,u);break;default:a.error("Unsupported drag event: "+b)}return v},_cancelDrag:function(){var b=a.ui.ddmanager.current;b&&b.cancel()}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.edit.min.js' */
!function(a,b,c,d){"use strict";var e=/Mac/.test(navigator.platform),f=a.ui.fancytree.escapeHtml,g=a.ui.fancytree.unescapeHtml;a.ui.fancytree._FancytreeNodeClass.prototype.editStart=function(){var b,d=this,e=this.tree,f=e.ext.edit,h=e.options.edit,i=a(".fancytree-title",d.span),j={node:d,tree:e,options:e.options,isNew:a(d[e.statusClassPropName]).hasClass("fancytree-edit-new"),orgTitle:d.title,input:null,dirty:!1};return h.beforeEdit.call(d,{type:"beforeEdit"},j)===!1?!1:(a.ui.fancytree.assert(!f.currentNode,"recursive edit"),f.currentNode=this,f.eventData=j,e.widget._unbind(),a(c).on("mousedown.fancytree-edit",function(b){a(b.target).hasClass("fancytree-edit-input")||d.editEnd(!0,b)}),b=a("<input />",{"class":"fancytree-edit-input",type:"text",value:e.options.escapeTitles?j.orgTitle:g(j.orgTitle)}),f.eventData.input=b,null!=h.adjustWidthOfs&&b.width(i.width()+h.adjustWidthOfs),null!=h.inputCss&&b.css(h.inputCss),i.html(b),b.focus().change(function(a){b.addClass("fancytree-edit-dirty")}).keydown(function(b){switch(b.which){case a.ui.keyCode.ESCAPE:d.editEnd(!1,b);break;case a.ui.keyCode.ENTER:return d.editEnd(!0,b),!1}b.stopPropagation()}).blur(function(a){return d.editEnd(!0,a)}),void h.edit.call(d,{type:"edit"},j))},a.ui.fancytree._FancytreeNodeClass.prototype.editEnd=function(b,d){var e,g=this,h=this.tree,i=h.ext.edit,j=i.eventData,k=h.options.edit,l=a(".fancytree-title",g.span),m=l.find("input.fancytree-edit-input");return k.trim&&m.val(a.trim(m.val())),e=m.val(),j.dirty=e!==g.title,b===!1?j.save=!1:j.isNew?j.save=""!==e:j.save=j.dirty&&""!==e,k.beforeClose.call(g,{type:"beforeClose"},j)===!1?!1:j.save&&k.save.call(g,{type:"save"},j)===!1?!1:(m.removeClass("fancytree-edit-dirty").unbind(),a(c).off(".fancytree-edit"),j.save?(g.setTitle(h.options.escapeTitles?e:f(e)),g.setFocus()):j.isNew?(g.remove(),g=j.node=null,i.relatedNode.setFocus()):(g.renderTitle(),g.setFocus()),i.eventData=null,i.currentNode=null,i.relatedNode=null,h.widget._bind(),a(h.$container).focus(),j.input=null,k.close.call(g,{type:"close"},j),!0)},a.ui.fancytree._FancytreeNodeClass.prototype.editCreateNode=function(b,c){var d,e=this.tree,f=this;return b=b||"child",null==c?c={title:""}:"string"==typeof c?c={title:c}:a.ui.fancytree.assert(a.isPlainObject(c)),"child"!==b||this.isExpanded()||this.hasChildren()===!1?(d=this.addNode(c,b),void d.makeVisible().done(function(){a(d[e.statusClassPropName]).addClass("fancytree-edit-new"),f.tree.ext.edit.relatedNode=f,d.editStart()})):void this.setExpanded().done(function(){f.editCreateNode(b,c)})},a.ui.fancytree._FancytreeClass.prototype.isEditing=function(){return this.ext.edit.currentNode},a.ui.fancytree._FancytreeNodeClass.prototype.isEditing=function(){return this.tree.ext.edit.currentNode===this},a.ui.fancytree.registerExtension({name:"edit",version:"0.2.0",options:{adjustWidthOfs:4,allowEmpty:!1,inputCss:{minWidth:"3em"},triggerCancel:["esc","tab","click"],triggerStart:["f2","shift+click","mac+enter"],trim:!0,beforeClose:a.noop,beforeEdit:a.noop,close:a.noop,edit:a.noop,save:a.noop},currentNode:null,treeInit:function(a){this._superApply(arguments),this.$container.addClass("fancytree-ext-edit")},nodeClick:function(b){return a.inArray("shift+click",b.options.edit.triggerStart)>=0&&b.originalEvent.shiftKey?(b.node.editStart(),!1):this._superApply(arguments)},nodeDblclick:function(b){return a.inArray("dblclick",b.options.edit.triggerStart)>=0?(b.node.editStart(),!1):this._superApply(arguments)},nodeKeydown:function(b){switch(b.originalEvent.which){case 113:if(a.inArray("f2",b.options.edit.triggerStart)>=0)return b.node.editStart(),!1;break;case a.ui.keyCode.ENTER:if(a.inArray("mac+enter",b.options.edit.triggerStart)>=0&&e)return b.node.editStart(),!1}return this._superApply(arguments)}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.filter.min.js' */
!function(a,b,c,d){"use strict";function e(a){return(a+"").replace(/([.?*+\^\$\[\]\\(){}|-])/g,"\\$1")}function f(b){return b.indexOf(">")>=0?a("<div/>").html(b).text():b}var g="__not_found__",h=a.ui.fancytree.escapeHtml;a.ui.fancytree._FancytreeClass.prototype._applyFilterImpl=function(b,c,d){var i,j,k,l,m,n=0,o=this.options,p=o.escapeTitles,q=o.filter,r="hide"===q.mode;return d=d||{},i=!!d.leavesOnly&&!c,"string"==typeof b&&(j=q.fuzzy?b.split("").reduce(function(a,b){return a+"[^"+b+"]*"+b}):e(b),l=new RegExp(".*"+j+".*","i"),m=new RegExp(b,"gi"),b=function(a){var b,c=p?a.title:f(a.title),d=!!l.test(c);return d&&q.highlight&&(b=p?h(a.title):c,a.titleWithHighlight=b.replace(m,function(a){return"<mark>"+a+"</mark>"})),d}),this.enableFilter=!0,this.lastFilterArgs=arguments,this.$div.addClass("fancytree-ext-filter"),r?this.$div.addClass("fancytree-ext-filter-hide"):this.$div.addClass("fancytree-ext-filter-dimm"),this.visit(function(a){delete a.match,delete a.titleWithHighlight,a.subMatchCount=0}),k=this.getRootNode()._findDirectChild(g),k&&k.remove(),this.visit(function(a){if(!i||null==a.children){var e=b(a);return"skip"===e?(a.visit(function(a){a.match=!1},!0),"skip"):e&&(n++,a.match=!0,a.visitParents(function(a){a.subMatchCount+=1,d.autoExpand&&!a.expanded&&(a.setExpanded(!0,{noAnimation:!0,noEvents:!0,scrollIntoView:!1}),a._filterAutoExpanded=!0)}),c||"branch"===e)?(a.visit(function(a){a.match=!0}),d.autoExpand&&!a.expanded&&(a.setExpanded(!0,{noAnimation:!0,noEvents:!0,scrollIntoView:!1}),a._filterAutoExpanded=!0),"skip"):void 0}}),0===n&&q.nodata&&(k=q.nodata,a.isFunction(k)&&(k=k()),k===!0?k={}:"string"==typeof k&&(k={title:k}),k=a.extend({statusNodeType:"nodata",key:g,title:this.options.strings.noData},k),this.getRootNode().addNode(k).match=!0),this.render(),n},a.ui.fancytree._FancytreeClass.prototype.filterNodes=function(a,b){return"boolean"==typeof b&&(b={leavesOnly:b},this.warn("Fancytree.filterNodes() leavesOnly option is deprecated since 2.9.0 / 2015-04-19.")),this._applyFilterImpl(a,!1,b)},a.ui.fancytree._FancytreeClass.prototype.applyFilter=function(a){return this.warn("Fancytree.applyFilter() is deprecated since 2.1.0 / 2014-05-29. Use .filterNodes() instead."),this.filterNodes.apply(this,arguments)},a.ui.fancytree._FancytreeClass.prototype.filterBranches=function(a,b){return this._applyFilterImpl(a,!0,b)},a.ui.fancytree._FancytreeClass.prototype.clearFilter=function(){var b,c=this.getRootNode()._findDirectChild(g),d=this.options.escapeTitles,e=this.options.enhanceTitle;c&&c.remove(),this.visit(function(c){c.match&&(b=a(">span.fancytree-title",c.span),d?b.text(c.title):b.html(c.title),e&&e({type:"enhanceTitle"},{node:c,$title:b})),delete c.match,delete c.subMatchCount,delete c.titleWithHighlight,c.$subMatchBadge&&(c.$subMatchBadge.remove(),delete c.$subMatchBadge),c._filterAutoExpanded&&c.expanded&&c.setExpanded(!1,{noAnimation:!0,noEvents:!0,scrollIntoView:!1}),delete c._filterAutoExpanded}),this.enableFilter=!1,this.lastFilterArgs=null,this.$div.removeClass("fancytree-ext-filter fancytree-ext-filter-dimm fancytree-ext-filter-hide"),this.render()},a.ui.fancytree._FancytreeClass.prototype.isFilterActive=function(){return!!this.enableFilter},a.ui.fancytree._FancytreeNodeClass.prototype.isMatched=function(){return!(this.tree.enableFilter&&!this.match)},a.ui.fancytree.registerExtension({name:"filter",version:"0.7.0",options:{autoApply:!0,counter:!0,fuzzy:!1,hideExpandedCounter:!0,highlight:!0,nodata:!0,mode:"dimm",enhanceTitle:null},nodeLoadChildren:function(a,b){return this._superApply(arguments).done(function(){a.tree.enableFilter&&a.tree.lastFilterArgs&&a.options.filter.autoApply&&a.tree._applyFilterImpl.apply(a.tree,a.tree.lastFilterArgs)})},nodeSetExpanded:function(a,b,c){return delete a.node._filterAutoExpanded,!b&&a.options.filter.hideExpandedCounter&&a.node.$subMatchBadge&&a.node.$subMatchBadge.show(),this._superApply(arguments)},nodeRenderStatus:function(b){var c,d=b.node,e=b.tree,f=b.options.filter,g=a("span.fancytree-title",d.span),h=a(d[e.statusClassPropName]),i=b.options.enhanceTitle,j=b.options.escapeTitles;return c=this._superApply(arguments),h.length&&e.enableFilter?(h.toggleClass("fancytree-match",!!d.match).toggleClass("fancytree-submatch",!!d.subMatchCount).toggleClass("fancytree-hide",!(d.match||d.subMatchCount)),!f.counter||!d.subMatchCount||d.isExpanded()&&f.hideExpandedCounter?d.$subMatchBadge&&d.$subMatchBadge.hide():(d.$subMatchBadge||(d.$subMatchBadge=a("<span class='fancytree-childcounter'/>"),a("span.fancytree-icon, span.fancytree-custom-icon",d.span).append(d.$subMatchBadge)),d.$subMatchBadge.show().text(d.subMatchCount)),d.titleWithHighlight?g.html(d.titleWithHighlight):j?g.text(d.title):g.html(d.title),i&&i({type:"enhanceTitle"},{node:d,$title:g}),c):c}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.glyph.min.js' */
!function(a,b,c,d){"use strict";function e(a,b){return a.map[b]}a.ui.fancytree.registerExtension({name:"glyph",version:"0.4.0",options:{map:{checkbox:"icon-check-empty",checkboxSelected:"icon-check",checkboxUnknown:"icon-check icon-muted",error:"icon-exclamation-sign",expanderClosed:"icon-caret-right",expanderLazy:"icon-angle-right",expanderOpen:"icon-caret-down",nodata:"icon-meh",noExpander:"",dragHelper:"icon-caret-right",dropMarker:"icon-caret-right",doc:"icon-file-alt",docOpen:"icon-file-alt",loading:"icon-refresh icon-spin",folder:"icon-folder-close-alt",folderOpen:"icon-folder-open-alt"}},treeInit:function(a){var b=a.tree;this._superApply(arguments),b.$container.addClass("fancytree-ext-glyph")},nodeRenderStatus:function(b){var c,d,f,g=b.node,h=a(g.span),i=b.options.glyph,j=i.map;return d=this._superApply(arguments),g.isRoot()?d:(f=h.children("span.fancytree-expander").get(0),f&&(c=g.expanded?"expanderOpen":g.isUndefined()?"expanderLazy":g.hasChildren()?"expanderClosed":"noExpander",f.className="fancytree-expander "+j[c]),f=g.tr?a("td",g.tr).find("span.fancytree-checkbox").get(0):h.children("span.fancytree-checkbox").get(0),f&&(c=g.selected?"checkboxSelected":g.partsel?"checkboxUnknown":"checkbox",f.className="fancytree-checkbox "+j[c]),f=h.children("span.fancytree-icon").get(0),f&&(c=g.statusNodeType?e(i,g.statusNodeType):g.folder?g.expanded?e(i,"folderOpen"):e(i,"folder"):g.expanded?e(i,"docOpen"):e(i,"doc"),f.className="fancytree-icon "+c),d)},nodeSetStatus:function(b,c,d,f){var g,h,i=b.options.glyph,j=b.node;return g=this._superApply(arguments),"error"!==c&&"loading"!==c&&"nodata"!==c||(j.parent?(h=a("span.fancytree-expander",j.span).get(0),h.className="fancytree-expander "+e(i,c)):(h=a(".fancytree-statusnode-"+c,j[this.nodeContainerAttrName]).find("span.fancytree-icon").get(0),h.className="fancytree-icon "+e(i,c))),g}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.gridnav.min.js' */
!function(a,b,c,d){"use strict";function e(b,c){var d,e=c.get(0),f=0;return b.children().each(function(){return this===e?!1:(d=a(this).prop("colspan"),void(f+=d?d:1))}),f}function f(b,c){var d,e=null,f=0;return b.children().each(function(){return f>=c?(e=a(this),!1):(d=a(this).prop("colspan"),void(f+=d?d:1))}),e}function g(a,b){var c,d,g=a.closest("td"),i=null;switch(b){case h.LEFT:i=g.prev();break;case h.RIGHT:i=g.next();break;case h.UP:case h.DOWN:for(c=g.parent(),d=e(c,g);;){if(c=b===h.UP?c.prev():c.next(),!c.length)break;if(!c.is(":hidden")&&(i=f(c,d),i&&i.find(":input").length))break}}return i}var h=a.ui.keyCode,i={text:[h.UP,h.DOWN],checkbox:[h.UP,h.DOWN,h.LEFT,h.RIGHT],radiobutton:[h.UP,h.DOWN,h.LEFT,h.RIGHT],"select-one":[h.LEFT,h.RIGHT],"select-multiple":[h.LEFT,h.RIGHT]};a.ui.fancytree.registerExtension({name:"gridnav",version:"0.0.1",options:{autofocusInput:!1,handleCursorKeys:!0},treeInit:function(b){this._requireExtension("table",!0,!0),this._superApply(arguments),this.$container.addClass("fancytree-ext-gridnav"),this.$container.on("focusin",function(c){var d,e=a.ui.fancytree.getNode(c.target);e&&!e.isActive()&&(d=b.tree._makeHookContext(e,c),b.tree._callHook("nodeSetActive",d,!0))})},nodeSetActive:function(b,c){var d,e=b.options.gridnav,f=b.node,g=b.originalEvent||{},h=a(g.target).is(":input");c=c!==!1,this._superApply(arguments),c&&(b.options.titlesTabbable?(h||(a(f.span).find("span.fancytree-title").focus(),f.setFocus()),b.tree.$container.attr("tabindex","-1")):e.autofocusInput&&!h&&(d=a(f.tr||f.span),d.find(":input:enabled:first").focus()))},nodeKeydown:function(b){var c,d,e,f=b.options.gridnav,h=b.originalEvent,j=a(h.target);return c=j.is(":input:enabled")?j.prop("type"):null,c&&f.handleCursorKeys?(d=i[c],d&&a.inArray(h.which,d)>=0&&(e=g(j,h.which),e&&e.length)?(e.find(":input:enabled").focus(),!1):!0):this._superApply(arguments)}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.persist.min.js' */
!function(a,b,c,d){"use strict";function e(b,c,d,f,g){var h,i,j,l,m=!1,n=[],o=[];for(d=d||[],g=g||a.Deferred(),h=0,j=d.length;j>h;h++)i=d[h],l=b.getNodeByKey(i),l?f&&l.isUndefined()?(m=!0,b.debug("_loadLazyNodes: "+l+" is lazy: loading..."),"expand"===f?n.push(l.setExpanded()):n.push(l.load())):(b.debug("_loadLazyNodes: "+l+" already loaded."),l.setExpanded()):(o.push(i),b.debug("_loadLazyNodes: "+l+" was not yet found."));return a.when.apply(a,n).always(function(){if(m&&o.length>0)e(b,c,o,f,g);else{if(o.length)for(b.warn("_loadLazyNodes: could not load those keys: ",o),h=0,j=o.length;j>h;h++)i=d[h],c._appendKey(k,d[h],!1);g.resolve()}}),g}var f,g,h,i=a.ui.fancytree.assert,j="active",k="expanded",l="focus",m="selected";"function"==typeof Cookies?(h=Cookies.set,f=Cookies.get,g=Cookies.remove):(h=f=a.cookie,g=a.removeCookie),a.ui.fancytree._FancytreeClass.prototype.clearCookies=function(a){var b=this.ext.persist,c=b.cookiePrefix;a=a||"active expanded focus selected",a.indexOf(j)>=0&&b._data(c+j,null),a.indexOf(k)>=0&&b._data(c+k,null),a.indexOf(l)>=0&&b._data(c+l,null),a.indexOf(m)>=0&&b._data(c+m,null)},a.ui.fancytree._FancytreeClass.prototype.getPersistData=function(){var a=this.ext.persist,b=a.cookiePrefix,c=a.cookieDelimiter,d={};return d[j]=a._data(b+j),d[k]=(a._data(b+k)||"").split(c),d[m]=(a._data(b+m)||"").split(c),d[l]=a._data(b+l),d},a.ui.fancytree.registerExtension({name:"persist",version:"0.3.0",options:{cookieDelimiter:"~",cookiePrefix:d,cookie:{raw:!1,expires:"",path:"",domain:"",secure:!1},expandLazy:!1,fireActivate:!0,overrideSource:!0,store:"auto",types:"active expanded focus selected"},_data:function(a,b){var c=this._local.localStorage;return b===d?c?c.getItem(a):f(a):void(null===b?c?c.removeItem(a):g(a):c?c.setItem(a,b):h(a,b,this.options.persist.cookie))},_appendKey:function(b,c,d){c=""+c;var e=this._local,f=this.options.persist,g=f.cookieDelimiter,h=e.cookiePrefix+b,i=e._data(h),j=i?i.split(g):[],k=a.inArray(c,j);k>=0&&j.splice(k,1),d&&j.push(c),e._data(h,j.join(g))},treeInit:function(c){var g=c.tree,h=c.options,n=this._local,o=this.options.persist;return i("auto"!==o.store&&"cookie"!==o.store||f,"Missing required plugin for 'persist' extension: js.cookie.js or jquery.cookie.js"),n.cookiePrefix=o.cookiePrefix||"fancytree-"+g._id+"-",n.storeActive=o.types.indexOf(j)>=0,n.storeExpanded=o.types.indexOf(k)>=0,n.storeSelected=o.types.indexOf(m)>=0,n.storeFocus=o.types.indexOf(l)>=0,"cookie"!==o.store&&b.localStorage?n.localStorage="local"===o.store?b.localStorage:b.sessionStorage:n.localStorage=null,g.$div.bind("fancytreeinit",function(b){if(g._triggerTreeEvent("beforeRestore",null,{})!==!1){var c,f,i,p,q,r=n._data(n.cookiePrefix+l),s=o.fireActivate===!1;c=n._data(n.cookiePrefix+k),p=c&&c.split(o.cookieDelimiter),f=n.storeExpanded?e(g,n,p,o.expandLazy?"expand":!1,null):(new a.Deferred).resolve(),f.done(function(){if(n.storeSelected){if(c=n._data(n.cookiePrefix+m))for(p=c.split(o.cookieDelimiter),i=0;i<p.length;i++)q=g.getNodeByKey(p[i]),q?(q.selected===d||o.overrideSource&&q.selected===!1)&&(q.selected=!0,q.renderStatus()):n._appendKey(m,p[i],!1);3===g.options.selectMode&&g.visit(function(a){return a.selected?(a.fixSelection3AfterClick(),"skip"):void 0})}n.storeActive&&(c=n._data(n.cookiePrefix+j),!c||!h.persist.overrideSource&&g.activeNode||(q=g.getNodeByKey(c),q&&(q.debug("persist: set active",c),q.setActive(!0,{noFocus:!0,noEvents:s})))),n.storeFocus&&r&&(q=g.getNodeByKey(r),q&&(g.options.titlesTabbable?a(q.span).find(".fancytree-title").focus():a(g.$container).focus())),g._triggerTreeEvent("restore",null,{})})}}),this._superApply(arguments)},nodeSetActive:function(a,b,c){var d,e=this._local;return b=b!==!1,d=this._superApply(arguments),e.storeActive&&e._data(e.cookiePrefix+j,this.activeNode?this.activeNode.key:null),d},nodeSetExpanded:function(a,b,c){var d,e=a.node,f=this._local;return b=b!==!1,d=this._superApply(arguments),f.storeExpanded&&f._appendKey(k,e.key,b),d},nodeSetFocus:function(a,b){var c,d=this._local;return b=b!==!1,c=this._superApply(arguments),d.storeFocus&&d._data(d.cookiePrefix+l,this.focusNode?this.focusNode.key:null),c},nodeSetSelected:function(b,c){var d,e,f=b.tree,g=b.node,h=this._local;return c=c!==!1,d=this._superApply(arguments),h.storeSelected&&(3===f.options.selectMode?(e=a.map(f.getSelectedNodes(!0),function(a){return a.key}),e=e.join(b.options.persist.cookieDelimiter),h._data(h.cookiePrefix+m,e)):h._appendKey(m,g.key,g.selected)),d}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.table.min.js' */
!function(a,b,c,d){"use strict";function e(b,c){c=c||"",b||a.error("Assertion failed "+c)}function f(a,b){a.parentNode.insertBefore(b,a.nextSibling)}function g(a,b){a.visit(function(a){var c=a.tr;return c&&(c.style.display=a.hide||!b?"none":""),a.expanded?void 0:"skip"})}function h(b){var c,d,f,g=b.parent,h=g?g.children:null;if(h&&h.length>1&&h[0]!==b)for(c=a.inArray(b,h),f=h[c-1],e(f.tr);f.children&&(d=f.children[f.children.length-1],d.tr);)f=d;else f=g;return f}a.ui.fancytree.registerExtension({name:"table",version:"0.3.0",options:{checkboxColumnIdx:null,indentation:16,nodeColumnIdx:0},treeInit:function(b){var d,f,g,h,i=b.tree,j=b.options,k=j.table,l=i.widget.element;if(null!=k.customStatus&&(null!=j.renderStatusColumns?a.error("The 'customStatus' option is deprecated since v2.15.0. Use 'renderStatusColumns' only instead."):(i.warn("The 'customStatus' option is deprecated since v2.15.0. Use 'renderStatusColumns' instead."),j.renderStatusColumns=k.customStatus)),j.renderStatusColumns&&j.renderStatusColumns===!0&&(j.renderStatusColumns=j.renderColumns),l.addClass("fancytree-container fancytree-ext-table"),i.tbody=l.find(">tbody")[0],h=a(i.tbody),i.columnCount=a("thead >tr:last >th",l).length,g=h.children("tr:first"),g.length)f=g.children("td").length,i.columnCount&&f!==i.columnCount&&(i.warn("Column count mismatch between thead ("+i.columnCount+") and tbody ("+f+"); using tbody."),i.columnCount=f),g=g.clone();else for(e(i.columnCount>=1,"Need either <thead> or <tbody> with <td> elements to determine column count."),g=a("<tr />"),d=0;d<i.columnCount;d++)g.append("<td />");g.find(">td").eq(k.nodeColumnIdx).html("<span class='fancytree-node' />"),j.aria&&(g.attr("role","row"),g.find("td").attr("role","gridcell")),i.rowFragment=c.createDocumentFragment(),i.rowFragment.appendChild(g.get(0)),h.empty(),i.statusClassPropName="tr",i.ariaPropName="tr",this.nodeContainerAttrName="tr",i.$container=l,this._superApply(arguments),a(i.rootNode.ul).remove(),i.rootNode.ul=null,this.$container.attr("tabindex",j.tabindex),j.aria&&i.$container.attr("role","treegrid").attr("aria-readonly",!0)},nodeRemoveChildMarkup:function(b){var c=b.node;c.visit(function(b){b.tr&&(a(b.tr).remove(),b.tr=null)})},nodeRemoveMarkup:function(b){var c=b.node;c.tr&&(a(c.tr).remove(),c.tr=null),this.nodeRemoveChildMarkup(b)},nodeRender:function(b,c,d,i,j){var k,l,m,n,o,p,q,r,s=b.tree,t=b.node,u=b.options,v=!t.parent;if(j||(b.hasCollapsedParents=t.parent&&!t.parent.expanded),!v)if(t.tr)c?this.nodeRenderTitle(b):this.nodeRenderStatus(b);else{if(b.hasCollapsedParents&&!d)return void t.debug("nodeRender ignored due to unrendered parent");o=s.rowFragment.firstChild.cloneNode(!0),p=h(t),e(p),i===!0&&j?o.style.display="none":d&&b.hasCollapsedParents&&(o.style.display="none"),p.tr?f(p.tr,o):(e(!p.parent,"prev. row must have a tr, or is system root"),s.tbody.appendChild(o)),t.tr=o,t.key&&u.generateIds&&(t.tr.id=u.idPrefix+t.key),t.tr.ftnode=t,u.aria&&a(t.tr).attr("aria-labelledby","ftal_"+t.key),t.span=a("span.fancytree-node",t.tr).get(0),this.nodeRenderTitle(b),u.createNode&&u.createNode.call(s,{type:"createNode"},b)}if(u.renderNode&&u.renderNode.call(s,{type:"renderNode"},b),k=t.children,k&&(v||d||t.expanded))for(m=0,n=k.length;n>m;m++)r=a.extend({},b,{node:k[m]}),r.hasCollapsedParents=r.hasCollapsedParents||!t.expanded,this.nodeRender(r,c,d,i,!0);k&&!j&&(q=t.tr||null,l=s.tbody.firstChild,t.visit(function(a){if(a.tr){if(a.parent.expanded||"none"===a.tr.style.display||(a.tr.style.display="none",g(a,!1)),a.tr.previousSibling!==q){t.debug("_fixOrder: mismatch at node: "+a);var b=q?q.nextSibling:l;s.tbody.insertBefore(a.tr,b)}q=a.tr}}))},nodeRenderTitle:function(b,c){var d,e,f=b.node,g=b.options,h=f.isStatusNode();return e=this._superApply(arguments),f.isRootNode()?e:(g.checkbox&&!h&&null!=g.table.checkboxColumnIdx&&(d=a("span.fancytree-checkbox",f.span),a(f.tr).find("td").eq(+g.table.checkboxColumnIdx).html(d)),this.nodeRenderStatus(b),h?g.renderStatusColumns&&g.renderStatusColumns.call(b.tree,{type:"renderStatusColumns"},b):g.renderColumns&&g.renderColumns.call(b.tree,{type:"renderColumns"},b),e)},nodeRenderStatus:function(b){var c,d=b.node,e=b.options;this._superApply(arguments),a(d.tr).removeClass("fancytree-node"),c=(d.getLevel()-1)*e.table.indentation,a(d.span).css({paddingLeft:c+"px"})},nodeSetExpanded:function(b,c,d){function e(a){g(b.node,c),a?c&&b.options.autoScroll&&!d.noAnimation&&b.node.hasChildren()?b.node.getLastChild().scrollIntoView(!0,{topNode:b.node}).always(function(){d.noEvents||b.tree._triggerNodeEvent(c?"expand":"collapse",b),f.resolveWith(b.node)}):(d.noEvents||b.tree._triggerNodeEvent(c?"expand":"collapse",b),f.resolveWith(b.node)):(d.noEvents||b.tree._triggerNodeEvent(c?"expand":"collapse",b),f.rejectWith(b.node))}if(c=c!==!1,b.node.expanded&&c||!b.node.expanded&&!c)return this._superApply(arguments);var f=new a.Deferred,h=a.extend({},d,{noEvents:!0,noAnimation:!0});return d=d||{},this._super(b,c,h).done(function(){e(!0)}).fail(function(){e(!1)}),f.promise()},nodeSetStatus:function(b,c,d,e){if("ok"===c){var f=b.node,g=f.children?f.children[0]:null;g&&g.isStatusNode()&&a(g.tr).remove()}return this._superApply(arguments)},treeClear:function(a){return this.nodeRemoveChildMarkup(this._makeHookContext(this.rootNode)),this._superApply(arguments)},treeDestroy:function(a){this.$container.find("tbody").empty(),this.$source&&this.$source.removeClass("ui-helper-hidden")}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.themeroller.min.js' */
!function(a,b,c,d){"use strict";a.ui.fancytree.registerExtension({name:"themeroller",version:"0.0.1",options:{activeClass:"ui-state-active",foccusClass:"ui-state-focus",hoverClass:"ui-state-hover",selectedClass:"ui-state-highlight"},treeInit:function(b){this._superApply(arguments);var c=b.widget.element;"TABLE"===c[0].nodeName?(c.addClass("ui-widget ui-corner-all"),c.find(">thead tr").addClass("ui-widget-header"),c.find(">tbody").addClass("ui-widget-conent")):c.addClass("ui-widget ui-widget-content ui-corner-all"),c.delegate(".fancytree-node","mouseenter mouseleave",function(b){var c=a.ui.fancytree.getNode(b.target),d="mouseenter"===b.type;c.debug("hover: "+d),a(c.tr?c.tr:c.span).toggleClass("ui-state-hover ui-corner-all",d)})},treeDestroy:function(a){this._superApply(arguments),a.widget.element.removeClass("ui-widget ui-widget-content ui-corner-all")},nodeRenderStatus:function(b){var c=b.node,d=a(c.tr?c.tr:c.span);this._superApply(arguments),d.toggleClass("ui-state-active",c.isActive()),d.toggleClass("ui-state-focus",c.hasFocus()),d.toggleClass("ui-state-highlight",c.isSelected())}})}(jQuery,window,document);
/*! Extension 'jquery.fancytree.wide.min.js' */
!function(a,b,c,d){"use strict";function e(b,c){b="fancytree-style-"+b;var d=a("#"+b);if(!c)return d.remove(),null;d.length||(d=a("<style />").attr("id",b).addClass("fancytree-style").prop("type","text/css").appendTo("head"));try{d.html(c)}catch(e){d[0].styleSheet.cssText=c}return d}function f(a,b,c,d,e){var f,g="#"+a+" span.fancytree-level-",h=[];for(f=0;b>f;f++)h.push(g+(f+1)+" span.fancytree-title { padding-left: "+(f*c+d)+e+"; }");return h.push("#"+a+" div.ui-effects-wrapper ul li span.fancytree-title { padding-left: 3px; position: static; width: auto; }"),h.join("\n")}var g=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;a.ui.fancytree.registerExtension({name:"wide",version:"0.0.3",options:{iconWidth:null,iconSpacing:null,levelOfs:null},treeCreate:function(b){this._superApply(arguments),this.$container.addClass("fancytree-ext-wide");var c,d,h,i,j,k=b.options.wide,l=a("<li id='fancytreeTemp'><span class='fancytree-node'><span class='fancytree-icon' /><span class='fancytree-title' /></span><ul />").appendTo(b.tree.$container),m=l.find(".fancytree-icon"),n=l.find("ul"),o=k.iconSpacing||m.css("margin-left"),p=k.iconWidth||m.css("width"),q=k.levelOfs||n.css("padding-left");l.remove(),h=o.match(g)[2],o=parseFloat(o,10),i=p.match(g)[2],p=parseFloat(p,10),j=q.match(g)[2],h===i&&j===i||a.error("iconWidth, iconSpacing, and levelOfs must have the same css measure unit"),this._local.measureUnit=i,this._local.levelOfs=parseFloat(q),this._local.lineOfs=(1+(b.options.checkbox?1:0)+(b.options.icon===!1?0:1))*(p+o)+o,this._local.maxDepth=10,c=this.$container.uniqueId().attr("id"),d=f(c,this._local.maxDepth,this._local.levelOfs,this._local.lineOfs,this._local.measureUnit),e(c,d)},treeDestroy:function(a){return e(this.$container.attr("id"),null),this._superApply(arguments)},nodeRenderStatus:function(b){var c,d,g,h=b.node,i=h.getLevel();return g=this._superApply(arguments),i>this._local.maxDepth&&(c=this.$container.attr("id"),this._local.maxDepth*=2,h.debug("Define global ext-wide css up to level "+this._local.maxDepth),d=f(c,this._local.maxDepth,this._local.levelOfs,this._local.lineOfs,this._local.measureUnit),e(c,d)),a(h.span).addClass("fancytree-level-"+i),g}})}(jQuery,window,document);
}));
|
docs/src/pages/Home.js
|
sghall/resonance
|
// @flow
import React from 'react'
import PropTypes from 'prop-types'
import { withStyles } from '@material-ui/core/styles'
import Link from 'react-router/lib/Link'
import Button from '@material-ui/core/Button'
import Grid from '@material-ui/core/Grid'
import Paper from '@material-ui/core/Paper'
import Typography from '@material-ui/core/Typography'
import SunburstDemo from './demos/charts/Sunburst'
const styles = () => ({
root: {
marginTop: 30,
textAlign: 'center',
},
})
function Home(props) {
const classes = props.classes
return (
<Grid container alignItems="center" justify="space-around">
<Grid item xs={12} className={classes.root}>
<Typography variant="h3">Resonance</Typography>
<Typography variant="body1">React Animation Library</Typography>
</Grid>
<Grid item xs={12} md={8} className={classes.root}>
<Paper>
<SunburstDemo />
</Paper>
</Grid>
<Grid item xs={12} className={classes.root}>
<Button component={Link} variant="outlined" to="/demos/node-group">
More Demos
</Button>
</Grid>
</Grid>
)
}
Home.propTypes = {
classes: PropTypes.object.isRequired,
}
export default withStyles(styles)(Home)
|
examples/counter/index.js
|
jonaustin/redux
|
import React from 'react';
import { Provider } from 'react-redux';
import App from './containers/App';
import configureStore from './store/configureStore';
const store = configureStore();
React.render(
<Provider store={store}>
{() => <App />}
</Provider>,
document.getElementById('root')
);
|
ajax/libs/material-ui/5.0.0-alpha.5/esm/TabScrollButton/TabScrollButton.min.js
|
cdnjs/cdnjs
|
import _extends from"@babel/runtime/helpers/esm/extends";import _objectWithoutProperties from"@babel/runtime/helpers/esm/objectWithoutProperties";import*as React from"react";import PropTypes from"prop-types";import clsx from"clsx";import KeyboardArrowLeft from"../internal/svg-icons/KeyboardArrowLeft";import KeyboardArrowRight from"../internal/svg-icons/KeyboardArrowRight";import withStyles from"../styles/withStyles";import ButtonBase from"../ButtonBase";export var styles={root:{width:40,flexShrink:0,opacity:.8,"&$disabled":{opacity:0}},vertical:{width:"100%",height:40,"& svg":{transform:"rotate(90deg)"}},disabled:{}};var _ref=React.createElement(KeyboardArrowLeft,{fontSize:"small"}),_ref2=React.createElement(KeyboardArrowRight,{fontSize:"small"}),TabScrollButton=React.forwardRef(function(e,t){var r=e.classes,o=e.className,s=e.direction,i=e.orientation,a=e.disabled,l=_objectWithoutProperties(e,["classes","className","direction","orientation","disabled"]);return React.createElement(ButtonBase,_extends({component:"div",className:clsx(r.root,o,a&&r.disabled,"vertical"===i&&r.vertical),ref:t,role:null,tabIndex:null},l),"left"===s?_ref:_ref2)});"production"!==process.env.NODE_ENV&&(TabScrollButton.propTypes={children:PropTypes.node,classes:PropTypes.object,className:PropTypes.string,direction:PropTypes.oneOf(["left","right"]).isRequired,disabled:PropTypes.bool,orientation:PropTypes.oneOf(["horizontal","vertical"]).isRequired});export default withStyles(styles,{name:"MuiTabScrollButton"})(TabScrollButton);
|
ajax/libs/react-instantsearch/6.8.2/Dom.js
|
cdnjs/cdnjs
|
/*! React InstantSearch 6.8.2 | © Algolia, inc. | https://github.com/algolia/react-instantsearch */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
(global = global || self, factory((global.ReactInstantSearch = global.ReactInstantSearch || {}, global.ReactInstantSearch.Dom = {}), global.React));
}(this, function (exports, React) { 'use strict';
var React__default = 'default' in React ? React['default'] : React;
function _extends() {
_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;
};
return _extends.apply(this, arguments);
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
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 _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
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 _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
function _typeof(obj) {
if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
_typeof = function _typeof(obj) {
return _typeof2(obj);
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
};
}
return _typeof(obj);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
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 _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);
}
/* global Map:readonly, Set:readonly, ArrayBuffer:readonly */
var hasElementType = typeof Element !== 'undefined';
var hasMap = typeof Map === 'function';
var hasSet = typeof Set === 'function';
var hasArrayBuffer = typeof ArrayBuffer === 'function';
// Note: We **don't** need `envHasBigInt64Array` in fde es6/index.js
function equal(a, b) {
// START: fast-deep-equal es6/index.js 3.1.1
if (a === b) return true;
if (a && b && typeof a == 'object' && typeof b == 'object') {
if (a.constructor !== b.constructor) return false;
var length, i, keys;
if (Array.isArray(a)) {
length = a.length;
if (length != b.length) return false;
for (i = length; i-- !== 0;)
if (!equal(a[i], b[i])) return false;
return true;
}
// START: Modifications:
// 1. Extra `has<Type> &&` helpers in initial condition allow es6 code
// to co-exist with es5.
// 2. Replace `for of` with es5 compliant iteration using `for`.
// Basically, take:
//
// ```js
// for (i of a.entries())
// if (!b.has(i[0])) return false;
// ```
//
// ... and convert to:
//
// ```js
// it = a.entries();
// while (!(i = it.next()).done)
// if (!b.has(i.value[0])) return false;
// ```
//
// **Note**: `i` access switches to `i.value`.
var it;
if (hasMap && (a instanceof Map) && (b instanceof Map)) {
if (a.size !== b.size) return false;
it = a.entries();
while (!(i = it.next()).done)
if (!b.has(i.value[0])) return false;
it = a.entries();
while (!(i = it.next()).done)
if (!equal(i.value[1], b.get(i.value[0]))) return false;
return true;
}
if (hasSet && (a instanceof Set) && (b instanceof Set)) {
if (a.size !== b.size) return false;
it = a.entries();
while (!(i = it.next()).done)
if (!b.has(i.value[0])) return false;
return true;
}
// END: Modifications
if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
length = a.length;
if (length != b.length) return false;
for (i = length; i-- !== 0;)
if (a[i] !== b[i]) return false;
return true;
}
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
keys = Object.keys(a);
length = keys.length;
if (length !== Object.keys(b).length) return false;
for (i = length; i-- !== 0;)
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
// END: fast-deep-equal
// START: react-fast-compare
// custom handling for DOM elements
if (hasElementType && a instanceof Element) return false;
// custom handling for React
for (i = length; i-- !== 0;) {
if (keys[i] === '_owner' && a.$$typeof) {
// React-specific: avoid traversing React elements' _owner.
// _owner contains circular references
// and is not needed when comparing the actual elements (and not their owners)
// .$$typeof and ._store on just reasonable markers of a react element
continue;
}
// all other properties should be traversed as usual
if (!equal(a[keys[i]], b[keys[i]])) return false;
}
// END: react-fast-compare
// START: fast-deep-equal
return true;
}
return a !== a && b !== b;
}
// end fast-deep-equal
var reactFastCompare = function isEqual(a, b) {
try {
return equal(a, b);
} catch (error) {
if (((error.message || '').match(/stack|recursion/i))) {
// warn on circular references, don't crash
// browsers give this different errors name and messages:
// chrome/safari: "RangeError", "Maximum call stack size exceeded"
// firefox: "InternalError", too much recursion"
// edge: "Error", "Out of stack space"
console.warn('react-fast-compare cannot handle circular refs');
return false;
}
// some other error. we should definitely know about these
throw error;
}
};
var shallowEqual = function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
} // Test for A's keys different from B.
var hasOwn = Object.prototype.hasOwnProperty;
for (var i = 0; i < keysA.length; i++) {
if (!hasOwn.call(objB, keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
return false;
}
}
return true;
};
var getDisplayName = function getDisplayName(Component) {
return Component.displayName || Component.name || 'UnknownComponent';
};
var resolved = Promise.resolve();
var defer = function defer(f) {
resolved.then(f);
};
var isPlainObject = function isPlainObject(value) {
return _typeof(value) === 'object' && value !== null && !Array.isArray(value);
};
var removeEmptyKey = function removeEmptyKey(obj) {
Object.keys(obj).forEach(function (key) {
var value = obj[key];
if (!isPlainObject(value)) {
return;
}
if (!objectHasKeys(value)) {
delete obj[key];
} else {
removeEmptyKey(value);
}
});
return obj;
};
var removeEmptyArraysFromObject = function removeEmptyArraysFromObject(obj) {
Object.keys(obj).forEach(function (key) {
var value = obj[key];
if (Array.isArray(value) && value.length === 0) {
delete obj[key];
}
});
return obj;
};
function addAbsolutePositions(hits, hitsPerPage, page) {
return hits.map(function (hit, index) {
return _objectSpread({}, hit, {
__position: hitsPerPage * page + index + 1
});
});
}
function addQueryID(hits, queryID) {
if (!queryID) {
return hits;
}
return hits.map(function (hit) {
return _objectSpread({}, hit, {
__queryID: queryID
});
});
}
function find(array, comparator) {
if (!Array.isArray(array)) {
return undefined;
}
for (var i = 0; i < array.length; i++) {
if (comparator(array[i])) {
return array[i];
}
}
return undefined;
}
function objectHasKeys(object) {
return object && Object.keys(object).length > 0;
} // https://github.com/babel/babel/blob/3aaafae053fa75febb3aa45d45b6f00646e30ba4/packages/babel-helpers/src/helpers.js#L604-L620
function omit(source, excluded) {
if (source === null || source === undefined) {
return {};
}
var target = {};
var sourceKeys = Object.keys(source);
for (var i = 0; i < sourceKeys.length; i++) {
var _key = sourceKeys[i];
if (excluded.indexOf(_key) >= 0) {
// eslint-disable-next-line no-continue
continue;
}
target[_key] = source[_key];
}
return target;
}
/**
* Retrieve the value at a path of the object:
*
* @example
* getPropertyByPath(
* { test: { this: { function: [{ now: { everyone: true } }] } } },
* 'test.this.function[0].now.everyone'
* ); // true
*
* getPropertyByPath(
* { test: { this: { function: [{ now: { everyone: true } }] } } },
* ['test', 'this', 'function', 0, 'now', 'everyone']
* ); // true
*
* @param object Source object to query
* @param path either an array of properties, or a string form of the properties, separated by .
*/
var getPropertyByPath = function getPropertyByPath(object, path) {
return (Array.isArray(path) ? path : path.replace(/\[(\d+)]/g, '.$1').split('.')).reduce(function (current, key) {
return current ? current[key] : undefined;
}, object);
};
var _createContext = React.createContext({
onInternalStateUpdate: function onInternalStateUpdate() {
return undefined;
},
createHrefForState: function createHrefForState() {
return '#';
},
onSearchForFacetValues: function onSearchForFacetValues() {
return undefined;
},
onSearchStateChange: function onSearchStateChange() {
return undefined;
},
onSearchParameters: function onSearchParameters() {
return undefined;
},
store: {},
widgetsManager: {},
mainTargetedIndex: ''
}),
InstantSearchConsumer = _createContext.Consumer,
InstantSearchProvider = _createContext.Provider;
var _createContext2 = React.createContext(undefined),
IndexConsumer = _createContext2.Consumer,
IndexProvider = _createContext2.Provider;
/**
* Connectors are the HOC used to transform React components
* into InstantSearch widgets.
* In order to simplify the construction of such connectors
* `createConnector` takes a description and transform it into
* a connector.
* @param {ConnectorDescription} connectorDesc the description of the connector
* @return {Connector} a function that wraps a component into
* an instantsearch connected one.
*/
function createConnectorWithoutContext(connectorDesc) {
if (!connectorDesc.displayName) {
throw new Error('`createConnector` requires you to provide a `displayName` property.');
}
var isWidget = typeof connectorDesc.getSearchParameters === 'function' || typeof connectorDesc.getMetadata === 'function' || typeof connectorDesc.transitionState === 'function';
return function (Composed) {
var Connector =
/*#__PURE__*/
function (_Component) {
_inherits(Connector, _Component);
function Connector(props) {
var _this;
_classCallCheck(this, Connector);
_this = _possibleConstructorReturn(this, _getPrototypeOf(Connector).call(this, props));
_defineProperty(_assertThisInitialized(_this), "unsubscribe", void 0);
_defineProperty(_assertThisInitialized(_this), "unregisterWidget", void 0);
_defineProperty(_assertThisInitialized(_this), "isUnmounting", false);
_defineProperty(_assertThisInitialized(_this), "state", {
providedProps: _this.getProvidedProps(_this.props)
});
_defineProperty(_assertThisInitialized(_this), "refine", function () {
var _ref;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this.props.contextValue.onInternalStateUpdate( // refine will always be defined here because the prop is only given conditionally
(_ref = connectorDesc.refine).call.apply(_ref, [_assertThisInitialized(_this), _this.props, _this.props.contextValue.store.getState().widgets].concat(args)));
});
_defineProperty(_assertThisInitialized(_this), "createURL", function () {
var _ref2;
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return _this.props.contextValue.createHrefForState( // refine will always be defined here because the prop is only given conditionally
(_ref2 = connectorDesc.refine).call.apply(_ref2, [_assertThisInitialized(_this), _this.props, _this.props.contextValue.store.getState().widgets].concat(args)));
});
_defineProperty(_assertThisInitialized(_this), "searchForFacetValues", function () {
var _ref3;
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
_this.props.contextValue.onSearchForFacetValues( // searchForFacetValues will always be defined here because the prop is only given conditionally
(_ref3 = connectorDesc.searchForFacetValues).call.apply(_ref3, [_assertThisInitialized(_this), _this.props, _this.props.contextValue.store.getState().widgets].concat(args)));
});
if (connectorDesc.getSearchParameters) {
_this.props.contextValue.onSearchParameters(connectorDesc.getSearchParameters.bind(_assertThisInitialized(_this)), {
ais: _this.props.contextValue,
multiIndexContext: _this.props.indexContextValue
}, _this.props, connectorDesc.getMetadata && connectorDesc.getMetadata.bind(_assertThisInitialized(_this)));
}
return _this;
}
_createClass(Connector, [{
key: "componentDidMount",
value: function componentDidMount() {
var _this2 = this;
this.unsubscribe = this.props.contextValue.store.subscribe(function () {
if (!_this2.isUnmounting) {
_this2.setState({
providedProps: _this2.getProvidedProps(_this2.props)
});
}
});
if (isWidget) {
this.unregisterWidget = this.props.contextValue.widgetsManager.registerWidget(this);
}
}
}, {
key: "shouldComponentUpdate",
value: function shouldComponentUpdate(nextProps, nextState) {
if (typeof connectorDesc.shouldComponentUpdate === 'function') {
return connectorDesc.shouldComponentUpdate.call(this, this.props, nextProps, this.state, nextState);
}
var propsEqual = shallowEqual(this.props, nextProps);
if (this.state.providedProps === null || nextState.providedProps === null) {
if (this.state.providedProps === nextState.providedProps) {
return !propsEqual;
}
return true;
}
return !propsEqual || !shallowEqual(this.state.providedProps, nextState.providedProps);
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
if (!reactFastCompare(prevProps, this.props)) {
this.setState({
providedProps: this.getProvidedProps(this.props)
});
if (isWidget) {
this.props.contextValue.widgetsManager.update();
if (typeof connectorDesc.transitionState === 'function') {
this.props.contextValue.onSearchStateChange(connectorDesc.transitionState.call(this, this.props, this.props.contextValue.store.getState().widgets, this.props.contextValue.store.getState().widgets));
}
}
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this.isUnmounting = true;
if (this.unsubscribe) {
this.unsubscribe();
}
if (this.unregisterWidget) {
this.unregisterWidget();
if (typeof connectorDesc.cleanUp === 'function') {
var nextState = connectorDesc.cleanUp.call(this, this.props, this.props.contextValue.store.getState().widgets);
this.props.contextValue.store.setState(_objectSpread({}, this.props.contextValue.store.getState(), {
widgets: nextState
}));
this.props.contextValue.onSearchStateChange(removeEmptyKey(nextState));
}
}
}
}, {
key: "getProvidedProps",
value: function getProvidedProps(props) {
var _this$props$contextVa = this.props.contextValue.store.getState(),
widgets = _this$props$contextVa.widgets,
results = _this$props$contextVa.results,
resultsFacetValues = _this$props$contextVa.resultsFacetValues,
searching = _this$props$contextVa.searching,
searchingForFacetValues = _this$props$contextVa.searchingForFacetValues,
isSearchStalled = _this$props$contextVa.isSearchStalled,
metadata = _this$props$contextVa.metadata,
error = _this$props$contextVa.error;
var searchResults = {
results: results,
searching: searching,
searchingForFacetValues: searchingForFacetValues,
isSearchStalled: isSearchStalled,
error: error
};
return connectorDesc.getProvidedProps.call(this, props, widgets, searchResults, metadata, // @MAJOR: move this attribute on the `searchResults` it doesn't
// makes sense to have it into a separate argument. The search
// flags are on the object why not the results?
resultsFacetValues);
}
}, {
key: "getSearchParameters",
value: function getSearchParameters(searchParameters) {
if (typeof connectorDesc.getSearchParameters === 'function') {
return connectorDesc.getSearchParameters.call(this, searchParameters, this.props, this.props.contextValue.store.getState().widgets);
}
return null;
}
}, {
key: "getMetadata",
value: function getMetadata(nextWidgetsState) {
if (typeof connectorDesc.getMetadata === 'function') {
return connectorDesc.getMetadata.call(this, this.props, nextWidgetsState);
}
return {};
}
}, {
key: "transitionState",
value: function transitionState(prevWidgetsState, nextWidgetsState) {
if (typeof connectorDesc.transitionState === 'function') {
return connectorDesc.transitionState.call(this, this.props, prevWidgetsState, nextWidgetsState);
}
return nextWidgetsState;
}
}, {
key: "render",
value: function render() {
var _this$props = this.props,
contextValue = _this$props.contextValue,
props = _objectWithoutProperties(_this$props, ["contextValue"]);
var providedProps = this.state.providedProps;
if (providedProps === null) {
return null;
}
var refineProps = typeof connectorDesc.refine === 'function' ? {
refine: this.refine,
createURL: this.createURL
} : {};
var searchForFacetValuesProps = typeof connectorDesc.searchForFacetValues === 'function' ? {
searchForItems: this.searchForFacetValues
} : {};
return React__default.createElement(Composed, _extends({}, props, providedProps, refineProps, searchForFacetValuesProps));
}
}]);
return Connector;
}(React.Component);
_defineProperty(Connector, "displayName", "".concat(connectorDesc.displayName, "(").concat(getDisplayName(Composed), ")"));
_defineProperty(Connector, "propTypes", connectorDesc.propTypes);
_defineProperty(Connector, "defaultProps", connectorDesc.defaultProps);
return Connector;
};
}
var createConnectorWithContext = function createConnectorWithContext(connectorDesc) {
return function (Composed) {
var Connector = createConnectorWithoutContext(connectorDesc)(Composed);
var ConnectorWrapper = function ConnectorWrapper(props) {
return React__default.createElement(InstantSearchConsumer, null, function (contextValue) {
return React__default.createElement(IndexConsumer, null, function (indexContextValue) {
return React__default.createElement(Connector, _extends({
contextValue: contextValue,
indexContextValue: indexContextValue
}, props));
});
});
};
return ConnectorWrapper;
};
};
var HIGHLIGHT_TAGS = {
highlightPreTag: "<ais-highlight-0000000000>",
highlightPostTag: "</ais-highlight-0000000000>"
};
/**
* Parses an highlighted attribute into an array of objects with the string value, and
* a boolean that indicated if this part is highlighted.
*
* @param {string} preTag - string used to identify the start of an highlighted value
* @param {string} postTag - string used to identify the end of an highlighted value
* @param {string} highlightedValue - highlighted attribute as returned by Algolia highlight feature
* @return {object[]} - An array of {value: string, isHighlighted: boolean}.
*/
function parseHighlightedAttribute(_ref) {
var preTag = _ref.preTag,
postTag = _ref.postTag,
_ref$highlightedValue = _ref.highlightedValue,
highlightedValue = _ref$highlightedValue === void 0 ? '' : _ref$highlightedValue;
var splitByPreTag = highlightedValue.split(preTag);
var firstValue = splitByPreTag.shift();
var elements = firstValue === '' ? [] : [{
value: firstValue,
isHighlighted: false
}];
if (postTag === preTag) {
var isHighlighted = true;
splitByPreTag.forEach(function (split) {
elements.push({
value: split,
isHighlighted: isHighlighted
});
isHighlighted = !isHighlighted;
});
} else {
splitByPreTag.forEach(function (split) {
var splitByPostTag = split.split(postTag);
elements.push({
value: splitByPostTag[0],
isHighlighted: true
});
if (splitByPostTag[1] !== '') {
elements.push({
value: splitByPostTag[1],
isHighlighted: false
});
}
});
}
return elements;
}
/**
* Find an highlighted attribute given an `attribute` and an `highlightProperty`, parses it,
* and provided an array of objects with the string value and a boolean if this
* value is highlighted.
*
* In order to use this feature, highlight must be activated in the configuration of
* the index. The `preTag` and `postTag` attributes are respectively highlightPreTag and
* highlightPostTag in Algolia configuration.
*
* @param {string} preTag - string used to identify the start of an highlighted value
* @param {string} postTag - string used to identify the end of an highlighted value
* @param {string} highlightProperty - the property that contains the highlight structure in the results
* @param {string} attribute - the highlighted attribute to look for
* @param {object} hit - the actual hit returned by Algolia.
* @return {object[]} - An array of {value: string, isHighlighted: boolean}.
*/
function parseAlgoliaHit(_ref2) {
var _ref2$preTag = _ref2.preTag,
preTag = _ref2$preTag === void 0 ? '<em>' : _ref2$preTag,
_ref2$postTag = _ref2.postTag,
postTag = _ref2$postTag === void 0 ? '</em>' : _ref2$postTag,
highlightProperty = _ref2.highlightProperty,
attribute = _ref2.attribute,
hit = _ref2.hit;
if (!hit) throw new Error('`hit`, the matching record, must be provided');
var highlightObject = getPropertyByPath(hit[highlightProperty], attribute) || {};
if (Array.isArray(highlightObject)) {
return highlightObject.map(function (item) {
return parseHighlightedAttribute({
preTag: preTag,
postTag: postTag,
highlightedValue: item.value
});
});
}
return parseHighlightedAttribute({
preTag: preTag,
postTag: postTag,
highlightedValue: highlightObject.value
});
}
var version = '6.8.2';
function translatable(defaultTranslations) {
return function (Composed) {
var Translatable =
/*#__PURE__*/
function (_Component) {
_inherits(Translatable, _Component);
function Translatable() {
var _getPrototypeOf2;
var _this;
_classCallCheck(this, Translatable);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Translatable)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(_assertThisInitialized(_this), "translate", function (key) {
var translations = _this.props.translations;
var translation = translations && translations.hasOwnProperty(key) ? translations[key] : defaultTranslations[key];
if (typeof translation === 'function') {
for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
params[_key2 - 1] = arguments[_key2];
}
return translation.apply(void 0, params);
}
return translation;
});
return _this;
}
_createClass(Translatable, [{
key: "render",
value: function render() {
return React__default.createElement(Composed, _extends({
translate: this.translate
}, this.props));
}
}]);
return Translatable;
}(React.Component);
var name = Composed.displayName || Composed.name || 'UnknownComponent';
Translatable.displayName = "Translatable(".concat(name, ")");
return Translatable;
};
}
function getIndexId(context) {
return hasMultipleIndices(context) ? context.multiIndexContext.targetedIndex : context.ais.mainTargetedIndex;
}
function getResults(searchResults, context) {
if (searchResults.results) {
if (searchResults.results.hits) {
return searchResults.results;
}
var indexId = getIndexId(context);
if (searchResults.results[indexId]) {
return searchResults.results[indexId];
}
}
return null;
}
function hasMultipleIndices(context) {
return context && context.multiIndexContext;
} // eslint-disable-next-line max-params
function refineValue(searchState, nextRefinement, context, resetPage, namespace) {
if (hasMultipleIndices(context)) {
var indexId = getIndexId(context);
return namespace ? refineMultiIndexWithNamespace(searchState, nextRefinement, indexId, resetPage, namespace) : refineMultiIndex(searchState, nextRefinement, indexId, resetPage);
} else {
// When we have a multi index page with shared widgets we should also
// reset their page to 1 if the resetPage is provided. Otherwise the
// indices will always be reset
// see: https://github.com/algolia/react-instantsearch/issues/310
// see: https://github.com/algolia/react-instantsearch/issues/637
if (searchState.indices && resetPage) {
Object.keys(searchState.indices).forEach(function (targetedIndex) {
searchState = refineValue(searchState, {
page: 1
}, {
multiIndexContext: {
targetedIndex: targetedIndex
}
}, true, namespace);
});
}
return namespace ? refineSingleIndexWithNamespace(searchState, nextRefinement, resetPage, namespace) : refineSingleIndex(searchState, nextRefinement, resetPage);
}
}
function refineMultiIndex(searchState, nextRefinement, indexId, resetPage) {
var page = resetPage ? {
page: 1
} : undefined;
var state = searchState.indices && searchState.indices[indexId] ? _objectSpread({}, searchState.indices, _defineProperty({}, indexId, _objectSpread({}, searchState.indices[indexId], nextRefinement, page))) : _objectSpread({}, searchState.indices, _defineProperty({}, indexId, _objectSpread({}, nextRefinement, page)));
return _objectSpread({}, searchState, {
indices: state
});
}
function refineSingleIndex(searchState, nextRefinement, resetPage) {
var page = resetPage ? {
page: 1
} : undefined;
return _objectSpread({}, searchState, nextRefinement, page);
} // eslint-disable-next-line max-params
function refineMultiIndexWithNamespace(searchState, nextRefinement, indexId, resetPage, namespace) {
var _objectSpread4;
var page = resetPage ? {
page: 1
} : undefined;
var state = searchState.indices && searchState.indices[indexId] ? _objectSpread({}, searchState.indices, _defineProperty({}, indexId, _objectSpread({}, searchState.indices[indexId], (_objectSpread4 = {}, _defineProperty(_objectSpread4, namespace, _objectSpread({}, searchState.indices[indexId][namespace], nextRefinement)), _defineProperty(_objectSpread4, "page", 1), _objectSpread4)))) : _objectSpread({}, searchState.indices, _defineProperty({}, indexId, _objectSpread(_defineProperty({}, namespace, nextRefinement), page)));
return _objectSpread({}, searchState, {
indices: state
});
}
function refineSingleIndexWithNamespace(searchState, nextRefinement, resetPage, namespace) {
var page = resetPage ? {
page: 1
} : undefined;
return _objectSpread({}, searchState, _defineProperty({}, namespace, _objectSpread({}, searchState[namespace], nextRefinement)), page);
}
function getNamespaceAndAttributeName(id) {
var parts = id.match(/^([^.]*)\.(.*)/);
var namespace = parts && parts[1];
var attributeName = parts && parts[2];
return {
namespace: namespace,
attributeName: attributeName
};
}
function hasRefinements(_ref) {
var multiIndex = _ref.multiIndex,
indexId = _ref.indexId,
namespace = _ref.namespace,
attributeName = _ref.attributeName,
id = _ref.id,
searchState = _ref.searchState;
if (multiIndex && namespace) {
return searchState.indices && searchState.indices[indexId] && searchState.indices[indexId][namespace] && Object.hasOwnProperty.call(searchState.indices[indexId][namespace], attributeName);
}
if (multiIndex) {
return searchState.indices && searchState.indices[indexId] && Object.hasOwnProperty.call(searchState.indices[indexId], id);
}
if (namespace) {
return searchState[namespace] && Object.hasOwnProperty.call(searchState[namespace], attributeName);
}
return Object.hasOwnProperty.call(searchState, id);
}
function getRefinements(_ref2) {
var multiIndex = _ref2.multiIndex,
indexId = _ref2.indexId,
namespace = _ref2.namespace,
attributeName = _ref2.attributeName,
id = _ref2.id,
searchState = _ref2.searchState;
if (multiIndex && namespace) {
return searchState.indices[indexId][namespace][attributeName];
}
if (multiIndex) {
return searchState.indices[indexId][id];
}
if (namespace) {
return searchState[namespace][attributeName];
}
return searchState[id];
}
function getCurrentRefinementValue(props, searchState, context, id, defaultValue) {
var indexId = getIndexId(context);
var _getNamespaceAndAttri = getNamespaceAndAttributeName(id),
namespace = _getNamespaceAndAttri.namespace,
attributeName = _getNamespaceAndAttri.attributeName;
var multiIndex = hasMultipleIndices(context);
var args = {
multiIndex: multiIndex,
indexId: indexId,
namespace: namespace,
attributeName: attributeName,
id: id,
searchState: searchState
};
var hasRefinementsValue = hasRefinements(args);
if (hasRefinementsValue) {
return getRefinements(args);
}
if (props.defaultRefinement) {
return props.defaultRefinement;
}
return defaultValue;
}
function cleanUpValue(searchState, context, id) {
var indexId = getIndexId(context);
var _getNamespaceAndAttri2 = getNamespaceAndAttributeName(id),
namespace = _getNamespaceAndAttri2.namespace,
attributeName = _getNamespaceAndAttri2.attributeName;
if (hasMultipleIndices(context) && Boolean(searchState.indices)) {
return cleanUpValueWithMultiIndex({
attribute: attributeName,
searchState: searchState,
indexId: indexId,
id: id,
namespace: namespace
});
}
return cleanUpValueWithSingleIndex({
attribute: attributeName,
searchState: searchState,
id: id,
namespace: namespace
});
}
function cleanUpValueWithSingleIndex(_ref3) {
var searchState = _ref3.searchState,
id = _ref3.id,
namespace = _ref3.namespace,
attribute = _ref3.attribute;
if (namespace) {
return _objectSpread({}, searchState, _defineProperty({}, namespace, omit(searchState[namespace], [attribute])));
}
return omit(searchState, [id]);
}
function cleanUpValueWithMultiIndex(_ref4) {
var searchState = _ref4.searchState,
indexId = _ref4.indexId,
id = _ref4.id,
namespace = _ref4.namespace,
attribute = _ref4.attribute;
var indexSearchState = searchState.indices[indexId];
if (namespace && indexSearchState) {
return _objectSpread({}, searchState, {
indices: _objectSpread({}, searchState.indices, _defineProperty({}, indexId, _objectSpread({}, indexSearchState, _defineProperty({}, namespace, omit(indexSearchState[namespace], [attribute])))))
});
}
if (indexSearchState) {
return _objectSpread({}, searchState, {
indices: _objectSpread({}, searchState.indices, _defineProperty({}, indexId, omit(indexSearchState, [id])))
});
}
return searchState;
}
function getId() {
return 'configure';
}
var connectConfigure = createConnectorWithContext({
displayName: 'AlgoliaConfigure',
getProvidedProps: function getProvidedProps() {
return {};
},
getSearchParameters: function getSearchParameters(searchParameters, props) {
var children = props.children,
contextValue = props.contextValue,
indexContextValue = props.indexContextValue,
items = _objectWithoutProperties(props, ["children", "contextValue", "indexContextValue"]);
return searchParameters.setQueryParameters(items);
},
transitionState: function transitionState(props, prevSearchState, nextSearchState) {
var id = getId();
var children = props.children,
contextValue = props.contextValue,
indexContextValue = props.indexContextValue,
items = _objectWithoutProperties(props, ["children", "contextValue", "indexContextValue"]);
var propKeys = Object.keys(props);
var nonPresentKeys = this._props ? Object.keys(this._props).filter(function (prop) {
return propKeys.indexOf(prop) === -1;
}) : [];
this._props = props;
var nextValue = _defineProperty({}, id, _objectSpread({}, omit(nextSearchState[id], nonPresentKeys), items));
return refineValue(nextSearchState, nextValue, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
cleanUp: function cleanUp(props, searchState) {
var id = getId();
var indexId = getIndexId({
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
var subState = hasMultipleIndices({
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}) && searchState.indices ? searchState.indices[indexId] : searchState;
var configureKeys = subState && subState[id] ? Object.keys(subState[id]) : [];
var configureState = configureKeys.reduce(function (acc, item) {
if (!props[item]) {
acc[item] = subState[id][item];
}
return acc;
}, {});
var nextValue = _defineProperty({}, id, configureState);
return refineValue(searchState, nextValue, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
}
});
/**
* Configure is a widget that lets you provide raw search parameters
* to the Algolia API.
*
* Any of the props added to this widget will be forwarded to Algolia. For more information
* on the different parameters that can be set, have a look at the
* [reference](https://www.algolia.com/doc/api-client/javascript/search#search-parameters).
*
* This widget can be used either with react-dom and react-native. It will not render anything
* on screen, only configure some parameters.
*
* Read more in the [Search parameters](guide/Search_parameters.html) guide.
* @name Configure
* @kind widget
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, Configure, Hits } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <Configure hitsPerPage={5} />
* <Hits />
* </InstantSearch>
* );
*/
var Configure = connectConfigure(function Configure() {
return null;
});
var global$1 = (typeof global !== "undefined" ? global :
typeof self !== "undefined" ? self :
typeof window !== "undefined" ? window : {});
if (typeof global$1.setTimeout === 'function') ;
if (typeof global$1.clearTimeout === 'function') ;
// from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
var performance = global$1.performance || {};
var performanceNow =
performance.now ||
performance.mozNow ||
performance.msNow ||
performance.oNow ||
performance.webkitNow ||
function(){ return (new Date()).getTime() };
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
arr2[i] = arr[i];
}
return arr2;
}
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}
function clone(value) {
if (typeof value === 'object' && value !== null) {
return _merge(Array.isArray(value) ? [] : {}, value);
}
return value;
}
function isObjectOrArrayOrFunction(value) {
return (
typeof value === 'function' ||
Array.isArray(value) ||
Object.prototype.toString.call(value) === '[object Object]'
);
}
function _merge(target, source) {
if (target === source) {
return target;
}
for (var key in source) {
if (!Object.prototype.hasOwnProperty.call(source, key)) {
continue;
}
var sourceVal = source[key];
var targetVal = target[key];
if (typeof targetVal !== 'undefined' && typeof sourceVal === 'undefined') {
continue;
}
if (isObjectOrArrayOrFunction(targetVal) && isObjectOrArrayOrFunction(sourceVal)) {
target[key] = _merge(targetVal, sourceVal);
} else {
target[key] = clone(sourceVal);
}
}
return target;
}
/**
* This method is like Object.assign, but recursively merges own and inherited
* enumerable keyed properties of source objects into the destination object.
*
* NOTE: this behaves like lodash/merge, but:
* - does mutate functions if they are a source
* - treats non-plain objects as plain
* - does not work for circular objects
* - treats sparse arrays as sparse
* - does not convert Array-like objects (Arguments, NodeLists, etc.) to arrays
*
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
*/
function merge(target) {
if (!isObjectOrArrayOrFunction(target)) {
target = {};
}
for (var i = 1, l = arguments.length; i < l; i++) {
var source = arguments[i];
if (isObjectOrArrayOrFunction(source)) {
_merge(target, source);
}
}
return target;
}
var merge_1 = merge;
// NOTE: this behaves like lodash/defaults, but doesn't mutate the target
var defaultsPure = function defaultsPure() {
var sources = Array.prototype.slice.call(arguments);
return sources.reduceRight(function(acc, source) {
Object.keys(Object(source)).forEach(function(key) {
if (source[key] !== undefined) {
acc[key] = source[key];
}
});
return acc;
}, {});
};
function intersection(arr1, arr2) {
return arr1.filter(function(value, index) {
return (
arr2.indexOf(value) > -1 &&
arr1.indexOf(value) === index /* skips duplicates */
);
});
}
var intersection_1 = intersection;
// @MAJOR can be replaced by native Array#find when we change support
var find$1 = function find(array, comparator) {
if (!Array.isArray(array)) {
return undefined;
}
for (var i = 0; i < array.length; i++) {
if (comparator(array[i])) {
return array[i];
}
}
};
function valToNumber(v) {
if (typeof v === 'number') {
return v;
} else if (typeof v === 'string') {
return parseFloat(v);
} else if (Array.isArray(v)) {
return v.map(valToNumber);
}
throw new Error('The value should be a number, a parsable string or an array of those.');
}
var valToNumber_1 = valToNumber;
// https://github.com/babel/babel/blob/3aaafae053fa75febb3aa45d45b6f00646e30ba4/packages/babel-helpers/src/helpers.js#L604-L620
function _objectWithoutPropertiesLoose$1(source, excluded) {
if (source === null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key;
var i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
var omit$1 = _objectWithoutPropertiesLoose$1;
function objectHasKeys$1(obj) {
return obj && Object.keys(obj).length > 0;
}
var objectHasKeys_1 = objectHasKeys$1;
/**
* Functions to manipulate refinement lists
*
* The RefinementList is not formally defined through a prototype but is based
* on a specific structure.
*
* @module SearchParameters.refinementList
*
* @typedef {string[]} SearchParameters.refinementList.Refinements
* @typedef {Object.<string, SearchParameters.refinementList.Refinements>} SearchParameters.refinementList.RefinementList
*/
var lib = {
/**
* Adds a refinement to a RefinementList
* @param {RefinementList} refinementList the initial list
* @param {string} attribute the attribute to refine
* @param {string} value the value of the refinement, if the value is not a string it will be converted
* @return {RefinementList} a new and updated refinement list
*/
addRefinement: function addRefinement(refinementList, attribute, value) {
if (lib.isRefined(refinementList, attribute, value)) {
return refinementList;
}
var valueAsString = '' + value;
var facetRefinement = !refinementList[attribute] ?
[valueAsString] :
refinementList[attribute].concat(valueAsString);
var mod = {};
mod[attribute] = facetRefinement;
return defaultsPure({}, mod, refinementList);
},
/**
* Removes refinement(s) for an attribute:
* - if the value is specified removes the refinement for the value on the attribute
* - if no value is specified removes all the refinements for this attribute
* @param {RefinementList} refinementList the initial list
* @param {string} attribute the attribute to refine
* @param {string} [value] the value of the refinement
* @return {RefinementList} a new and updated refinement lst
*/
removeRefinement: function removeRefinement(refinementList, attribute, value) {
if (value === undefined) {
// we use the "filter" form of clearRefinement, since it leaves empty values as-is
// the form with a string will remove the attribute completely
return lib.clearRefinement(refinementList, function(v, f) {
return attribute === f;
});
}
var valueAsString = '' + value;
return lib.clearRefinement(refinementList, function(v, f) {
return attribute === f && valueAsString === v;
});
},
/**
* Toggles the refinement value for an attribute.
* @param {RefinementList} refinementList the initial list
* @param {string} attribute the attribute to refine
* @param {string} value the value of the refinement
* @return {RefinementList} a new and updated list
*/
toggleRefinement: function toggleRefinement(refinementList, attribute, value) {
if (value === undefined) throw new Error('toggleRefinement should be used with a value');
if (lib.isRefined(refinementList, attribute, value)) {
return lib.removeRefinement(refinementList, attribute, value);
}
return lib.addRefinement(refinementList, attribute, value);
},
/**
* Clear all or parts of a RefinementList. Depending on the arguments, three
* kinds of behavior can happen:
* - if no attribute is provided: clears the whole list
* - if an attribute is provided as a string: clears the list for the specific attribute
* - if an attribute is provided as a function: discards the elements for which the function returns true
* @param {RefinementList} refinementList the initial list
* @param {string} [attribute] the attribute or function to discard
* @param {string} [refinementType] optional parameter to give more context to the attribute function
* @return {RefinementList} a new and updated refinement list
*/
clearRefinement: function clearRefinement(refinementList, attribute, refinementType) {
if (attribute === undefined) {
if (!objectHasKeys_1(refinementList)) {
return refinementList;
}
return {};
} else if (typeof attribute === 'string') {
return omit$1(refinementList, attribute);
} else if (typeof attribute === 'function') {
var hasChanged = false;
var newRefinementList = Object.keys(refinementList).reduce(function(memo, key) {
var values = refinementList[key] || [];
var facetList = values.filter(function(value) {
return !attribute(value, key, refinementType);
});
if (facetList.length !== values.length) {
hasChanged = true;
}
memo[key] = facetList;
return memo;
}, {});
if (hasChanged) return newRefinementList;
return refinementList;
}
},
/**
* Test if the refinement value is used for the attribute. If no refinement value
* is provided, test if the refinementList contains any refinement for the
* given attribute.
* @param {RefinementList} refinementList the list of refinement
* @param {string} attribute name of the attribute
* @param {string} [refinementValue] value of the filter/refinement
* @return {boolean}
*/
isRefined: function isRefined(refinementList, attribute, refinementValue) {
var containsRefinements = !!refinementList[attribute] &&
refinementList[attribute].length > 0;
if (refinementValue === undefined || !containsRefinements) {
return containsRefinements;
}
var refinementValueAsString = '' + refinementValue;
return refinementList[attribute].indexOf(refinementValueAsString) !== -1;
}
};
var RefinementList = lib;
/**
* isEqual, but only for numeric refinement values, possible values:
* - 5
* - [5]
* - [[5]]
* - [[5,5],[4]]
*/
function isEqualNumericRefinement(a, b) {
if (Array.isArray(a) && Array.isArray(b)) {
return (
a.length === b.length &&
a.every(function(el, i) {
return isEqualNumericRefinement(b[i], el);
})
);
}
return a === b;
}
/**
* like _.find but using deep equality to be able to use it
* to find arrays.
* @private
* @param {any[]} array array to search into (elements are base or array of base)
* @param {any} searchedValue the value we're looking for (base or array of base)
* @return {any} the searched value or undefined
*/
function findArray(array, searchedValue) {
return find$1(array, function(currentValue) {
return isEqualNumericRefinement(currentValue, searchedValue);
});
}
/**
* The facet list is the structure used to store the list of values used to
* filter a single attribute.
* @typedef {string[]} SearchParameters.FacetList
*/
/**
* Structure to store numeric filters with the operator as the key. The supported operators
* are `=`, `>`, `<`, `>=`, `<=` and `!=`.
* @typedef {Object.<string, Array.<number|number[]>>} SearchParameters.OperatorList
*/
/**
* SearchParameters is the data structure that contains all the information
* usable for making a search to Algolia API. It doesn't do the search itself,
* nor does it contains logic about the parameters.
* It is an immutable object, therefore it has been created in a way that each
* changes does not change the object itself but returns a copy with the
* modification.
* This object should probably not be instantiated outside of the helper. It will
* be provided when needed. This object is documented for reference as you'll
* get it from events generated by the {@link AlgoliaSearchHelper}.
* If need be, instantiate the Helper from the factory function {@link SearchParameters.make}
* @constructor
* @classdesc contains all the parameters of a search
* @param {object|SearchParameters} newParameters existing parameters or partial object
* for the properties of a new SearchParameters
* @see SearchParameters.make
* @example <caption>SearchParameters of the first query in
* <a href="http://demos.algolia.com/instant-search-demo/">the instant search demo</a></caption>
{
"query": "",
"disjunctiveFacets": [
"customerReviewCount",
"category",
"salePrice_range",
"manufacturer"
],
"maxValuesPerFacet": 30,
"page": 0,
"hitsPerPage": 10,
"facets": [
"type",
"shipping"
]
}
*/
function SearchParameters(newParameters) {
var params = newParameters ? SearchParameters._parseNumbers(newParameters) : {};
/**
* This attribute contains the list of all the conjunctive facets
* used. This list will be added to requested facets in the
* [facets attribute](https://www.algolia.com/doc/rest-api/search#param-facets) sent to algolia.
* @member {string[]}
*/
this.facets = params.facets || [];
/**
* This attribute contains the list of all the disjunctive facets
* used. This list will be added to requested facets in the
* [facets attribute](https://www.algolia.com/doc/rest-api/search#param-facets) sent to algolia.
* @member {string[]}
*/
this.disjunctiveFacets = params.disjunctiveFacets || [];
/**
* This attribute contains the list of all the hierarchical facets
* used. This list will be added to requested facets in the
* [facets attribute](https://www.algolia.com/doc/rest-api/search#param-facets) sent to algolia.
* Hierarchical facets are a sub type of disjunctive facets that
* let you filter faceted attributes hierarchically.
* @member {string[]|object[]}
*/
this.hierarchicalFacets = params.hierarchicalFacets || [];
// Refinements
/**
* This attribute contains all the filters that need to be
* applied on the conjunctive facets. Each facet must be properly
* defined in the `facets` attribute.
*
* The key is the name of the facet, and the `FacetList` contains all
* filters selected for the associated facet name.
*
* When querying algolia, the values stored in this attribute will
* be translated into the `facetFilters` attribute.
* @member {Object.<string, SearchParameters.FacetList>}
*/
this.facetsRefinements = params.facetsRefinements || {};
/**
* This attribute contains all the filters that need to be
* excluded from the conjunctive facets. Each facet must be properly
* defined in the `facets` attribute.
*
* The key is the name of the facet, and the `FacetList` contains all
* filters excluded for the associated facet name.
*
* When querying algolia, the values stored in this attribute will
* be translated into the `facetFilters` attribute.
* @member {Object.<string, SearchParameters.FacetList>}
*/
this.facetsExcludes = params.facetsExcludes || {};
/**
* This attribute contains all the filters that need to be
* applied on the disjunctive facets. Each facet must be properly
* defined in the `disjunctiveFacets` attribute.
*
* The key is the name of the facet, and the `FacetList` contains all
* filters selected for the associated facet name.
*
* When querying algolia, the values stored in this attribute will
* be translated into the `facetFilters` attribute.
* @member {Object.<string, SearchParameters.FacetList>}
*/
this.disjunctiveFacetsRefinements = params.disjunctiveFacetsRefinements || {};
/**
* This attribute contains all the filters that need to be
* applied on the numeric attributes.
*
* The key is the name of the attribute, and the value is the
* filters to apply to this attribute.
*
* When querying algolia, the values stored in this attribute will
* be translated into the `numericFilters` attribute.
* @member {Object.<string, SearchParameters.OperatorList>}
*/
this.numericRefinements = params.numericRefinements || {};
/**
* This attribute contains all the tags used to refine the query.
*
* When querying algolia, the values stored in this attribute will
* be translated into the `tagFilters` attribute.
* @member {string[]}
*/
this.tagRefinements = params.tagRefinements || [];
/**
* This attribute contains all the filters that need to be
* applied on the hierarchical facets. Each facet must be properly
* defined in the `hierarchicalFacets` attribute.
*
* The key is the name of the facet, and the `FacetList` contains all
* filters selected for the associated facet name. The FacetList values
* are structured as a string that contain the values for each level
* separated by the configured separator.
*
* When querying algolia, the values stored in this attribute will
* be translated into the `facetFilters` attribute.
* @member {Object.<string, SearchParameters.FacetList>}
*/
this.hierarchicalFacetsRefinements = params.hierarchicalFacetsRefinements || {};
var self = this;
Object.keys(params).forEach(function(paramName) {
var isKeyKnown = SearchParameters.PARAMETERS.indexOf(paramName) !== -1;
var isValueDefined = params[paramName] !== undefined;
if (!isKeyKnown && isValueDefined) {
self[paramName] = params[paramName];
}
});
}
/**
* List all the properties in SearchParameters and therefore all the known Algolia properties
* This doesn't contain any beta/hidden features.
* @private
*/
SearchParameters.PARAMETERS = Object.keys(new SearchParameters());
/**
* @private
* @param {object} partialState full or part of a state
* @return {object} a new object with the number keys as number
*/
SearchParameters._parseNumbers = function(partialState) {
// Do not reparse numbers in SearchParameters, they ought to be parsed already
if (partialState instanceof SearchParameters) return partialState;
var numbers = {};
var numberKeys = [
'aroundPrecision',
'aroundRadius',
'getRankingInfo',
'minWordSizefor2Typos',
'minWordSizefor1Typo',
'page',
'maxValuesPerFacet',
'distinct',
'minimumAroundRadius',
'hitsPerPage',
'minProximity'
];
numberKeys.forEach(function(k) {
var value = partialState[k];
if (typeof value === 'string') {
var parsedValue = parseFloat(value);
// global isNaN is ok to use here, value is only number or NaN
numbers[k] = isNaN(parsedValue) ? value : parsedValue;
}
});
// there's two formats of insideBoundingBox, we need to parse
// the one which is an array of float geo rectangles
if (Array.isArray(partialState.insideBoundingBox)) {
numbers.insideBoundingBox = partialState.insideBoundingBox.map(function(geoRect) {
return geoRect.map(function(value) {
return parseFloat(value);
});
});
}
if (partialState.numericRefinements) {
var numericRefinements = {};
Object.keys(partialState.numericRefinements).forEach(function(attribute) {
var operators = partialState.numericRefinements[attribute] || {};
numericRefinements[attribute] = {};
Object.keys(operators).forEach(function(operator) {
var values = operators[operator];
var parsedValues = values.map(function(v) {
if (Array.isArray(v)) {
return v.map(function(vPrime) {
if (typeof vPrime === 'string') {
return parseFloat(vPrime);
}
return vPrime;
});
} else if (typeof v === 'string') {
return parseFloat(v);
}
return v;
});
numericRefinements[attribute][operator] = parsedValues;
});
});
numbers.numericRefinements = numericRefinements;
}
return merge_1({}, partialState, numbers);
};
/**
* Factory for SearchParameters
* @param {object|SearchParameters} newParameters existing parameters or partial
* object for the properties of a new SearchParameters
* @return {SearchParameters} frozen instance of SearchParameters
*/
SearchParameters.make = function makeSearchParameters(newParameters) {
var instance = new SearchParameters(newParameters);
var hierarchicalFacets = newParameters.hierarchicalFacets || [];
hierarchicalFacets.forEach(function(facet) {
if (facet.rootPath) {
var currentRefinement = instance.getHierarchicalRefinement(facet.name);
if (currentRefinement.length > 0 && currentRefinement[0].indexOf(facet.rootPath) !== 0) {
instance = instance.clearRefinements(facet.name);
}
// get it again in case it has been cleared
currentRefinement = instance.getHierarchicalRefinement(facet.name);
if (currentRefinement.length === 0) {
instance = instance.toggleHierarchicalFacetRefinement(facet.name, facet.rootPath);
}
}
});
return instance;
};
/**
* Validates the new parameters based on the previous state
* @param {SearchParameters} currentState the current state
* @param {object|SearchParameters} parameters the new parameters to set
* @return {Error|null} Error if the modification is invalid, null otherwise
*/
SearchParameters.validate = function(currentState, parameters) {
var params = parameters || {};
if (currentState.tagFilters && params.tagRefinements && params.tagRefinements.length > 0) {
return new Error(
'[Tags] Cannot switch from the managed tag API to the advanced API. It is probably ' +
'an error, if it is really what you want, you should first clear the tags with clearTags method.');
}
if (currentState.tagRefinements.length > 0 && params.tagFilters) {
return new Error(
'[Tags] Cannot switch from the advanced tag API to the managed API. It is probably ' +
'an error, if it is not, you should first clear the tags with clearTags method.');
}
if (
currentState.numericFilters &&
params.numericRefinements &&
objectHasKeys_1(params.numericRefinements)
) {
return new Error(
"[Numeric filters] Can't switch from the advanced to the managed API. It" +
' is probably an error, if this is really what you want, you have to first' +
' clear the numeric filters.'
);
}
if (objectHasKeys_1(currentState.numericRefinements) && params.numericFilters) {
return new Error(
"[Numeric filters] Can't switch from the managed API to the advanced. It" +
' is probably an error, if this is really what you want, you have to first' +
' clear the numeric filters.');
}
return null;
};
SearchParameters.prototype = {
constructor: SearchParameters,
/**
* Remove all refinements (disjunctive + conjunctive + excludes + numeric filters)
* @method
* @param {undefined|string|SearchParameters.clearCallback} [attribute] optional string or function
* - If not given, means to clear all the filters.
* - If `string`, means to clear all refinements for the `attribute` named filter.
* - If `function`, means to clear all the refinements that return truthy values.
* @return {SearchParameters}
*/
clearRefinements: function clearRefinements(attribute) {
var patch = {
numericRefinements: this._clearNumericRefinements(attribute),
facetsRefinements: RefinementList.clearRefinement(
this.facetsRefinements,
attribute,
'conjunctiveFacet'
),
facetsExcludes: RefinementList.clearRefinement(
this.facetsExcludes,
attribute,
'exclude'
),
disjunctiveFacetsRefinements: RefinementList.clearRefinement(
this.disjunctiveFacetsRefinements,
attribute,
'disjunctiveFacet'
),
hierarchicalFacetsRefinements: RefinementList.clearRefinement(
this.hierarchicalFacetsRefinements,
attribute,
'hierarchicalFacet'
)
};
if (
patch.numericRefinements === this.numericRefinements &&
patch.facetsRefinements === this.facetsRefinements &&
patch.facetsExcludes === this.facetsExcludes &&
patch.disjunctiveFacetsRefinements === this.disjunctiveFacetsRefinements &&
patch.hierarchicalFacetsRefinements === this.hierarchicalFacetsRefinements
) {
return this;
}
return this.setQueryParameters(patch);
},
/**
* Remove all the refined tags from the SearchParameters
* @method
* @return {SearchParameters}
*/
clearTags: function clearTags() {
if (this.tagFilters === undefined && this.tagRefinements.length === 0) return this;
return this.setQueryParameters({
tagFilters: undefined,
tagRefinements: []
});
},
/**
* Set the index.
* @method
* @param {string} index the index name
* @return {SearchParameters}
*/
setIndex: function setIndex(index) {
if (index === this.index) return this;
return this.setQueryParameters({
index: index
});
},
/**
* Query setter
* @method
* @param {string} newQuery value for the new query
* @return {SearchParameters}
*/
setQuery: function setQuery(newQuery) {
if (newQuery === this.query) return this;
return this.setQueryParameters({
query: newQuery
});
},
/**
* Page setter
* @method
* @param {number} newPage new page number
* @return {SearchParameters}
*/
setPage: function setPage(newPage) {
if (newPage === this.page) return this;
return this.setQueryParameters({
page: newPage
});
},
/**
* Facets setter
* The facets are the simple facets, used for conjunctive (and) faceting.
* @method
* @param {string[]} facets all the attributes of the algolia records used for conjunctive faceting
* @return {SearchParameters}
*/
setFacets: function setFacets(facets) {
return this.setQueryParameters({
facets: facets
});
},
/**
* Disjunctive facets setter
* Change the list of disjunctive (or) facets the helper chan handle.
* @method
* @param {string[]} facets all the attributes of the algolia records used for disjunctive faceting
* @return {SearchParameters}
*/
setDisjunctiveFacets: function setDisjunctiveFacets(facets) {
return this.setQueryParameters({
disjunctiveFacets: facets
});
},
/**
* HitsPerPage setter
* Hits per page represents the number of hits retrieved for this query
* @method
* @param {number} n number of hits retrieved per page of results
* @return {SearchParameters}
*/
setHitsPerPage: function setHitsPerPage(n) {
if (this.hitsPerPage === n) return this;
return this.setQueryParameters({
hitsPerPage: n
});
},
/**
* typoTolerance setter
* Set the value of typoTolerance
* @method
* @param {string} typoTolerance new value of typoTolerance ("true", "false", "min" or "strict")
* @return {SearchParameters}
*/
setTypoTolerance: function setTypoTolerance(typoTolerance) {
if (this.typoTolerance === typoTolerance) return this;
return this.setQueryParameters({
typoTolerance: typoTolerance
});
},
/**
* Add a numeric filter for a given attribute
* When value is an array, they are combined with OR
* When value is a single value, it will combined with AND
* @method
* @param {string} attribute attribute to set the filter on
* @param {string} operator operator of the filter (possible values: =, >, >=, <, <=, !=)
* @param {number | number[]} value value of the filter
* @return {SearchParameters}
* @example
* // for price = 50 or 40
* searchparameter.addNumericRefinement('price', '=', [50, 40]);
* @example
* // for size = 38 and 40
* searchparameter.addNumericRefinement('size', '=', 38);
* searchparameter.addNumericRefinement('size', '=', 40);
*/
addNumericRefinement: function(attribute, operator, v) {
var value = valToNumber_1(v);
if (this.isNumericRefined(attribute, operator, value)) return this;
var mod = merge_1({}, this.numericRefinements);
mod[attribute] = merge_1({}, mod[attribute]);
if (mod[attribute][operator]) {
// Array copy
mod[attribute][operator] = mod[attribute][operator].slice();
// Add the element. Concat can't be used here because value can be an array.
mod[attribute][operator].push(value);
} else {
mod[attribute][operator] = [value];
}
return this.setQueryParameters({
numericRefinements: mod
});
},
/**
* Get the list of conjunctive refinements for a single facet
* @param {string} facetName name of the attribute used for faceting
* @return {string[]} list of refinements
*/
getConjunctiveRefinements: function(facetName) {
if (!this.isConjunctiveFacet(facetName)) {
return [];
}
return this.facetsRefinements[facetName] || [];
},
/**
* Get the list of disjunctive refinements for a single facet
* @param {string} facetName name of the attribute used for faceting
* @return {string[]} list of refinements
*/
getDisjunctiveRefinements: function(facetName) {
if (!this.isDisjunctiveFacet(facetName)) {
return [];
}
return this.disjunctiveFacetsRefinements[facetName] || [];
},
/**
* Get the list of hierarchical refinements for a single facet
* @param {string} facetName name of the attribute used for faceting
* @return {string[]} list of refinements
*/
getHierarchicalRefinement: function(facetName) {
// we send an array but we currently do not support multiple
// hierarchicalRefinements for a hierarchicalFacet
return this.hierarchicalFacetsRefinements[facetName] || [];
},
/**
* Get the list of exclude refinements for a single facet
* @param {string} facetName name of the attribute used for faceting
* @return {string[]} list of refinements
*/
getExcludeRefinements: function(facetName) {
if (!this.isConjunctiveFacet(facetName)) {
return [];
}
return this.facetsExcludes[facetName] || [];
},
/**
* Remove all the numeric filter for a given (attribute, operator)
* @method
* @param {string} attribute attribute to set the filter on
* @param {string} [operator] operator of the filter (possible values: =, >, >=, <, <=, !=)
* @param {number} [number] the value to be removed
* @return {SearchParameters}
*/
removeNumericRefinement: function(attribute, operator, paramValue) {
if (paramValue !== undefined) {
if (!this.isNumericRefined(attribute, operator, paramValue)) {
return this;
}
return this.setQueryParameters({
numericRefinements: this._clearNumericRefinements(function(value, key) {
return (
key === attribute &&
value.op === operator &&
isEqualNumericRefinement(value.val, valToNumber_1(paramValue))
);
})
});
} else if (operator !== undefined) {
if (!this.isNumericRefined(attribute, operator)) return this;
return this.setQueryParameters({
numericRefinements: this._clearNumericRefinements(function(value, key) {
return key === attribute && value.op === operator;
})
});
}
if (!this.isNumericRefined(attribute)) return this;
return this.setQueryParameters({
numericRefinements: this._clearNumericRefinements(function(value, key) {
return key === attribute;
})
});
},
/**
* Get the list of numeric refinements for a single facet
* @param {string} facetName name of the attribute used for faceting
* @return {SearchParameters.OperatorList[]} list of refinements
*/
getNumericRefinements: function(facetName) {
return this.numericRefinements[facetName] || {};
},
/**
* Return the current refinement for the (attribute, operator)
* @param {string} attribute attribute in the record
* @param {string} operator operator applied on the refined values
* @return {Array.<number|number[]>} refined values
*/
getNumericRefinement: function(attribute, operator) {
return this.numericRefinements[attribute] && this.numericRefinements[attribute][operator];
},
/**
* Clear numeric filters.
* @method
* @private
* @param {string|SearchParameters.clearCallback} [attribute] optional string or function
* - If not given, means to clear all the filters.
* - If `string`, means to clear all refinements for the `attribute` named filter.
* - If `function`, means to clear all the refinements that return truthy values.
* @return {Object.<string, OperatorList>}
*/
_clearNumericRefinements: function _clearNumericRefinements(attribute) {
if (attribute === undefined) {
if (!objectHasKeys_1(this.numericRefinements)) {
return this.numericRefinements;
}
return {};
} else if (typeof attribute === 'string') {
if (!objectHasKeys_1(this.numericRefinements[attribute])) {
return this.numericRefinements;
}
return omit$1(this.numericRefinements, attribute);
} else if (typeof attribute === 'function') {
var hasChanged = false;
var numericRefinements = this.numericRefinements;
var newNumericRefinements = Object.keys(numericRefinements).reduce(function(memo, key) {
var operators = numericRefinements[key];
var operatorList = {};
operators = operators || {};
Object.keys(operators).forEach(function(operator) {
var values = operators[operator] || [];
var outValues = [];
values.forEach(function(value) {
var predicateResult = attribute({val: value, op: operator}, key, 'numeric');
if (!predicateResult) outValues.push(value);
});
if (outValues.length !== values.length) {
hasChanged = true;
}
operatorList[operator] = outValues;
});
memo[key] = operatorList;
return memo;
}, {});
if (hasChanged) return newNumericRefinements;
return this.numericRefinements;
}
},
/**
* Add a facet to the facets attribute of the helper configuration, if it
* isn't already present.
* @method
* @param {string} facet facet name to add
* @return {SearchParameters}
*/
addFacet: function addFacet(facet) {
if (this.isConjunctiveFacet(facet)) {
return this;
}
return this.setQueryParameters({
facets: this.facets.concat([facet])
});
},
/**
* Add a disjunctive facet to the disjunctiveFacets attribute of the helper
* configuration, if it isn't already present.
* @method
* @param {string} facet disjunctive facet name to add
* @return {SearchParameters}
*/
addDisjunctiveFacet: function addDisjunctiveFacet(facet) {
if (this.isDisjunctiveFacet(facet)) {
return this;
}
return this.setQueryParameters({
disjunctiveFacets: this.disjunctiveFacets.concat([facet])
});
},
/**
* Add a hierarchical facet to the hierarchicalFacets attribute of the helper
* configuration.
* @method
* @param {object} hierarchicalFacet hierarchical facet to add
* @return {SearchParameters}
* @throws will throw an error if a hierarchical facet with the same name was already declared
*/
addHierarchicalFacet: function addHierarchicalFacet(hierarchicalFacet) {
if (this.isHierarchicalFacet(hierarchicalFacet.name)) {
throw new Error(
'Cannot declare two hierarchical facets with the same name: `' + hierarchicalFacet.name + '`');
}
return this.setQueryParameters({
hierarchicalFacets: this.hierarchicalFacets.concat([hierarchicalFacet])
});
},
/**
* Add a refinement on a "normal" facet
* @method
* @param {string} facet attribute to apply the faceting on
* @param {string} value value of the attribute (will be converted to string)
* @return {SearchParameters}
*/
addFacetRefinement: function addFacetRefinement(facet, value) {
if (!this.isConjunctiveFacet(facet)) {
throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');
}
if (RefinementList.isRefined(this.facetsRefinements, facet, value)) return this;
return this.setQueryParameters({
facetsRefinements: RefinementList.addRefinement(this.facetsRefinements, facet, value)
});
},
/**
* Exclude a value from a "normal" facet
* @method
* @param {string} facet attribute to apply the exclusion on
* @param {string} value value of the attribute (will be converted to string)
* @return {SearchParameters}
*/
addExcludeRefinement: function addExcludeRefinement(facet, value) {
if (!this.isConjunctiveFacet(facet)) {
throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');
}
if (RefinementList.isRefined(this.facetsExcludes, facet, value)) return this;
return this.setQueryParameters({
facetsExcludes: RefinementList.addRefinement(this.facetsExcludes, facet, value)
});
},
/**
* Adds a refinement on a disjunctive facet.
* @method
* @param {string} facet attribute to apply the faceting on
* @param {string} value value of the attribute (will be converted to string)
* @return {SearchParameters}
*/
addDisjunctiveFacetRefinement: function addDisjunctiveFacetRefinement(facet, value) {
if (!this.isDisjunctiveFacet(facet)) {
throw new Error(
facet + ' is not defined in the disjunctiveFacets attribute of the helper configuration');
}
if (RefinementList.isRefined(this.disjunctiveFacetsRefinements, facet, value)) return this;
return this.setQueryParameters({
disjunctiveFacetsRefinements: RefinementList.addRefinement(
this.disjunctiveFacetsRefinements, facet, value)
});
},
/**
* addTagRefinement adds a tag to the list used to filter the results
* @param {string} tag tag to be added
* @return {SearchParameters}
*/
addTagRefinement: function addTagRefinement(tag) {
if (this.isTagRefined(tag)) return this;
var modification = {
tagRefinements: this.tagRefinements.concat(tag)
};
return this.setQueryParameters(modification);
},
/**
* Remove a facet from the facets attribute of the helper configuration, if it
* is present.
* @method
* @param {string} facet facet name to remove
* @return {SearchParameters}
*/
removeFacet: function removeFacet(facet) {
if (!this.isConjunctiveFacet(facet)) {
return this;
}
return this.clearRefinements(facet).setQueryParameters({
facets: this.facets.filter(function(f) {
return f !== facet;
})
});
},
/**
* Remove a disjunctive facet from the disjunctiveFacets attribute of the
* helper configuration, if it is present.
* @method
* @param {string} facet disjunctive facet name to remove
* @return {SearchParameters}
*/
removeDisjunctiveFacet: function removeDisjunctiveFacet(facet) {
if (!this.isDisjunctiveFacet(facet)) {
return this;
}
return this.clearRefinements(facet).setQueryParameters({
disjunctiveFacets: this.disjunctiveFacets.filter(function(f) {
return f !== facet;
})
});
},
/**
* Remove a hierarchical facet from the hierarchicalFacets attribute of the
* helper configuration, if it is present.
* @method
* @param {string} facet hierarchical facet name to remove
* @return {SearchParameters}
*/
removeHierarchicalFacet: function removeHierarchicalFacet(facet) {
if (!this.isHierarchicalFacet(facet)) {
return this;
}
return this.clearRefinements(facet).setQueryParameters({
hierarchicalFacets: this.hierarchicalFacets.filter(function(f) {
return f.name !== facet;
})
});
},
/**
* Remove a refinement set on facet. If a value is provided, it will clear the
* refinement for the given value, otherwise it will clear all the refinement
* values for the faceted attribute.
* @method
* @param {string} facet name of the attribute used for faceting
* @param {string} [value] value used to filter
* @return {SearchParameters}
*/
removeFacetRefinement: function removeFacetRefinement(facet, value) {
if (!this.isConjunctiveFacet(facet)) {
throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');
}
if (!RefinementList.isRefined(this.facetsRefinements, facet, value)) return this;
return this.setQueryParameters({
facetsRefinements: RefinementList.removeRefinement(this.facetsRefinements, facet, value)
});
},
/**
* Remove a negative refinement on a facet
* @method
* @param {string} facet name of the attribute used for faceting
* @param {string} value value used to filter
* @return {SearchParameters}
*/
removeExcludeRefinement: function removeExcludeRefinement(facet, value) {
if (!this.isConjunctiveFacet(facet)) {
throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');
}
if (!RefinementList.isRefined(this.facetsExcludes, facet, value)) return this;
return this.setQueryParameters({
facetsExcludes: RefinementList.removeRefinement(this.facetsExcludes, facet, value)
});
},
/**
* Remove a refinement on a disjunctive facet
* @method
* @param {string} facet name of the attribute used for faceting
* @param {string} value value used to filter
* @return {SearchParameters}
*/
removeDisjunctiveFacetRefinement: function removeDisjunctiveFacetRefinement(facet, value) {
if (!this.isDisjunctiveFacet(facet)) {
throw new Error(
facet + ' is not defined in the disjunctiveFacets attribute of the helper configuration');
}
if (!RefinementList.isRefined(this.disjunctiveFacetsRefinements, facet, value)) return this;
return this.setQueryParameters({
disjunctiveFacetsRefinements: RefinementList.removeRefinement(
this.disjunctiveFacetsRefinements, facet, value)
});
},
/**
* Remove a tag from the list of tag refinements
* @method
* @param {string} tag the tag to remove
* @return {SearchParameters}
*/
removeTagRefinement: function removeTagRefinement(tag) {
if (!this.isTagRefined(tag)) return this;
var modification = {
tagRefinements: this.tagRefinements.filter(function(t) {
return t !== tag;
})
};
return this.setQueryParameters(modification);
},
/**
* Generic toggle refinement method to use with facet, disjunctive facets
* and hierarchical facets
* @param {string} facet the facet to refine
* @param {string} value the associated value
* @return {SearchParameters}
* @throws will throw an error if the facet is not declared in the settings of the helper
* @deprecated since version 2.19.0, see {@link SearchParameters#toggleFacetRefinement}
*/
toggleRefinement: function toggleRefinement(facet, value) {
return this.toggleFacetRefinement(facet, value);
},
/**
* Generic toggle refinement method to use with facet, disjunctive facets
* and hierarchical facets
* @param {string} facet the facet to refine
* @param {string} value the associated value
* @return {SearchParameters}
* @throws will throw an error if the facet is not declared in the settings of the helper
*/
toggleFacetRefinement: function toggleFacetRefinement(facet, value) {
if (this.isHierarchicalFacet(facet)) {
return this.toggleHierarchicalFacetRefinement(facet, value);
} else if (this.isConjunctiveFacet(facet)) {
return this.toggleConjunctiveFacetRefinement(facet, value);
} else if (this.isDisjunctiveFacet(facet)) {
return this.toggleDisjunctiveFacetRefinement(facet, value);
}
throw new Error('Cannot refine the undeclared facet ' + facet +
'; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets');
},
/**
* Switch the refinement applied over a facet/value
* @method
* @param {string} facet name of the attribute used for faceting
* @param {value} value value used for filtering
* @return {SearchParameters}
*/
toggleConjunctiveFacetRefinement: function toggleConjunctiveFacetRefinement(facet, value) {
if (!this.isConjunctiveFacet(facet)) {
throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');
}
return this.setQueryParameters({
facetsRefinements: RefinementList.toggleRefinement(this.facetsRefinements, facet, value)
});
},
/**
* Switch the refinement applied over a facet/value
* @method
* @param {string} facet name of the attribute used for faceting
* @param {value} value value used for filtering
* @return {SearchParameters}
*/
toggleExcludeFacetRefinement: function toggleExcludeFacetRefinement(facet, value) {
if (!this.isConjunctiveFacet(facet)) {
throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');
}
return this.setQueryParameters({
facetsExcludes: RefinementList.toggleRefinement(this.facetsExcludes, facet, value)
});
},
/**
* Switch the refinement applied over a facet/value
* @method
* @param {string} facet name of the attribute used for faceting
* @param {value} value value used for filtering
* @return {SearchParameters}
*/
toggleDisjunctiveFacetRefinement: function toggleDisjunctiveFacetRefinement(facet, value) {
if (!this.isDisjunctiveFacet(facet)) {
throw new Error(
facet + ' is not defined in the disjunctiveFacets attribute of the helper configuration');
}
return this.setQueryParameters({
disjunctiveFacetsRefinements: RefinementList.toggleRefinement(
this.disjunctiveFacetsRefinements, facet, value)
});
},
/**
* Switch the refinement applied over a facet/value
* @method
* @param {string} facet name of the attribute used for faceting
* @param {value} value value used for filtering
* @return {SearchParameters}
*/
toggleHierarchicalFacetRefinement: function toggleHierarchicalFacetRefinement(facet, value) {
if (!this.isHierarchicalFacet(facet)) {
throw new Error(
facet + ' is not defined in the hierarchicalFacets attribute of the helper configuration');
}
var separator = this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(facet));
var mod = {};
var upOneOrMultipleLevel = this.hierarchicalFacetsRefinements[facet] !== undefined &&
this.hierarchicalFacetsRefinements[facet].length > 0 && (
// remove current refinement:
// refinement was 'beer > IPA', call is toggleRefine('beer > IPA'), refinement should be `beer`
this.hierarchicalFacetsRefinements[facet][0] === value ||
// remove a parent refinement of the current refinement:
// - refinement was 'beer > IPA > Flying dog'
// - call is toggleRefine('beer > IPA')
// - refinement should be `beer`
this.hierarchicalFacetsRefinements[facet][0].indexOf(value + separator) === 0
);
if (upOneOrMultipleLevel) {
if (value.indexOf(separator) === -1) {
// go back to root level
mod[facet] = [];
} else {
mod[facet] = [value.slice(0, value.lastIndexOf(separator))];
}
} else {
mod[facet] = [value];
}
return this.setQueryParameters({
hierarchicalFacetsRefinements: defaultsPure({}, mod, this.hierarchicalFacetsRefinements)
});
},
/**
* Adds a refinement on a hierarchical facet.
* @param {string} facet the facet name
* @param {string} path the hierarchical facet path
* @return {SearchParameter} the new state
* @throws Error if the facet is not defined or if the facet is refined
*/
addHierarchicalFacetRefinement: function(facet, path) {
if (this.isHierarchicalFacetRefined(facet)) {
throw new Error(facet + ' is already refined.');
}
if (!this.isHierarchicalFacet(facet)) {
throw new Error(facet + ' is not defined in the hierarchicalFacets attribute of the helper configuration.');
}
var mod = {};
mod[facet] = [path];
return this.setQueryParameters({
hierarchicalFacetsRefinements: defaultsPure({}, mod, this.hierarchicalFacetsRefinements)
});
},
/**
* Removes the refinement set on a hierarchical facet.
* @param {string} facet the facet name
* @return {SearchParameter} the new state
* @throws Error if the facet is not defined or if the facet is not refined
*/
removeHierarchicalFacetRefinement: function(facet) {
if (!this.isHierarchicalFacetRefined(facet)) {
return this;
}
var mod = {};
mod[facet] = [];
return this.setQueryParameters({
hierarchicalFacetsRefinements: defaultsPure({}, mod, this.hierarchicalFacetsRefinements)
});
},
/**
* Switch the tag refinement
* @method
* @param {string} tag the tag to remove or add
* @return {SearchParameters}
*/
toggleTagRefinement: function toggleTagRefinement(tag) {
if (this.isTagRefined(tag)) {
return this.removeTagRefinement(tag);
}
return this.addTagRefinement(tag);
},
/**
* Test if the facet name is from one of the disjunctive facets
* @method
* @param {string} facet facet name to test
* @return {boolean}
*/
isDisjunctiveFacet: function(facet) {
return this.disjunctiveFacets.indexOf(facet) > -1;
},
/**
* Test if the facet name is from one of the hierarchical facets
* @method
* @param {string} facetName facet name to test
* @return {boolean}
*/
isHierarchicalFacet: function(facetName) {
return this.getHierarchicalFacetByName(facetName) !== undefined;
},
/**
* Test if the facet name is from one of the conjunctive/normal facets
* @method
* @param {string} facet facet name to test
* @return {boolean}
*/
isConjunctiveFacet: function(facet) {
return this.facets.indexOf(facet) > -1;
},
/**
* Returns true if the facet is refined, either for a specific value or in
* general.
* @method
* @param {string} facet name of the attribute for used for faceting
* @param {string} value, optional value. If passed will test that this value
* is filtering the given facet.
* @return {boolean} returns true if refined
*/
isFacetRefined: function isFacetRefined(facet, value) {
if (!this.isConjunctiveFacet(facet)) {
return false;
}
return RefinementList.isRefined(this.facetsRefinements, facet, value);
},
/**
* Returns true if the facet contains exclusions or if a specific value is
* excluded.
*
* @method
* @param {string} facet name of the attribute for used for faceting
* @param {string} [value] optional value. If passed will test that this value
* is filtering the given facet.
* @return {boolean} returns true if refined
*/
isExcludeRefined: function isExcludeRefined(facet, value) {
if (!this.isConjunctiveFacet(facet)) {
return false;
}
return RefinementList.isRefined(this.facetsExcludes, facet, value);
},
/**
* Returns true if the facet contains a refinement, or if a value passed is a
* refinement for the facet.
* @method
* @param {string} facet name of the attribute for used for faceting
* @param {string} value optional, will test if the value is used for refinement
* if there is one, otherwise will test if the facet contains any refinement
* @return {boolean}
*/
isDisjunctiveFacetRefined: function isDisjunctiveFacetRefined(facet, value) {
if (!this.isDisjunctiveFacet(facet)) {
return false;
}
return RefinementList.isRefined(this.disjunctiveFacetsRefinements, facet, value);
},
/**
* Returns true if the facet contains a refinement, or if a value passed is a
* refinement for the facet.
* @method
* @param {string} facet name of the attribute for used for faceting
* @param {string} value optional, will test if the value is used for refinement
* if there is one, otherwise will test if the facet contains any refinement
* @return {boolean}
*/
isHierarchicalFacetRefined: function isHierarchicalFacetRefined(facet, value) {
if (!this.isHierarchicalFacet(facet)) {
return false;
}
var refinements = this.getHierarchicalRefinement(facet);
if (!value) {
return refinements.length > 0;
}
return refinements.indexOf(value) !== -1;
},
/**
* Test if the triple (attribute, operator, value) is already refined.
* If only the attribute and the operator are provided, it tests if the
* contains any refinement value.
* @method
* @param {string} attribute attribute for which the refinement is applied
* @param {string} [operator] operator of the refinement
* @param {string} [value] value of the refinement
* @return {boolean} true if it is refined
*/
isNumericRefined: function isNumericRefined(attribute, operator, value) {
if (value === undefined && operator === undefined) {
return !!this.numericRefinements[attribute];
}
var isOperatorDefined =
this.numericRefinements[attribute] &&
this.numericRefinements[attribute][operator] !== undefined;
if (value === undefined || !isOperatorDefined) {
return isOperatorDefined;
}
var parsedValue = valToNumber_1(value);
var isAttributeValueDefined =
findArray(this.numericRefinements[attribute][operator], parsedValue) !==
undefined;
return isOperatorDefined && isAttributeValueDefined;
},
/**
* Returns true if the tag refined, false otherwise
* @method
* @param {string} tag the tag to check
* @return {boolean}
*/
isTagRefined: function isTagRefined(tag) {
return this.tagRefinements.indexOf(tag) !== -1;
},
/**
* Returns the list of all disjunctive facets refined
* @method
* @param {string} facet name of the attribute used for faceting
* @param {value} value value used for filtering
* @return {string[]}
*/
getRefinedDisjunctiveFacets: function getRefinedDisjunctiveFacets() {
var self = this;
// attributes used for numeric filter can also be disjunctive
var disjunctiveNumericRefinedFacets = intersection_1(
Object.keys(this.numericRefinements).filter(function(facet) {
return Object.keys(self.numericRefinements[facet]).length > 0;
}),
this.disjunctiveFacets
);
return Object.keys(this.disjunctiveFacetsRefinements).filter(function(facet) {
return self.disjunctiveFacetsRefinements[facet].length > 0;
})
.concat(disjunctiveNumericRefinedFacets)
.concat(this.getRefinedHierarchicalFacets());
},
/**
* Returns the list of all disjunctive facets refined
* @method
* @param {string} facet name of the attribute used for faceting
* @param {value} value value used for filtering
* @return {string[]}
*/
getRefinedHierarchicalFacets: function getRefinedHierarchicalFacets() {
var self = this;
return intersection_1(
// enforce the order between the two arrays,
// so that refinement name index === hierarchical facet index
this.hierarchicalFacets.map(function(facet) { return facet.name; }),
Object.keys(this.hierarchicalFacetsRefinements).filter(function(facet) {
return self.hierarchicalFacetsRefinements[facet].length > 0;
})
);
},
/**
* Returned the list of all disjunctive facets not refined
* @method
* @return {string[]}
*/
getUnrefinedDisjunctiveFacets: function() {
var refinedFacets = this.getRefinedDisjunctiveFacets();
return this.disjunctiveFacets.filter(function(f) {
return refinedFacets.indexOf(f) === -1;
});
},
managedParameters: [
'index',
'facets', 'disjunctiveFacets', 'facetsRefinements',
'facetsExcludes', 'disjunctiveFacetsRefinements',
'numericRefinements', 'tagRefinements', 'hierarchicalFacets', 'hierarchicalFacetsRefinements'
],
getQueryParams: function getQueryParams() {
var managedParameters = this.managedParameters;
var queryParams = {};
var self = this;
Object.keys(this).forEach(function(paramName) {
var paramValue = self[paramName];
if (managedParameters.indexOf(paramName) === -1 && paramValue !== undefined) {
queryParams[paramName] = paramValue;
}
});
return queryParams;
},
/**
* Let the user set a specific value for a given parameter. Will return the
* same instance if the parameter is invalid or if the value is the same as the
* previous one.
* @method
* @param {string} parameter the parameter name
* @param {any} value the value to be set, must be compliant with the definition
* of the attribute on the object
* @return {SearchParameters} the updated state
*/
setQueryParameter: function setParameter(parameter, value) {
if (this[parameter] === value) return this;
var modification = {};
modification[parameter] = value;
return this.setQueryParameters(modification);
},
/**
* Let the user set any of the parameters with a plain object.
* @method
* @param {object} params all the keys and the values to be updated
* @return {SearchParameters} a new updated instance
*/
setQueryParameters: function setQueryParameters(params) {
if (!params) return this;
var error = SearchParameters.validate(this, params);
if (error) {
throw error;
}
var self = this;
var nextWithNumbers = SearchParameters._parseNumbers(params);
var previousPlainObject = Object.keys(this).reduce(function(acc, key) {
acc[key] = self[key];
return acc;
}, {});
var nextPlainObject = Object.keys(nextWithNumbers).reduce(
function(previous, key) {
var isPreviousValueDefined = previous[key] !== undefined;
var isNextValueDefined = nextWithNumbers[key] !== undefined;
if (isPreviousValueDefined && !isNextValueDefined) {
return omit$1(previous, [key]);
}
if (isNextValueDefined) {
previous[key] = nextWithNumbers[key];
}
return previous;
},
previousPlainObject
);
return new this.constructor(nextPlainObject);
},
/**
* Returns a new instance with the page reset. Two scenarios possible:
* the page is omitted -> return the given instance
* the page is set -> return a new instance with a page of 0
* @return {SearchParameters} a new updated instance
*/
resetPage: function() {
if (this.page === undefined) {
return this;
}
return this.setPage(0);
},
/**
* Helper function to get the hierarchicalFacet separator or the default one (`>`)
* @param {object} hierarchicalFacet
* @return {string} returns the hierarchicalFacet.separator or `>` as default
*/
_getHierarchicalFacetSortBy: function(hierarchicalFacet) {
return hierarchicalFacet.sortBy || ['isRefined:desc', 'name:asc'];
},
/**
* Helper function to get the hierarchicalFacet separator or the default one (`>`)
* @private
* @param {object} hierarchicalFacet
* @return {string} returns the hierarchicalFacet.separator or `>` as default
*/
_getHierarchicalFacetSeparator: function(hierarchicalFacet) {
return hierarchicalFacet.separator || ' > ';
},
/**
* Helper function to get the hierarchicalFacet prefix path or null
* @private
* @param {object} hierarchicalFacet
* @return {string} returns the hierarchicalFacet.rootPath or null as default
*/
_getHierarchicalRootPath: function(hierarchicalFacet) {
return hierarchicalFacet.rootPath || null;
},
/**
* Helper function to check if we show the parent level of the hierarchicalFacet
* @private
* @param {object} hierarchicalFacet
* @return {string} returns the hierarchicalFacet.showParentLevel or true as default
*/
_getHierarchicalShowParentLevel: function(hierarchicalFacet) {
if (typeof hierarchicalFacet.showParentLevel === 'boolean') {
return hierarchicalFacet.showParentLevel;
}
return true;
},
/**
* Helper function to get the hierarchicalFacet by it's name
* @param {string} hierarchicalFacetName
* @return {object} a hierarchicalFacet
*/
getHierarchicalFacetByName: function(hierarchicalFacetName) {
return find$1(
this.hierarchicalFacets,
function(f) {
return f.name === hierarchicalFacetName;
}
);
},
/**
* Get the current breadcrumb for a hierarchical facet, as an array
* @param {string} facetName Hierarchical facet name
* @return {array.<string>} the path as an array of string
*/
getHierarchicalFacetBreadcrumb: function(facetName) {
if (!this.isHierarchicalFacet(facetName)) {
return [];
}
var refinement = this.getHierarchicalRefinement(facetName)[0];
if (!refinement) return [];
var separator = this._getHierarchicalFacetSeparator(
this.getHierarchicalFacetByName(facetName)
);
var path = refinement.split(separator);
return path.map(function(part) {
return part.trim();
});
},
toString: function() {
return JSON.stringify(this, null, 2);
}
};
/**
* Callback used for clearRefinement method
* @callback SearchParameters.clearCallback
* @param {OperatorList|FacetList} value the value of the filter
* @param {string} key the current attribute name
* @param {string} type `numeric`, `disjunctiveFacet`, `conjunctiveFacet`, `hierarchicalFacet` or `exclude`
* depending on the type of facet
* @return {boolean} `true` if the element should be removed. `false` otherwise.
*/
var SearchParameters_1 = SearchParameters;
function compareAscending(value, other) {
if (value !== other) {
var valIsDefined = value !== undefined;
var valIsNull = value === null;
var othIsDefined = other !== undefined;
var othIsNull = other === null;
if (
(!othIsNull && value > other) ||
(valIsNull && othIsDefined) ||
!valIsDefined
) {
return 1;
}
if (
(!valIsNull && value < other) ||
(othIsNull && valIsDefined) ||
!othIsDefined
) {
return -1;
}
}
return 0;
}
/**
* @param {Array<object>} collection object with keys in attributes
* @param {Array<string>} iteratees attributes
* @param {Array<string>} orders asc | desc
*/
function orderBy(collection, iteratees, orders) {
if (!Array.isArray(collection)) {
return [];
}
if (!Array.isArray(orders)) {
orders = [];
}
var result = collection.map(function(value, index) {
return {
criteria: iteratees.map(function(iteratee) {
return value[iteratee];
}),
index: index,
value: value
};
});
result.sort(function comparer(object, other) {
var index = -1;
while (++index < object.criteria.length) {
var res = compareAscending(object.criteria[index], other.criteria[index]);
if (res) {
if (index >= orders.length) {
return res;
}
if (orders[index] === 'desc') {
return -res;
}
return res;
}
}
// This ensures a stable sort in V8 and other engines.
// See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
return object.index - other.index;
});
return result.map(function(res) {
return res.value;
});
}
var orderBy_1 = orderBy;
var compact = function compact(array) {
if (!Array.isArray(array)) {
return [];
}
return array.filter(Boolean);
};
// @MAJOR can be replaced by native Array#findIndex when we change support
var findIndex = function find(array, comparator) {
if (!Array.isArray(array)) {
return -1;
}
for (var i = 0; i < array.length; i++) {
if (comparator(array[i])) {
return i;
}
}
return -1;
};
/**
* Transform sort format from user friendly notation to lodash format
* @param {string[]} sortBy array of predicate of the form "attribute:order"
* @param {string[]} [defaults] array of predicate of the form "attribute:order"
* @return {array.<string[]>} array containing 2 elements : attributes, orders
*/
var formatSort = function formatSort(sortBy, defaults) {
var defaultInstructions = (defaults || []).map(function(sort) {
return sort.split(':');
});
return sortBy.reduce(
function preparePredicate(out, sort) {
var sortInstruction = sort.split(':');
var matchingDefault = find$1(defaultInstructions, function(
defaultInstruction
) {
return defaultInstruction[0] === sortInstruction[0];
});
if (sortInstruction.length > 1 || !matchingDefault) {
out[0].push(sortInstruction[0]);
out[1].push(sortInstruction[1]);
return out;
}
out[0].push(matchingDefault[0]);
out[1].push(matchingDefault[1]);
return out;
},
[[], []]
);
};
var generateHierarchicalTree_1 = generateTrees;
function generateTrees(state) {
return function generate(hierarchicalFacetResult, hierarchicalFacetIndex) {
var hierarchicalFacet = state.hierarchicalFacets[hierarchicalFacetIndex];
var hierarchicalFacetRefinement =
(state.hierarchicalFacetsRefinements[hierarchicalFacet.name] &&
state.hierarchicalFacetsRefinements[hierarchicalFacet.name][0]) ||
'';
var hierarchicalSeparator = state._getHierarchicalFacetSeparator(
hierarchicalFacet
);
var hierarchicalRootPath = state._getHierarchicalRootPath(
hierarchicalFacet
);
var hierarchicalShowParentLevel = state._getHierarchicalShowParentLevel(
hierarchicalFacet
);
var sortBy = formatSort(
state._getHierarchicalFacetSortBy(hierarchicalFacet)
);
var rootExhaustive = hierarchicalFacetResult.every(function(facetResult) {
return facetResult.exhaustive;
});
var generateTreeFn = generateHierarchicalTree(
sortBy,
hierarchicalSeparator,
hierarchicalRootPath,
hierarchicalShowParentLevel,
hierarchicalFacetRefinement
);
var results = hierarchicalFacetResult;
if (hierarchicalRootPath) {
results = hierarchicalFacetResult.slice(
hierarchicalRootPath.split(hierarchicalSeparator).length
);
}
return results.reduce(generateTreeFn, {
name: state.hierarchicalFacets[hierarchicalFacetIndex].name,
count: null, // root level, no count
isRefined: true, // root level, always refined
path: null, // root level, no path
exhaustive: rootExhaustive,
data: null
});
};
}
function generateHierarchicalTree(
sortBy,
hierarchicalSeparator,
hierarchicalRootPath,
hierarchicalShowParentLevel,
currentRefinement
) {
return function generateTree(
hierarchicalTree,
hierarchicalFacetResult,
currentHierarchicalLevel
) {
var parent = hierarchicalTree;
if (currentHierarchicalLevel > 0) {
var level = 0;
parent = hierarchicalTree;
while (level < currentHierarchicalLevel) {
/**
* @type {object[]]} hierarchical data
*/
var data = parent && Array.isArray(parent.data) ? parent.data : [];
parent = find$1(data, function(subtree) {
return subtree.isRefined;
});
level++;
}
}
// we found a refined parent, let's add current level data under it
if (parent) {
// filter values in case an object has multiple categories:
// {
// categories: {
// level0: ['beers', 'bières'],
// level1: ['beers > IPA', 'bières > Belges']
// }
// }
//
// If parent refinement is `beers`, then we do not want to have `bières > Belges`
// showing up
var picked = Object.keys(hierarchicalFacetResult.data)
.map(function(facetValue) {
return [facetValue, hierarchicalFacetResult.data[facetValue]];
})
.filter(function(tuple) {
var facetValue = tuple[0];
return onlyMatchingTree(
facetValue,
parent.path || hierarchicalRootPath,
currentRefinement,
hierarchicalSeparator,
hierarchicalRootPath,
hierarchicalShowParentLevel
);
});
parent.data = orderBy_1(
picked.map(function(tuple) {
var facetValue = tuple[0];
var facetCount = tuple[1];
return format(
facetCount,
facetValue,
hierarchicalSeparator,
currentRefinement,
hierarchicalFacetResult.exhaustive
);
}),
sortBy[0],
sortBy[1]
);
}
return hierarchicalTree;
};
}
function onlyMatchingTree(
facetValue,
parentPath,
currentRefinement,
hierarchicalSeparator,
hierarchicalRootPath,
hierarchicalShowParentLevel
) {
// we want the facetValue is a child of hierarchicalRootPath
if (
hierarchicalRootPath &&
(facetValue.indexOf(hierarchicalRootPath) !== 0 ||
hierarchicalRootPath === facetValue)
) {
return false;
}
// we always want root levels (only when there is no prefix path)
return (
(!hierarchicalRootPath &&
facetValue.indexOf(hierarchicalSeparator) === -1) ||
// if there is a rootPath, being root level mean 1 level under rootPath
(hierarchicalRootPath &&
facetValue.split(hierarchicalSeparator).length -
hierarchicalRootPath.split(hierarchicalSeparator).length ===
1) ||
// if current refinement is a root level and current facetValue is a root level,
// keep the facetValue
(facetValue.indexOf(hierarchicalSeparator) === -1 &&
currentRefinement.indexOf(hierarchicalSeparator) === -1) ||
// currentRefinement is a child of the facet value
currentRefinement.indexOf(facetValue) === 0 ||
// facetValue is a child of the current parent, add it
(facetValue.indexOf(parentPath + hierarchicalSeparator) === 0 &&
(hierarchicalShowParentLevel ||
facetValue.indexOf(currentRefinement) === 0))
);
}
function format(
facetCount,
facetValue,
hierarchicalSeparator,
currentRefinement,
exhaustive
) {
var parts = facetValue.split(hierarchicalSeparator);
return {
name: parts[parts.length - 1].trim(),
path: facetValue,
count: facetCount,
isRefined:
currentRefinement === facetValue ||
currentRefinement.indexOf(facetValue + hierarchicalSeparator) === 0,
exhaustive: exhaustive,
data: null
};
}
/**
* @typedef SearchResults.Facet
* @type {object}
* @property {string} name name of the attribute in the record
* @property {object} data the faceting data: value, number of entries
* @property {object} stats undefined unless facet_stats is retrieved from algolia
*/
/**
* @typedef SearchResults.HierarchicalFacet
* @type {object}
* @property {string} name name of the current value given the hierarchical level, trimmed.
* If root node, you get the facet name
* @property {number} count number of objects matching this hierarchical value
* @property {string} path the current hierarchical value full path
* @property {boolean} isRefined `true` if the current value was refined, `false` otherwise
* @property {HierarchicalFacet[]} data sub values for the current level
*/
/**
* @typedef SearchResults.FacetValue
* @type {object}
* @property {string} name the facet value itself
* @property {number} count times this facet appears in the results
* @property {boolean} isRefined is the facet currently selected
* @property {boolean} isExcluded is the facet currently excluded (only for conjunctive facets)
*/
/**
* @typedef Refinement
* @type {object}
* @property {string} type the type of filter used:
* `numeric`, `facet`, `exclude`, `disjunctive`, `hierarchical`
* @property {string} attributeName name of the attribute used for filtering
* @property {string} name the value of the filter
* @property {number} numericValue the value as a number. Only for numeric filters.
* @property {string} operator the operator used. Only for numeric filters.
* @property {number} count the number of computed hits for this filter. Only on facets.
* @property {boolean} exhaustive if the count is exhaustive
*/
/**
* @param {string[]} attributes
*/
function getIndices(attributes) {
var indices = {};
attributes.forEach(function(val, idx) {
indices[val] = idx;
});
return indices;
}
function assignFacetStats(dest, facetStats, key) {
if (facetStats && facetStats[key]) {
dest.stats = facetStats[key];
}
}
/**
* @typedef {Object} HierarchicalFacet
* @property {string} name
* @property {string[]} attributes
*/
/**
* @param {HierarchicalFacet[]} hierarchicalFacets
* @param {string} hierarchicalAttributeName
*/
function findMatchingHierarchicalFacetFromAttributeName(
hierarchicalFacets,
hierarchicalAttributeName
) {
return find$1(hierarchicalFacets, function facetKeyMatchesAttribute(
hierarchicalFacet
) {
var facetNames = hierarchicalFacet.attributes || [];
return facetNames.indexOf(hierarchicalAttributeName) > -1;
});
}
/*eslint-disable */
/**
* Constructor for SearchResults
* @class
* @classdesc SearchResults contains the results of a query to Algolia using the
* {@link AlgoliaSearchHelper}.
* @param {SearchParameters} state state that led to the response
* @param {array.<object>} results the results from algolia client
* @example <caption>SearchResults of the first query in
* <a href="http://demos.algolia.com/instant-search-demo">the instant search demo</a></caption>
{
"hitsPerPage": 10,
"processingTimeMS": 2,
"facets": [
{
"name": "type",
"data": {
"HardGood": 6627,
"BlackTie": 550,
"Music": 665,
"Software": 131,
"Game": 456,
"Movie": 1571
},
"exhaustive": false
},
{
"exhaustive": false,
"data": {
"Free shipping": 5507
},
"name": "shipping"
}
],
"hits": [
{
"thumbnailImage": "http://img.bbystatic.com/BestBuy_US/images/products/1688/1688832_54x108_s.gif",
"_highlightResult": {
"shortDescription": {
"matchLevel": "none",
"value": "Safeguard your PC, Mac, Android and iOS devices with comprehensive Internet protection",
"matchedWords": []
},
"category": {
"matchLevel": "none",
"value": "Computer Security Software",
"matchedWords": []
},
"manufacturer": {
"matchedWords": [],
"value": "Webroot",
"matchLevel": "none"
},
"name": {
"value": "Webroot SecureAnywhere Internet Security (3-Device) (1-Year Subscription) - Mac/Windows",
"matchedWords": [],
"matchLevel": "none"
}
},
"image": "http://img.bbystatic.com/BestBuy_US/images/products/1688/1688832_105x210_sc.jpg",
"shipping": "Free shipping",
"bestSellingRank": 4,
"shortDescription": "Safeguard your PC, Mac, Android and iOS devices with comprehensive Internet protection",
"url": "http://www.bestbuy.com/site/webroot-secureanywhere-internet-security-3-devi…d=1219060687969&skuId=1688832&cmp=RMX&ky=2d3GfEmNIzjA0vkzveHdZEBgpPCyMnLTJ",
"name": "Webroot SecureAnywhere Internet Security (3-Device) (1-Year Subscription) - Mac/Windows",
"category": "Computer Security Software",
"salePrice_range": "1 - 50",
"objectID": "1688832",
"type": "Software",
"customerReviewCount": 5980,
"salePrice": 49.99,
"manufacturer": "Webroot"
},
....
],
"nbHits": 10000,
"disjunctiveFacets": [
{
"exhaustive": false,
"data": {
"5": 183,
"12": 112,
"7": 149,
...
},
"name": "customerReviewCount",
"stats": {
"max": 7461,
"avg": 157.939,
"min": 1
}
},
{
"data": {
"Printer Ink": 142,
"Wireless Speakers": 60,
"Point & Shoot Cameras": 48,
...
},
"name": "category",
"exhaustive": false
},
{
"exhaustive": false,
"data": {
"> 5000": 2,
"1 - 50": 6524,
"501 - 2000": 566,
"201 - 500": 1501,
"101 - 200": 1360,
"2001 - 5000": 47
},
"name": "salePrice_range"
},
{
"data": {
"Dynex™": 202,
"Insignia™": 230,
"PNY": 72,
...
},
"name": "manufacturer",
"exhaustive": false
}
],
"query": "",
"nbPages": 100,
"page": 0,
"index": "bestbuy"
}
**/
/*eslint-enable */
function SearchResults(state, results) {
var mainSubResponse = results[0];
this._rawResults = results;
/**
* query used to generate the results
* @member {string}
*/
this.query = mainSubResponse.query;
/**
* The query as parsed by the engine given all the rules.
* @member {string}
*/
this.parsedQuery = mainSubResponse.parsedQuery;
/**
* all the records that match the search parameters. Each record is
* augmented with a new attribute `_highlightResult`
* which is an object keyed by attribute and with the following properties:
* - `value` : the value of the facet highlighted (html)
* - `matchLevel`: full, partial or none depending on how the query terms match
* @member {object[]}
*/
this.hits = mainSubResponse.hits;
/**
* index where the results come from
* @member {string}
*/
this.index = mainSubResponse.index;
/**
* number of hits per page requested
* @member {number}
*/
this.hitsPerPage = mainSubResponse.hitsPerPage;
/**
* total number of hits of this query on the index
* @member {number}
*/
this.nbHits = mainSubResponse.nbHits;
/**
* total number of pages with respect to the number of hits per page and the total number of hits
* @member {number}
*/
this.nbPages = mainSubResponse.nbPages;
/**
* current page
* @member {number}
*/
this.page = mainSubResponse.page;
/**
* sum of the processing time of all the queries
* @member {number}
*/
this.processingTimeMS = results.reduce(function(sum, result) {
return result.processingTimeMS === undefined
? sum
: sum + result.processingTimeMS;
}, 0);
/**
* The position if the position was guessed by IP.
* @member {string}
* @example "48.8637,2.3615",
*/
this.aroundLatLng = mainSubResponse.aroundLatLng;
/**
* The radius computed by Algolia.
* @member {string}
* @example "126792922",
*/
this.automaticRadius = mainSubResponse.automaticRadius;
/**
* String identifying the server used to serve this request.
*
* getRankingInfo needs to be set to `true` for this to be returned
*
* @member {string}
* @example "c7-use-2.algolia.net",
*/
this.serverUsed = mainSubResponse.serverUsed;
/**
* Boolean that indicates if the computation of the counts did time out.
* @deprecated
* @member {boolean}
*/
this.timeoutCounts = mainSubResponse.timeoutCounts;
/**
* Boolean that indicates if the computation of the hits did time out.
* @deprecated
* @member {boolean}
*/
this.timeoutHits = mainSubResponse.timeoutHits;
/**
* True if the counts of the facets is exhaustive
* @member {boolean}
*/
this.exhaustiveFacetsCount = mainSubResponse.exhaustiveFacetsCount;
/**
* True if the number of hits is exhaustive
* @member {boolean}
*/
this.exhaustiveNbHits = mainSubResponse.exhaustiveNbHits;
/**
* Contains the userData if they are set by a [query rule](https://www.algolia.com/doc/guides/query-rules/query-rules-overview/).
* @member {object[]}
*/
this.userData = mainSubResponse.userData;
/**
* queryID is the unique identifier of the query used to generate the current search results.
* This value is only available if the `clickAnalytics` search parameter is set to `true`.
* @member {string}
*/
this.queryID = mainSubResponse.queryID;
/**
* disjunctive facets results
* @member {SearchResults.Facet[]}
*/
this.disjunctiveFacets = [];
/**
* disjunctive facets results
* @member {SearchResults.HierarchicalFacet[]}
*/
this.hierarchicalFacets = state.hierarchicalFacets.map(function initFutureTree() {
return [];
});
/**
* other facets results
* @member {SearchResults.Facet[]}
*/
this.facets = [];
var disjunctiveFacets = state.getRefinedDisjunctiveFacets();
var facetsIndices = getIndices(state.facets);
var disjunctiveFacetsIndices = getIndices(state.disjunctiveFacets);
var nextDisjunctiveResult = 1;
var self = this;
// Since we send request only for disjunctive facets that have been refined,
// we get the facets information from the first, general, response.
var mainFacets = mainSubResponse.facets || {};
Object.keys(mainFacets).forEach(function(facetKey) {
var facetValueObject = mainFacets[facetKey];
var hierarchicalFacet = findMatchingHierarchicalFacetFromAttributeName(
state.hierarchicalFacets,
facetKey
);
if (hierarchicalFacet) {
// Place the hierarchicalFacet data at the correct index depending on
// the attributes order that was defined at the helper initialization
var facetIndex = hierarchicalFacet.attributes.indexOf(facetKey);
var idxAttributeName = findIndex(state.hierarchicalFacets, function(f) {
return f.name === hierarchicalFacet.name;
});
self.hierarchicalFacets[idxAttributeName][facetIndex] = {
attribute: facetKey,
data: facetValueObject,
exhaustive: mainSubResponse.exhaustiveFacetsCount
};
} else {
var isFacetDisjunctive = state.disjunctiveFacets.indexOf(facetKey) !== -1;
var isFacetConjunctive = state.facets.indexOf(facetKey) !== -1;
var position;
if (isFacetDisjunctive) {
position = disjunctiveFacetsIndices[facetKey];
self.disjunctiveFacets[position] = {
name: facetKey,
data: facetValueObject,
exhaustive: mainSubResponse.exhaustiveFacetsCount
};
assignFacetStats(self.disjunctiveFacets[position], mainSubResponse.facets_stats, facetKey);
}
if (isFacetConjunctive) {
position = facetsIndices[facetKey];
self.facets[position] = {
name: facetKey,
data: facetValueObject,
exhaustive: mainSubResponse.exhaustiveFacetsCount
};
assignFacetStats(self.facets[position], mainSubResponse.facets_stats, facetKey);
}
}
});
// Make sure we do not keep holes within the hierarchical facets
this.hierarchicalFacets = compact(this.hierarchicalFacets);
// aggregate the refined disjunctive facets
disjunctiveFacets.forEach(function(disjunctiveFacet) {
var result = results[nextDisjunctiveResult];
var facets = result && result.facets ? result.facets : {};
var hierarchicalFacet = state.getHierarchicalFacetByName(disjunctiveFacet);
// There should be only item in facets.
Object.keys(facets).forEach(function(dfacet) {
var facetResults = facets[dfacet];
var position;
if (hierarchicalFacet) {
position = findIndex(state.hierarchicalFacets, function(f) {
return f.name === hierarchicalFacet.name;
});
var attributeIndex = findIndex(self.hierarchicalFacets[position], function(f) {
return f.attribute === dfacet;
});
// previous refinements and no results so not able to find it
if (attributeIndex === -1) {
return;
}
self.hierarchicalFacets[position][attributeIndex].data = merge_1(
{},
self.hierarchicalFacets[position][attributeIndex].data,
facetResults
);
} else {
position = disjunctiveFacetsIndices[dfacet];
var dataFromMainRequest = mainSubResponse.facets && mainSubResponse.facets[dfacet] || {};
self.disjunctiveFacets[position] = {
name: dfacet,
data: defaultsPure({}, facetResults, dataFromMainRequest),
exhaustive: result.exhaustiveFacetsCount
};
assignFacetStats(self.disjunctiveFacets[position], result.facets_stats, dfacet);
if (state.disjunctiveFacetsRefinements[dfacet]) {
state.disjunctiveFacetsRefinements[dfacet].forEach(function(refinementValue) {
// add the disjunctive refinements if it is no more retrieved
if (!self.disjunctiveFacets[position].data[refinementValue] &&
state.disjunctiveFacetsRefinements[dfacet].indexOf(refinementValue) > -1) {
self.disjunctiveFacets[position].data[refinementValue] = 0;
}
});
}
}
});
nextDisjunctiveResult++;
});
// if we have some root level values for hierarchical facets, merge them
state.getRefinedHierarchicalFacets().forEach(function(refinedFacet) {
var hierarchicalFacet = state.getHierarchicalFacetByName(refinedFacet);
var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);
var currentRefinement = state.getHierarchicalRefinement(refinedFacet);
// if we are already at a root refinement (or no refinement at all), there is no
// root level values request
if (currentRefinement.length === 0 || currentRefinement[0].split(separator).length < 2) {
return;
}
var result = results[nextDisjunctiveResult];
var facets = result && result.facets
? result.facets
: {};
Object.keys(facets).forEach(function(dfacet) {
var facetResults = facets[dfacet];
var position = findIndex(state.hierarchicalFacets, function(f) {
return f.name === hierarchicalFacet.name;
});
var attributeIndex = findIndex(self.hierarchicalFacets[position], function(f) {
return f.attribute === dfacet;
});
// previous refinements and no results so not able to find it
if (attributeIndex === -1) {
return;
}
// when we always get root levels, if the hits refinement is `beers > IPA` (count: 5),
// then the disjunctive values will be `beers` (count: 100),
// but we do not want to display
// | beers (100)
// > IPA (5)
// We want
// | beers (5)
// > IPA (5)
var defaultData = {};
if (currentRefinement.length > 0) {
var root = currentRefinement[0].split(separator)[0];
defaultData[root] = self.hierarchicalFacets[position][attributeIndex].data[root];
}
self.hierarchicalFacets[position][attributeIndex].data = defaultsPure(
defaultData,
facetResults,
self.hierarchicalFacets[position][attributeIndex].data
);
});
nextDisjunctiveResult++;
});
// add the excludes
Object.keys(state.facetsExcludes).forEach(function(facetName) {
var excludes = state.facetsExcludes[facetName];
var position = facetsIndices[facetName];
self.facets[position] = {
name: facetName,
data: mainSubResponse.facets[facetName],
exhaustive: mainSubResponse.exhaustiveFacetsCount
};
excludes.forEach(function(facetValue) {
self.facets[position] = self.facets[position] || {name: facetName};
self.facets[position].data = self.facets[position].data || {};
self.facets[position].data[facetValue] = 0;
});
});
/**
* @type {Array}
*/
this.hierarchicalFacets = this.hierarchicalFacets.map(generateHierarchicalTree_1(state));
/**
* @type {Array}
*/
this.facets = compact(this.facets);
/**
* @type {Array}
*/
this.disjunctiveFacets = compact(this.disjunctiveFacets);
this._state = state;
}
/**
* Get a facet object with its name
* @deprecated
* @param {string} name name of the faceted attribute
* @return {SearchResults.Facet} the facet object
*/
SearchResults.prototype.getFacetByName = function(name) {
function predicate(facet) {
return facet.name === name;
}
return find$1(this.facets, predicate) ||
find$1(this.disjunctiveFacets, predicate) ||
find$1(this.hierarchicalFacets, predicate);
};
/**
* Get the facet values of a specified attribute from a SearchResults object.
* @private
* @param {SearchResults} results the search results to search in
* @param {string} attribute name of the faceted attribute to search for
* @return {array|object} facet values. For the hierarchical facets it is an object.
*/
function extractNormalizedFacetValues(results, attribute) {
function predicate(facet) {
return facet.name === attribute;
}
if (results._state.isConjunctiveFacet(attribute)) {
var facet = find$1(results.facets, predicate);
if (!facet) return [];
return Object.keys(facet.data).map(function(name) {
return {
name: name,
count: facet.data[name],
isRefined: results._state.isFacetRefined(attribute, name),
isExcluded: results._state.isExcludeRefined(attribute, name)
};
});
} else if (results._state.isDisjunctiveFacet(attribute)) {
var disjunctiveFacet = find$1(results.disjunctiveFacets, predicate);
if (!disjunctiveFacet) return [];
return Object.keys(disjunctiveFacet.data).map(function(name) {
return {
name: name,
count: disjunctiveFacet.data[name],
isRefined: results._state.isDisjunctiveFacetRefined(attribute, name)
};
});
} else if (results._state.isHierarchicalFacet(attribute)) {
return find$1(results.hierarchicalFacets, predicate);
}
}
/**
* Sort nodes of a hierarchical facet results
* @private
* @param {HierarchicalFacet} node node to upon which we want to apply the sort
*/
function recSort(sortFn, node) {
if (!node.data || node.data.length === 0) {
return node;
}
var children = node.data.map(function(childNode) {
return recSort(sortFn, childNode);
});
var sortedChildren = sortFn(children);
var newNode = merge_1({}, node, {data: sortedChildren});
return newNode;
}
SearchResults.DEFAULT_SORT = ['isRefined:desc', 'count:desc', 'name:asc'];
function vanillaSortFn(order, data) {
return data.sort(order);
}
/**
* Get a the list of values for a given facet attribute. Those values are sorted
* refinement first, descending count (bigger value on top), and name ascending
* (alphabetical order). The sort formula can overridden using either string based
* predicates or a function.
*
* This method will return all the values returned by the Algolia engine plus all
* the values already refined. This means that it can happen that the
* `maxValuesPerFacet` [configuration](https://www.algolia.com/doc/rest-api/search#param-maxValuesPerFacet)
* might not be respected if you have facet values that are already refined.
* @param {string} attribute attribute name
* @param {object} opts configuration options.
* @param {Array.<string> | function} opts.sortBy
* When using strings, it consists of
* the name of the [FacetValue](#SearchResults.FacetValue) or the
* [HierarchicalFacet](#SearchResults.HierarchicalFacet) attributes with the
* order (`asc` or `desc`). For example to order the value by count, the
* argument would be `['count:asc']`.
*
* If only the attribute name is specified, the ordering defaults to the one
* specified in the default value for this attribute.
*
* When not specified, the order is
* ascending. This parameter can also be a function which takes two facet
* values and should return a number, 0 if equal, 1 if the first argument is
* bigger or -1 otherwise.
*
* The default value for this attribute `['isRefined:desc', 'count:desc', 'name:asc']`
* @return {FacetValue[]|HierarchicalFacet|undefined} depending on the type of facet of
* the attribute requested (hierarchical, disjunctive or conjunctive)
* @example
* helper.on('result', function(event){
* //get values ordered only by name ascending using the string predicate
* event.results.getFacetValues('city', {sortBy: ['name:asc']});
* //get values ordered only by count ascending using a function
* event.results.getFacetValues('city', {
* // this is equivalent to ['count:asc']
* sortBy: function(a, b) {
* if (a.count === b.count) return 0;
* if (a.count > b.count) return 1;
* if (b.count > a.count) return -1;
* }
* });
* });
*/
SearchResults.prototype.getFacetValues = function(attribute, opts) {
var facetValues = extractNormalizedFacetValues(this, attribute);
if (!facetValues) {
return undefined;
}
var options = defaultsPure({}, opts, {sortBy: SearchResults.DEFAULT_SORT});
if (Array.isArray(options.sortBy)) {
var order = formatSort(options.sortBy, SearchResults.DEFAULT_SORT);
if (Array.isArray(facetValues)) {
return orderBy_1(facetValues, order[0], order[1]);
}
// If facetValues is not an array, it's an object thus a hierarchical facet object
return recSort(function(hierarchicalFacetValues) {
return orderBy_1(hierarchicalFacetValues, order[0], order[1]);
}, facetValues);
} else if (typeof options.sortBy === 'function') {
if (Array.isArray(facetValues)) {
return facetValues.sort(options.sortBy);
}
// If facetValues is not an array, it's an object thus a hierarchical facet object
return recSort(function(data) {
return vanillaSortFn(options.sortBy, data);
}, facetValues);
}
throw new Error(
'options.sortBy is optional but if defined it must be ' +
'either an array of string (predicates) or a sorting function'
);
};
/**
* Returns the facet stats if attribute is defined and the facet contains some.
* Otherwise returns undefined.
* @param {string} attribute name of the faceted attribute
* @return {object} The stats of the facet
*/
SearchResults.prototype.getFacetStats = function(attribute) {
if (this._state.isConjunctiveFacet(attribute)) {
return getFacetStatsIfAvailable(this.facets, attribute);
} else if (this._state.isDisjunctiveFacet(attribute)) {
return getFacetStatsIfAvailable(this.disjunctiveFacets, attribute);
}
return undefined;
};
/**
* @typedef {Object} FacetListItem
* @property {string} name
*/
/**
* @param {FacetListItem[]} facetList (has more items, but enough for here)
* @param {string} facetName
*/
function getFacetStatsIfAvailable(facetList, facetName) {
var data = find$1(facetList, function(facet) {
return facet.name === facetName;
});
return data && data.stats;
}
/**
* Returns all refinements for all filters + tags. It also provides
* additional information: count and exhaustiveness for each filter.
*
* See the [refinement type](#Refinement) for an exhaustive view of the available
* data.
*
* Note that for a numeric refinement, results are grouped per operator, this
* means that it will return responses for operators which are empty.
*
* @return {Array.<Refinement>} all the refinements
*/
SearchResults.prototype.getRefinements = function() {
var state = this._state;
var results = this;
var res = [];
Object.keys(state.facetsRefinements).forEach(function(attributeName) {
state.facetsRefinements[attributeName].forEach(function(name) {
res.push(getRefinement(state, 'facet', attributeName, name, results.facets));
});
});
Object.keys(state.facetsExcludes).forEach(function(attributeName) {
state.facetsExcludes[attributeName].forEach(function(name) {
res.push(getRefinement(state, 'exclude', attributeName, name, results.facets));
});
});
Object.keys(state.disjunctiveFacetsRefinements).forEach(function(attributeName) {
state.disjunctiveFacetsRefinements[attributeName].forEach(function(name) {
res.push(getRefinement(state, 'disjunctive', attributeName, name, results.disjunctiveFacets));
});
});
Object.keys(state.hierarchicalFacetsRefinements).forEach(function(attributeName) {
state.hierarchicalFacetsRefinements[attributeName].forEach(function(name) {
res.push(getHierarchicalRefinement(state, attributeName, name, results.hierarchicalFacets));
});
});
Object.keys(state.numericRefinements).forEach(function(attributeName) {
var operators = state.numericRefinements[attributeName];
Object.keys(operators).forEach(function(operator) {
operators[operator].forEach(function(value) {
res.push({
type: 'numeric',
attributeName: attributeName,
name: value,
numericValue: value,
operator: operator
});
});
});
});
state.tagRefinements.forEach(function(name) {
res.push({type: 'tag', attributeName: '_tags', name: name});
});
return res;
};
/**
* @typedef {Object} Facet
* @property {string} name
* @property {Object} data
* @property {boolean} exhaustive
*/
/**
* @param {*} state
* @param {*} type
* @param {string} attributeName
* @param {*} name
* @param {Facet[]} resultsFacets
*/
function getRefinement(state, type, attributeName, name, resultsFacets) {
var facet = find$1(resultsFacets, function(f) {
return f.name === attributeName;
});
var count = facet && facet.data && facet.data[name] ? facet.data[name] : 0;
var exhaustive = (facet && facet.exhaustive) || false;
return {
type: type,
attributeName: attributeName,
name: name,
count: count,
exhaustive: exhaustive
};
}
/**
* @param {*} state
* @param {string} attributeName
* @param {*} name
* @param {Facet[]} resultsFacets
*/
function getHierarchicalRefinement(state, attributeName, name, resultsFacets) {
var facetDeclaration = state.getHierarchicalFacetByName(attributeName);
var separator = state._getHierarchicalFacetSeparator(facetDeclaration);
var split = name.split(separator);
var rootFacet = find$1(resultsFacets, function(facet) {
return facet.name === attributeName;
});
var facet = split.reduce(function(intermediateFacet, part) {
var newFacet =
intermediateFacet && find$1(intermediateFacet.data, function(f) {
return f.name === part;
});
return newFacet !== undefined ? newFacet : intermediateFacet;
}, rootFacet);
var count = (facet && facet.count) || 0;
var exhaustive = (facet && facet.exhaustive) || false;
var path = (facet && facet.path) || '';
return {
type: 'hierarchical',
attributeName: attributeName,
name: path,
count: count,
exhaustive: exhaustive
};
}
var SearchResults_1 = SearchResults;
// 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;
}
var events = 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
} else {
// At least give some kind of context to the user
var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
err.context = er;
throw err;
}
}
}
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:
args = Array.prototype.slice.call(arguments, 1);
handler.apply(this, args);
}
} else if (isObject(handler)) {
args = Array.prototype.slice.call(arguments, 1);
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) {
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 if (listeners) {
// 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.prototype.listenerCount = function(type) {
if (this._events) {
var evlistener = this._events[type];
if (isFunction(evlistener))
return 1;
else if (evlistener)
return evlistener.length;
}
return 0;
};
EventEmitter.listenerCount = function(emitter, type) {
return emitter.listenerCount(type);
};
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;
}
function inherits(ctor, superCtor) {
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
}
var inherits_1 = inherits;
/**
* A DerivedHelper is a way to create sub requests to
* Algolia from a main helper.
* @class
* @classdesc The DerivedHelper provides an event based interface for search callbacks:
* - search: when a search is triggered using the `search()` method.
* - result: when the response is retrieved from Algolia and is processed.
* This event contains a {@link SearchResults} object and the
* {@link SearchParameters} corresponding to this answer.
*/
function DerivedHelper(mainHelper, fn) {
this.main = mainHelper;
this.fn = fn;
this.lastResults = null;
}
inherits_1(DerivedHelper, events.EventEmitter);
/**
* Detach this helper from the main helper
* @return {undefined}
* @throws Error if the derived helper is already detached
*/
DerivedHelper.prototype.detach = function() {
this.removeAllListeners();
this.main.detachDerivedHelper(this);
};
DerivedHelper.prototype.getModifiedState = function(parameters) {
return this.fn(parameters);
};
var DerivedHelper_1 = DerivedHelper;
var requestBuilder = {
/**
* Get all the queries to send to the client, those queries can used directly
* with the Algolia client.
* @private
* @return {object[]} The queries
*/
_getQueries: function getQueries(index, state) {
var queries = [];
// One query for the hits
queries.push({
indexName: index,
params: requestBuilder._getHitsSearchParams(state)
});
// One for each disjunctive facets
state.getRefinedDisjunctiveFacets().forEach(function(refinedFacet) {
queries.push({
indexName: index,
params: requestBuilder._getDisjunctiveFacetSearchParams(state, refinedFacet)
});
});
// maybe more to get the root level of hierarchical facets when activated
state.getRefinedHierarchicalFacets().forEach(function(refinedFacet) {
var hierarchicalFacet = state.getHierarchicalFacetByName(refinedFacet);
var currentRefinement = state.getHierarchicalRefinement(refinedFacet);
// if we are deeper than level 0 (starting from `beer > IPA`)
// we want to get the root values
var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);
if (currentRefinement.length > 0 && currentRefinement[0].split(separator).length > 1) {
queries.push({
indexName: index,
params: requestBuilder._getDisjunctiveFacetSearchParams(state, refinedFacet, true)
});
}
});
return queries;
},
/**
* Build search parameters used to fetch hits
* @private
* @return {object.<string, any>}
*/
_getHitsSearchParams: function(state) {
var facets = state.facets
.concat(state.disjunctiveFacets)
.concat(requestBuilder._getHitsHierarchicalFacetsAttributes(state));
var facetFilters = requestBuilder._getFacetFilters(state);
var numericFilters = requestBuilder._getNumericFilters(state);
var tagFilters = requestBuilder._getTagFilters(state);
var additionalParams = {
facets: facets,
tagFilters: tagFilters
};
if (facetFilters.length > 0) {
additionalParams.facetFilters = facetFilters;
}
if (numericFilters.length > 0) {
additionalParams.numericFilters = numericFilters;
}
return merge_1({}, state.getQueryParams(), additionalParams);
},
/**
* Build search parameters used to fetch a disjunctive facet
* @private
* @param {string} facet the associated facet name
* @param {boolean} hierarchicalRootLevel ?? FIXME
* @return {object}
*/
_getDisjunctiveFacetSearchParams: function(state, facet, hierarchicalRootLevel) {
var facetFilters = requestBuilder._getFacetFilters(state, facet, hierarchicalRootLevel);
var numericFilters = requestBuilder._getNumericFilters(state, facet);
var tagFilters = requestBuilder._getTagFilters(state);
var additionalParams = {
hitsPerPage: 1,
page: 0,
attributesToRetrieve: [],
attributesToHighlight: [],
attributesToSnippet: [],
tagFilters: tagFilters,
analytics: false,
clickAnalytics: false
};
var hierarchicalFacet = state.getHierarchicalFacetByName(facet);
if (hierarchicalFacet) {
additionalParams.facets = requestBuilder._getDisjunctiveHierarchicalFacetAttribute(
state,
hierarchicalFacet,
hierarchicalRootLevel
);
} else {
additionalParams.facets = facet;
}
if (numericFilters.length > 0) {
additionalParams.numericFilters = numericFilters;
}
if (facetFilters.length > 0) {
additionalParams.facetFilters = facetFilters;
}
return merge_1({}, state.getQueryParams(), additionalParams);
},
/**
* Return the numeric filters in an algolia request fashion
* @private
* @param {string} [facetName] the name of the attribute for which the filters should be excluded
* @return {string[]} the numeric filters in the algolia format
*/
_getNumericFilters: function(state, facetName) {
if (state.numericFilters) {
return state.numericFilters;
}
var numericFilters = [];
Object.keys(state.numericRefinements).forEach(function(attribute) {
var operators = state.numericRefinements[attribute] || {};
Object.keys(operators).forEach(function(operator) {
var values = operators[operator] || [];
if (facetName !== attribute) {
values.forEach(function(value) {
if (Array.isArray(value)) {
var vs = value.map(function(v) {
return attribute + operator + v;
});
numericFilters.push(vs);
} else {
numericFilters.push(attribute + operator + value);
}
});
}
});
});
return numericFilters;
},
/**
* Return the tags filters depending
* @private
* @return {string}
*/
_getTagFilters: function(state) {
if (state.tagFilters) {
return state.tagFilters;
}
return state.tagRefinements.join(',');
},
/**
* Build facetFilters parameter based on current refinements. The array returned
* contains strings representing the facet filters in the algolia format.
* @private
* @param {string} [facet] if set, the current disjunctive facet
* @return {array.<string>}
*/
_getFacetFilters: function(state, facet, hierarchicalRootLevel) {
var facetFilters = [];
var facetsRefinements = state.facetsRefinements || {};
Object.keys(facetsRefinements).forEach(function(facetName) {
var facetValues = facetsRefinements[facetName] || [];
facetValues.forEach(function(facetValue) {
facetFilters.push(facetName + ':' + facetValue);
});
});
var facetsExcludes = state.facetsExcludes || {};
Object.keys(facetsExcludes).forEach(function(facetName) {
var facetValues = facetsExcludes[facetName] || [];
facetValues.forEach(function(facetValue) {
facetFilters.push(facetName + ':-' + facetValue);
});
});
var disjunctiveFacetsRefinements = state.disjunctiveFacetsRefinements || {};
Object.keys(disjunctiveFacetsRefinements).forEach(function(facetName) {
var facetValues = disjunctiveFacetsRefinements[facetName] || [];
if (facetName === facet || !facetValues || facetValues.length === 0) {
return;
}
var orFilters = [];
facetValues.forEach(function(facetValue) {
orFilters.push(facetName + ':' + facetValue);
});
facetFilters.push(orFilters);
});
var hierarchicalFacetsRefinements = state.hierarchicalFacetsRefinements || {};
Object.keys(hierarchicalFacetsRefinements).forEach(function(facetName) {
var facetValues = hierarchicalFacetsRefinements[facetName] || [];
var facetValue = facetValues[0];
if (facetValue === undefined) {
return;
}
var hierarchicalFacet = state.getHierarchicalFacetByName(facetName);
var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);
var rootPath = state._getHierarchicalRootPath(hierarchicalFacet);
var attributeToRefine;
var attributesIndex;
// we ask for parent facet values only when the `facet` is the current hierarchical facet
if (facet === facetName) {
// if we are at the root level already, no need to ask for facet values, we get them from
// the hits query
if (facetValue.indexOf(separator) === -1 || (!rootPath && hierarchicalRootLevel === true) ||
(rootPath && rootPath.split(separator).length === facetValue.split(separator).length)) {
return;
}
if (!rootPath) {
attributesIndex = facetValue.split(separator).length - 2;
facetValue = facetValue.slice(0, facetValue.lastIndexOf(separator));
} else {
attributesIndex = rootPath.split(separator).length - 1;
facetValue = rootPath;
}
attributeToRefine = hierarchicalFacet.attributes[attributesIndex];
} else {
attributesIndex = facetValue.split(separator).length - 1;
attributeToRefine = hierarchicalFacet.attributes[attributesIndex];
}
if (attributeToRefine) {
facetFilters.push([attributeToRefine + ':' + facetValue]);
}
});
return facetFilters;
},
_getHitsHierarchicalFacetsAttributes: function(state) {
var out = [];
return state.hierarchicalFacets.reduce(
// ask for as much levels as there's hierarchical refinements
function getHitsAttributesForHierarchicalFacet(allAttributes, hierarchicalFacet) {
var hierarchicalRefinement = state.getHierarchicalRefinement(hierarchicalFacet.name)[0];
// if no refinement, ask for root level
if (!hierarchicalRefinement) {
allAttributes.push(hierarchicalFacet.attributes[0]);
return allAttributes;
}
var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);
var level = hierarchicalRefinement.split(separator).length;
var newAttributes = hierarchicalFacet.attributes.slice(0, level + 1);
return allAttributes.concat(newAttributes);
}, out);
},
_getDisjunctiveHierarchicalFacetAttribute: function(state, hierarchicalFacet, rootLevel) {
var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);
if (rootLevel === true) {
var rootPath = state._getHierarchicalRootPath(hierarchicalFacet);
var attributeIndex = 0;
if (rootPath) {
attributeIndex = rootPath.split(separator).length;
}
return [hierarchicalFacet.attributes[attributeIndex]];
}
var hierarchicalRefinement = state.getHierarchicalRefinement(hierarchicalFacet.name)[0] || '';
// if refinement is 'beers > IPA > Flying dog',
// then we want `facets: ['beers > IPA']` as disjunctive facet (parent level values)
var parentLevel = hierarchicalRefinement.split(separator).length - 1;
return hierarchicalFacet.attributes.slice(0, parentLevel + 1);
},
getSearchForFacetQuery: function(facetName, query, maxFacetHits, state) {
var stateForSearchForFacetValues = state.isDisjunctiveFacet(facetName) ?
state.clearRefinements(facetName) :
state;
var searchForFacetSearchParameters = {
facetQuery: query,
facetName: facetName
};
if (typeof maxFacetHits === 'number') {
searchForFacetSearchParameters.maxFacetHits = maxFacetHits;
}
return merge_1(
{},
requestBuilder._getHitsSearchParams(stateForSearchForFacetValues),
searchForFacetSearchParameters
);
}
};
var requestBuilder_1 = requestBuilder;
var version$1 = '3.1.0';
/**
* Event triggered when a parameter is set or updated
* @event AlgoliaSearchHelper#event:change
* @property {object} event
* @property {SearchParameters} event.state the current parameters with the latest changes applied
* @property {SearchResults} event.results the previous results received from Algolia. `null` before the first request
* @example
* helper.on('change', function(event) {
* console.log('The parameters have changed');
* });
*/
/**
* Event triggered when a main search is sent to Algolia
* @event AlgoliaSearchHelper#event:search
* @property {object} event
* @property {SearchParameters} event.state the parameters used for this search
* @property {SearchResults} event.results the results from the previous search. `null` if it is the first search.
* @example
* helper.on('search', function(event) {
* console.log('Search sent');
* });
*/
/**
* Event triggered when a search using `searchForFacetValues` is sent to Algolia
* @event AlgoliaSearchHelper#event:searchForFacetValues
* @property {object} event
* @property {SearchParameters} event.state the parameters used for this search it is the first search.
* @property {string} event.facet the facet searched into
* @property {string} event.query the query used to search in the facets
* @example
* helper.on('searchForFacetValues', function(event) {
* console.log('searchForFacetValues sent');
* });
*/
/**
* Event triggered when a search using `searchOnce` is sent to Algolia
* @event AlgoliaSearchHelper#event:searchOnce
* @property {object} event
* @property {SearchParameters} event.state the parameters used for this search it is the first search.
* @example
* helper.on('searchOnce', function(event) {
* console.log('searchOnce sent');
* });
*/
/**
* Event triggered when the results are retrieved from Algolia
* @event AlgoliaSearchHelper#event:result
* @property {object} event
* @property {SearchResults} event.results the results received from Algolia
* @property {SearchParameters} event.state the parameters used to query Algolia. Those might be different from the one in the helper instance (for example if the network is unreliable).
* @example
* helper.on('result', function(event) {
* console.log('Search results received');
* });
*/
/**
* Event triggered when Algolia sends back an error. For example, if an unknown parameter is
* used, the error can be caught using this event.
* @event AlgoliaSearchHelper#event:error
* @property {object} event
* @property {Error} event.error the error returned by the Algolia.
* @example
* helper.on('error', function(event) {
* console.log('Houston we got a problem.');
* });
*/
/**
* Event triggered when the queue of queries have been depleted (with any result or outdated queries)
* @event AlgoliaSearchHelper#event:searchQueueEmpty
* @example
* helper.on('searchQueueEmpty', function() {
* console.log('No more search pending');
* // This is received before the result event if we're not expecting new results
* });
*
* helper.search();
*/
/**
* Initialize a new AlgoliaSearchHelper
* @class
* @classdesc The AlgoliaSearchHelper is a class that ease the management of the
* search. It provides an event based interface for search callbacks:
* - change: when the internal search state is changed.
* This event contains a {@link SearchParameters} object and the
* {@link SearchResults} of the last result if any.
* - search: when a search is triggered using the `search()` method.
* - result: when the response is retrieved from Algolia and is processed.
* This event contains a {@link SearchResults} object and the
* {@link SearchParameters} corresponding to this answer.
* - error: when the response is an error. This event contains the error returned by the server.
* @param {AlgoliaSearch} client an AlgoliaSearch client
* @param {string} index the index name to query
* @param {SearchParameters | object} options an object defining the initial
* config of the search. It doesn't have to be a {SearchParameters},
* just an object containing the properties you need from it.
*/
function AlgoliaSearchHelper(client, index, options) {
if (typeof client.addAlgoliaAgent === 'function') {
client.addAlgoliaAgent('JS Helper (' + version$1 + ')');
}
this.setClient(client);
var opts = options || {};
opts.index = index;
this.state = SearchParameters_1.make(opts);
this.lastResults = null;
this._queryId = 0;
this._lastQueryIdReceived = -1;
this.derivedHelpers = [];
this._currentNbQueries = 0;
}
inherits_1(AlgoliaSearchHelper, events.EventEmitter);
/**
* Start the search with the parameters set in the state. When the
* method is called, it triggers a `search` event. The results will
* be available through the `result` event. If an error occurs, an
* `error` will be fired instead.
* @return {AlgoliaSearchHelper}
* @fires search
* @fires result
* @fires error
* @chainable
*/
AlgoliaSearchHelper.prototype.search = function() {
this._search({onlyWithDerivedHelpers: false});
return this;
};
AlgoliaSearchHelper.prototype.searchOnlyWithDerivedHelpers = function() {
this._search({onlyWithDerivedHelpers: true});
return this;
};
/**
* Gets the search query parameters that would be sent to the Algolia Client
* for the hits
* @return {object} Query Parameters
*/
AlgoliaSearchHelper.prototype.getQuery = function() {
var state = this.state;
return requestBuilder_1._getHitsSearchParams(state);
};
/**
* Start a search using a modified version of the current state. This method does
* not trigger the helper lifecycle and does not modify the state kept internally
* by the helper. This second aspect means that the next search call will be the
* same as a search call before calling searchOnce.
* @param {object} options can contain all the parameters that can be set to SearchParameters
* plus the index
* @param {function} [callback] optional callback executed when the response from the
* server is back.
* @return {promise|undefined} if a callback is passed the method returns undefined
* otherwise it returns a promise containing an object with two keys :
* - content with a SearchResults
* - state with the state used for the query as a SearchParameters
* @example
* // Changing the number of records returned per page to 1
* // This example uses the callback API
* var state = helper.searchOnce({hitsPerPage: 1},
* function(error, content, state) {
* // if an error occurred it will be passed in error, otherwise its value is null
* // content contains the results formatted as a SearchResults
* // state is the instance of SearchParameters used for this search
* });
* @example
* // Changing the number of records returned per page to 1
* // This example uses the promise API
* var state1 = helper.searchOnce({hitsPerPage: 1})
* .then(promiseHandler);
*
* function promiseHandler(res) {
* // res contains
* // {
* // content : SearchResults
* // state : SearchParameters (the one used for this specific search)
* // }
* }
*/
AlgoliaSearchHelper.prototype.searchOnce = function(options, cb) {
var tempState = !options ? this.state : this.state.setQueryParameters(options);
var queries = requestBuilder_1._getQueries(tempState.index, tempState);
var self = this;
this._currentNbQueries++;
this.emit('searchOnce', {
state: tempState
});
if (cb) {
this.client
.search(queries)
.then(function(content) {
self._currentNbQueries--;
if (self._currentNbQueries === 0) {
self.emit('searchQueueEmpty');
}
cb(null, new SearchResults_1(tempState, content.results), tempState);
})
.catch(function(err) {
self._currentNbQueries--;
if (self._currentNbQueries === 0) {
self.emit('searchQueueEmpty');
}
cb(err, null, tempState);
});
return undefined;
}
return this.client.search(queries).then(function(content) {
self._currentNbQueries--;
if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');
return {
content: new SearchResults_1(tempState, content.results),
state: tempState,
_originalResponse: content
};
}, function(e) {
self._currentNbQueries--;
if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');
throw e;
});
};
/**
* Structure of each result when using
* [`searchForFacetValues()`](reference.html#AlgoliaSearchHelper#searchForFacetValues)
* @typedef FacetSearchHit
* @type {object}
* @property {string} value the facet value
* @property {string} highlighted the facet value highlighted with the query string
* @property {number} count number of occurrence of this facet value
* @property {boolean} isRefined true if the value is already refined
*/
/**
* Structure of the data resolved by the
* [`searchForFacetValues()`](reference.html#AlgoliaSearchHelper#searchForFacetValues)
* promise.
* @typedef FacetSearchResult
* @type {object}
* @property {FacetSearchHit} facetHits the results for this search for facet values
* @property {number} processingTimeMS time taken by the query inside the engine
*/
/**
* Search for facet values based on an query and the name of a faceted attribute. This
* triggers a search and will return a promise. On top of using the query, it also sends
* the parameters from the state so that the search is narrowed down to only the possible values.
*
* See the description of [FacetSearchResult](reference.html#FacetSearchResult)
* @param {string} facet the name of the faceted attribute
* @param {string} query the string query for the search
* @param {number} [maxFacetHits] the maximum number values returned. Should be > 0 and <= 100
* @param {object} [userState] the set of custom parameters to use on top of the current state. Setting a property to `undefined` removes
* it in the generated query.
* @return {promise.<FacetSearchResult>} the results of the search
*/
AlgoliaSearchHelper.prototype.searchForFacetValues = function(facet, query, maxFacetHits, userState) {
var clientHasSFFV = typeof this.client.searchForFacetValues === 'function';
if (
!clientHasSFFV &&
typeof this.client.initIndex !== 'function'
) {
throw new Error(
'search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues'
);
}
var state = this.state.setQueryParameters(userState || {});
var isDisjunctive = state.isDisjunctiveFacet(facet);
var algoliaQuery = requestBuilder_1.getSearchForFacetQuery(facet, query, maxFacetHits, state);
this._currentNbQueries++;
var self = this;
this.emit('searchForFacetValues', {
state: state,
facet: facet,
query: query
});
var searchForFacetValuesPromise = clientHasSFFV
? this.client.searchForFacetValues([{indexName: state.index, params: algoliaQuery}])
: this.client.initIndex(state.index).searchForFacetValues(algoliaQuery);
return searchForFacetValuesPromise.then(function addIsRefined(content) {
self._currentNbQueries--;
if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');
content = Array.isArray(content) ? content[0] : content;
content.facetHits.forEach(function(f) {
f.isRefined = isDisjunctive
? state.isDisjunctiveFacetRefined(facet, f.value)
: state.isFacetRefined(facet, f.value);
});
return content;
}, function(e) {
self._currentNbQueries--;
if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');
throw e;
});
};
/**
* Sets the text query used for the search.
*
* This method resets the current page to 0.
* @param {string} q the user query
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.setQuery = function(q) {
this._change({
state: this.state.resetPage().setQuery(q),
isPageReset: true
});
return this;
};
/**
* Remove all the types of refinements except tags. A string can be provided to remove
* only the refinements of a specific attribute. For more advanced use case, you can
* provide a function instead. This function should follow the
* [clearCallback definition](#SearchParameters.clearCallback).
*
* This method resets the current page to 0.
* @param {string} [name] optional name of the facet / attribute on which we want to remove all refinements
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
* @example
* // Removing all the refinements
* helper.clearRefinements().search();
* @example
* // Removing all the filters on a the category attribute.
* helper.clearRefinements('category').search();
* @example
* // Removing only the exclude filters on the category facet.
* helper.clearRefinements(function(value, attribute, type) {
* return type === 'exclude' && attribute === 'category';
* }).search();
*/
AlgoliaSearchHelper.prototype.clearRefinements = function(name) {
this._change({
state: this.state.resetPage().clearRefinements(name),
isPageReset: true
});
return this;
};
/**
* Remove all the tag filters.
*
* This method resets the current page to 0.
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.clearTags = function() {
this._change({
state: this.state.resetPage().clearTags(),
isPageReset: true
});
return this;
};
/**
* Adds a disjunctive filter to a faceted attribute with the `value` provided. If the
* filter is already set, it doesn't change the filters.
*
* This method resets the current page to 0.
* @param {string} facet the facet to refine
* @param {string} value the associated value (will be converted to string)
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.addDisjunctiveFacetRefinement = function(facet, value) {
this._change({
state: this.state.resetPage().addDisjunctiveFacetRefinement(facet, value),
isPageReset: true
});
return this;
};
/**
* @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#addDisjunctiveFacetRefinement}
*/
AlgoliaSearchHelper.prototype.addDisjunctiveRefine = function() {
return this.addDisjunctiveFacetRefinement.apply(this, arguments);
};
/**
* Adds a refinement on a hierarchical facet. It will throw
* an exception if the facet is not defined or if the facet
* is already refined.
*
* This method resets the current page to 0.
* @param {string} facet the facet name
* @param {string} path the hierarchical facet path
* @return {AlgoliaSearchHelper}
* @throws Error if the facet is not defined or if the facet is refined
* @chainable
* @fires change
*/
AlgoliaSearchHelper.prototype.addHierarchicalFacetRefinement = function(facet, value) {
this._change({
state: this.state.resetPage().addHierarchicalFacetRefinement(facet, value),
isPageReset: true
});
return this;
};
/**
* Adds a an numeric filter to an attribute with the `operator` and `value` provided. If the
* filter is already set, it doesn't change the filters.
*
* This method resets the current page to 0.
* @param {string} attribute the attribute on which the numeric filter applies
* @param {string} operator the operator of the filter
* @param {number} value the value of the filter
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.addNumericRefinement = function(attribute, operator, value) {
this._change({
state: this.state.resetPage().addNumericRefinement(attribute, operator, value),
isPageReset: true
});
return this;
};
/**
* Adds a filter to a faceted attribute with the `value` provided. If the
* filter is already set, it doesn't change the filters.
*
* This method resets the current page to 0.
* @param {string} facet the facet to refine
* @param {string} value the associated value (will be converted to string)
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.addFacetRefinement = function(facet, value) {
this._change({
state: this.state.resetPage().addFacetRefinement(facet, value),
isPageReset: true
});
return this;
};
/**
* @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#addFacetRefinement}
*/
AlgoliaSearchHelper.prototype.addRefine = function() {
return this.addFacetRefinement.apply(this, arguments);
};
/**
* Adds a an exclusion filter to a faceted attribute with the `value` provided. If the
* filter is already set, it doesn't change the filters.
*
* This method resets the current page to 0.
* @param {string} facet the facet to refine
* @param {string} value the associated value (will be converted to string)
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.addFacetExclusion = function(facet, value) {
this._change({
state: this.state.resetPage().addExcludeRefinement(facet, value),
isPageReset: true
});
return this;
};
/**
* @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#addFacetExclusion}
*/
AlgoliaSearchHelper.prototype.addExclude = function() {
return this.addFacetExclusion.apply(this, arguments);
};
/**
* Adds a tag filter with the `tag` provided. If the
* filter is already set, it doesn't change the filters.
*
* This method resets the current page to 0.
* @param {string} tag the tag to add to the filter
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.addTag = function(tag) {
this._change({
state: this.state.resetPage().addTagRefinement(tag),
isPageReset: true
});
return this;
};
/**
* Removes an numeric filter to an attribute with the `operator` and `value` provided. If the
* filter is not set, it doesn't change the filters.
*
* Some parameters are optional, triggering different behavior:
* - if the value is not provided, then all the numeric value will be removed for the
* specified attribute/operator couple.
* - if the operator is not provided either, then all the numeric filter on this attribute
* will be removed.
*
* This method resets the current page to 0.
* @param {string} attribute the attribute on which the numeric filter applies
* @param {string} [operator] the operator of the filter
* @param {number} [value] the value of the filter
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.removeNumericRefinement = function(attribute, operator, value) {
this._change({
state: this.state.resetPage().removeNumericRefinement(attribute, operator, value),
isPageReset: true
});
return this;
};
/**
* Removes a disjunctive filter to a faceted attribute with the `value` provided. If the
* filter is not set, it doesn't change the filters.
*
* If the value is omitted, then this method will remove all the filters for the
* attribute.
*
* This method resets the current page to 0.
* @param {string} facet the facet to refine
* @param {string} [value] the associated value
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.removeDisjunctiveFacetRefinement = function(facet, value) {
this._change({
state: this.state.resetPage().removeDisjunctiveFacetRefinement(facet, value),
isPageReset: true
});
return this;
};
/**
* @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#removeDisjunctiveFacetRefinement}
*/
AlgoliaSearchHelper.prototype.removeDisjunctiveRefine = function() {
return this.removeDisjunctiveFacetRefinement.apply(this, arguments);
};
/**
* Removes the refinement set on a hierarchical facet.
* @param {string} facet the facet name
* @return {AlgoliaSearchHelper}
* @throws Error if the facet is not defined or if the facet is not refined
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.removeHierarchicalFacetRefinement = function(facet) {
this._change({
state: this.state.resetPage().removeHierarchicalFacetRefinement(facet),
isPageReset: true
});
return this;
};
/**
* Removes a filter to a faceted attribute with the `value` provided. If the
* filter is not set, it doesn't change the filters.
*
* If the value is omitted, then this method will remove all the filters for the
* attribute.
*
* This method resets the current page to 0.
* @param {string} facet the facet to refine
* @param {string} [value] the associated value
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.removeFacetRefinement = function(facet, value) {
this._change({
state: this.state.resetPage().removeFacetRefinement(facet, value),
isPageReset: true
});
return this;
};
/**
* @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#removeFacetRefinement}
*/
AlgoliaSearchHelper.prototype.removeRefine = function() {
return this.removeFacetRefinement.apply(this, arguments);
};
/**
* Removes an exclusion filter to a faceted attribute with the `value` provided. If the
* filter is not set, it doesn't change the filters.
*
* If the value is omitted, then this method will remove all the filters for the
* attribute.
*
* This method resets the current page to 0.
* @param {string} facet the facet to refine
* @param {string} [value] the associated value
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.removeFacetExclusion = function(facet, value) {
this._change({
state: this.state.resetPage().removeExcludeRefinement(facet, value),
isPageReset: true
});
return this;
};
/**
* @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#removeFacetExclusion}
*/
AlgoliaSearchHelper.prototype.removeExclude = function() {
return this.removeFacetExclusion.apply(this, arguments);
};
/**
* Removes a tag filter with the `tag` provided. If the
* filter is not set, it doesn't change the filters.
*
* This method resets the current page to 0.
* @param {string} tag tag to remove from the filter
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.removeTag = function(tag) {
this._change({
state: this.state.resetPage().removeTagRefinement(tag),
isPageReset: true
});
return this;
};
/**
* Adds or removes an exclusion filter to a faceted attribute with the `value` provided. If
* the value is set then it removes it, otherwise it adds the filter.
*
* This method resets the current page to 0.
* @param {string} facet the facet to refine
* @param {string} value the associated value
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.toggleFacetExclusion = function(facet, value) {
this._change({
state: this.state.resetPage().toggleExcludeFacetRefinement(facet, value),
isPageReset: true
});
return this;
};
/**
* @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#toggleFacetExclusion}
*/
AlgoliaSearchHelper.prototype.toggleExclude = function() {
return this.toggleFacetExclusion.apply(this, arguments);
};
/**
* Adds or removes a filter to a faceted attribute with the `value` provided. If
* the value is set then it removes it, otherwise it adds the filter.
*
* This method can be used for conjunctive, disjunctive and hierarchical filters.
*
* This method resets the current page to 0.
* @param {string} facet the facet to refine
* @param {string} value the associated value
* @return {AlgoliaSearchHelper}
* @throws Error will throw an error if the facet is not declared in the settings of the helper
* @fires change
* @chainable
* @deprecated since version 2.19.0, see {@link AlgoliaSearchHelper#toggleFacetRefinement}
*/
AlgoliaSearchHelper.prototype.toggleRefinement = function(facet, value) {
return this.toggleFacetRefinement(facet, value);
};
/**
* Adds or removes a filter to a faceted attribute with the `value` provided. If
* the value is set then it removes it, otherwise it adds the filter.
*
* This method can be used for conjunctive, disjunctive and hierarchical filters.
*
* This method resets the current page to 0.
* @param {string} facet the facet to refine
* @param {string} value the associated value
* @return {AlgoliaSearchHelper}
* @throws Error will throw an error if the facet is not declared in the settings of the helper
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.toggleFacetRefinement = function(facet, value) {
this._change({
state: this.state.resetPage().toggleFacetRefinement(facet, value),
isPageReset: true
});
return this;
};
/**
* @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#toggleFacetRefinement}
*/
AlgoliaSearchHelper.prototype.toggleRefine = function() {
return this.toggleFacetRefinement.apply(this, arguments);
};
/**
* Adds or removes a tag filter with the `value` provided. If
* the value is set then it removes it, otherwise it adds the filter.
*
* This method resets the current page to 0.
* @param {string} tag tag to remove or add
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.toggleTag = function(tag) {
this._change({
state: this.state.resetPage().toggleTagRefinement(tag),
isPageReset: true
});
return this;
};
/**
* Increments the page number by one.
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
* @example
* helper.setPage(0).nextPage().getPage();
* // returns 1
*/
AlgoliaSearchHelper.prototype.nextPage = function() {
var page = this.state.page || 0;
return this.setPage(page + 1);
};
/**
* Decrements the page number by one.
* @fires change
* @return {AlgoliaSearchHelper}
* @chainable
* @example
* helper.setPage(1).previousPage().getPage();
* // returns 0
*/
AlgoliaSearchHelper.prototype.previousPage = function() {
var page = this.state.page || 0;
return this.setPage(page - 1);
};
/**
* @private
*/
function setCurrentPage(page) {
if (page < 0) throw new Error('Page requested below 0.');
this._change({
state: this.state.setPage(page),
isPageReset: false
});
return this;
}
/**
* Change the current page
* @deprecated
* @param {number} page The page number
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.setCurrentPage = setCurrentPage;
/**
* Updates the current page.
* @function
* @param {number} page The page number
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.setPage = setCurrentPage;
/**
* Updates the name of the index that will be targeted by the query.
*
* This method resets the current page to 0.
* @param {string} name the index name
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.setIndex = function(name) {
this._change({
state: this.state.resetPage().setIndex(name),
isPageReset: true
});
return this;
};
/**
* Update a parameter of the search. This method reset the page
*
* The complete list of parameters is available on the
* [Algolia website](https://www.algolia.com/doc/rest#query-an-index).
* The most commonly used parameters have their own [shortcuts](#query-parameters-shortcuts)
* or benefit from higher-level APIs (all the kind of filters and facets have their own API)
*
* This method resets the current page to 0.
* @param {string} parameter name of the parameter to update
* @param {any} value new value of the parameter
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
* @example
* helper.setQueryParameter('hitsPerPage', 20).search();
*/
AlgoliaSearchHelper.prototype.setQueryParameter = function(parameter, value) {
this._change({
state: this.state.resetPage().setQueryParameter(parameter, value),
isPageReset: true
});
return this;
};
/**
* Set the whole state (warning: will erase previous state)
* @param {SearchParameters} newState the whole new state
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.setState = function(newState) {
this._change({
state: SearchParameters_1.make(newState),
isPageReset: false
});
return this;
};
/**
* Override the current state without triggering a change event.
* Do not use this method unless you know what you are doing. (see the example
* for a legit use case)
* @param {SearchParameters} newState the whole new state
* @return {AlgoliaSearchHelper}
* @example
* helper.on('change', function(state){
* // In this function you might want to find a way to store the state in the url/history
* updateYourURL(state)
* })
* window.onpopstate = function(event){
* // This is naive though as you should check if the state is really defined etc.
* helper.overrideStateWithoutTriggeringChangeEvent(event.state).search()
* }
* @chainable
*/
AlgoliaSearchHelper.prototype.overrideStateWithoutTriggeringChangeEvent = function(newState) {
this.state = new SearchParameters_1(newState);
return this;
};
/**
* Check if an attribute has any numeric, conjunctive, disjunctive or hierarchical filters.
* @param {string} attribute the name of the attribute
* @return {boolean} true if the attribute is filtered by at least one value
* @example
* // hasRefinements works with numeric, conjunctive, disjunctive and hierarchical filters
* helper.hasRefinements('price'); // false
* helper.addNumericRefinement('price', '>', 100);
* helper.hasRefinements('price'); // true
*
* helper.hasRefinements('color'); // false
* helper.addFacetRefinement('color', 'blue');
* helper.hasRefinements('color'); // true
*
* helper.hasRefinements('material'); // false
* helper.addDisjunctiveFacetRefinement('material', 'plastic');
* helper.hasRefinements('material'); // true
*
* helper.hasRefinements('categories'); // false
* helper.toggleFacetRefinement('categories', 'kitchen > knife');
* helper.hasRefinements('categories'); // true
*
*/
AlgoliaSearchHelper.prototype.hasRefinements = function(attribute) {
if (objectHasKeys_1(this.state.getNumericRefinements(attribute))) {
return true;
} else if (this.state.isConjunctiveFacet(attribute)) {
return this.state.isFacetRefined(attribute);
} else if (this.state.isDisjunctiveFacet(attribute)) {
return this.state.isDisjunctiveFacetRefined(attribute);
} else if (this.state.isHierarchicalFacet(attribute)) {
return this.state.isHierarchicalFacetRefined(attribute);
}
// there's currently no way to know that the user did call `addNumericRefinement` at some point
// thus we cannot distinguish if there once was a numeric refinement that was cleared
// so we will return false in every other situations to be consistent
// while what we should do here is throw because we did not find the attribute in any type
// of refinement
return false;
};
/**
* Check if a value is excluded for a specific faceted attribute. If the value
* is omitted then the function checks if there is any excluding refinements.
*
* @param {string} facet name of the attribute for used for faceting
* @param {string} [value] optional value. If passed will test that this value
* is filtering the given facet.
* @return {boolean} true if refined
* @example
* helper.isExcludeRefined('color'); // false
* helper.isExcludeRefined('color', 'blue') // false
* helper.isExcludeRefined('color', 'red') // false
*
* helper.addFacetExclusion('color', 'red');
*
* helper.isExcludeRefined('color'); // true
* helper.isExcludeRefined('color', 'blue') // false
* helper.isExcludeRefined('color', 'red') // true
*/
AlgoliaSearchHelper.prototype.isExcluded = function(facet, value) {
return this.state.isExcludeRefined(facet, value);
};
/**
* @deprecated since 2.4.0, see {@link AlgoliaSearchHelper#hasRefinements}
*/
AlgoliaSearchHelper.prototype.isDisjunctiveRefined = function(facet, value) {
return this.state.isDisjunctiveFacetRefined(facet, value);
};
/**
* Check if the string is a currently filtering tag.
* @param {string} tag tag to check
* @return {boolean}
*/
AlgoliaSearchHelper.prototype.hasTag = function(tag) {
return this.state.isTagRefined(tag);
};
/**
* @deprecated since 2.4.0, see {@link AlgoliaSearchHelper#hasTag}
*/
AlgoliaSearchHelper.prototype.isTagRefined = function() {
return this.hasTagRefinements.apply(this, arguments);
};
/**
* Get the name of the currently used index.
* @return {string}
* @example
* helper.setIndex('highestPrice_products').getIndex();
* // returns 'highestPrice_products'
*/
AlgoliaSearchHelper.prototype.getIndex = function() {
return this.state.index;
};
function getCurrentPage() {
return this.state.page;
}
/**
* Get the currently selected page
* @deprecated
* @return {number} the current page
*/
AlgoliaSearchHelper.prototype.getCurrentPage = getCurrentPage;
/**
* Get the currently selected page
* @function
* @return {number} the current page
*/
AlgoliaSearchHelper.prototype.getPage = getCurrentPage;
/**
* Get all the tags currently set to filters the results.
*
* @return {string[]} The list of tags currently set.
*/
AlgoliaSearchHelper.prototype.getTags = function() {
return this.state.tagRefinements;
};
/**
* Get the list of refinements for a given attribute. This method works with
* conjunctive, disjunctive, excluding and numerical filters.
*
* See also SearchResults#getRefinements
*
* @param {string} facetName attribute name used for faceting
* @return {Array.<FacetRefinement|NumericRefinement>} All Refinement are objects that contain a value, and
* a type. Numeric also contains an operator.
* @example
* helper.addNumericRefinement('price', '>', 100);
* helper.getRefinements('price');
* // [
* // {
* // "value": [
* // 100
* // ],
* // "operator": ">",
* // "type": "numeric"
* // }
* // ]
* @example
* helper.addFacetRefinement('color', 'blue');
* helper.addFacetExclusion('color', 'red');
* helper.getRefinements('color');
* // [
* // {
* // "value": "blue",
* // "type": "conjunctive"
* // },
* // {
* // "value": "red",
* // "type": "exclude"
* // }
* // ]
* @example
* helper.addDisjunctiveFacetRefinement('material', 'plastic');
* // [
* // {
* // "value": "plastic",
* // "type": "disjunctive"
* // }
* // ]
*/
AlgoliaSearchHelper.prototype.getRefinements = function(facetName) {
var refinements = [];
if (this.state.isConjunctiveFacet(facetName)) {
var conjRefinements = this.state.getConjunctiveRefinements(facetName);
conjRefinements.forEach(function(r) {
refinements.push({
value: r,
type: 'conjunctive'
});
});
var excludeRefinements = this.state.getExcludeRefinements(facetName);
excludeRefinements.forEach(function(r) {
refinements.push({
value: r,
type: 'exclude'
});
});
} else if (this.state.isDisjunctiveFacet(facetName)) {
var disjRefinements = this.state.getDisjunctiveRefinements(facetName);
disjRefinements.forEach(function(r) {
refinements.push({
value: r,
type: 'disjunctive'
});
});
}
var numericRefinements = this.state.getNumericRefinements(facetName);
Object.keys(numericRefinements).forEach(function(operator) {
var value = numericRefinements[operator];
refinements.push({
value: value,
operator: operator,
type: 'numeric'
});
});
return refinements;
};
/**
* Return the current refinement for the (attribute, operator)
* @param {string} attribute attribute in the record
* @param {string} operator operator applied on the refined values
* @return {Array.<number|number[]>} refined values
*/
AlgoliaSearchHelper.prototype.getNumericRefinement = function(attribute, operator) {
return this.state.getNumericRefinement(attribute, operator);
};
/**
* Get the current breadcrumb for a hierarchical facet, as an array
* @param {string} facetName Hierarchical facet name
* @return {array.<string>} the path as an array of string
*/
AlgoliaSearchHelper.prototype.getHierarchicalFacetBreadcrumb = function(facetName) {
return this.state.getHierarchicalFacetBreadcrumb(facetName);
};
// /////////// PRIVATE
/**
* Perform the underlying queries
* @private
* @return {undefined}
* @fires search
* @fires result
* @fires error
*/
AlgoliaSearchHelper.prototype._search = function(options) {
var state = this.state;
var states = [];
var mainQueries = [];
if (!options.onlyWithDerivedHelpers) {
mainQueries = requestBuilder_1._getQueries(state.index, state);
states.push({
state: state,
queriesCount: mainQueries.length,
helper: this
});
this.emit('search', {
state: state,
results: this.lastResults
});
}
var derivedQueries = this.derivedHelpers.map(function(derivedHelper) {
var derivedState = derivedHelper.getModifiedState(state);
var derivedStateQueries = requestBuilder_1._getQueries(derivedState.index, derivedState);
states.push({
state: derivedState,
queriesCount: derivedStateQueries.length,
helper: derivedHelper
});
derivedHelper.emit('search', {
state: derivedState,
results: derivedHelper.lastResults
});
return derivedStateQueries;
});
var queries = Array.prototype.concat.apply(mainQueries, derivedQueries);
var queryId = this._queryId++;
this._currentNbQueries++;
try {
this.client.search(queries)
.then(this._dispatchAlgoliaResponse.bind(this, states, queryId))
.catch(this._dispatchAlgoliaError.bind(this, queryId));
} catch (error) {
// If we reach this part, we're in an internal error state
this.emit('error', {
error: error
});
}
};
/**
* Transform the responses as sent by the server and transform them into a user
* usable object that merge the results of all the batch requests. It will dispatch
* over the different helper + derived helpers (when there are some).
* @private
* @param {array.<{SearchParameters, AlgoliaQueries, AlgoliaSearchHelper}>}
* state state used for to generate the request
* @param {number} queryId id of the current request
* @param {object} content content of the response
* @return {undefined}
*/
AlgoliaSearchHelper.prototype._dispatchAlgoliaResponse = function(states, queryId, content) {
// FIXME remove the number of outdated queries discarded instead of just one
if (queryId < this._lastQueryIdReceived) {
// Outdated answer
return;
}
this._currentNbQueries -= (queryId - this._lastQueryIdReceived);
this._lastQueryIdReceived = queryId;
if (this._currentNbQueries === 0) this.emit('searchQueueEmpty');
var results = content.results.slice();
states.forEach(function(s) {
var state = s.state;
var queriesCount = s.queriesCount;
var helper = s.helper;
var specificResults = results.splice(0, queriesCount);
var formattedResponse = helper.lastResults = new SearchResults_1(state, specificResults);
helper.emit('result', {
results: formattedResponse,
state: state
});
});
};
AlgoliaSearchHelper.prototype._dispatchAlgoliaError = function(queryId, error) {
if (queryId < this._lastQueryIdReceived) {
// Outdated answer
return;
}
this._currentNbQueries -= queryId - this._lastQueryIdReceived;
this._lastQueryIdReceived = queryId;
this.emit('error', {
error: error
});
if (this._currentNbQueries === 0) this.emit('searchQueueEmpty');
};
AlgoliaSearchHelper.prototype.containsRefinement = function(query, facetFilters, numericFilters, tagFilters) {
return query ||
facetFilters.length !== 0 ||
numericFilters.length !== 0 ||
tagFilters.length !== 0;
};
/**
* Test if there are some disjunctive refinements on the facet
* @private
* @param {string} facet the attribute to test
* @return {boolean}
*/
AlgoliaSearchHelper.prototype._hasDisjunctiveRefinements = function(facet) {
return this.state.disjunctiveRefinements[facet] &&
this.state.disjunctiveRefinements[facet].length > 0;
};
AlgoliaSearchHelper.prototype._change = function(event) {
var state = event.state;
var isPageReset = event.isPageReset;
if (state !== this.state) {
this.state = state;
this.emit('change', {
state: this.state,
results: this.lastResults,
isPageReset: isPageReset
});
}
};
/**
* Clears the cache of the underlying Algolia client.
* @return {AlgoliaSearchHelper}
*/
AlgoliaSearchHelper.prototype.clearCache = function() {
this.client.clearCache && this.client.clearCache();
return this;
};
/**
* Updates the internal client instance. If the reference of the clients
* are equal then no update is actually done.
* @param {AlgoliaSearch} newClient an AlgoliaSearch client
* @return {AlgoliaSearchHelper}
*/
AlgoliaSearchHelper.prototype.setClient = function(newClient) {
if (this.client === newClient) return this;
if (typeof newClient.addAlgoliaAgent === 'function') {
newClient.addAlgoliaAgent('JS Helper (' + version$1 + ')');
}
this.client = newClient;
return this;
};
/**
* Gets the instance of the currently used client.
* @return {AlgoliaSearch}
*/
AlgoliaSearchHelper.prototype.getClient = function() {
return this.client;
};
/**
* Creates an derived instance of the Helper. A derived helper
* is a way to request other indices synchronised with the lifecycle
* of the main Helper. This mechanism uses the multiqueries feature
* of Algolia to aggregate all the requests in a single network call.
*
* This method takes a function that is used to create a new SearchParameter
* that will be used to create requests to Algolia. Those new requests
* are created just before the `search` event. The signature of the function
* is `SearchParameters -> SearchParameters`.
*
* This method returns a new DerivedHelper which is an EventEmitter
* that fires the same `search`, `result` and `error` events. Those
* events, however, will receive data specific to this DerivedHelper
* and the SearchParameters that is returned by the call of the
* parameter function.
* @param {function} fn SearchParameters -> SearchParameters
* @return {DerivedHelper}
*/
AlgoliaSearchHelper.prototype.derive = function(fn) {
var derivedHelper = new DerivedHelper_1(this, fn);
this.derivedHelpers.push(derivedHelper);
return derivedHelper;
};
/**
* This method detaches a derived Helper from the main one. Prefer using the one from the
* derived helper itself, to remove the event listeners too.
* @private
* @return {undefined}
* @throws Error
*/
AlgoliaSearchHelper.prototype.detachDerivedHelper = function(derivedHelper) {
var pos = this.derivedHelpers.indexOf(derivedHelper);
if (pos === -1) throw new Error('Derived helper already detached');
this.derivedHelpers.splice(pos, 1);
};
/**
* This method returns true if there is currently at least one on-going search.
* @return {boolean} true if there is a search pending
*/
AlgoliaSearchHelper.prototype.hasPendingRequests = function() {
return this._currentNbQueries > 0;
};
/**
* @typedef AlgoliaSearchHelper.NumericRefinement
* @type {object}
* @property {number[]} value the numbers that are used for filtering this attribute with
* the operator specified.
* @property {string} operator the faceting data: value, number of entries
* @property {string} type will be 'numeric'
*/
/**
* @typedef AlgoliaSearchHelper.FacetRefinement
* @type {object}
* @property {string} value the string use to filter the attribute
* @property {string} type the type of filter: 'conjunctive', 'disjunctive', 'exclude'
*/
var algoliasearch_helper = AlgoliaSearchHelper;
/**
* The algoliasearchHelper module is the function that will let its
* contains everything needed to use the Algoliasearch
* Helper. It is a also a function that instanciate the helper.
* To use the helper, you also need the Algolia JS client v3.
* @example
* //using the UMD build
* var client = algoliasearch('latency', '6be0576ff61c053d5f9a3225e2a90f76');
* var helper = algoliasearchHelper(client, 'bestbuy', {
* facets: ['shipping'],
* disjunctiveFacets: ['category']
* });
* helper.on('result', function(event) {
* console.log(event.results);
* });
* helper
* .toggleFacetRefinement('category', 'Movies & TV Shows')
* .toggleFacetRefinement('shipping', 'Free shipping')
* .search();
* @example
* // The helper is an event emitter using the node API
* helper.on('result', updateTheResults);
* helper.once('result', updateTheResults);
* helper.removeListener('result', updateTheResults);
* helper.removeAllListeners('result');
* @module algoliasearchHelper
* @param {AlgoliaSearch} client an AlgoliaSearch client
* @param {string} index the name of the index to query
* @param {SearchParameters|object} opts an object defining the initial config of the search. It doesn't have to be a {SearchParameters}, just an object containing the properties you need from it.
* @return {AlgoliaSearchHelper}
*/
function algoliasearchHelper(client, index, opts) {
return new algoliasearch_helper(client, index, opts);
}
/**
* The version currently used
* @member module:algoliasearchHelper.version
* @type {number}
*/
algoliasearchHelper.version = version$1;
/**
* Constructor for the Helper.
* @member module:algoliasearchHelper.AlgoliaSearchHelper
* @type {AlgoliaSearchHelper}
*/
algoliasearchHelper.AlgoliaSearchHelper = algoliasearch_helper;
/**
* Constructor for the object containing all the parameters of the search.
* @member module:algoliasearchHelper.SearchParameters
* @type {SearchParameters}
*/
algoliasearchHelper.SearchParameters = SearchParameters_1;
/**
* Constructor for the object containing the results of the search.
* @member module:algoliasearchHelper.SearchResults
* @type {SearchResults}
*/
algoliasearchHelper.SearchResults = SearchResults_1;
var algoliasearchHelper_1 = algoliasearchHelper;
function createOptionalFilter(_ref) {
var attributeName = _ref.attributeName,
attributeValue = _ref.attributeValue,
attributeScore = _ref.attributeScore;
return "".concat(attributeName, ":").concat(attributeValue, "<score=").concat(attributeScore || 1, ">");
}
var defaultProps = {
transformSearchParameters: function transformSearchParameters(x) {
return _objectSpread({}, x);
}
};
function getId$1() {
// We store the search state of this widget in `configure`.
return 'configure';
}
function getSearchParametersFromProps(props) {
var optionalFilters = Object.keys(props.matchingPatterns).reduce(function (acc, attributeName) {
var attributePattern = props.matchingPatterns[attributeName];
var attributeValue = getPropertyByPath(props.hit, attributeName);
var attributeScore = attributePattern.score;
if (Array.isArray(attributeValue)) {
return [].concat(_toConsumableArray(acc), [attributeValue.map(function (attributeSubValue) {
return createOptionalFilter({
attributeName: attributeName,
attributeValue: attributeSubValue,
attributeScore: attributeScore
});
})]);
}
if (typeof attributeValue === 'string') {
return [].concat(_toConsumableArray(acc), [createOptionalFilter({
attributeName: attributeName,
attributeValue: attributeValue,
attributeScore: attributeScore
})]);
}
return acc;
}, []);
return props.transformSearchParameters(new algoliasearchHelper_1.SearchParameters({
// @ts-ignore @TODO algoliasearch-helper@3.0.1 will contain the type
// `sumOrFiltersScores`.
// See https://github.com/algolia/algoliasearch-helper-js/pull/753
sumOrFiltersScores: true,
facetFilters: ["objectID:-".concat(props.hit.objectID)],
optionalFilters: optionalFilters
}));
}
var connectConfigureRelatedItems = createConnectorWithContext({
displayName: 'AlgoliaConfigureRelatedItems',
defaultProps: defaultProps,
getProvidedProps: function getProvidedProps() {
return {};
},
getSearchParameters: function getSearchParameters(searchParameters, props) {
return searchParameters.setQueryParameters(getSearchParametersFromProps(props));
},
transitionState: function transitionState(props, _prevSearchState, nextSearchState) {
var id = getId$1(); // We need to transform the exhaustive search parameters back to clean
// search parameters without the empty default keys so we don't pollute the
// `configure` search state.
var searchParameters = removeEmptyArraysFromObject(removeEmptyKey(getSearchParametersFromProps(props)));
var searchParametersKeys = Object.keys(searchParameters);
var nonPresentKeys = this._searchParameters ? Object.keys(this._searchParameters).filter(function (prop) {
return searchParametersKeys.indexOf(prop) === -1;
}) : [];
this._searchParameters = searchParameters;
var nextValue = _defineProperty({}, id, _objectSpread({}, omit(nextSearchState[id], nonPresentKeys), searchParameters));
return refineValue(nextSearchState, nextValue, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
cleanUp: function cleanUp(props, searchState) {
var _this = this;
var id = getId$1();
var indexId = getIndexId({
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
var subState = hasMultipleIndices({
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}) && searchState.indices ? searchState.indices[indexId] : searchState;
var configureKeys = subState && subState[id] ? Object.keys(subState[id]) : [];
var configureState = configureKeys.reduce(function (acc, item) {
if (!_this._searchParameters[item]) {
acc[item] = subState[id][item];
}
return acc;
}, {});
var nextValue = _defineProperty({}, id, configureState);
return refineValue(searchState, nextValue, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
}
});
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
/* eslint-disable no-unused-vars */
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2['_' + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join('') !== '0123456789') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
test3[letter] = letter;
});
if (Object.keys(Object.assign({}, test3)).join('') !==
'abcdefghijklmnopqrst') {
return false;
}
return true;
} catch (err) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
function emptyFunction() {}
var factoryWithThrowingShims = function() {
function shim(props, propName, componentName, location, propFullName, secret) {
if (secret === ReactPropTypesSecret_1) {
// It is still safe when called from React.
return;
}
var err = new Error(
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use PropTypes.checkPropTypes() to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
err.name = 'Invariant Violation';
throw err;
} shim.isRequired = shim;
function getShim() {
return shim;
} // Important!
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
var ReactPropTypes = {
array: shim,
bool: shim,
func: shim,
number: shim,
object: shim,
string: shim,
symbol: shim,
any: shim,
arrayOf: getShim,
element: shim,
instanceOf: getShim,
node: shim,
objectOf: getShim,
oneOf: getShim,
oneOfType: getShim,
shape: getShim,
exact: getShim
};
ReactPropTypes.checkPropTypes = emptyFunction;
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
var propTypes = createCommonjsModule(function (module) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
{
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = factoryWithThrowingShims();
}
});
function ConfigureRelatedItems() {
return null;
}
ConfigureRelatedItems.propTypes = {
hit: propTypes.object.isRequired,
matchingPatterns: propTypes.object.isRequired,
transformSearchParameters: propTypes.func
};
var ConfigureRelatedItems$1 = connectConfigureRelatedItems(ConfigureRelatedItems);
function getIndexContext(props) {
return {
targetedIndex: props.indexId
};
}
/**
* The component that allows you to apply widgets to a dedicated index. It's
* useful if you want to build an interface that targets multiple indices.
*
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, Index, SearchBox, Hits, Configure } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <Configure hitsPerPage={5} />
* <SearchBox />
* <Index indexName="instant_search">
* <Hits />
* </Index>
* <Index indexName="bestbuy">
* <Hits />
* </Index>
* </InstantSearch>
* );
*/
var Index =
/*#__PURE__*/
function (_Component) {
_inherits(Index, _Component);
_createClass(Index, null, [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(props) {
return {
indexContext: getIndexContext(props)
};
}
}]);
function Index(props) {
var _this;
_classCallCheck(this, Index);
_this = _possibleConstructorReturn(this, _getPrototypeOf(Index).call(this, props));
_defineProperty(_assertThisInitialized(_this), "state", {
indexContext: getIndexContext(_this.props)
});
_defineProperty(_assertThisInitialized(_this), "unregisterWidget", void 0);
_this.props.contextValue.onSearchParameters(_this.getSearchParameters.bind(_assertThisInitialized(_this)), {
ais: _this.props.contextValue,
multiIndexContext: _this.state.indexContext
}, _this.props, undefined);
return _this;
}
_createClass(Index, [{
key: "componentDidMount",
value: function componentDidMount() {
this.unregisterWidget = this.props.contextValue.widgetsManager.registerWidget(this);
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
if (this.props.indexName !== prevProps.indexName) {
this.props.contextValue.widgetsManager.update();
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
if (typeof this.unregisterWidget === 'function') {
this.unregisterWidget();
}
}
}, {
key: "getSearchParameters",
value: function getSearchParameters(searchParameters, props) {
return searchParameters.setIndex(this.props ? this.props.indexName : props.indexName);
}
}, {
key: "render",
value: function render() {
var childrenCount = React.Children.count(this.props.children);
if (childrenCount === 0) {
return null;
}
return React__default.createElement(IndexProvider, {
value: this.state.indexContext
}, this.props.children);
}
}]);
return Index;
}(React.Component);
_defineProperty(Index, "propTypes", {
indexName: propTypes.string.isRequired,
indexId: propTypes.string.isRequired,
children: propTypes.node
});
var IndexWrapper = function IndexWrapper(props) {
var inferredIndexId = props.indexName;
return React__default.createElement(InstantSearchConsumer, null, function (contextValue) {
return React__default.createElement(Index, _extends({
contextValue: contextValue,
indexId: inferredIndexId
}, props));
});
};
function createWidgetsManager(onWidgetsUpdate) {
var widgets = []; // Is an update scheduled?
var scheduled = false; // The state manager's updates need to be batched since more than one
// component can register or unregister widgets during the same tick.
function scheduleUpdate() {
if (scheduled) {
return;
}
scheduled = true;
defer(function () {
scheduled = false;
onWidgetsUpdate();
});
}
return {
registerWidget: function registerWidget(widget) {
widgets.push(widget);
scheduleUpdate();
return function unregisterWidget() {
widgets.splice(widgets.indexOf(widget), 1);
scheduleUpdate();
};
},
update: scheduleUpdate,
getWidgets: function getWidgets() {
return widgets;
}
};
}
function createStore(initialState) {
var state = initialState;
var listeners = [];
return {
getState: function getState() {
return state;
},
setState: function setState(nextState) {
state = nextState;
listeners.forEach(function (listener) {
return listener();
});
},
subscribe: function subscribe(listener) {
listeners.push(listener);
return function unsubscribe() {
listeners.splice(listeners.indexOf(listener), 1);
};
}
};
}
function addAlgoliaAgents(searchClient) {
if (typeof searchClient.addAlgoliaAgent === 'function') {
searchClient.addAlgoliaAgent("react (".concat(React.version, ")"));
searchClient.addAlgoliaAgent("react-instantsearch (".concat(version, ")"));
}
}
var isMultiIndexContext = function isMultiIndexContext(widget) {
return hasMultipleIndices({
ais: widget.props.contextValue,
multiIndexContext: widget.props.indexContextValue
});
};
var isTargetedIndexEqualIndex = function isTargetedIndexEqualIndex(widget, indexId) {
return widget.props.indexContextValue.targetedIndex === indexId;
}; // Relying on the `indexId` is a bit brittle to detect the `Index` widget.
// Since it's a class we could rely on `instanceof` or similar. We never
// had an issue though. Works for now.
var isIndexWidget = function isIndexWidget(widget) {
return Boolean(widget.props.indexId);
};
var isIndexWidgetEqualIndex = function isIndexWidgetEqualIndex(widget, indexId) {
return widget.props.indexId === indexId;
};
var sortIndexWidgetsFirst = function sortIndexWidgetsFirst(firstWidget, secondWidget) {
var isFirstWidgetIndex = isIndexWidget(firstWidget);
var isSecondWidgetIndex = isIndexWidget(secondWidget);
if (isFirstWidgetIndex && !isSecondWidgetIndex) {
return -1;
}
if (!isFirstWidgetIndex && isSecondWidgetIndex) {
return 1;
}
return 0;
}; // This function is copied from the algoliasearch v4 API Client. If modified,
// consider updating it also in `serializeQueryParameters` from `@algolia/transporter`.
function serializeQueryParameters(parameters) {
var isObjectOrArray = function isObjectOrArray(value) {
return Object.prototype.toString.call(value) === '[object Object]' || Object.prototype.toString.call(value) === '[object Array]';
};
var encode = function encode(format) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var i = 0;
return format.replace(/%s/g, function () {
return encodeURIComponent(args[i++]);
});
};
return Object.keys(parameters).map(function (key) {
return encode('%s=%s', key, isObjectOrArray(parameters[key]) ? JSON.stringify(parameters[key]) : parameters[key]);
}).join('&');
}
/**
* Creates a new instance of the InstantSearchManager which controls the widgets and
* trigger the search when the widgets are updated.
* @param {string} indexName - the main index name
* @param {object} initialState - initial widget state
* @param {object} SearchParameters - optional additional parameters to send to the algolia API
* @param {number} stalledSearchDelay - time (in ms) after the search is stalled
* @return {InstantSearchManager} a new instance of InstantSearchManager
*/
function createInstantSearchManager(_ref) {
var indexName = _ref.indexName,
_ref$initialState = _ref.initialState,
initialState = _ref$initialState === void 0 ? {} : _ref$initialState,
searchClient = _ref.searchClient,
resultsState = _ref.resultsState,
stalledSearchDelay = _ref.stalledSearchDelay;
var helper = algoliasearchHelper_1(searchClient, indexName, _objectSpread({}, HIGHLIGHT_TAGS));
addAlgoliaAgents(searchClient);
helper.on('search', handleNewSearch).on('result', handleSearchSuccess({
indexId: indexName
})).on('error', handleSearchError);
var skip = false;
var stalledSearchTimer = null;
var initialSearchParameters = helper.state;
var widgetsManager = createWidgetsManager(onWidgetsUpdate);
hydrateSearchClient(searchClient, resultsState);
var store = createStore({
widgets: initialState,
metadata: hydrateMetadata(resultsState),
results: hydrateResultsState(resultsState),
error: null,
searching: false,
isSearchStalled: true,
searchingForFacetValues: false
});
function skipSearch() {
skip = true;
}
function updateClient(client) {
addAlgoliaAgents(client);
helper.setClient(client);
search();
}
function clearCache() {
helper.clearCache();
search();
}
function getMetadata(state) {
return widgetsManager.getWidgets().filter(function (widget) {
return Boolean(widget.getMetadata);
}).map(function (widget) {
return widget.getMetadata(state);
});
}
function getSearchParameters() {
var sharedParameters = widgetsManager.getWidgets().filter(function (widget) {
return Boolean(widget.getSearchParameters);
}).filter(function (widget) {
return !isMultiIndexContext(widget) && !isIndexWidget(widget);
}).reduce(function (res, widget) {
return widget.getSearchParameters(res);
}, initialSearchParameters);
var mainParameters = widgetsManager.getWidgets().filter(function (widget) {
return Boolean(widget.getSearchParameters);
}).filter(function (widget) {
var targetedIndexEqualMainIndex = isMultiIndexContext(widget) && isTargetedIndexEqualIndex(widget, indexName);
var subIndexEqualMainIndex = isIndexWidget(widget) && isIndexWidgetEqualIndex(widget, indexName);
return targetedIndexEqualMainIndex || subIndexEqualMainIndex;
}) // We have to sort the `Index` widgets first so the `index` parameter
// is correctly set in the `reduce` function for the following widgets
.sort(sortIndexWidgetsFirst).reduce(function (res, widget) {
return widget.getSearchParameters(res);
}, sharedParameters);
var derivedIndices = widgetsManager.getWidgets().filter(function (widget) {
return Boolean(widget.getSearchParameters);
}).filter(function (widget) {
var targetedIndexNotEqualMainIndex = isMultiIndexContext(widget) && !isTargetedIndexEqualIndex(widget, indexName);
var subIndexNotEqualMainIndex = isIndexWidget(widget) && !isIndexWidgetEqualIndex(widget, indexName);
return targetedIndexNotEqualMainIndex || subIndexNotEqualMainIndex;
}) // We have to sort the `Index` widgets first so the `index` parameter
// is correctly set in the `reduce` function for the following widgets
.sort(sortIndexWidgetsFirst).reduce(function (indices, widget) {
var indexId = isMultiIndexContext(widget) ? widget.props.indexContextValue.targetedIndex : widget.props.indexId;
var widgets = indices[indexId] || [];
return _objectSpread({}, indices, _defineProperty({}, indexId, widgets.concat(widget)));
}, {});
var derivedParameters = Object.keys(derivedIndices).map(function (indexId) {
return {
parameters: derivedIndices[indexId].reduce(function (res, widget) {
return widget.getSearchParameters(res);
}, sharedParameters),
indexId: indexId
};
});
return {
mainParameters: mainParameters,
derivedParameters: derivedParameters
};
}
function search() {
if (!skip) {
var _getSearchParameters = getSearchParameters(),
mainParameters = _getSearchParameters.mainParameters,
derivedParameters = _getSearchParameters.derivedParameters; // We have to call `slice` because the method `detach` on the derived
// helpers mutates the value `derivedHelpers`. The `forEach` loop does
// not iterate on each value and we're not able to correctly clear the
// previous derived helpers (memory leak + useless requests).
helper.derivedHelpers.slice().forEach(function (derivedHelper) {
// Since we detach the derived helpers on **every** new search they
// won't receive intermediate results in case of a stalled search.
// Only the last result is dispatched by the derived helper because
// they are not detached yet:
//
// - a -> main helper receives results
// - ap -> main helper receives results
// - app -> main helper + derived helpers receive results
//
// The quick fix is to avoid to detach them on search but only once they
// received the results. But it means that in case of a stalled search
// all the derived helpers not detached yet register a new search inside
// the helper. The number grows fast in case of a bad network and it's
// not deterministic.
derivedHelper.detach();
});
derivedParameters.forEach(function (_ref2) {
var indexId = _ref2.indexId,
parameters = _ref2.parameters;
var derivedHelper = helper.derive(function () {
return parameters;
});
derivedHelper.on('result', handleSearchSuccess({
indexId: indexId
})).on('error', handleSearchError);
});
helper.setState(mainParameters);
helper.search();
}
}
function handleSearchSuccess(_ref3) {
var indexId = _ref3.indexId;
return function (event) {
var state = store.getState();
var isDerivedHelpersEmpty = !helper.derivedHelpers.length;
var results = state.results ? state.results : {}; // Switching from mono index to multi index and vice versa must reset the
// results to an empty object, otherwise we keep reference of stalled and
// unused results.
results = !isDerivedHelpersEmpty && results.getFacetByName ? {} : results;
if (!isDerivedHelpersEmpty) {
results = _objectSpread({}, results, _defineProperty({}, indexId, event.results));
} else {
results = event.results;
}
var currentState = store.getState();
var nextIsSearchStalled = currentState.isSearchStalled;
if (!helper.hasPendingRequests()) {
clearTimeout(stalledSearchTimer);
stalledSearchTimer = null;
nextIsSearchStalled = false;
}
var resultsFacetValues = currentState.resultsFacetValues,
partialState = _objectWithoutProperties(currentState, ["resultsFacetValues"]);
store.setState(_objectSpread({}, partialState, {
results: results,
isSearchStalled: nextIsSearchStalled,
searching: false,
error: null
}));
};
}
function handleSearchError(_ref4) {
var error = _ref4.error;
var currentState = store.getState();
var nextIsSearchStalled = currentState.isSearchStalled;
if (!helper.hasPendingRequests()) {
clearTimeout(stalledSearchTimer);
nextIsSearchStalled = false;
}
var resultsFacetValues = currentState.resultsFacetValues,
partialState = _objectWithoutProperties(currentState, ["resultsFacetValues"]);
store.setState(_objectSpread({}, partialState, {
isSearchStalled: nextIsSearchStalled,
error: error,
searching: false
}));
}
function handleNewSearch() {
if (!stalledSearchTimer) {
stalledSearchTimer = setTimeout(function () {
var _store$getState = store.getState(),
resultsFacetValues = _store$getState.resultsFacetValues,
partialState = _objectWithoutProperties(_store$getState, ["resultsFacetValues"]);
store.setState(_objectSpread({}, partialState, {
isSearchStalled: true
}));
}, stalledSearchDelay);
}
}
function hydrateSearchClient(client, results) {
if (!results) {
return;
} // Disable cache hydration on:
// - Algoliasearch API Client < v4 with cache disabled
// - Third party clients (detected by the `addAlgoliaAgent` function missing)
if ((!client.transporter || client._cacheHydrated) && (!client._useCache || typeof client.addAlgoliaAgent !== 'function')) {
return;
} // Algoliasearch API Client >= v4
// To hydrate the client we need to populate the cache with the data from
// the server (done in `hydrateSearchClientWithMultiIndexRequest` or
// `hydrateSearchClientWithSingleIndexRequest`). But since there is no way
// for us to compute the key the same way as `algoliasearch-client` we need
// to populate it on a custom key and override the `search` method to
// search on it first.
if (client.transporter && !client._cacheHydrated) {
client._cacheHydrated = true;
var baseMethod = client.search;
client.search = function (requests) {
for (var _len2 = arguments.length, methodArgs = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
methodArgs[_key2 - 1] = arguments[_key2];
}
var requestsWithSerializedParams = requests.map(function (request) {
return _objectSpread({}, request, {
params: serializeQueryParameters(request.params)
});
});
return client.transporter.responsesCache.get({
method: 'search',
args: [requestsWithSerializedParams].concat(methodArgs)
}, function () {
return baseMethod.apply(void 0, [requests].concat(methodArgs));
});
};
}
if (Array.isArray(results.results)) {
hydrateSearchClientWithMultiIndexRequest(client, results.results);
return;
}
hydrateSearchClientWithSingleIndexRequest(client, results);
}
function hydrateSearchClientWithMultiIndexRequest(client, results) {
// Algoliasearch API Client >= v4
// Populate the cache with the data from the server
if (client.transporter) {
client.transporter.responsesCache.set({
method: 'search',
args: [results.reduce(function (acc, result) {
return acc.concat(result.rawResults.map(function (request) {
return {
indexName: request.index,
params: request.params
};
}));
}, [])]
}, {
results: results.reduce(function (acc, result) {
return acc.concat(result.rawResults);
}, [])
});
return;
} // Algoliasearch API Client < v4
// Prior to client v4 we didn't have a proper API to hydrate the client
// cache from the outside. The following code populates the cache with
// a single-index result. You can find more information about the
// computation of the key inside the client (see link below).
// https://github.com/algolia/algoliasearch-client-javascript/blob/c27e89ff92b2a854ae6f40dc524bffe0f0cbc169/src/AlgoliaSearchCore.js#L232-L240
var key = "/1/indexes/*/queries_body_".concat(JSON.stringify({
requests: results.reduce(function (acc, result) {
return acc.concat(result.rawResults.map(function (request) {
return {
indexName: request.index,
params: request.params
};
}));
}, [])
}));
client.cache = _objectSpread({}, client.cache, _defineProperty({}, key, JSON.stringify({
results: results.reduce(function (acc, result) {
return acc.concat(result.rawResults);
}, [])
})));
}
function hydrateSearchClientWithSingleIndexRequest(client, results) {
// Algoliasearch API Client >= v4
// Populate the cache with the data from the server
if (client.transporter) {
client.transporter.responsesCache.set({
method: 'search',
args: [results.rawResults.map(function (request) {
return {
indexName: request.index,
params: request.params
};
})]
}, {
results: results.rawResults
});
return;
} // Algoliasearch API Client < v4
// Prior to client v4 we didn't have a proper API to hydrate the client
// cache from the outside. The following code populates the cache with
// a single-index result. You can find more information about the
// computation of the key inside the client (see link below).
// https://github.com/algolia/algoliasearch-client-javascript/blob/c27e89ff92b2a854ae6f40dc524bffe0f0cbc169/src/AlgoliaSearchCore.js#L232-L240
var key = "/1/indexes/*/queries_body_".concat(JSON.stringify({
requests: results.rawResults.map(function (request) {
return {
indexName: request.index,
params: request.params
};
})
}));
client.cache = _objectSpread({}, client.cache, _defineProperty({}, key, JSON.stringify({
results: results.rawResults
})));
}
function hydrateResultsState(results) {
if (!results) {
return null;
}
if (Array.isArray(results.results)) {
return results.results.reduce(function (acc, result) {
return _objectSpread({}, acc, _defineProperty({}, result._internalIndexId, new algoliasearchHelper_1.SearchResults(new algoliasearchHelper_1.SearchParameters(result.state), result.rawResults)));
}, {});
}
return new algoliasearchHelper_1.SearchResults(new algoliasearchHelper_1.SearchParameters(results.state), results.rawResults);
} // Called whenever a widget has been rendered with new props.
function onWidgetsUpdate() {
var metadata = getMetadata(store.getState().widgets);
store.setState(_objectSpread({}, store.getState(), {
metadata: metadata,
searching: true
})); // Since the `getSearchParameters` method of widgets also depends on props,
// the result search parameters might have changed.
search();
}
function transitionState(nextSearchState) {
var searchState = store.getState().widgets;
return widgetsManager.getWidgets().filter(function (widget) {
return Boolean(widget.transitionState);
}).reduce(function (res, widget) {
return widget.transitionState(searchState, res);
}, nextSearchState);
}
function onExternalStateUpdate(nextSearchState) {
var metadata = getMetadata(nextSearchState);
store.setState(_objectSpread({}, store.getState(), {
widgets: nextSearchState,
metadata: metadata,
searching: true
}));
search();
}
function onSearchForFacetValues(_ref5) {
var facetName = _ref5.facetName,
query = _ref5.query,
_ref5$maxFacetHits = _ref5.maxFacetHits,
maxFacetHits = _ref5$maxFacetHits === void 0 ? 10 : _ref5$maxFacetHits; // The values 1, 100 are the min / max values that the engine accepts.
// see: https://www.algolia.com/doc/api-reference/api-parameters/maxFacetHits
var maxFacetHitsWithinRange = Math.max(1, Math.min(maxFacetHits, 100));
store.setState(_objectSpread({}, store.getState(), {
searchingForFacetValues: true
}));
helper.searchForFacetValues(facetName, query, maxFacetHitsWithinRange).then(function (content) {
var _objectSpread7;
store.setState(_objectSpread({}, store.getState(), {
error: null,
searchingForFacetValues: false,
resultsFacetValues: _objectSpread({}, store.getState().resultsFacetValues, (_objectSpread7 = {}, _defineProperty(_objectSpread7, facetName, content.facetHits), _defineProperty(_objectSpread7, "query", query), _objectSpread7))
}));
}, function (error) {
store.setState(_objectSpread({}, store.getState(), {
searchingForFacetValues: false,
error: error
}));
}).catch(function (error) {
// Since setState is synchronous, any error that occurs in the render of a
// component will be swallowed by this promise.
// This is a trick to make the error show up correctly in the console.
// See http://stackoverflow.com/a/30741722/969302
setTimeout(function () {
throw error;
});
});
}
function updateIndex(newIndex) {
initialSearchParameters = initialSearchParameters.setIndex(newIndex); // No need to trigger a new search here as the widgets will also update and trigger it if needed.
}
function getWidgetsIds() {
return store.getState().metadata.reduce(function (res, meta) {
return typeof meta.id !== 'undefined' ? res.concat(meta.id) : res;
}, []);
}
return {
store: store,
widgetsManager: widgetsManager,
getWidgetsIds: getWidgetsIds,
getSearchParameters: getSearchParameters,
onSearchForFacetValues: onSearchForFacetValues,
onExternalStateUpdate: onExternalStateUpdate,
transitionState: transitionState,
updateClient: updateClient,
updateIndex: updateIndex,
clearCache: clearCache,
skipSearch: skipSearch
};
}
function hydrateMetadata(resultsState) {
if (!resultsState) {
return [];
} // add a value noop, which gets replaced once the widgets are mounted
return resultsState.metadata.map(function (datum) {
return _objectSpread({
value: function value() {}
}, datum, {
items: datum.items && datum.items.map(function (item) {
return _objectSpread({
value: function value() {}
}, item, {
items: item.items && item.items.map(function (nestedItem) {
return _objectSpread({
value: function value() {}
}, nestedItem);
})
});
})
});
});
}
function isControlled(props) {
return Boolean(props.searchState);
}
/**
* @description
* `<InstantSearch>` is the root component of all React InstantSearch implementations.
* It provides all the connected components (aka widgets) a means to interact
* with the searchState.
* @kind widget
* @name <InstantSearch>
* @requirements You will need to have an Algolia account to be able to use this widget.
* [Create one now](https://www.algolia.com/users/sign_up).
* @propType {string} indexName - Main index in which to search.
* @propType {boolean} [refresh=false] - Flag to activate when the cache needs to be cleared so that the front-end is updated when a change occurs in the index.
* @propType {object} [searchClient] - Provide a custom search client.
* @propType {func} [onSearchStateChange] - Function to be called everytime a new search is done. Useful for [URL Routing](guide/Routing.html).
* @propType {object} [searchState] - Object to inject some search state. Switches the InstantSearch component in controlled mode. Useful for [URL Routing](guide/Routing.html).
* @propType {func} [createURL] - Function to call when creating links, useful for [URL Routing](guide/Routing.html).
* @propType {SearchResults|SearchResults[]} [resultsState] - Use this to inject the results that will be used at first rendering. Those results are found by using the `findResultsState` function. Useful for [Server Side Rendering](guide/Server-side_rendering.html).
* @propType {number} [stalledSearchDelay=200] - The amount of time before considering that the search takes too much time. The time is expressed in milliseconds.
* @propType {{ Root: string|function, props: object }} [root] - Use this to customize the root element. Default value: `{ Root: 'div' }`
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, SearchBox, Hits } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <SearchBox />
* <Hits />
* </InstantSearch>
* );
*/
var InstantSearch =
/*#__PURE__*/
function (_Component) {
_inherits(InstantSearch, _Component);
_createClass(InstantSearch, null, [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(nextProps, prevState) {
var nextIsControlled = isControlled(nextProps);
var previousSearchState = prevState.instantSearchManager.store.getState().widgets;
var nextSearchState = nextProps.searchState;
if (nextIsControlled && !reactFastCompare(previousSearchState, nextSearchState)) {
prevState.instantSearchManager.onExternalStateUpdate(nextProps.searchState);
}
return {
isControlled: nextIsControlled,
contextValue: _objectSpread({}, prevState.contextValue, {
mainTargetedIndex: nextProps.indexName
})
};
}
}]);
function InstantSearch(props) {
var _this;
_classCallCheck(this, InstantSearch);
_this = _possibleConstructorReturn(this, _getPrototypeOf(InstantSearch).call(this, props));
_defineProperty(_assertThisInitialized(_this), "isUnmounting", false);
var instantSearchManager = createInstantSearchManager({
indexName: _this.props.indexName,
searchClient: _this.props.searchClient,
initialState: _this.props.searchState || {},
resultsState: _this.props.resultsState,
stalledSearchDelay: _this.props.stalledSearchDelay
});
var contextValue = {
store: instantSearchManager.store,
widgetsManager: instantSearchManager.widgetsManager,
mainTargetedIndex: _this.props.indexName,
onInternalStateUpdate: _this.onWidgetsInternalStateUpdate.bind(_assertThisInitialized(_this)),
createHrefForState: _this.createHrefForState.bind(_assertThisInitialized(_this)),
onSearchForFacetValues: _this.onSearchForFacetValues.bind(_assertThisInitialized(_this)),
onSearchStateChange: _this.onSearchStateChange.bind(_assertThisInitialized(_this)),
onSearchParameters: _this.onSearchParameters.bind(_assertThisInitialized(_this))
};
_this.state = {
isControlled: isControlled(_this.props),
instantSearchManager: instantSearchManager,
contextValue: contextValue
};
return _this;
}
_createClass(InstantSearch, [{
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
var prevIsControlled = isControlled(prevProps);
if (prevIsControlled && !this.state.isControlled) {
throw new Error("You can't switch <InstantSearch> from being controlled to uncontrolled");
}
if (!prevIsControlled && this.state.isControlled) {
throw new Error("You can't switch <InstantSearch> from being uncontrolled to controlled");
}
if (this.props.refresh !== prevProps.refresh && this.props.refresh) {
this.state.instantSearchManager.clearCache();
}
if (prevProps.indexName !== this.props.indexName) {
this.state.instantSearchManager.updateIndex(this.props.indexName);
}
if (prevProps.searchClient !== this.props.searchClient) {
this.state.instantSearchManager.updateClient(this.props.searchClient);
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this.isUnmounting = true;
this.state.instantSearchManager.skipSearch();
}
}, {
key: "createHrefForState",
value: function createHrefForState(searchState) {
searchState = this.state.instantSearchManager.transitionState(searchState);
return this.state.isControlled && this.props.createURL ? this.props.createURL(searchState, this.getKnownKeys()) : '#';
}
}, {
key: "onWidgetsInternalStateUpdate",
value: function onWidgetsInternalStateUpdate(searchState) {
searchState = this.state.instantSearchManager.transitionState(searchState);
this.onSearchStateChange(searchState);
if (!this.state.isControlled) {
this.state.instantSearchManager.onExternalStateUpdate(searchState);
}
}
}, {
key: "onSearchStateChange",
value: function onSearchStateChange(searchState) {
if (this.props.onSearchStateChange && !this.isUnmounting) {
this.props.onSearchStateChange(searchState);
}
}
}, {
key: "onSearchParameters",
value: function onSearchParameters(getSearchParameters, context, props, getMetadata) {
if (this.props.onSearchParameters) {
var _searchState = this.props.searchState ? this.props.searchState : {};
this.props.onSearchParameters(getSearchParameters, context, props, _searchState);
}
if (this.props.widgetsCollector) {
var _searchState2 = this.props.searchState ? this.props.searchState : {};
this.props.widgetsCollector({
getSearchParameters: getSearchParameters,
getMetadata: getMetadata,
context: context,
props: props,
searchState: _searchState2
});
}
}
}, {
key: "onSearchForFacetValues",
value: function onSearchForFacetValues(searchState) {
this.state.instantSearchManager.onSearchForFacetValues(searchState);
}
}, {
key: "getKnownKeys",
value: function getKnownKeys() {
return this.state.instantSearchManager.getWidgetsIds();
}
}, {
key: "render",
value: function render() {
if (React.Children.count(this.props.children) === 0) {
return null;
}
return React__default.createElement(InstantSearchProvider, {
value: this.state.contextValue
}, this.props.children);
}
}]);
return InstantSearch;
}(React.Component);
_defineProperty(InstantSearch, "defaultProps", {
stalledSearchDelay: 200,
refresh: false
});
_defineProperty(InstantSearch, "propTypes", {
// @TODO: These props are currently constant.
indexName: propTypes.string.isRequired,
searchClient: propTypes.shape({
search: propTypes.func.isRequired,
searchForFacetValues: propTypes.func,
addAlgoliaAgent: propTypes.func,
clearCache: propTypes.func
}).isRequired,
createURL: propTypes.func,
refresh: propTypes.bool,
searchState: propTypes.object,
onSearchStateChange: propTypes.func,
onSearchParameters: propTypes.func,
widgetsCollector: propTypes.func,
resultsState: propTypes.oneOfType([propTypes.object, propTypes.array]),
children: propTypes.node,
stalledSearchDelay: propTypes.number
});
var getId$2 = function getId(props) {
return props.attributes[0];
};
var namespace = 'hierarchicalMenu';
function _refine(props, searchState, nextRefinement, context) {
var id = getId$2(props);
var nextValue = _defineProperty({}, id, nextRefinement || '');
var resetPage = true;
return refineValue(searchState, nextValue, context, resetPage, namespace);
}
function transformValue(values) {
return values.reduce(function (acc, item) {
if (item.isRefined) {
acc.push({
label: item.name,
// If dealing with a nested "items", "value" is equal to the previous value concatenated with the current label
// If dealing with the first level, "value" is equal to the current label
value: item.path
}); // Create a variable in order to keep the same acc for the recursion, otherwise "reduce" returns a new one
if (item.data) {
acc = acc.concat(transformValue(item.data));
}
}
return acc;
}, []);
}
/**
* The breadcrumb component is s a type of secondary navigation scheme that
* reveals the user’s location in a website or web application.
*
* @name connectBreadcrumb
* @requirements To use this widget, your attributes must be formatted in a specific way.
* If you want for example to have a Breadcrumb of categories, objects in your index
* should be formatted this way:
*
* ```json
* {
* "categories.lvl0": "products",
* "categories.lvl1": "products > fruits",
* "categories.lvl2": "products > fruits > citrus"
* }
* ```
*
* It's also possible to provide more than one path for each level:
*
* ```json
* {
* "categories.lvl0": ["products", "goods"],
* "categories.lvl1": ["products > fruits", "goods > to eat"]
* }
* ```
*
* All attributes passed to the `attributes` prop must be present in "attributes for faceting"
* on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.
*
* @kind connector
* @propType {array.<string>} attributes - List of attributes to use to generate the hierarchy of the menu. See the example for the convention to follow.
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @providedPropType {function} refine - a function to toggle a refinement
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
* @providedPropType {array.<{items: object, count: number, isRefined: boolean, label: string, value: string}>} items - the list of items the Breadcrumb can display.
*/
var connectBreadcrumb = createConnectorWithContext({
displayName: 'AlgoliaBreadcrumb',
propTypes: {
attributes: function attributes(props, propName, componentName) {
var isNotString = function isNotString(val) {
return typeof val !== 'string';
};
if (!Array.isArray(props[propName]) || props[propName].some(isNotString) || props[propName].length < 1) {
return new Error("Invalid prop ".concat(propName, " supplied to ").concat(componentName, ". Expected an Array of Strings"));
}
return undefined;
},
transformItems: propTypes.func
},
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var id = getId$2(props);
var results = getResults(searchResults, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
var isFacetPresent = Boolean(results) && Boolean(results.getFacetByName(id));
if (!isFacetPresent) {
return {
items: [],
canRefine: false
};
}
var values = results.getFacetValues(id);
var items = values.data ? transformValue(values.data) : [];
var transformedItems = props.transformItems ? props.transformItems(items) : items;
return {
canRefine: transformedItems.length > 0,
items: transformedItems
};
},
refine: function refine(props, searchState, nextRefinement) {
return _refine(props, searchState, nextRefinement, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
}
});
/**
* connectCurrentRefinements connector provides the logic to build a widget that will
* give the user the ability to remove all or some of the filters that were
* set.
* @name connectCurrentRefinements
* @kind connector
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @propType {function} [clearsQuery=false] - Pass true to also clear the search query
* @providedPropType {function} refine - a function to remove a single filter
* @providedPropType {array.<{label: string, attribute: string, currentRefinement: string || object, items: array, value: function}>} items - all the filters, the `value` is to pass to the `refine` function for removing all currentrefinements, `label` is for the display. When existing several refinements for the same atribute name, then you get a nested `items` object that contains a `label` and a `value` function to use to remove a single filter. `attribute` and `currentRefinement` are metadata containing row values.
* @providedPropType {string} query - the search query
*/
var connectCurrentRefinements = createConnectorWithContext({
displayName: 'AlgoliaCurrentRefinements',
propTypes: {
transformItems: propTypes.func
},
getProvidedProps: function getProvidedProps(props, searchState, searchResults, metadata) {
var items = metadata.reduce(function (res, meta) {
if (typeof meta.items !== 'undefined') {
if (!props.clearsQuery && meta.id === 'query') {
return res;
} else {
if (props.clearsQuery && meta.id === 'query' && meta.items[0].currentRefinement === '') {
return res;
}
return res.concat(meta.items.map(function (item) {
return _objectSpread({}, item, {
id: meta.id,
index: meta.index
});
}));
}
}
return res;
}, []);
var transformedItems = props.transformItems ? props.transformItems(items) : items;
return {
items: transformedItems,
canRefine: transformedItems.length > 0
};
},
refine: function refine(props, searchState, items) {
// `value` corresponds to our internal clear function computed in each connector metadata.
var refinementsToClear = items instanceof Array ? items.map(function (item) {
return item.value;
}) : [items];
return refinementsToClear.reduce(function (res, clear) {
return clear(res);
}, searchState);
}
});
var getId$3 = function getId(props) {
return props.attributes[0];
};
var namespace$1 = 'hierarchicalMenu';
function getCurrentRefinement(props, searchState, context) {
var currentRefinement = getCurrentRefinementValue(props, searchState, context, "".concat(namespace$1, ".").concat(getId$3(props)), null);
if (currentRefinement === '') {
return null;
}
return currentRefinement;
}
function getValue(path, props, searchState, context) {
var id = props.id,
attributes = props.attributes,
separator = props.separator,
rootPath = props.rootPath,
showParentLevel = props.showParentLevel;
var currentRefinement = getCurrentRefinement(props, searchState, context);
var nextRefinement;
if (currentRefinement === null) {
nextRefinement = path;
} else {
var tmpSearchParameters = new algoliasearchHelper_1.SearchParameters({
hierarchicalFacets: [{
name: id,
attributes: attributes,
separator: separator,
rootPath: rootPath,
showParentLevel: showParentLevel
}]
});
nextRefinement = tmpSearchParameters.toggleHierarchicalFacetRefinement(id, currentRefinement).toggleHierarchicalFacetRefinement(id, path).getHierarchicalRefinement(id)[0];
}
return nextRefinement;
}
function transformValue$1(value, props, searchState, context) {
return value.map(function (v) {
return {
label: v.name,
value: getValue(v.path, props, searchState, context),
count: v.count,
isRefined: v.isRefined,
items: v.data && transformValue$1(v.data, props, searchState, context)
};
});
}
var truncate = function truncate() {
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
return items.slice(0, limit).map(function () {
var item = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return Array.isArray(item.items) ? _objectSpread({}, item, {
items: truncate(item.items, limit)
}) : item;
});
};
function _refine$1(props, searchState, nextRefinement, context) {
var id = getId$3(props);
var nextValue = _defineProperty({}, id, nextRefinement || '');
var resetPage = true;
return refineValue(searchState, nextValue, context, resetPage, namespace$1);
}
function _cleanUp(props, searchState, context) {
return cleanUpValue(searchState, context, "".concat(namespace$1, ".").concat(getId$3(props)));
}
var sortBy = ['name:asc'];
/**
* connectHierarchicalMenu connector provides the logic to build a widget that will
* give the user the ability to explore a tree-like structure.
* This is commonly used for multi-level categorization of products on e-commerce
* websites. From a UX point of view, we suggest not displaying more than two levels deep.
* @name connectHierarchicalMenu
* @requirements To use this widget, your attributes must be formatted in a specific way.
* If you want for example to have a hiearchical menu of categories, objects in your index
* should be formatted this way:
*
* ```json
* {
* "categories.lvl0": "products",
* "categories.lvl1": "products > fruits",
* "categories.lvl2": "products > fruits > citrus"
* }
* ```
*
* It's also possible to provide more than one path for each level:
*
* ```json
* {
* "categories.lvl0": ["products", "goods"],
* "categories.lvl1": ["products > fruits", "goods > to eat"]
* }
* ```
*
* All attributes passed to the `attributes` prop must be present in "attributes for faceting"
* on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.
*
* @kind connector
* @propType {array.<string>} attributes - List of attributes to use to generate the hierarchy of the menu. See the example for the convention to follow.
* @propType {string} [defaultRefinement] - the item value selected by default
* @propType {boolean} [showMore=false] - Flag to activate the show more button, for toggling the number of items between limit and showMoreLimit.
* @propType {number} [limit=10] - The maximum number of items displayed.
* @propType {number} [showMoreLimit=20] - The maximum number of items displayed when the user triggers the show more. Not considered if `showMore` is false.
* @propType {string} [separator='>'] - Specifies the level separator used in the data.
* @propType {string} [rootPath=null] - The path to use if the first level is not the root level.
* @propType {boolean} [showParentLevel=true] - Flag to set if the parent level should be displayed.
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @providedPropType {function} refine - a function to toggle a refinement
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
* @providedPropType {string} currentRefinement - the refinement currently applied
* @providedPropType {array.<{items: object, count: number, isRefined: boolean, label: string, value: string}>} items - the list of items the HierarchicalMenu can display. items has the same shape as parent items.
*/
var connectHierarchicalMenu = createConnectorWithContext({
displayName: 'AlgoliaHierarchicalMenu',
propTypes: {
attributes: function attributes(props, propName, componentName) {
var isNotString = function isNotString(val) {
return typeof val !== 'string';
};
if (!Array.isArray(props[propName]) || props[propName].some(isNotString) || props[propName].length < 1) {
return new Error("Invalid prop ".concat(propName, " supplied to ").concat(componentName, ". Expected an Array of Strings"));
}
return undefined;
},
separator: propTypes.string,
rootPath: propTypes.string,
showParentLevel: propTypes.bool,
defaultRefinement: propTypes.string,
showMore: propTypes.bool,
limit: propTypes.number,
showMoreLimit: propTypes.number,
transformItems: propTypes.func
},
defaultProps: {
showMore: false,
limit: 10,
showMoreLimit: 20,
separator: ' > ',
rootPath: null,
showParentLevel: true
},
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var showMore = props.showMore,
limit = props.limit,
showMoreLimit = props.showMoreLimit;
var id = getId$3(props);
var results = getResults(searchResults, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
var isFacetPresent = Boolean(results) && Boolean(results.getFacetByName(id));
if (!isFacetPresent) {
return {
items: [],
currentRefinement: getCurrentRefinement(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}),
canRefine: false
};
}
var itemsLimit = showMore ? showMoreLimit : limit;
var value = results.getFacetValues(id, {
sortBy: sortBy
});
var items = value.data ? transformValue$1(value.data, props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}) : [];
var transformedItems = props.transformItems ? props.transformItems(items) : items;
return {
items: truncate(transformedItems, itemsLimit),
currentRefinement: getCurrentRefinement(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}),
canRefine: transformedItems.length > 0
};
},
refine: function refine(props, searchState, nextRefinement) {
return _refine$1(props, searchState, nextRefinement, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
cleanUp: function cleanUp(props, searchState) {
return _cleanUp(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
var attributes = props.attributes,
separator = props.separator,
rootPath = props.rootPath,
showParentLevel = props.showParentLevel,
showMore = props.showMore,
limit = props.limit,
showMoreLimit = props.showMoreLimit,
contextValue = props.contextValue;
var id = getId$3(props);
var itemsLimit = showMore ? showMoreLimit : limit;
searchParameters = searchParameters.addHierarchicalFacet({
name: id,
attributes: attributes,
separator: separator,
rootPath: rootPath,
showParentLevel: showParentLevel
}).setQueryParameters({
maxValuesPerFacet: Math.max(searchParameters.maxValuesPerFacet || 0, itemsLimit)
});
var currentRefinement = getCurrentRefinement(props, searchState, {
ais: contextValue,
multiIndexContext: props.indexContextValue
});
if (currentRefinement !== null) {
searchParameters = searchParameters.toggleHierarchicalFacetRefinement(id, currentRefinement);
}
return searchParameters;
},
getMetadata: function getMetadata(props, searchState) {
var rootAttribute = props.attributes[0];
var id = getId$3(props);
var currentRefinement = getCurrentRefinement(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
var items = !currentRefinement ? [] : [{
label: "".concat(rootAttribute, ": ").concat(currentRefinement),
attribute: rootAttribute,
value: function value(nextState) {
return _refine$1(props, nextState, '', {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
currentRefinement: currentRefinement
}];
return {
id: id,
index: getIndexId({
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}),
items: items
};
}
});
var highlight = function highlight(_ref) {
var attribute = _ref.attribute,
hit = _ref.hit,
highlightProperty = _ref.highlightProperty,
_ref$preTag = _ref.preTag,
preTag = _ref$preTag === void 0 ? HIGHLIGHT_TAGS.highlightPreTag : _ref$preTag,
_ref$postTag = _ref.postTag,
postTag = _ref$postTag === void 0 ? HIGHLIGHT_TAGS.highlightPostTag : _ref$postTag;
return parseAlgoliaHit({
attribute: attribute,
highlightProperty: highlightProperty,
hit: hit,
preTag: preTag,
postTag: postTag
});
};
/**
* connectHighlight connector provides the logic to create an highlighter
* component that will retrieve, parse and render an highlighted attribute
* from an Algolia hit.
* @name connectHighlight
* @kind connector
* @category connector
* @providedPropType {function} highlight - function to retrieve and parse an attribute from a hit. It takes a configuration object with 3 attributes: `highlightProperty` which is the property that contains the highlight structure from the records, `attribute` which is the name of the attribute (it can be either a string or an array of strings) to look for and `hit` which is the hit from Algolia. It returns an array of objects `{value: string, isHighlighted: boolean}`. If the element that corresponds to the attribute is an array of strings, it will return a nested array of objects.
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, SearchBox, Hits, connectHighlight } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const CustomHighlight = connectHighlight(
* ({ highlight, attribute, hit, highlightProperty }) => {
* const highlights = highlight({
* highlightProperty: '_highlightResult',
* attribute,
* hit
* });
*
* return highlights.map(part => part.isHighlighted ? (
* <mark>{part.value}</mark>
* ) : (
* <span>{part.value}</span>
* ));
* }
* );
*
* const Hit = ({ hit }) => (
* <p>
* <CustomHighlight attribute="name" hit={hit} />
* </p>
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <SearchBox defaultRefinement="pho" />
* <Hits hitComponent={Hit} />
* </InstantSearch>
* );
*/
var connectHighlight = createConnectorWithContext({
displayName: 'AlgoliaHighlighter',
propTypes: {},
getProvidedProps: function getProvidedProps() {
return {
highlight: highlight
};
}
});
/**
* connectHits connector provides the logic to create connected
* components that will render the results retrieved from
* Algolia.
*
* To configure the number of hits retrieved, use [HitsPerPage widget](widgets/HitsPerPage.html),
* [connectHitsPerPage connector](connectors/connectHitsPerPage.html) or pass the hitsPerPage
* prop to a [Configure](guide/Search_parameters.html) widget.
*
* **Warning:** you will need to use the **objectID** property available on every hit as a key
* when iterating over them. This will ensure you have the best possible UI experience
* especially on slow networks.
* @name connectHits
* @kind connector
* @providedPropType {array.<object>} hits - the records that matched the search state
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, Highlight, connectHits } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
* const CustomHits = connectHits(({ hits }) => (
* <div>
* {hits.map(hit =>
* <p key={hit.objectID}>
* <Highlight attribute="name" hit={hit} />
* </p>
* )}
* </div>
* ));
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <CustomHits />
* </InstantSearch>
* );
*/
var connectHits = createConnectorWithContext({
displayName: 'AlgoliaHits',
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var results = getResults(searchResults, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
if (!results) {
return {
hits: []
};
}
var hitsWithPositions = addAbsolutePositions(results.hits, results.hitsPerPage, results.page);
var hitsWithPositionsAndQueryID = addQueryID(hitsWithPositions, results.queryID);
return {
hits: hitsWithPositionsAndQueryID
};
},
/**
* Hits needs to be considered as a widget to trigger a search,
* even if no other widgets are used.
*
* To be considered as a widget you need either:
* - getSearchParameters
* - getMetadata
* - transitionState
*
* See: createConnector.tsx
*/
getSearchParameters: function getSearchParameters(searchParameters) {
return searchParameters;
}
});
function getId$4() {
return 'hitsPerPage';
}
function getCurrentRefinement$1(props, searchState, context) {
var id = getId$4();
var currentRefinement = getCurrentRefinementValue(props, searchState, context, id, null);
if (typeof currentRefinement === 'string') {
return parseInt(currentRefinement, 10);
}
return currentRefinement;
}
/**
* connectHitsPerPage connector provides the logic to create connected
* components that will allow a user to choose to display more or less results from Algolia.
* @name connectHitsPerPage
* @kind connector
* @propType {number} defaultRefinement - The number of items selected by default
* @propType {{value: number, label: string}[]} items - List of hits per page options.
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @providedPropType {function} refine - a function to remove a single filter
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
* @providedPropType {string} currentRefinement - the refinement currently applied
* @providedPropType {array.<{isRefined: boolean, label?: string, value: number}>} items - the list of items the HitsPerPage can display. If no label provided, the value will be displayed.
*/
var connectHitsPerPage = createConnectorWithContext({
displayName: 'AlgoliaHitsPerPage',
propTypes: {
defaultRefinement: propTypes.number.isRequired,
items: propTypes.arrayOf(propTypes.shape({
label: propTypes.string,
value: propTypes.number.isRequired
})).isRequired,
transformItems: propTypes.func
},
getProvidedProps: function getProvidedProps(props, searchState) {
var currentRefinement = getCurrentRefinement$1(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
var items = props.items.map(function (item) {
return item.value === currentRefinement ? _objectSpread({}, item, {
isRefined: true
}) : _objectSpread({}, item, {
isRefined: false
});
});
return {
items: props.transformItems ? props.transformItems(items) : items,
currentRefinement: currentRefinement
};
},
refine: function refine(props, searchState, nextRefinement) {
var id = getId$4();
var nextValue = _defineProperty({}, id, nextRefinement);
var resetPage = true;
return refineValue(searchState, nextValue, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}, resetPage);
},
cleanUp: function cleanUp(props, searchState) {
return cleanUpValue(searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}, getId$4());
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
return searchParameters.setHitsPerPage(getCurrentRefinement$1(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}));
},
getMetadata: function getMetadata() {
return {
id: getId$4()
};
}
});
function getId$5() {
return 'page';
}
function getCurrentRefinement$2(props, searchState, context) {
var id = getId$5();
var page = 1;
var currentRefinement = getCurrentRefinementValue(props, searchState, context, id, page);
if (typeof currentRefinement === 'string') {
return parseInt(currentRefinement, 10);
}
return currentRefinement;
}
function getStateWithoutPage(state) {
var _ref = state || {},
page = _ref.page,
rest = _objectWithoutProperties(_ref, ["page"]);
return rest;
}
function getInMemoryCache() {
var cachedHits = undefined;
var cachedState = undefined;
return {
read: function read(_ref2) {
var state = _ref2.state;
return reactFastCompare(cachedState, getStateWithoutPage(state)) ? cachedHits : null;
},
write: function write(_ref3) {
var state = _ref3.state,
hits = _ref3.hits;
cachedState = getStateWithoutPage(state);
cachedHits = hits;
}
};
}
function extractHitsFromCachedHits(cachedHits) {
return Object.keys(cachedHits).map(Number).sort(function (a, b) {
return a - b;
}).reduce(function (acc, page) {
return acc.concat(cachedHits[page]);
}, []);
}
/**
* InfiniteHits connector provides the logic to create connected
* components that will render an continuous list of results retrieved from
* Algolia. This connector provides a function to load more results.
* @name connectInfiniteHits
* @kind connector
* @providedPropType {array.<object>} hits - the records that matched the search state
* @providedPropType {boolean} hasMore - indicates if there are more pages to load
* @providedPropType {function} refine - call to load more results
*/
var connectInfiniteHits = createConnectorWithContext({
displayName: 'AlgoliaInfiniteHits',
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var _this = this;
var results = getResults(searchResults, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
this._prevState = this._prevState || {};
var cache = props.cache || getInMemoryCache();
if (this._cachedHits === undefined) {
this._cachedHits = cache.read({
state: searchState
}) || {};
}
if (!results) {
return {
hits: extractHitsFromCachedHits(this._cachedHits),
hasPrevious: false,
hasMore: false,
refine: function refine() {},
refinePrevious: function refinePrevious() {},
refineNext: function refineNext() {}
};
}
var page = results.page,
hits = results.hits,
hitsPerPage = results.hitsPerPage,
nbPages = results.nbPages,
_results$_state = results._state;
_results$_state = _results$_state === void 0 ? {} : _results$_state;
var p = _results$_state.page,
currentState = _objectWithoutProperties(_results$_state, ["page"]);
var hitsWithPositions = addAbsolutePositions(hits, hitsPerPage, page);
var hitsWithPositionsAndQueryID = addQueryID(hitsWithPositions, results.queryID);
if (!reactFastCompare(currentState, this._prevState)) {
this._cachedHits = cache.read({
state: searchState
}) || {};
}
if (this._cachedHits[page] === undefined) {
this._cachedHits[page] = hitsWithPositionsAndQueryID;
cache.write({
state: searchState,
hits: this._cachedHits
});
}
this._prevState = currentState;
/*
Math.min() and Math.max() returns Infinity or -Infinity when no argument is given.
But there is always something in this point because of `this._cachedHits[page]`.
*/
var firstReceivedPage = Math.min.apply(Math, _toConsumableArray(Object.keys(this._cachedHits).map(Number)));
var lastReceivedPage = Math.max.apply(Math, _toConsumableArray(Object.keys(this._cachedHits).map(Number)));
var hasPrevious = firstReceivedPage > 0;
var lastPageIndex = nbPages - 1;
var hasMore = lastReceivedPage < lastPageIndex;
var refinePrevious = function refinePrevious(event) {
return _this.refine(event, firstReceivedPage - 1);
};
var refineNext = function refineNext(event) {
return _this.refine(event, lastReceivedPage + 1);
};
return {
hits: extractHitsFromCachedHits(this._cachedHits),
hasPrevious: hasPrevious,
hasMore: hasMore,
refinePrevious: refinePrevious,
refineNext: refineNext
};
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
return searchParameters.setQueryParameters({
page: getCurrentRefinement$2(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}) - 1
});
},
refine: function refine(props, searchState, event, index) {
var pages = Object.keys(this._cachedHits || {}).map(Number);
var lastReceivedPage = pages.length === 0 ? undefined : Math.max.apply(Math, _toConsumableArray(pages)); // If there is no key in `this._cachedHits`,
// then `lastReceivedPage` should be `undefined`.
if (index === undefined && lastReceivedPage !== undefined) {
index = lastReceivedPage + 1;
} else if (index === undefined) {
index = getCurrentRefinement$2(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
}
var id = getId$5();
var nextValue = _defineProperty({}, id, index + 1);
var resetPage = false;
return refineValue(searchState, nextValue, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}, resetPage);
}
});
var namespace$2 = 'menu';
function getId$6(props) {
return props.attribute;
}
function getCurrentRefinement$3(props, searchState, context) {
var currentRefinement = getCurrentRefinementValue(props, searchState, context, "".concat(namespace$2, ".").concat(getId$6(props)), null);
if (currentRefinement === '') {
return null;
}
return currentRefinement;
}
function getValue$1(name, props, searchState, context) {
var currentRefinement = getCurrentRefinement$3(props, searchState, context);
return name === currentRefinement ? '' : name;
}
function getLimit(_ref) {
var showMore = _ref.showMore,
limit = _ref.limit,
showMoreLimit = _ref.showMoreLimit;
return showMore ? showMoreLimit : limit;
}
function _refine$2(props, searchState, nextRefinement, context) {
var id = getId$6(props);
var nextValue = _defineProperty({}, id, nextRefinement ? nextRefinement : '');
var resetPage = true;
return refineValue(searchState, nextValue, context, resetPage, namespace$2);
}
function _cleanUp$1(props, searchState, context) {
return cleanUpValue(searchState, context, "".concat(namespace$2, ".").concat(getId$6(props)));
}
var defaultSortBy = ['count:desc', 'name:asc'];
/**
* connectMenu connector provides the logic to build a widget that will
* give the user the ability to choose a single value for a specific facet.
* @name connectMenu
* @requirements The attribute passed to the `attribute` prop must be present in "attributes for faceting"
* on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.
* @kind connector
* @propType {string} attribute - the name of the attribute in the record
* @propType {boolean} [showMore=false] - true if the component should display a button that will expand the number of items
* @propType {number} [limit=10] - the minimum number of diplayed items
* @propType {number} [showMoreLimit=20] - the maximun number of displayed items. Only used when showMore is set to `true`
* @propType {string} [defaultRefinement] - the value of the item selected by default
* @propType {boolean} [searchable=false] - allow search inside values
* @providedPropType {function} refine - a function to toggle a refinement
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
* @providedPropType {string} currentRefinement - the refinement currently applied
* @providedPropType {array.<{count: number, isRefined: boolean, label: string, value: string}>} items - the list of items the Menu can display.
* @providedPropType {function} searchForItems - a function to toggle a search inside items values
* @providedPropType {boolean} isFromSearch - a boolean that says if the `items` props contains facet values from the global search or from the search inside items.
*/
var connectMenu = createConnectorWithContext({
displayName: 'AlgoliaMenu',
propTypes: {
attribute: propTypes.string.isRequired,
showMore: propTypes.bool,
limit: propTypes.number,
showMoreLimit: propTypes.number,
defaultRefinement: propTypes.string,
transformItems: propTypes.func,
searchable: propTypes.bool
},
defaultProps: {
showMore: false,
limit: 10,
showMoreLimit: 20
},
getProvidedProps: function getProvidedProps(props, searchState, searchResults, meta, searchForFacetValuesResults) {
var attribute = props.attribute,
searchable = props.searchable,
indexContextValue = props.indexContextValue;
var results = getResults(searchResults, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
var canRefine = Boolean(results) && Boolean(results.getFacetByName(attribute));
var isFromSearch = Boolean(searchForFacetValuesResults && searchForFacetValuesResults[attribute] && searchForFacetValuesResults.query !== ''); // Search For Facet Values is not available with derived helper (used for multi index search)
if (searchable && indexContextValue) {
throw new Error('react-instantsearch: searching in *List is not available when used inside a' + ' multi index context');
}
if (!canRefine) {
return {
items: [],
currentRefinement: getCurrentRefinement$3(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}),
isFromSearch: isFromSearch,
searchable: searchable,
canRefine: canRefine
};
}
var items;
if (isFromSearch) {
items = searchForFacetValuesResults[attribute].map(function (v) {
return {
label: v.value,
value: getValue$1(v.value, props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}),
_highlightResult: {
label: {
value: v.highlighted
}
},
count: v.count,
isRefined: v.isRefined
};
});
} else {
items = results.getFacetValues(attribute, {
sortBy: searchable ? undefined : defaultSortBy
}).map(function (v) {
return {
label: v.name,
value: getValue$1(v.name, props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}),
count: v.count,
isRefined: v.isRefined
};
});
}
var transformedItems = props.transformItems ? props.transformItems(items) : items;
return {
items: transformedItems.slice(0, getLimit(props)),
currentRefinement: getCurrentRefinement$3(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}),
isFromSearch: isFromSearch,
searchable: searchable,
canRefine: transformedItems.length > 0
};
},
refine: function refine(props, searchState, nextRefinement) {
return _refine$2(props, searchState, nextRefinement, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
searchForFacetValues: function searchForFacetValues(props, searchState, nextRefinement) {
return {
facetName: props.attribute,
query: nextRefinement,
maxFacetHits: getLimit(props)
};
},
cleanUp: function cleanUp(props, searchState) {
return _cleanUp$1(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
var attribute = props.attribute;
searchParameters = searchParameters.setQueryParameters({
maxValuesPerFacet: Math.max(searchParameters.maxValuesPerFacet || 0, getLimit(props))
});
searchParameters = searchParameters.addDisjunctiveFacet(attribute);
var currentRefinement = getCurrentRefinement$3(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
if (currentRefinement !== null) {
searchParameters = searchParameters.addDisjunctiveFacetRefinement(attribute, currentRefinement);
}
return searchParameters;
},
getMetadata: function getMetadata(props, searchState) {
var id = getId$6(props);
var currentRefinement = getCurrentRefinement$3(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
return {
id: id,
index: getIndexId({
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}),
items: currentRefinement === null ? [] : [{
label: "".concat(props.attribute, ": ").concat(currentRefinement),
attribute: props.attribute,
value: function value(nextState) {
return _refine$2(props, nextState, '', {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
currentRefinement: currentRefinement
}]
};
}
});
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArrayLimit(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}
function stringifyItem(item) {
if (typeof item.start === 'undefined' && typeof item.end === 'undefined') {
return '';
}
var start = typeof item.start !== 'undefined' ? item.start : '';
var end = typeof item.end !== 'undefined' ? item.end : '';
return "".concat(start, ":").concat(end);
}
function parseItem(value) {
if (value.length === 0) {
return {
start: null,
end: null
};
}
var _value$split = value.split(':'),
_value$split2 = _slicedToArray(_value$split, 2),
startStr = _value$split2[0],
endStr = _value$split2[1];
return {
start: startStr.length > 0 ? parseInt(startStr, 10) : null,
end: endStr.length > 0 ? parseInt(endStr, 10) : null
};
}
var namespace$3 = 'multiRange';
function getId$7(props) {
return props.attribute;
}
function getCurrentRefinement$4(props, searchState, context) {
return getCurrentRefinementValue(props, searchState, context, "".concat(namespace$3, ".").concat(getId$7(props)), '');
}
function isRefinementsRangeIncludesInsideItemRange(stats, start, end) {
return stats.min > start && stats.min < end || stats.max > start && stats.max < end;
}
function isItemRangeIncludedInsideRefinementsRange(stats, start, end) {
return start > stats.min && start < stats.max || end > stats.min && end < stats.max;
}
function itemHasRefinement(attribute, results, value) {
var stats = results.getFacetByName(attribute) ? results.getFacetStats(attribute) : null;
var range = value.split(':');
var start = Number(range[0]) === 0 || value === '' ? Number.NEGATIVE_INFINITY : Number(range[0]);
var end = Number(range[1]) === 0 || value === '' ? Number.POSITIVE_INFINITY : Number(range[1]);
return !(Boolean(stats) && (isRefinementsRangeIncludesInsideItemRange(stats, start, end) || isItemRangeIncludedInsideRefinementsRange(stats, start, end)));
}
function _refine$3(props, searchState, nextRefinement, context) {
var nextValue = _defineProperty({}, getId$7(props), nextRefinement);
var resetPage = true;
return refineValue(searchState, nextValue, context, resetPage, namespace$3);
}
function _cleanUp$2(props, searchState, context) {
return cleanUpValue(searchState, context, "".concat(namespace$3, ".").concat(getId$7(props)));
}
/**
* connectNumericMenu connector provides the logic to build a widget that will
* give the user the ability to select a range value for a numeric attribute.
* Ranges are defined statically.
* @name connectNumericMenu
* @requirements The attribute passed to the `attribute` prop must be holding numerical values.
* @kind connector
* @propType {string} attribute - the name of the attribute in the records
* @propType {{label: string, start: number, end: number}[]} items - List of options. With a text label, and upper and lower bounds.
* @propType {string} [defaultRefinement] - the value of the item selected by default, follow the shape of a `string` with a pattern of `'{start}:{end}'`.
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @providedPropType {function} refine - a function to select a range.
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
* @providedPropType {string} currentRefinement - the refinement currently applied. follow the shape of a `string` with a pattern of `'{start}:{end}'` which corresponds to the current selected item. For instance, when the selected item is `{start: 10, end: 20}`, the searchState of the widget is `'10:20'`. When `start` isn't defined, the searchState of the widget is `':{end}'`, and the same way around when `end` isn't defined. However, when neither `start` nor `end` are defined, the searchState is an empty string.
* @providedPropType {array.<{isRefined: boolean, label: string, value: string, isRefined: boolean, noRefinement: boolean}>} items - the list of ranges the NumericMenu can display.
*/
var connectNumericMenu = createConnectorWithContext({
displayName: 'AlgoliaNumericMenu',
propTypes: {
id: propTypes.string,
attribute: propTypes.string.isRequired,
items: propTypes.arrayOf(propTypes.shape({
label: propTypes.node,
start: propTypes.number,
end: propTypes.number
})).isRequired,
transformItems: propTypes.func
},
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var attribute = props.attribute;
var currentRefinement = getCurrentRefinement$4(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
var results = getResults(searchResults, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
var items = props.items.map(function (item) {
var value = stringifyItem(item);
return {
label: item.label,
value: value,
isRefined: value === currentRefinement,
noRefinement: results ? itemHasRefinement(getId$7(props), results, value) : false
};
});
var stats = results && results.getFacetByName(attribute) ? results.getFacetStats(attribute) : null;
var refinedItem = find(items, function (item) {
return item.isRefined === true;
});
if (!items.some(function (item) {
return item.value === '';
})) {
items.push({
value: '',
isRefined: refinedItem === undefined,
noRefinement: !stats,
label: 'All'
});
}
var transformedItems = props.transformItems ? props.transformItems(items) : items;
return {
items: transformedItems,
currentRefinement: currentRefinement,
canRefine: transformedItems.length > 0 && transformedItems.some(function (item) {
return item.noRefinement === false;
})
};
},
refine: function refine(props, searchState, nextRefinement) {
return _refine$3(props, searchState, nextRefinement, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
cleanUp: function cleanUp(props, searchState) {
return _cleanUp$2(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
var attribute = props.attribute;
var _parseItem = parseItem(getCurrentRefinement$4(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
})),
start = _parseItem.start,
end = _parseItem.end;
searchParameters = searchParameters.addDisjunctiveFacet(attribute);
if (typeof start === 'number') {
searchParameters = searchParameters.addNumericRefinement(attribute, '>=', start);
}
if (typeof end === 'number') {
searchParameters = searchParameters.addNumericRefinement(attribute, '<=', end);
}
return searchParameters;
},
getMetadata: function getMetadata(props, searchState) {
var id = getId$7(props);
var value = getCurrentRefinement$4(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
var items = [];
var index = getIndexId({
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
if (value !== '') {
var _find = find(props.items, function (item) {
return stringifyItem(item) === value;
}),
label = _find.label;
items.push({
label: "".concat(props.attribute, ": ").concat(label),
attribute: props.attribute,
currentRefinement: label,
value: function value(nextState) {
return _refine$3(props, nextState, '', {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
}
});
}
return {
id: id,
index: index,
items: items
};
}
});
function getId$8() {
return 'page';
}
function getCurrentRefinement$5(props, searchState, context) {
var id = getId$8();
var page = 1;
var currentRefinement = getCurrentRefinementValue(props, searchState, context, id, page);
if (typeof currentRefinement === 'string') {
return parseInt(currentRefinement, 10);
}
return currentRefinement;
}
function _refine$4(props, searchState, nextPage, context) {
var id = getId$8();
var nextValue = _defineProperty({}, id, nextPage);
var resetPage = false;
return refineValue(searchState, nextValue, context, resetPage);
}
/**
* connectPagination connector provides the logic to build a widget that will
* let the user displays hits corresponding to a certain page.
* @name connectPagination
* @kind connector
* @propType {boolean} [showFirst=true] - Display the first page link.
* @propType {boolean} [showLast=false] - Display the last page link.
* @propType {boolean} [showPrevious=true] - Display the previous page link.
* @propType {boolean} [showNext=true] - Display the next page link.
* @propType {number} [padding=3] - How many page links to display around the current page.
* @propType {number} [totalPages=Infinity] - Maximum number of pages to display.
* @providedPropType {function} refine - a function to remove a single filter
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
* @providedPropType {number} nbPages - the total of existing pages
* @providedPropType {number} currentRefinement - the page refinement currently applied
*/
var connectPagination = createConnectorWithContext({
displayName: 'AlgoliaPagination',
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var results = getResults(searchResults, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
if (!results) {
return null;
}
var nbPages = results.nbPages;
return {
nbPages: nbPages,
currentRefinement: getCurrentRefinement$5(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}),
canRefine: nbPages > 1
};
},
refine: function refine(props, searchState, nextPage) {
return _refine$4(props, searchState, nextPage, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
cleanUp: function cleanUp(props, searchState) {
return cleanUpValue(searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}, getId$8());
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
return searchParameters.setPage(getCurrentRefinement$5(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}) - 1);
},
getMetadata: function getMetadata() {
return {
id: getId$8()
};
}
});
/**
* connectPoweredBy connector provides the logic to build a widget that
* will display a link to algolia.
* @name connectPoweredBy
* @kind connector
* @providedPropType {string} url - the url to redirect to algolia
*/
var connectPoweredBy = createConnectorWithContext({
displayName: 'AlgoliaPoweredBy',
getProvidedProps: function getProvidedProps() {
var hostname = typeof window === 'undefined' ? '' : window.location.hostname;
var url = 'https://www.algolia.com/?' + 'utm_source=react-instantsearch&' + 'utm_medium=website&' + "utm_content=".concat(hostname, "&") + 'utm_campaign=poweredby';
return {
url: url
};
}
});
/**
* connectRange connector provides the logic to create connected
* components that will give the ability for a user to refine results using
* a numeric range.
* @name connectRange
* @kind connector
* @requirements The attribute passed to the `attribute` prop must be present in “attributes for faceting”
* on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.
* The values inside the attribute must be JavaScript numbers (not strings).
* @propType {string} attribute - Name of the attribute for faceting
* @propType {{min?: number, max?: number}} [defaultRefinement] - Default searchState of the widget containing the start and the end of the range.
* @propType {number} [min] - Minimum value. When this isn't set, the minimum value will be automatically computed by Algolia using the data in the index.
* @propType {number} [max] - Maximum value. When this isn't set, the maximum value will be automatically computed by Algolia using the data in the index.
* @propType {number} [precision=0] - Number of digits after decimal point to use.
* @providedPropType {function} refine - a function to select a range.
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
* @providedPropType {string} currentRefinement - the refinement currently applied
* @providedPropType {number} min - the minimum value available.
* @providedPropType {number} max - the maximum value available.
* @providedPropType {number} precision - Number of digits after decimal point to use.
*/
function getId$9(props) {
return props.attribute;
}
var namespace$4 = 'range';
function getCurrentRange(boundaries, stats, precision) {
var pow = Math.pow(10, precision);
var min;
if (typeof boundaries.min === 'number' && isFinite(boundaries.min)) {
min = boundaries.min;
} else if (typeof stats.min === 'number' && isFinite(stats.min)) {
min = stats.min;
} else {
min = undefined;
}
var max;
if (typeof boundaries.max === 'number' && isFinite(boundaries.max)) {
max = boundaries.max;
} else if (typeof stats.max === 'number' && isFinite(stats.max)) {
max = stats.max;
} else {
max = undefined;
}
return {
min: min !== undefined ? Math.floor(min * pow) / pow : min,
max: max !== undefined ? Math.ceil(max * pow) / pow : max
};
}
function getCurrentRefinement$6(props, searchState, currentRange, context) {
var _getCurrentRefinement = getCurrentRefinementValue(props, searchState, context, "".concat(namespace$4, ".").concat(getId$9(props)), {}),
min = _getCurrentRefinement.min,
max = _getCurrentRefinement.max;
var isFloatPrecision = Boolean(props.precision);
var nextMin = min;
if (typeof nextMin === 'string') {
nextMin = isFloatPrecision ? parseFloat(nextMin) : parseInt(nextMin, 10);
}
var nextMax = max;
if (typeof nextMax === 'string') {
nextMax = isFloatPrecision ? parseFloat(nextMax) : parseInt(nextMax, 10);
}
var refinement = {
min: nextMin,
max: nextMax
};
var hasMinBound = props.min !== undefined;
var hasMaxBound = props.max !== undefined;
var hasMinRefinment = refinement.min !== undefined;
var hasMaxRefinment = refinement.max !== undefined;
if (hasMinBound && hasMinRefinment && refinement.min < currentRange.min) {
throw Error("You can't provide min value lower than range.");
}
if (hasMaxBound && hasMaxRefinment && refinement.max > currentRange.max) {
throw Error("You can't provide max value greater than range.");
}
if (hasMinBound && !hasMinRefinment) {
refinement.min = currentRange.min;
}
if (hasMaxBound && !hasMaxRefinment) {
refinement.max = currentRange.max;
}
return refinement;
}
function getCurrentRefinementWithRange(refinement, range) {
return {
min: refinement.min !== undefined ? refinement.min : range.min,
max: refinement.max !== undefined ? refinement.max : range.max
};
}
function nextValueForRefinement(hasBound, isReset, range, value) {
var next;
if (!hasBound && range === value) {
next = undefined;
} else if (hasBound && isReset) {
next = range;
} else {
next = value;
}
return next;
}
function _refine$5(props, searchState, nextRefinement, currentRange, context) {
var nextMin = nextRefinement.min,
nextMax = nextRefinement.max;
var currentMinRange = currentRange.min,
currentMaxRange = currentRange.max;
var isMinReset = nextMin === undefined || nextMin === '';
var isMaxReset = nextMax === undefined || nextMax === '';
var nextMinAsNumber = !isMinReset ? parseFloat(nextMin) : undefined;
var nextMaxAsNumber = !isMaxReset ? parseFloat(nextMax) : undefined;
var isNextMinValid = isMinReset || isFinite(nextMinAsNumber);
var isNextMaxValid = isMaxReset || isFinite(nextMaxAsNumber);
if (!isNextMinValid || !isNextMaxValid) {
throw Error("You can't provide non finite values to the range connector.");
}
if (nextMinAsNumber < currentMinRange) {
throw Error("You can't provide min value lower than range.");
}
if (nextMaxAsNumber > currentMaxRange) {
throw Error("You can't provide max value greater than range.");
}
var id = getId$9(props);
var resetPage = true;
var nextValue = _defineProperty({}, id, {
min: nextValueForRefinement(props.min !== undefined, isMinReset, currentMinRange, nextMinAsNumber),
max: nextValueForRefinement(props.max !== undefined, isMaxReset, currentMaxRange, nextMaxAsNumber)
});
return refineValue(searchState, nextValue, context, resetPage, namespace$4);
}
function _cleanUp$3(props, searchState, context) {
return cleanUpValue(searchState, context, "".concat(namespace$4, ".").concat(getId$9(props)));
}
var connectRange = createConnectorWithContext({
displayName: 'AlgoliaRange',
propTypes: {
id: propTypes.string,
attribute: propTypes.string.isRequired,
defaultRefinement: propTypes.shape({
min: propTypes.number,
max: propTypes.number
}),
min: propTypes.number,
max: propTypes.number,
precision: propTypes.number,
header: propTypes.node,
footer: propTypes.node
},
defaultProps: {
precision: 0
},
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var attribute = props.attribute,
precision = props.precision,
minBound = props.min,
maxBound = props.max;
var results = getResults(searchResults, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
var hasFacet = results && results.getFacetByName(attribute);
var stats = hasFacet ? results.getFacetStats(attribute) || {} : {};
var facetValues = hasFacet ? results.getFacetValues(attribute) : [];
var count = facetValues.map(function (v) {
return {
value: v.name,
count: v.count
};
});
var _getCurrentRange = getCurrentRange({
min: minBound,
max: maxBound
}, stats, precision),
rangeMin = _getCurrentRange.min,
rangeMax = _getCurrentRange.max; // The searchState is not always in sync with the helper state. For example
// when we set boundaries on the first render the searchState don't have
// the correct refinement. If this behavior change in the upcoming version
// we could store the range inside the searchState instead of rely on `this`.
this._currentRange = {
min: rangeMin,
max: rangeMax
};
var currentRefinement = getCurrentRefinement$6(props, searchState, this._currentRange, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
return {
min: rangeMin,
max: rangeMax,
canRefine: count.length > 0,
currentRefinement: getCurrentRefinementWithRange(currentRefinement, this._currentRange),
count: count,
precision: precision
};
},
refine: function refine(props, searchState, nextRefinement) {
return _refine$5(props, searchState, nextRefinement, this._currentRange, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
cleanUp: function cleanUp(props, searchState) {
return _cleanUp$3(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
getSearchParameters: function getSearchParameters(params, props, searchState) {
var attribute = props.attribute;
var _getCurrentRefinement2 = getCurrentRefinement$6(props, searchState, this._currentRange, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}),
min = _getCurrentRefinement2.min,
max = _getCurrentRefinement2.max;
params = params.addDisjunctiveFacet(attribute);
if (min !== undefined) {
params = params.addNumericRefinement(attribute, '>=', min);
}
if (max !== undefined) {
params = params.addNumericRefinement(attribute, '<=', max);
}
return params;
},
getMetadata: function getMetadata(props, searchState) {
var _this = this;
var _this$_currentRange = this._currentRange,
minRange = _this$_currentRange.min,
maxRange = _this$_currentRange.max;
var _getCurrentRefinement3 = getCurrentRefinement$6(props, searchState, this._currentRange, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}),
minValue = _getCurrentRefinement3.min,
maxValue = _getCurrentRefinement3.max;
var items = [];
var hasMin = minValue !== undefined;
var hasMax = maxValue !== undefined;
var shouldDisplayMinLabel = hasMin && minValue !== minRange;
var shouldDisplayMaxLabel = hasMax && maxValue !== maxRange;
if (shouldDisplayMinLabel || shouldDisplayMaxLabel) {
var fragments = [hasMin ? "".concat(minValue, " <= ") : '', props.attribute, hasMax ? " <= ".concat(maxValue) : ''];
items.push({
label: fragments.join(''),
attribute: props.attribute,
value: function value(nextState) {
return _refine$5(props, nextState, {}, _this._currentRange, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
currentRefinement: getCurrentRefinementWithRange({
min: minValue,
max: maxValue
}, {
min: minRange,
max: maxRange
})
});
}
return {
id: getId$9(props),
index: getIndexId({
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}),
items: items
};
}
});
var namespace$5 = 'refinementList';
function getId$a(props) {
return props.attribute;
}
function getCurrentRefinement$7(props, searchState, context) {
var currentRefinement = getCurrentRefinementValue(props, searchState, context, "".concat(namespace$5, ".").concat(getId$a(props)), []);
if (typeof currentRefinement !== 'string') {
return currentRefinement;
}
if (currentRefinement) {
return [currentRefinement];
}
return [];
}
function getValue$2(name, props, searchState, context) {
var currentRefinement = getCurrentRefinement$7(props, searchState, context);
var isAnewValue = currentRefinement.indexOf(name) === -1;
var nextRefinement = isAnewValue ? currentRefinement.concat([name]) // cannot use .push(), it mutates
: currentRefinement.filter(function (selectedValue) {
return selectedValue !== name;
}); // cannot use .splice(), it mutates
return nextRefinement;
}
function getLimit$1(_ref) {
var showMore = _ref.showMore,
limit = _ref.limit,
showMoreLimit = _ref.showMoreLimit;
return showMore ? showMoreLimit : limit;
}
function _refine$6(props, searchState, nextRefinement, context) {
var id = getId$a(props); // Setting the value to an empty string ensures that it is persisted in
// the URL as an empty value.
// This is necessary in the case where `defaultRefinement` contains one
// item and we try to deselect it. `nextSelected` would be an empty array,
// which would not be persisted to the URL.
// {foo: ['bar']} => "foo[0]=bar"
// {foo: []} => ""
var nextValue = _defineProperty({}, id, nextRefinement.length > 0 ? nextRefinement : '');
var resetPage = true;
return refineValue(searchState, nextValue, context, resetPage, namespace$5);
}
function _cleanUp$4(props, searchState, context) {
return cleanUpValue(searchState, context, "".concat(namespace$5, ".").concat(getId$a(props)));
}
/**
* connectRefinementList connector provides the logic to build a widget that will
* give the user the ability to choose multiple values for a specific facet.
* @name connectRefinementList
* @kind connector
* @requirements The attribute passed to the `attribute` prop must be present in "attributes for faceting"
* on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.
* @propType {string} attribute - the name of the attribute in the record
* @propType {boolean} [searchable=false] - allow search inside values
* @propType {string} [operator=or] - How to apply the refinements. Possible values: 'or' or 'and'.
* @propType {boolean} [showMore=false] - true if the component should display a button that will expand the number of items
* @propType {number} [limit=10] - the minimum number of displayed items
* @propType {number} [showMoreLimit=20] - the maximun number of displayed items. Only used when showMore is set to `true`
* @propType {string[]} defaultRefinement - the values of the items selected by default. The searchState of this widget takes the form of a list of `string`s, which correspond to the values of all selected refinements. However, when there are no refinements selected, the value of the searchState is an empty string.
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @providedPropType {function} refine - a function to toggle a refinement
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
* @providedPropType {string[]} currentRefinement - the refinement currently applied
* @providedPropType {array.<{count: number, isRefined: boolean, label: string, value: string}>} items - the list of items the RefinementList can display.
* @providedPropType {function} searchForItems - a function to toggle a search inside items values
* @providedPropType {boolean} isFromSearch - a boolean that says if the `items` props contains facet values from the global search or from the search inside items.
* @providedPropType {boolean} canRefine - a boolean that says whether you can refine
*/
var sortBy$1 = ['isRefined', 'count:desc', 'name:asc'];
var connectRefinementList = createConnectorWithContext({
displayName: 'AlgoliaRefinementList',
propTypes: {
id: propTypes.string,
attribute: propTypes.string.isRequired,
operator: propTypes.oneOf(['and', 'or']),
showMore: propTypes.bool,
limit: propTypes.number,
showMoreLimit: propTypes.number,
defaultRefinement: propTypes.arrayOf(propTypes.oneOfType([propTypes.string, propTypes.number])),
searchable: propTypes.bool,
transformItems: propTypes.func
},
defaultProps: {
operator: 'or',
showMore: false,
limit: 10,
showMoreLimit: 20
},
getProvidedProps: function getProvidedProps(props, searchState, searchResults, metadata, searchForFacetValuesResults) {
var attribute = props.attribute,
searchable = props.searchable,
indexContextValue = props.indexContextValue;
var results = getResults(searchResults, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
var canRefine = Boolean(results) && Boolean(results.getFacetByName(attribute));
var isFromSearch = Boolean(searchForFacetValuesResults && searchForFacetValuesResults[attribute] && searchForFacetValuesResults.query !== ''); // Search For Facet Values is not available with derived helper (used for multi index search)
if (searchable && indexContextValue) {
throw new Error('react-instantsearch: searching in *List is not available when used inside a' + ' multi index context');
}
if (!canRefine) {
return {
items: [],
currentRefinement: getCurrentRefinement$7(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}),
canRefine: canRefine,
isFromSearch: isFromSearch,
searchable: searchable
};
}
var items = isFromSearch ? searchForFacetValuesResults[attribute].map(function (v) {
return {
label: v.value,
value: getValue$2(v.value, props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}),
_highlightResult: {
label: {
value: v.highlighted
}
},
count: v.count,
isRefined: v.isRefined
};
}) : results.getFacetValues(attribute, {
sortBy: sortBy$1
}).map(function (v) {
return {
label: v.name,
value: getValue$2(v.name, props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}),
count: v.count,
isRefined: v.isRefined
};
});
var transformedItems = props.transformItems ? props.transformItems(items) : items;
return {
items: transformedItems.slice(0, getLimit$1(props)),
currentRefinement: getCurrentRefinement$7(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}),
isFromSearch: isFromSearch,
searchable: searchable,
canRefine: transformedItems.length > 0
};
},
refine: function refine(props, searchState, nextRefinement) {
return _refine$6(props, searchState, nextRefinement, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
searchForFacetValues: function searchForFacetValues(props, searchState, nextRefinement) {
return {
facetName: props.attribute,
query: nextRefinement,
maxFacetHits: getLimit$1(props)
};
},
cleanUp: function cleanUp(props, searchState) {
return _cleanUp$4(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
var attribute = props.attribute,
operator = props.operator;
var addKey = operator === 'and' ? 'addFacet' : 'addDisjunctiveFacet';
var addRefinementKey = "".concat(addKey, "Refinement");
searchParameters = searchParameters.setQueryParameters({
maxValuesPerFacet: Math.max(searchParameters.maxValuesPerFacet || 0, getLimit$1(props))
});
searchParameters = searchParameters[addKey](attribute);
return getCurrentRefinement$7(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}).reduce(function (res, val) {
return res[addRefinementKey](attribute, val);
}, searchParameters);
},
getMetadata: function getMetadata(props, searchState) {
var id = getId$a(props);
var context = {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
};
return {
id: id,
index: getIndexId(context),
items: getCurrentRefinement$7(props, searchState, context).length > 0 ? [{
attribute: props.attribute,
label: "".concat(props.attribute, ": "),
currentRefinement: getCurrentRefinement$7(props, searchState, context),
value: function value(nextState) {
return _refine$6(props, nextState, [], context);
},
items: getCurrentRefinement$7(props, searchState, context).map(function (item) {
return {
label: "".concat(item),
value: function value(nextState) {
var nextSelectedItems = getCurrentRefinement$7(props, nextState, context).filter(function (other) {
return other !== item;
});
return _refine$6(props, searchState, nextSelectedItems, context);
}
};
})
}] : []
};
}
});
/**
* connectScrollTo connector provides the logic to build a widget that will
* let the page scroll to a certain point.
* @name connectScrollTo
* @kind connector
* @propType {string} [scrollOn="page"] - Widget searchState key on which to listen for changes, default to the pagination widget.
* @providedPropType {any} value - the current refinement applied to the widget listened by scrollTo
* @providedPropType {boolean} hasNotChanged - indicates whether the refinement came from the scrollOn argument (for instance page by default)
*/
var connectScrollTo = createConnectorWithContext({
displayName: 'AlgoliaScrollTo',
propTypes: {
scrollOn: propTypes.string
},
defaultProps: {
scrollOn: 'page'
},
getProvidedProps: function getProvidedProps(props, searchState) {
var id = props.scrollOn;
var value = getCurrentRefinementValue(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}, id, null);
if (!this._prevSearchState) {
this._prevSearchState = {};
} // Get the subpart of the state that interest us
if (hasMultipleIndices({
ais: props.contextValue,
multiIndexContext: props.indexContextValue
})) {
searchState = searchState.indices ? searchState.indices[getIndexId({
ais: props.contextValue,
multiIndexContext: props.indexContextValue
})] : {};
} // if there is a change in the app that has been triggered by another element
// than "props.scrollOn (id) or the Configure widget, we need to keep track of
// the search state to know if there's a change in the app that was not triggered
// by the props.scrollOn (id) or the Configure widget. This is useful when
// using ScrollTo in combination of Pagination. As pagination can be change
// by every widget, we want to scroll only if it cames from the pagination
// widget itself. We also remove the configure key from the search state to
// do this comparison because for now configure values are not present in the
// search state before a first refinement has been made and will false the results.
// See: https://github.com/algolia/react-instantsearch/issues/164
var cleanedSearchState = omit(searchState, ['configure', id]);
var hasNotChanged = shallowEqual(this._prevSearchState, cleanedSearchState);
this._prevSearchState = cleanedSearchState;
return {
value: value,
hasNotChanged: hasNotChanged
};
}
});
function getId$b() {
return 'query';
}
function getCurrentRefinement$8(props, searchState, context) {
var id = getId$b();
var currentRefinement = getCurrentRefinementValue(props, searchState, context, id, '');
if (currentRefinement) {
return currentRefinement;
}
return '';
}
function _refine$7(props, searchState, nextRefinement, context) {
var id = getId$b();
var nextValue = _defineProperty({}, id, nextRefinement);
var resetPage = true;
return refineValue(searchState, nextValue, context, resetPage);
}
function _cleanUp$5(props, searchState, context) {
return cleanUpValue(searchState, context, getId$b());
}
/**
* connectSearchBox connector provides the logic to build a widget that will
* let the user search for a query
* @name connectSearchBox
* @kind connector
* @propType {string} [defaultRefinement] - Provide a default value for the query
* @providedPropType {function} refine - a function to change the current query
* @providedPropType {string} currentRefinement - the current query used
* @providedPropType {boolean} isSearchStalled - a flag that indicates if InstantSearch has detected that searches are stalled
*/
var connectSearchBox = createConnectorWithContext({
displayName: 'AlgoliaSearchBox',
propTypes: {
defaultRefinement: propTypes.string
},
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
return {
currentRefinement: getCurrentRefinement$8(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}),
isSearchStalled: searchResults.isSearchStalled
};
},
refine: function refine(props, searchState, nextRefinement) {
return _refine$7(props, searchState, nextRefinement, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
cleanUp: function cleanUp(props, searchState) {
return _cleanUp$5(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
return searchParameters.setQuery(getCurrentRefinement$8(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}));
},
getMetadata: function getMetadata(props, searchState) {
var id = getId$b();
var currentRefinement = getCurrentRefinement$8(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
return {
id: id,
index: getIndexId({
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}),
items: currentRefinement === null ? [] : [{
label: "".concat(id, ": ").concat(currentRefinement),
value: function value(nextState) {
return _refine$7(props, nextState, '', {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
currentRefinement: currentRefinement
}]
};
}
});
function getId$c() {
return 'sortBy';
}
function getCurrentRefinement$9(props, searchState, context) {
var id = getId$c();
var currentRefinement = getCurrentRefinementValue(props, searchState, context, id, null);
if (currentRefinement) {
return currentRefinement;
}
return null;
}
/**
* The connectSortBy connector provides the logic to build a widget that will
* display a list of indices. This allows a user to change how the hits are being sorted.
* @name connectSortBy
* @requirements Algolia handles sorting by creating replica indices. [Read more about sorting](https://www.algolia.com/doc/guides/relevance/sorting/) on
* the Algolia website.
* @kind connector
* @propType {string} defaultRefinement - The default selected index.
* @propType {{value: string, label: string}[]} items - The list of indexes to search in.
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @providedPropType {function} refine - a function to remove a single filter
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
* @providedPropType {string[]} currentRefinement - the refinement currently applied
* @providedPropType {array.<{isRefined: boolean, label?: string, value: string}>} items - the list of items the HitsPerPage can display. If no label provided, the value will be displayed.
*/
var connectSortBy = createConnectorWithContext({
displayName: 'AlgoliaSortBy',
propTypes: {
defaultRefinement: propTypes.string,
items: propTypes.arrayOf(propTypes.shape({
label: propTypes.string,
value: propTypes.string.isRequired
})).isRequired,
transformItems: propTypes.func
},
getProvidedProps: function getProvidedProps(props, searchState) {
var currentRefinement = getCurrentRefinement$9(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
var items = props.items.map(function (item) {
return item.value === currentRefinement ? _objectSpread({}, item, {
isRefined: true
}) : _objectSpread({}, item, {
isRefined: false
});
});
return {
items: props.transformItems ? props.transformItems(items) : items,
currentRefinement: currentRefinement
};
},
refine: function refine(props, searchState, nextRefinement) {
var id = getId$c();
var nextValue = _defineProperty({}, id, nextRefinement);
var resetPage = true;
return refineValue(searchState, nextValue, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}, resetPage);
},
cleanUp: function cleanUp(props, searchState) {
return cleanUpValue(searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
}, getId$c());
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
var selectedIndex = getCurrentRefinement$9(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
return searchParameters.setIndex(selectedIndex);
},
getMetadata: function getMetadata() {
return {
id: getId$c()
};
}
});
/**
* connectStats connector provides the logic to build a widget that will
* displays algolia search statistics (hits number and processing time).
* @name connectStats
* @kind connector
* @providedPropType {number} nbHits - number of hits returned by Algolia.
* @providedPropType {number} processingTimeMS - the time in ms took by Algolia to search for results.
*/
var connectStats = createConnectorWithContext({
displayName: 'AlgoliaStats',
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var results = getResults(searchResults, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
if (!results) {
return null;
}
return {
nbHits: results.nbHits,
processingTimeMS: results.processingTimeMS
};
}
});
function getId$d(props) {
return props.attribute;
}
var namespace$6 = 'toggle';
var falsyStrings = ['0', 'false', 'null', 'undefined'];
function getCurrentRefinement$a(props, searchState, context) {
var currentRefinement = getCurrentRefinementValue(props, searchState, context, "".concat(namespace$6, ".").concat(getId$d(props)), false);
if (falsyStrings.indexOf(currentRefinement) !== -1) {
return false;
}
return Boolean(currentRefinement);
}
function _refine$8(props, searchState, nextRefinement, context) {
var id = getId$d(props);
var nextValue = _defineProperty({}, id, nextRefinement ? nextRefinement : false);
var resetPage = true;
return refineValue(searchState, nextValue, context, resetPage, namespace$6);
}
function _cleanUp$6(props, searchState, context) {
return cleanUpValue(searchState, context, "".concat(namespace$6, ".").concat(getId$d(props)));
}
/**
* connectToggleRefinement connector provides the logic to build a widget that will
* provides an on/off filtering feature based on an attribute value.
* @name connectToggleRefinement
* @kind connector
* @requirements To use this widget, you'll need an attribute to toggle on.
*
* You can't toggle on null or not-null values. If you want to address this particular use-case you'll need to compute an
* extra boolean attribute saying if the value exists or not. See this [thread](https://discourse.algolia.com/t/how-to-create-a-toggle-for-the-absence-of-a-string-attribute/2460) for more details.
*
* @propType {string} attribute - Name of the attribute on which to apply the `value` refinement. Required when `value` is present.
* @propType {string} label - Label for the toggle.
* @propType {string} value - Value of the refinement to apply on `attribute`.
* @propType {boolean} [defaultRefinement=false] - Default searchState of the widget. Should the toggle be checked by default?
* @providedPropType {boolean} currentRefinement - `true` when the refinement is applied, `false` otherwise
* @providedPropType {object} count - an object that contains the count for `checked` and `unchecked` state
* @providedPropType {function} refine - a function to toggle a refinement
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
*/
var connectToggleRefinement = createConnectorWithContext({
displayName: 'AlgoliaToggle',
propTypes: {
label: propTypes.string.isRequired,
attribute: propTypes.string.isRequired,
value: propTypes.any.isRequired,
filter: propTypes.func,
defaultRefinement: propTypes.bool
},
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var attribute = props.attribute,
value = props.value;
var results = getResults(searchResults, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
var currentRefinement = getCurrentRefinement$a(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
var allFacetValues = results && results.getFacetByName(attribute) ? results.getFacetValues(attribute) : null;
var facetValue = // Use null to always be consistent with type of the value
// count: number | null
allFacetValues && allFacetValues.length ? find(allFacetValues, function (item) {
return item.name === value.toString();
}) : null;
var facetValueCount = facetValue && facetValue.count;
var allFacetValuesCount = // Use null to always be consistent with type of the value
// count: number | null
allFacetValues && allFacetValues.length ? allFacetValues.reduce(function (acc, item) {
return acc + item.count;
}, 0) : null;
var canRefine = currentRefinement ? allFacetValuesCount !== null && allFacetValuesCount > 0 : facetValueCount !== null && facetValueCount > 0;
var count = {
checked: allFacetValuesCount,
unchecked: facetValueCount
};
return {
currentRefinement: currentRefinement,
canRefine: canRefine,
count: count
};
},
refine: function refine(props, searchState, nextRefinement) {
return _refine$8(props, searchState, nextRefinement, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
cleanUp: function cleanUp(props, searchState) {
return _cleanUp$6(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
var attribute = props.attribute,
value = props.value,
filter = props.filter;
var checked = getCurrentRefinement$a(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
var nextSearchParameters = searchParameters.addDisjunctiveFacet(attribute);
if (checked) {
nextSearchParameters = nextSearchParameters.addDisjunctiveFacetRefinement(attribute, value);
if (filter) {
nextSearchParameters = filter(nextSearchParameters);
}
}
return nextSearchParameters;
},
getMetadata: function getMetadata(props, searchState) {
var id = getId$d(props);
var checked = getCurrentRefinement$a(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
var items = [];
var index = getIndexId({
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
if (checked) {
items.push({
label: props.label,
currentRefinement: checked,
attribute: props.attribute,
value: function value(nextState) {
return _refine$8(props, nextState, false, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue
});
}
});
}
return {
id: id,
index: index,
items: items
};
}
});
var classnames = createCommonjsModule(function (module) {
/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
var hasOwn = {}.hasOwnProperty;
function classNames () {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg)) {
classes.push(classNames.apply(null, arg));
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(' ');
}
if ( module.exports) {
module.exports = classNames;
} else {
window.classNames = classNames;
}
}());
});
var createClassNames = function createClassNames(block) {
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'ais';
return function () {
for (var _len = arguments.length, elements = new Array(_len), _key = 0; _key < _len; _key++) {
elements[_key] = arguments[_key];
}
var suitElements = elements.filter(function (element) {
return element || element === '';
}).map(function (element) {
var baseClassName = "".concat(prefix, "-").concat(block);
return element ? "".concat(baseClassName, "-").concat(element) : baseClassName;
});
return classnames(suitElements);
};
};
var isSpecialClick = function isSpecialClick(event) {
var isMiddleClick = event.button === 1;
return Boolean(isMiddleClick || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey);
};
var capitalize = function capitalize(key) {
return key.length === 0 ? '' : "".concat(key[0].toUpperCase()).concat(key.slice(1));
}; // taken from InstantSearch.js/utils
function range(_ref) {
var _ref$start = _ref.start,
start = _ref$start === void 0 ? 0 : _ref$start,
end = _ref.end,
_ref$step = _ref.step,
step = _ref$step === void 0 ? 1 : _ref$step; // We can't divide by 0 so we re-assign the step to 1 if it happens.
var limitStep = step === 0 ? 1 : step; // In some cases the array to create has a decimal length.
// We therefore need to round the value.
// Example:
// { start: 1, end: 5000, step: 500 }
// => Array length = (5000 - 1) / 500 = 9.998
var arrayLength = Math.round((end - start) / limitStep);
return _toConsumableArray(Array(arrayLength)).map(function (_, current) {
return (start + current) * limitStep;
});
}
function find$2(array, comparator) {
if (!Array.isArray(array)) {
return undefined;
}
for (var i = 0; i < array.length; i++) {
if (comparator(array[i])) {
return array[i];
}
}
return undefined;
}
var cx = createClassNames('Panel');
var _createContext$1 = React.createContext(function setCanRefine() {}),
PanelConsumer = _createContext$1.Consumer,
PanelProvider = _createContext$1.Provider;
var Panel =
/*#__PURE__*/
function (_Component) {
_inherits(Panel, _Component);
function Panel() {
var _getPrototypeOf2;
var _this;
_classCallCheck(this, Panel);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Panel)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(_assertThisInitialized(_this), "state", {
canRefine: true
});
_defineProperty(_assertThisInitialized(_this), "setCanRefine", function (nextCanRefine) {
_this.setState({
canRefine: nextCanRefine
});
});
return _this;
}
_createClass(Panel, [{
key: "render",
value: function render() {
var _this$props = this.props,
children = _this$props.children,
className = _this$props.className,
header = _this$props.header,
footer = _this$props.footer;
var canRefine = this.state.canRefine;
return React__default.createElement("div", {
className: classnames(cx('', !canRefine && '-noRefinement'), className)
}, header && React__default.createElement("div", {
className: cx('header')
}, header), React__default.createElement("div", {
className: cx('body')
}, React__default.createElement(PanelProvider, {
value: this.setCanRefine
}, children)), footer && React__default.createElement("div", {
className: cx('footer')
}, footer));
}
}]);
return Panel;
}(React.Component);
_defineProperty(Panel, "propTypes", {
children: propTypes.node.isRequired,
className: propTypes.string,
header: propTypes.node,
footer: propTypes.node
});
_defineProperty(Panel, "defaultProps", {
className: '',
header: null,
footer: null
});
var PanelCallbackHandler =
/*#__PURE__*/
function (_Component) {
_inherits(PanelCallbackHandler, _Component);
function PanelCallbackHandler() {
_classCallCheck(this, PanelCallbackHandler);
return _possibleConstructorReturn(this, _getPrototypeOf(PanelCallbackHandler).apply(this, arguments));
}
_createClass(PanelCallbackHandler, [{
key: "componentDidMount",
value: function componentDidMount() {
this.props.setCanRefine(this.props.canRefine);
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
if (prevProps.canRefine !== this.props.canRefine) {
this.props.setCanRefine(this.props.canRefine);
}
}
}, {
key: "render",
value: function render() {
return this.props.children;
}
}]);
return PanelCallbackHandler;
}(React.Component);
_defineProperty(PanelCallbackHandler, "propTypes", {
children: propTypes.node.isRequired,
canRefine: propTypes.bool.isRequired,
setCanRefine: propTypes.func.isRequired
});
var PanelWrapper = function PanelWrapper(_ref) {
var canRefine = _ref.canRefine,
children = _ref.children;
return React__default.createElement(PanelConsumer, null, function (setCanRefine) {
return React__default.createElement(PanelCallbackHandler, {
setCanRefine: setCanRefine,
canRefine: canRefine
}, children);
});
};
var Link =
/*#__PURE__*/
function (_Component) {
_inherits(Link, _Component);
function Link() {
var _getPrototypeOf2;
var _this;
_classCallCheck(this, Link);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Link)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(_assertThisInitialized(_this), "onClick", function (e) {
if (isSpecialClick(e)) {
return;
}
_this.props.onClick();
e.preventDefault();
});
return _this;
}
_createClass(Link, [{
key: "render",
value: function render() {
return React__default.createElement("a", _extends({}, this.props, {
onClick: this.onClick
}));
}
}]);
return Link;
}(React.Component);
_defineProperty(Link, "propTypes", {
onClick: propTypes.func.isRequired
});
var cx$1 = createClassNames('Breadcrumb');
var itemsPropType = propTypes.arrayOf(propTypes.shape({
label: propTypes.string.isRequired,
value: propTypes.string.isRequired
}));
var Breadcrumb =
/*#__PURE__*/
function (_Component) {
_inherits(Breadcrumb, _Component);
function Breadcrumb() {
_classCallCheck(this, Breadcrumb);
return _possibleConstructorReturn(this, _getPrototypeOf(Breadcrumb).apply(this, arguments));
}
_createClass(Breadcrumb, [{
key: "render",
value: function render() {
var _this$props = this.props,
canRefine = _this$props.canRefine,
createURL = _this$props.createURL,
items = _this$props.items,
refine = _this$props.refine,
rootURL = _this$props.rootURL,
separator = _this$props.separator,
translate = _this$props.translate,
className = _this$props.className;
var rootPath = canRefine ? React__default.createElement("li", {
className: cx$1('item')
}, React__default.createElement(Link, {
className: cx$1('link'),
onClick: function onClick() {
return !rootURL ? refine() : null;
},
href: rootURL ? rootURL : createURL()
}, translate('rootLabel'))) : null;
var breadcrumb = items.map(function (item, idx) {
var isLast = idx === items.length - 1;
return React__default.createElement("li", {
className: cx$1('item', isLast && 'item--selected'),
key: idx
}, React__default.createElement("span", {
className: cx$1('separator')
}, separator), !isLast ? React__default.createElement(Link, {
className: cx$1('link'),
onClick: function onClick() {
return refine(item.value);
},
href: createURL(item.value)
}, item.label) : item.label);
});
return React__default.createElement("div", {
className: classnames(cx$1('', !canRefine && '-noRefinement'), className)
}, React__default.createElement("ul", {
className: cx$1('list')
}, rootPath, breadcrumb));
}
}]);
return Breadcrumb;
}(React.Component);
_defineProperty(Breadcrumb, "propTypes", {
canRefine: propTypes.bool.isRequired,
createURL: propTypes.func.isRequired,
items: itemsPropType,
refine: propTypes.func.isRequired,
rootURL: propTypes.string,
separator: propTypes.node,
translate: propTypes.func.isRequired,
className: propTypes.string
});
_defineProperty(Breadcrumb, "defaultProps", {
rootURL: null,
separator: ' > ',
className: ''
});
var Breadcrumb$1 = translatable({
rootLabel: 'Home'
})(Breadcrumb);
/**
* A breadcrumb is a secondary navigation scheme that allows the user to see where the current page
* is in relation to the website or web application’s hierarchy.
* In terms of usability, using a breadcrumb reduces the number of actions a visitor needs to take in
* order to get to a higher-level page.
*
* If you want to select a specific refinement for your Breadcrumb component, you will need to
* use a [Virtual Hierarchical Menu](https://community.algolia.com/react-instantsearch/guide/Virtual_widgets.html)
* and set its defaultRefinement that will be then used by the Breadcrumb.
*
* @name Breadcrumb
* @kind widget
* @requirements Breadcrumbs are used for websites with a large amount of content organised in a hierarchical manner.
* The typical example is an e-commerce website which has a large variety of products grouped into logical categories
* (with categories, subcategories which also have subcategories).To use this widget, your attributes must be formatted in a specific way.
*
* Keep in mind that breadcrumbs shouldn’t replace effective primary navigation menus:
* it is only an alternative way to navigate around the website.
*
* If, for instance, you would like to have a breadcrumb of categories, objects in your index
* should be formatted this way:
*
* ```json
* {
* "categories.lvl0": "products",
* "categories.lvl1": "products > fruits",
* "categories.lvl2": "products > fruits > citrus"
* }
* ```
*
* It's also possible to provide more than one path for each level:
*
* ```json
* {
* "categories.lvl0": ["products", "goods"],
* "categories.lvl1": ["products > fruits", "goods > to eat"]
* }
* ```
*
* All attributes passed to the `attributes` prop must be present in "attributes for faceting"
* on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.
*
* @propType {array.<string>} attributes - List of attributes to use to generate the hierarchy of the menu. See the example for the convention to follow
* @propType {node} [separator='>'] - Symbol used for separating hyperlinks
* @propType {string} [rootURL=null] - The originating page (homepage)
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return
* @themeKey ais-Breadcrumb - the root div of the widget
* @themeKey ais-Breadcrumb--noRefinement - the root div of the widget when there is no refinement
* @themeKey ais-Breadcrumb-list - the list of all breadcrumb items
* @themeKey ais-Breadcrumb-item - the breadcrumb navigation item
* @themeKey ais-Breadcrumb-item--selected - the selected breadcrumb item
* @themeKey ais-Breadcrumb-separator - the separator of each breadcrumb item
* @themeKey ais-Breadcrumb-link - the clickable breadcrumb element
* @translationKey rootLabel - The root's label. Accepts a string
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { Breadcrumb, InstantSearch, HierarchicalMenu } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <Breadcrumb
* attributes={[
* 'hierarchicalCategories.lvl0',
* 'hierarchicalCategories.lvl1',
* 'hierarchicalCategories.lvl2',
* ]}
* />
* <HierarchicalMenu
* defaultRefinement="Cameras & Camcorders"
* attributes={[
* 'hierarchicalCategories.lvl0',
* 'hierarchicalCategories.lvl1',
* 'hierarchicalCategories.lvl2',
* ]}
* />
* </InstantSearch>
* );
*/
var BreadcrumbWidget = function BreadcrumbWidget(props) {
return React__default.createElement(PanelWrapper, props, React__default.createElement(Breadcrumb$1, props));
};
var Breadcrumb$2 = connectBreadcrumb(BreadcrumbWidget);
var cx$2 = createClassNames('ClearRefinements');
var ClearRefinements =
/*#__PURE__*/
function (_Component) {
_inherits(ClearRefinements, _Component);
function ClearRefinements() {
_classCallCheck(this, ClearRefinements);
return _possibleConstructorReturn(this, _getPrototypeOf(ClearRefinements).apply(this, arguments));
}
_createClass(ClearRefinements, [{
key: "render",
value: function render() {
var _this$props = this.props,
items = _this$props.items,
canRefine = _this$props.canRefine,
refine = _this$props.refine,
translate = _this$props.translate,
className = _this$props.className;
return React__default.createElement("div", {
className: classnames(cx$2(''), className)
}, React__default.createElement("button", {
className: cx$2('button', !canRefine && 'button--disabled'),
onClick: function onClick() {
return refine(items);
},
disabled: !canRefine
}, translate('reset')));
}
}]);
return ClearRefinements;
}(React.Component);
_defineProperty(ClearRefinements, "propTypes", {
items: propTypes.arrayOf(propTypes.object).isRequired,
canRefine: propTypes.bool.isRequired,
refine: propTypes.func.isRequired,
translate: propTypes.func.isRequired,
className: propTypes.string
});
_defineProperty(ClearRefinements, "defaultProps", {
className: ''
});
var ClearRefinements$1 = translatable({
reset: 'Clear all filters'
})(ClearRefinements);
/**
* The ClearRefinements widget displays a button that lets the user clean every refinement applied
* to the search.
* @name ClearRefinements
* @kind widget
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @propType {boolean} [clearsQuery=false] - Pass true to also clear the search query
* @themeKey ais-ClearRefinements - the root div of the widget
* @themeKey ais-ClearRefinements-button - the clickable button
* @themeKey ais-ClearRefinements-button--disabled - the disabled clickable button
* @translationKey reset - the clear all button value
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, ClearRefinements, RefinementList } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <ClearRefinements />
* <RefinementList
* attribute="brand"
* defaultRefinement={['Apple']}
* />
* </InstantSearch>
* );
*/
var ClearRefinementsWidget = function ClearRefinementsWidget(props) {
return React__default.createElement(PanelWrapper, props, React__default.createElement(ClearRefinements$1, props));
};
var ClearRefinements$2 = connectCurrentRefinements(ClearRefinementsWidget);
var cx$3 = createClassNames('CurrentRefinements');
var CurrentRefinements = function CurrentRefinements(_ref) {
var items = _ref.items,
canRefine = _ref.canRefine,
refine = _ref.refine,
translate = _ref.translate,
className = _ref.className;
return React__default.createElement("div", {
className: classnames(cx$3('', !canRefine && '-noRefinement'), className)
}, React__default.createElement("ul", {
className: cx$3('list', !canRefine && 'list--noRefinement')
}, items.map(function (item) {
return React__default.createElement("li", {
key: item.label,
className: cx$3('item')
}, React__default.createElement("span", {
className: cx$3('label')
}, item.label), item.items ? item.items.map(function (nest) {
return React__default.createElement("span", {
key: nest.label,
className: cx$3('category')
}, React__default.createElement("span", {
className: cx$3('categoryLabel')
}, nest.label), React__default.createElement("button", {
className: cx$3('delete'),
onClick: function onClick() {
return refine(nest.value);
}
}, translate('clearFilter', nest)));
}) : React__default.createElement("span", {
className: cx$3('category')
}, React__default.createElement("button", {
className: cx$3('delete'),
onClick: function onClick() {
return refine(item.value);
}
}, translate('clearFilter', item))));
})));
};
var itemPropTypes = propTypes.arrayOf(propTypes.shape({
label: propTypes.string.isRequired,
value: propTypes.func.isRequired,
items: function items() {
return itemPropTypes.apply(void 0, arguments);
}
}));
CurrentRefinements.defaultProps = {
className: ''
};
var CurrentRefinements$1 = translatable({
clearFilter: '✕'
})(CurrentRefinements);
/**
* The CurrentRefinements widget displays the list of currently applied filters.
*
* It allows the user to selectively remove them.
* @name CurrentRefinements
* @kind widget
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @themeKey ais-CurrentRefinements - the root div of the widget
* @themeKey ais-CurrentRefinements--noRefinement - the root div of the widget when there is no refinement
* @themeKey ais-CurrentRefinements-list - the list of all refined items
* @themeKey ais-CurrentRefinements-list--noRefinement - the list of all refined items when there is no refinement
* @themeKey ais-CurrentRefinements-item - the refined list item
* @themeKey ais-CurrentRefinements-button - the button of each refined list item
* @themeKey ais-CurrentRefinements-label - the refined list label
* @themeKey ais-CurrentRefinements-category - the category of each item
* @themeKey ais-CurrentRefinements-categoryLabel - the label of each catgory
* @themeKey ais-CurrentRefinements-delete - the delete button of each label
* @translationKey clearFilter - the remove filter button label
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, CurrentRefinements, RefinementList } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <CurrentRefinements />
* <RefinementList
* attribute="brand"
* defaultRefinement={['Colors']}
* />
* </InstantSearch>
* );
*/
var CurrentRefinementsWidget = function CurrentRefinementsWidget(props) {
return React__default.createElement(PanelWrapper, props, React__default.createElement(CurrentRefinements$1, props));
};
var CurrentRefinements$2 = connectCurrentRefinements(CurrentRefinementsWidget);
var cx$4 = createClassNames('SearchBox');
var defaultLoadingIndicator = React__default.createElement("svg", {
width: "18",
height: "18",
viewBox: "0 0 38 38",
xmlns: "http://www.w3.org/2000/svg",
stroke: "#444",
className: cx$4('loadingIcon')
}, React__default.createElement("g", {
fill: "none",
fillRule: "evenodd"
}, React__default.createElement("g", {
transform: "translate(1 1)",
strokeWidth: "2"
}, React__default.createElement("circle", {
strokeOpacity: ".5",
cx: "18",
cy: "18",
r: "18"
}), React__default.createElement("path", {
d: "M36 18c0-9.94-8.06-18-18-18"
}, React__default.createElement("animateTransform", {
attributeName: "transform",
type: "rotate",
from: "0 18 18",
to: "360 18 18",
dur: "1s",
repeatCount: "indefinite"
})))));
var defaultReset = React__default.createElement("svg", {
className: cx$4('resetIcon'),
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 20 20",
width: "10",
height: "10"
}, React__default.createElement("path", {
d: "M8.114 10L.944 2.83 0 1.885 1.886 0l.943.943L10 8.113l7.17-7.17.944-.943L20 1.886l-.943.943-7.17 7.17 7.17 7.17.943.944L18.114 20l-.943-.943-7.17-7.17-7.17 7.17-.944.943L0 18.114l.943-.943L8.113 10z"
}));
var defaultSubmit = React__default.createElement("svg", {
className: cx$4('submitIcon'),
xmlns: "http://www.w3.org/2000/svg",
width: "10",
height: "10",
viewBox: "0 0 40 40"
}, React__default.createElement("path", {
d: "M26.804 29.01c-2.832 2.34-6.465 3.746-10.426 3.746C7.333 32.756 0 25.424 0 16.378 0 7.333 7.333 0 16.378 0c9.046 0 16.378 7.333 16.378 16.378 0 3.96-1.406 7.594-3.746 10.426l10.534 10.534c.607.607.61 1.59-.004 2.202-.61.61-1.597.61-2.202.004L26.804 29.01zm-10.426.627c7.323 0 13.26-5.936 13.26-13.26 0-7.32-5.937-13.257-13.26-13.257C9.056 3.12 3.12 9.056 3.12 16.378c0 7.323 5.936 13.26 13.258 13.26z"
}));
var SearchBox =
/*#__PURE__*/
function (_Component) {
_inherits(SearchBox, _Component);
function SearchBox(props) {
var _this;
_classCallCheck(this, SearchBox);
_this = _possibleConstructorReturn(this, _getPrototypeOf(SearchBox).call(this));
_defineProperty(_assertThisInitialized(_this), "getQuery", function () {
return _this.props.searchAsYouType ? _this.props.currentRefinement : _this.state.query;
});
_defineProperty(_assertThisInitialized(_this), "onInputMount", function (input) {
_this.input = input;
if (!_this.props.inputRef) return;
if (typeof _this.props.inputRef === 'function') {
_this.props.inputRef(input);
} else {
_this.props.inputRef.current = input;
}
});
_defineProperty(_assertThisInitialized(_this), "onKeyDown", function (e) {
if (!_this.props.focusShortcuts) {
return;
}
var shortcuts = _this.props.focusShortcuts.map(function (key) {
return typeof key === 'string' ? key.toUpperCase().charCodeAt(0) : key;
});
var elt = e.target || e.srcElement;
var tagName = elt.tagName;
if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
// already in an input
return;
}
var which = e.which || e.keyCode;
if (shortcuts.indexOf(which) === -1) {
// not the right shortcut
return;
}
_this.input.focus();
e.stopPropagation();
e.preventDefault();
});
_defineProperty(_assertThisInitialized(_this), "onSubmit", function (e) {
e.preventDefault();
e.stopPropagation();
_this.input.blur();
var _this$props = _this.props,
refine = _this$props.refine,
searchAsYouType = _this$props.searchAsYouType;
if (!searchAsYouType) {
refine(_this.getQuery());
}
return false;
});
_defineProperty(_assertThisInitialized(_this), "onChange", function (event) {
var _this$props2 = _this.props,
searchAsYouType = _this$props2.searchAsYouType,
refine = _this$props2.refine,
onChange = _this$props2.onChange;
var value = event.target.value;
if (searchAsYouType) {
refine(value);
} else {
_this.setState({
query: value
});
}
if (onChange) {
onChange(event);
}
});
_defineProperty(_assertThisInitialized(_this), "onReset", function (event) {
var _this$props3 = _this.props,
searchAsYouType = _this$props3.searchAsYouType,
refine = _this$props3.refine,
onReset = _this$props3.onReset;
refine('');
_this.input.focus();
if (!searchAsYouType) {
_this.setState({
query: ''
});
}
if (onReset) {
onReset(event);
}
});
_this.state = {
query: props.searchAsYouType ? null : props.currentRefinement
};
return _this;
}
_createClass(SearchBox, [{
key: "componentDidMount",
value: function componentDidMount() {
document.addEventListener('keydown', this.onKeyDown);
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
document.removeEventListener('keydown', this.onKeyDown);
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
if (!this.props.searchAsYouType && prevProps.currentRefinement !== this.props.currentRefinement) {
this.setState({
query: this.props.currentRefinement
});
}
}
}, {
key: "render",
value: function render() {
var _this2 = this;
var _this$props4 = this.props,
className = _this$props4.className,
translate = _this$props4.translate,
autoFocus = _this$props4.autoFocus,
loadingIndicator = _this$props4.loadingIndicator,
submit = _this$props4.submit,
reset = _this$props4.reset;
var query = this.getQuery();
var searchInputEvents = Object.keys(this.props).reduce(function (props, prop) {
if (['onsubmit', 'onreset', 'onchange'].indexOf(prop.toLowerCase()) === -1 && prop.indexOf('on') === 0) {
return _objectSpread({}, props, _defineProperty({}, prop, _this2.props[prop]));
}
return props;
}, {});
var isSearchStalled = this.props.showLoadingIndicator && this.props.isSearchStalled;
/* eslint-disable max-len */
return React__default.createElement("div", {
className: classnames(cx$4(''), className)
}, React__default.createElement("form", {
noValidate: true,
onSubmit: this.props.onSubmit ? this.props.onSubmit : this.onSubmit,
onReset: this.onReset,
className: cx$4('form', isSearchStalled && 'form--stalledSearch'),
action: "",
role: "search"
}, React__default.createElement("input", _extends({
ref: this.onInputMount,
type: "search",
placeholder: translate('placeholder'),
autoFocus: autoFocus,
autoComplete: "off",
autoCorrect: "off",
autoCapitalize: "off",
spellCheck: "false",
required: true,
maxLength: "512",
value: query,
onChange: this.onChange
}, searchInputEvents, {
className: cx$4('input')
})), React__default.createElement("button", {
type: "submit",
title: translate('submitTitle'),
className: cx$4('submit')
}, submit), React__default.createElement("button", {
type: "reset",
title: translate('resetTitle'),
className: cx$4('reset'),
hidden: !query || isSearchStalled
}, reset), this.props.showLoadingIndicator && React__default.createElement("span", {
hidden: !isSearchStalled,
className: cx$4('loadingIndicator')
}, loadingIndicator)));
/* eslint-enable */
}
}]);
return SearchBox;
}(React.Component);
_defineProperty(SearchBox, "propTypes", {
currentRefinement: propTypes.string,
className: propTypes.string,
refine: propTypes.func.isRequired,
translate: propTypes.func.isRequired,
loadingIndicator: propTypes.node,
reset: propTypes.node,
submit: propTypes.node,
focusShortcuts: propTypes.arrayOf(propTypes.oneOfType([propTypes.string, propTypes.number])),
autoFocus: propTypes.bool,
searchAsYouType: propTypes.bool,
onSubmit: propTypes.func,
onReset: propTypes.func,
onChange: propTypes.func,
isSearchStalled: propTypes.bool,
showLoadingIndicator: propTypes.bool,
inputRef: propTypes.oneOfType([propTypes.func, propTypes.exact({
current: propTypes.object
})])
});
_defineProperty(SearchBox, "defaultProps", {
currentRefinement: '',
className: '',
focusShortcuts: ['s', '/'],
autoFocus: false,
searchAsYouType: true,
showLoadingIndicator: false,
isSearchStalled: false,
loadingIndicator: defaultLoadingIndicator,
reset: defaultReset,
submit: defaultSubmit
});
var SearchBox$1 = translatable({
resetTitle: 'Clear the search query.',
submitTitle: 'Submit your search query.',
placeholder: 'Search here…'
})(SearchBox);
var itemsPropType$1 = propTypes.arrayOf(propTypes.shape({
value: propTypes.any,
label: propTypes.node.isRequired,
items: function items() {
return itemsPropType$1.apply(void 0, arguments);
}
}));
var List =
/*#__PURE__*/
function (_Component) {
_inherits(List, _Component);
function List() {
var _this;
_classCallCheck(this, List);
_this = _possibleConstructorReturn(this, _getPrototypeOf(List).call(this));
_defineProperty(_assertThisInitialized(_this), "onShowMoreClick", function () {
_this.setState(function (state) {
return {
extended: !state.extended
};
});
});
_defineProperty(_assertThisInitialized(_this), "getLimit", function () {
var _this$props = _this.props,
limit = _this$props.limit,
showMoreLimit = _this$props.showMoreLimit;
var extended = _this.state.extended;
return extended ? showMoreLimit : limit;
});
_defineProperty(_assertThisInitialized(_this), "resetQuery", function () {
_this.setState({
query: ''
});
});
_defineProperty(_assertThisInitialized(_this), "renderItem", function (item, resetQuery) {
var itemHasChildren = item.items && Boolean(item.items.length);
return React__default.createElement("li", {
key: item.key || item.label,
className: _this.props.cx('item', item.isRefined && 'item--selected', item.noRefinement && 'item--noRefinement', itemHasChildren && 'item--parent')
}, _this.props.renderItem(item, resetQuery), itemHasChildren && React__default.createElement("ul", {
className: _this.props.cx('list', 'list--child')
}, item.items.slice(0, _this.getLimit()).map(function (child) {
return _this.renderItem(child, item);
})));
});
_this.state = {
extended: false,
query: ''
};
return _this;
}
_createClass(List, [{
key: "renderShowMore",
value: function renderShowMore() {
var _this$props2 = this.props,
showMore = _this$props2.showMore,
translate = _this$props2.translate,
cx = _this$props2.cx;
var extended = this.state.extended;
var disabled = this.props.limit >= this.props.items.length;
if (!showMore) {
return null;
}
return React__default.createElement("button", {
disabled: disabled,
className: cx('showMore', disabled && 'showMore--disabled'),
onClick: this.onShowMoreClick
}, translate('showMore', extended));
}
}, {
key: "renderSearchBox",
value: function renderSearchBox() {
var _this2 = this;
var _this$props3 = this.props,
cx = _this$props3.cx,
searchForItems = _this$props3.searchForItems,
isFromSearch = _this$props3.isFromSearch,
translate = _this$props3.translate,
items = _this$props3.items,
selectItem = _this$props3.selectItem;
var noResults = items.length === 0 && this.state.query !== '' ? React__default.createElement("div", {
className: cx('noResults')
}, translate('noResults')) : null;
return React__default.createElement("div", {
className: cx('searchBox')
}, React__default.createElement(SearchBox$1, {
currentRefinement: this.state.query,
refine: function refine(value) {
_this2.setState({
query: value
});
searchForItems(value);
},
focusShortcuts: [],
translate: translate,
onSubmit: function onSubmit(e) {
e.preventDefault();
e.stopPropagation();
if (isFromSearch) {
selectItem(items[0], _this2.resetQuery);
}
}
}), noResults);
}
}, {
key: "render",
value: function render() {
var _this3 = this;
var _this$props4 = this.props,
cx = _this$props4.cx,
items = _this$props4.items,
className = _this$props4.className,
searchable = _this$props4.searchable,
canRefine = _this$props4.canRefine;
var searchBox = searchable ? this.renderSearchBox() : null;
var rootClassName = classnames(cx('', !canRefine && '-noRefinement'), className);
if (items.length === 0) {
return React__default.createElement("div", {
className: rootClassName
}, searchBox);
} // Always limit the number of items we show on screen, since the actual
// number of retrieved items might vary with the `maxValuesPerFacet` config
// option.
return React__default.createElement("div", {
className: rootClassName
}, searchBox, React__default.createElement("ul", {
className: cx('list', !canRefine && 'list--noRefinement')
}, items.slice(0, this.getLimit()).map(function (item) {
return _this3.renderItem(item, _this3.resetQuery);
})), this.renderShowMore());
}
}]);
return List;
}(React.Component);
_defineProperty(List, "propTypes", {
cx: propTypes.func.isRequired,
// Only required with showMore.
translate: propTypes.func,
items: itemsPropType$1,
renderItem: propTypes.func.isRequired,
selectItem: propTypes.func,
className: propTypes.string,
showMore: propTypes.bool,
limit: propTypes.number,
showMoreLimit: propTypes.number,
show: propTypes.func,
searchForItems: propTypes.func,
searchable: propTypes.bool,
isFromSearch: propTypes.bool,
canRefine: propTypes.bool
});
_defineProperty(List, "defaultProps", {
className: '',
isFromSearch: false
});
var cx$5 = createClassNames('HierarchicalMenu');
var itemsPropType$2 = propTypes.arrayOf(propTypes.shape({
label: propTypes.string.isRequired,
value: propTypes.string,
count: propTypes.number.isRequired,
items: function items() {
return itemsPropType$2.apply(void 0, arguments);
}
}));
var HierarchicalMenu =
/*#__PURE__*/
function (_Component) {
_inherits(HierarchicalMenu, _Component);
function HierarchicalMenu() {
var _getPrototypeOf2;
var _this;
_classCallCheck(this, HierarchicalMenu);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(HierarchicalMenu)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(_assertThisInitialized(_this), "renderItem", function (item) {
var _this$props = _this.props,
createURL = _this$props.createURL,
refine = _this$props.refine;
return React__default.createElement(Link, {
className: cx$5('link'),
onClick: function onClick() {
return refine(item.value);
},
href: createURL(item.value)
}, React__default.createElement("span", {
className: cx$5('label')
}, item.label), ' ', React__default.createElement("span", {
className: cx$5('count')
}, item.count));
});
return _this;
}
_createClass(HierarchicalMenu, [{
key: "render",
value: function render() {
var _this$props2 = this.props,
translate = _this$props2.translate,
items = _this$props2.items,
showMore = _this$props2.showMore,
limit = _this$props2.limit,
showMoreLimit = _this$props2.showMoreLimit,
canRefine = _this$props2.canRefine,
className = _this$props2.className;
return React__default.createElement(List, {
renderItem: this.renderItem,
cx: cx$5,
translate: translate,
items: items,
showMore: showMore,
limit: limit,
showMoreLimit: showMoreLimit,
canRefine: canRefine,
className: className
});
}
}]);
return HierarchicalMenu;
}(React.Component);
_defineProperty(HierarchicalMenu, "propTypes", {
translate: propTypes.func.isRequired,
refine: propTypes.func.isRequired,
createURL: propTypes.func.isRequired,
canRefine: propTypes.bool.isRequired,
items: itemsPropType$2,
showMore: propTypes.bool,
className: propTypes.string,
limit: propTypes.number,
showMoreLimit: propTypes.number,
transformItems: propTypes.func
});
_defineProperty(HierarchicalMenu, "defaultProps", {
className: ''
});
var HierarchicalMenu$1 = translatable({
showMore: function showMore(extended) {
return extended ? 'Show less' : 'Show more';
}
})(HierarchicalMenu);
/**
* The hierarchical menu lets the user browse attributes using a tree-like structure.
*
* This is commonly used for multi-level categorization of products on e-commerce
* websites. From a UX point of view, we suggest not displaying more than two levels deep.
*
* @name HierarchicalMenu
* @kind widget
* @requirements To use this widget, your attributes must be formatted in a specific way.
* If you want for example to have a hiearchical menu of categories, objects in your index
* should be formatted this way:
*
* ```json
* [{
* "objectID": "321432",
* "name": "lemon",
* "categories.lvl0": "products",
* "categories.lvl1": "products > fruits",
* },
* {
* "objectID": "8976987",
* "name": "orange",
* "categories.lvl0": "products",
* "categories.lvl1": "products > fruits",
* }]
* ```
*
* It's also possible to provide more than one path for each level:
*
* ```json
* {
* "objectID": "321432",
* "name": "lemon",
* "categories.lvl0": ["products", "goods"],
* "categories.lvl1": ["products > fruits", "goods > to eat"]
* }
* ```
*
* All attributes passed to the `attributes` prop must be present in "attributes for faceting"
* on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.
*
* @propType {array.<string>} attributes - List of attributes to use to generate the hierarchy of the menu. See the example for the convention to follow.
* @propType {boolean} [showMore=false] - Flag to activate the show more button, for toggling the number of items between limit and showMoreLimit.
* @propType {number} [limit=10] - The maximum number of items displayed.
* @propType {number} [showMoreLimit=20] - The maximum number of items displayed when the user triggers the show more. Not considered if `showMore` is false.
* @propType {string} [separator='>'] - Specifies the level separator used in the data.
* @propType {string} [rootPath=null] - The path to use if the first level is not the root level.
* @propType {boolean} [showParentLevel=true] - Flag to set if the parent level should be displayed.
* @propType {string} [defaultRefinement] - the item value selected by default
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @themeKey ais-HierarchicalMenu - the root div of the widget
* @themeKey ais-HierarchicalMenu-noRefinement - the root div of the widget when there is no refinement
* @themeKey ais-HierarchicalMenu-searchBox - the search box of the widget. See [the SearchBox documentation](widgets/SearchBox.html#classnames) for the classnames and translation keys of the SearchBox.
* @themeKey ais-HierarchicalMenu-list - the list of menu items
* @themeKey ais-HierarchicalMenu-list--child - the child list of menu items
* @themeKey ais-HierarchicalMenu-item - the menu list item
* @themeKey ais-HierarchicalMenu-item--selected - the selected menu list item
* @themeKey ais-HierarchicalMenu-item--parent - the menu list item containing children
* @themeKey ais-HierarchicalMenu-link - the clickable menu element
* @themeKey ais-HierarchicalMenu-label - the label of each item
* @themeKey ais-HierarchicalMenu-count - the count of values for each item
* @themeKey ais-HierarchicalMenu-showMore - the button used to display more categories
* @themeKey ais-HierarchicalMenu-showMore--disabled - the disabled button used to display more categories
* @translationKey showMore - The label of the show more button. Accepts one parameter, a boolean that is true if the values are expanded
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, HierarchicalMenu } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <HierarchicalMenu
* attributes={[
* 'hierarchicalCategories.lvl0',
* 'hierarchicalCategories.lvl1',
* 'hierarchicalCategories.lvl2',
* ]}
* />
* </InstantSearch>
* );
*/
var HierarchicalMenuWidget = function HierarchicalMenuWidget(props) {
return React__default.createElement(PanelWrapper, props, React__default.createElement(HierarchicalMenu$1, props));
};
var HierarchicalMenu$2 = connectHierarchicalMenu(HierarchicalMenuWidget);
var Highlight = function Highlight(_ref) {
var cx = _ref.cx,
value = _ref.value,
highlightedTagName = _ref.highlightedTagName,
isHighlighted = _ref.isHighlighted,
nonHighlightedTagName = _ref.nonHighlightedTagName;
var TagName = isHighlighted ? highlightedTagName : nonHighlightedTagName;
var className = isHighlighted ? 'highlighted' : 'nonHighlighted';
return React__default.createElement(TagName, {
className: cx(className)
}, value);
};
var Highlighter = function Highlighter(_ref2) {
var cx = _ref2.cx,
hit = _ref2.hit,
attribute = _ref2.attribute,
highlight = _ref2.highlight,
highlightProperty = _ref2.highlightProperty,
tagName = _ref2.tagName,
nonHighlightedTagName = _ref2.nonHighlightedTagName,
separator = _ref2.separator,
className = _ref2.className;
var parsedHighlightedValue = highlight({
hit: hit,
attribute: attribute,
highlightProperty: highlightProperty
});
return React__default.createElement("span", {
className: classnames(cx(''), className)
}, parsedHighlightedValue.map(function (item, i) {
if (Array.isArray(item)) {
var isLast = i === parsedHighlightedValue.length - 1;
return React__default.createElement("span", {
key: i
}, item.map(function (element, index) {
return React__default.createElement(Highlight, {
cx: cx,
key: index,
value: element.value,
highlightedTagName: tagName,
nonHighlightedTagName: nonHighlightedTagName,
isHighlighted: element.isHighlighted
});
}), !isLast && React__default.createElement("span", {
className: cx('separator')
}, separator));
}
return React__default.createElement(Highlight, {
cx: cx,
key: i,
value: item.value,
highlightedTagName: tagName,
nonHighlightedTagName: nonHighlightedTagName,
isHighlighted: item.isHighlighted
});
}));
};
Highlighter.defaultProps = {
tagName: 'em',
nonHighlightedTagName: 'span',
className: '',
separator: ', '
};
var cx$6 = createClassNames('Highlight');
var Highlight$1 = function Highlight(props) {
return React__default.createElement(Highlighter, _extends({}, props, {
highlightProperty: "_highlightResult",
cx: cx$6
}));
};
/**
* Renders any attribute from a hit into its highlighted form when relevant.
*
* Read more about it in the [Highlighting results](guide/Highlighting_results.html) guide.
* @name Highlight
* @kind widget
* @propType {string} attribute - location of the highlighted attribute in the hit (the corresponding element can be either a string or an array of strings)
* @propType {object} hit - hit object containing the highlighted attribute
* @propType {string} [tagName='em'] - tag to be used for highlighted parts of the hit
* @propType {string} [nonHighlightedTagName='span'] - tag to be used for the parts of the hit that are not highlighted
* @propType {node} [separator=',<space>'] - symbol used to separate the elements of the array in case the attribute points to an array of strings.
* @themeKey ais-Highlight - root of the component
* @themeKey ais-Highlight-highlighted - part of the text which is highlighted
* @themeKey ais-Highlight-nonHighlighted - part of the text that is not highlighted
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, SearchBox, Hits, Highlight } from 'react-instantsearch-dom';
*
* const Hit = ({ hit }) => (
* <div>
* <Highlight attribute="name" hit={hit} />
* </div>
* );
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <SearchBox defaultRefinement="Pho" />
* <Hits hitComponent={Hit} />
* </InstantSearch>
* );
*/
var Highlight$2 = connectHighlight(Highlight$1);
var cx$7 = createClassNames('Hits');
var DefaultHitComponent = function DefaultHitComponent(props) {
return React__default.createElement("div", {
style: {
borderBottom: '1px solid #bbb',
paddingBottom: '5px',
marginBottom: '5px',
wordBreak: 'break-all'
}
}, JSON.stringify(props).slice(0, 100), "...");
};
var Hits = function Hits(_ref) {
var hits = _ref.hits,
_ref$className = _ref.className,
className = _ref$className === void 0 ? '' : _ref$className,
_ref$hitComponent = _ref.hitComponent,
HitComponent = _ref$hitComponent === void 0 ? DefaultHitComponent : _ref$hitComponent;
return React__default.createElement("div", {
className: classnames(cx$7(''), className)
}, React__default.createElement("ul", {
className: cx$7('list')
}, hits.map(function (hit) {
return React__default.createElement("li", {
className: cx$7('item'),
key: hit.objectID
}, React__default.createElement(HitComponent, {
hit: hit
}));
})));
};
var HitPropTypes = propTypes.shape({
objectID: propTypes.oneOfType([propTypes.string, propTypes.number]).isRequired
});
/**
* Displays a list of hits.
*
* To configure the number of hits being shown, use the [HitsPerPage widget](widgets/HitsPerPage.html),
* [connectHitsPerPage connector](connectors/connectHitsPerPage.html) or the [Configure widget](widgets/Configure.html).
*
* @name Hits
* @kind widget
* @propType {Component} [hitComponent] - Component used for rendering each hit from
* the results. If it is not provided the rendering defaults to displaying the
* hit in its JSON form. The component will be called with a `hit` prop.
* @themeKey ais-Hits - the root div of the widget
* @themeKey ais-Hits-list - the list of results
* @themeKey ais-Hits-item - the hit list item
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, Hits } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <Hits />
* </InstantSearch>
* );
*/
var Hits$1 = connectHits(Hits);
var Select =
/*#__PURE__*/
function (_Component) {
_inherits(Select, _Component);
function Select() {
var _getPrototypeOf2;
var _this;
_classCallCheck(this, Select);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Select)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(_assertThisInitialized(_this), "onChange", function (e) {
_this.props.onSelect(e.target.value);
});
return _this;
}
_createClass(Select, [{
key: "render",
value: function render() {
var _this$props = this.props,
cx = _this$props.cx,
items = _this$props.items,
selectedItem = _this$props.selectedItem;
return React__default.createElement("select", {
className: cx('select'),
value: selectedItem,
onChange: this.onChange
}, items.map(function (item) {
return React__default.createElement("option", {
className: cx('option'),
key: item.key === undefined ? item.value : item.key,
disabled: item.disabled,
value: item.value
}, item.label === undefined ? item.value : item.label);
}));
}
}]);
return Select;
}(React.Component);
_defineProperty(Select, "propTypes", {
cx: propTypes.func.isRequired,
onSelect: propTypes.func.isRequired,
items: propTypes.arrayOf(propTypes.shape({
value: propTypes.oneOfType([propTypes.string, propTypes.number]).isRequired,
key: propTypes.oneOfType([propTypes.string, propTypes.number]),
label: propTypes.string,
disabled: propTypes.bool
})).isRequired,
selectedItem: propTypes.oneOfType([propTypes.string, propTypes.number]).isRequired
});
var cx$8 = createClassNames('HitsPerPage');
var HitsPerPage =
/*#__PURE__*/
function (_Component) {
_inherits(HitsPerPage, _Component);
function HitsPerPage() {
_classCallCheck(this, HitsPerPage);
return _possibleConstructorReturn(this, _getPrototypeOf(HitsPerPage).apply(this, arguments));
}
_createClass(HitsPerPage, [{
key: "render",
value: function render() {
var _this$props = this.props,
items = _this$props.items,
currentRefinement = _this$props.currentRefinement,
refine = _this$props.refine,
className = _this$props.className;
return React__default.createElement("div", {
className: classnames(cx$8(''), className)
}, React__default.createElement(Select, {
onSelect: refine,
selectedItem: currentRefinement,
items: items,
cx: cx$8
}));
}
}]);
return HitsPerPage;
}(React.Component);
_defineProperty(HitsPerPage, "propTypes", {
items: propTypes.arrayOf(propTypes.shape({
value: propTypes.number.isRequired,
label: propTypes.string
})).isRequired,
currentRefinement: propTypes.number.isRequired,
refine: propTypes.func.isRequired,
className: propTypes.string
});
_defineProperty(HitsPerPage, "defaultProps", {
className: ''
});
/**
* The HitsPerPage widget displays a dropdown menu to let the user change the number
* of displayed hits.
*
* If you only want to configure the number of hits per page without
* displaying a widget, you should use the `<Configure hitsPerPage={20} />` widget. See [`<Configure />` documentation](widgets/Configure.html)
*
* @name HitsPerPage
* @kind widget
* @propType {{value: number, label: string}[]} items - List of available options.
* @propType {number} defaultRefinement - The number of items selected by default
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @themeKey ais-HitsPerPage - the root div of the widget
* @themeKey ais-HitsPerPage-select - the select
* @themeKey ais-HitsPerPage-option - the select option
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, HitsPerPage, Hits } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <HitsPerPage
* defaultRefinement={5}
* items={[
* { value: 5, label: 'Show 5 hits' },
* { value: 10, label: 'Show 10 hits' },
* ]}
* />
* <Hits />
* </InstantSearch>
* );
*/
var HitsPerPage$1 = connectHitsPerPage(HitsPerPage);
var cx$9 = createClassNames('InfiniteHits');
var InfiniteHits =
/*#__PURE__*/
function (_Component) {
_inherits(InfiniteHits, _Component);
function InfiniteHits() {
_classCallCheck(this, InfiniteHits);
return _possibleConstructorReturn(this, _getPrototypeOf(InfiniteHits).apply(this, arguments));
}
_createClass(InfiniteHits, [{
key: "render",
value: function render() {
var _this$props = this.props,
HitComponent = _this$props.hitComponent,
hits = _this$props.hits,
showPrevious = _this$props.showPrevious,
hasPrevious = _this$props.hasPrevious,
hasMore = _this$props.hasMore,
refinePrevious = _this$props.refinePrevious,
refineNext = _this$props.refineNext,
translate = _this$props.translate,
className = _this$props.className;
return React__default.createElement("div", {
className: classnames(cx$9(''), className)
}, showPrevious && React__default.createElement("button", {
className: cx$9('loadPrevious', !hasPrevious && 'loadPrevious--disabled'),
onClick: function onClick() {
return refinePrevious();
},
disabled: !hasPrevious
}, translate('loadPrevious')), React__default.createElement("ul", {
className: cx$9('list')
}, hits.map(function (hit) {
return React__default.createElement("li", {
key: hit.objectID,
className: cx$9('item')
}, React__default.createElement(HitComponent, {
hit: hit
}));
})), React__default.createElement("button", {
className: cx$9('loadMore', !hasMore && 'loadMore--disabled'),
onClick: function onClick() {
return refineNext();
},
disabled: !hasMore
}, translate('loadMore')));
}
}]);
return InfiniteHits;
}(React.Component);
InfiniteHits.defaultProps = {
className: '',
showPrevious: false,
hitComponent: function hitComponent(hit) {
return React__default.createElement("div", {
style: {
borderBottom: '1px solid #bbb',
paddingBottom: '5px',
marginBottom: '5px',
wordBreak: 'break-all'
}
}, JSON.stringify(hit).slice(0, 100), "...");
}
};
var InfiniteHits$1 = translatable({
loadPrevious: 'Load previous',
loadMore: 'Load more'
})(InfiniteHits);
/**
* Displays an infinite list of hits along with a **load more** button.
*
* To configure the number of hits being shown, use the [HitsPerPage widget](widgets/HitsPerPage.html),
* [connectHitsPerPage connector](connectors/connectHitsPerPage.html) or the [Configure widget](widgets/Configure.html).
*
* @name InfiniteHits
* @kind widget
* @propType {Component} [hitComponent] - Component used for rendering each hit from
* the results. If it is not provided the rendering defaults to displaying the
* hit in its JSON form. The component will be called with a `hit` prop.
* @themeKey ais-InfiniteHits - the root div of the widget
* @themeKey ais-InfiniteHits-list - the list of hits
* @themeKey ais-InfiniteHits-item - the hit list item
* @themeKey ais-InfiniteHits-loadMore - the button used to display more results
* @themeKey ais-InfiniteHits-loadMore--disabled - the disabled button used to display more results
* @translationKey loadMore - the label of load more button
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, InfiniteHits } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <InfiniteHits />
* </InstantSearch>
* );
*/
var InfiniteHits$2 = connectInfiniteHits(InfiniteHits$1);
var cx$a = createClassNames('Menu');
var Menu =
/*#__PURE__*/
function (_Component) {
_inherits(Menu, _Component);
function Menu() {
var _getPrototypeOf2;
var _this;
_classCallCheck(this, Menu);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Menu)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(_assertThisInitialized(_this), "renderItem", function (item, resetQuery) {
var createURL = _this.props.createURL;
var label = _this.props.isFromSearch ? React__default.createElement(Highlight$2, {
attribute: "label",
hit: item
}) : item.label;
return React__default.createElement(Link, {
className: cx$a('link'),
onClick: function onClick() {
return _this.selectItem(item, resetQuery);
},
href: createURL(item.value)
}, React__default.createElement("span", {
className: cx$a('label')
}, label), ' ', React__default.createElement("span", {
className: cx$a('count')
}, item.count));
});
_defineProperty(_assertThisInitialized(_this), "selectItem", function (item, resetQuery) {
resetQuery();
_this.props.refine(item.value);
});
return _this;
}
_createClass(Menu, [{
key: "render",
value: function render() {
var _this$props = this.props,
translate = _this$props.translate,
items = _this$props.items,
showMore = _this$props.showMore,
limit = _this$props.limit,
showMoreLimit = _this$props.showMoreLimit,
isFromSearch = _this$props.isFromSearch,
searchForItems = _this$props.searchForItems,
searchable = _this$props.searchable,
canRefine = _this$props.canRefine,
className = _this$props.className;
return React__default.createElement(List, {
renderItem: this.renderItem,
selectItem: this.selectItem,
cx: cx$a,
translate: translate,
items: items,
showMore: showMore,
limit: limit,
showMoreLimit: showMoreLimit,
isFromSearch: isFromSearch,
searchForItems: searchForItems,
searchable: searchable,
canRefine: canRefine,
className: className
});
}
}]);
return Menu;
}(React.Component);
_defineProperty(Menu, "propTypes", {
translate: propTypes.func.isRequired,
refine: propTypes.func.isRequired,
searchForItems: propTypes.func.isRequired,
searchable: propTypes.bool,
createURL: propTypes.func.isRequired,
items: propTypes.arrayOf(propTypes.shape({
label: propTypes.string.isRequired,
value: propTypes.string.isRequired,
count: propTypes.number.isRequired,
isRefined: propTypes.bool.isRequired
})),
isFromSearch: propTypes.bool.isRequired,
canRefine: propTypes.bool.isRequired,
showMore: propTypes.bool,
limit: propTypes.number,
showMoreLimit: propTypes.number,
transformItems: propTypes.func,
className: propTypes.string
});
_defineProperty(Menu, "defaultProps", {
className: ''
});
var Menu$1 = translatable({
showMore: function showMore(extended) {
return extended ? 'Show less' : 'Show more';
},
noResults: 'No results',
submit: null,
reset: null,
resetTitle: 'Clear the search query.',
submitTitle: 'Submit your search query.',
placeholder: 'Search here…'
})(Menu);
/**
* The Menu component displays a menu that lets the user choose a single value for a specific attribute.
* @name Menu
* @kind widget
* @requirements The attribute passed to the `attribute` prop must be present in "attributes for faceting"
* on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.
*
* If you are using the `searchable` prop, you'll also need to make the attribute searchable using
* the [dashboard](https://www.algolia.com/explorer/display/) or using the [API](https://www.algolia.com/doc/guides/searching/faceting/#search-for-facet-values).
* @propType {string} attribute - the name of the attribute in the record
* @propType {boolean} [showMore=false] - true if the component should display a button that will expand the number of items
* @propType {number} [limit=10] - the minimum number of diplayed items
* @propType {number} [showMoreLimit=20] - the maximun number of displayed items. Only used when showMore is set to `true`
* @propType {string} [defaultRefinement] - the value of the item selected by default
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @propType {boolean} [searchable=false] - true if the component should display an input to search for facet values. <br> In order to make this feature work, you need to make the attribute searchable [using the API](https://www.algolia.com/doc/guides/searching/faceting/?language=js#declaring-a-searchable-attribute-for-faceting) or [the dashboard](https://www.algolia.com/explorer/display/).
* @themeKey ais-Menu - the root div of the widget
* @themeKey ais-Menu-searchBox - the search box of the widget. See [the SearchBox documentation](widgets/SearchBox.html#classnames) for the classnames and translation keys of the SearchBox.
* @themeKey ais-Menu-list - the list of all menu items
* @themeKey ais-Menu-item - the menu list item
* @themeKey ais-Menu-item--selected - the selected menu list item
* @themeKey ais-Menu-link - the clickable menu element
* @themeKey ais-Menu-label - the label of each item
* @themeKey ais-Menu-count - the count of values for each item
* @themeKey ais-Menu-noResults - the div displayed when there are no results
* @themeKey ais-Menu-showMore - the button used to display more categories
* @themeKey ais-Menu-showMore--disabled - the disabled button used to display more categories
* @translationkey showMore - The label of the show more button. Accepts one parameters, a boolean that is true if the values are expanded
* @translationkey noResults - The label of the no results text when no search for facet values results are found.
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, Menu } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <Menu attribute="categories" />
* </InstantSearch>
* );
*/
var MenuWidget = function MenuWidget(props) {
return React__default.createElement(PanelWrapper, props, React__default.createElement(Menu$1, props));
};
var Menu$2 = connectMenu(MenuWidget);
var cx$b = createClassNames('MenuSelect');
var MenuSelect =
/*#__PURE__*/
function (_Component) {
_inherits(MenuSelect, _Component);
function MenuSelect() {
var _getPrototypeOf2;
var _this;
_classCallCheck(this, MenuSelect);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(MenuSelect)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(_assertThisInitialized(_this), "handleSelectChange", function (_ref) {
var value = _ref.target.value;
_this.props.refine(value === 'ais__see__all__option' ? '' : value);
});
return _this;
}
_createClass(MenuSelect, [{
key: "render",
value: function render() {
var _this$props = this.props,
items = _this$props.items,
canRefine = _this$props.canRefine,
translate = _this$props.translate,
className = _this$props.className;
return React__default.createElement("div", {
className: classnames(cx$b('', !canRefine && '-noRefinement'), className)
}, React__default.createElement("select", {
value: this.selectedValue,
onChange: this.handleSelectChange,
className: cx$b('select')
}, React__default.createElement("option", {
value: "ais__see__all__option",
className: cx$b('option')
}, translate('seeAllOption')), items.map(function (item) {
return React__default.createElement("option", {
key: item.value,
value: item.value,
className: cx$b('option')
}, item.label, " (", item.count, ")");
})));
}
}, {
key: "selectedValue",
get: function get() {
var _ref2 = find$2(this.props.items, function (item) {
return item.isRefined === true;
}) || {
value: 'ais__see__all__option'
},
value = _ref2.value;
return value;
}
}]);
return MenuSelect;
}(React.Component);
_defineProperty(MenuSelect, "propTypes", {
items: propTypes.arrayOf(propTypes.shape({
label: propTypes.string.isRequired,
value: propTypes.string.isRequired,
count: propTypes.oneOfType([propTypes.number.isRequired, propTypes.string.isRequired]),
isRefined: propTypes.bool.isRequired
})).isRequired,
canRefine: propTypes.bool.isRequired,
refine: propTypes.func.isRequired,
translate: propTypes.func.isRequired,
className: propTypes.string
});
_defineProperty(MenuSelect, "defaultProps", {
className: ''
});
var MenuSelect$1 = translatable({
seeAllOption: 'See all'
})(MenuSelect);
/**
* The MenuSelect component displays a select that lets the user choose a single value for a specific attribute.
* @name MenuSelect
* @kind widget
* @requirements The attribute passed to the `attribute` prop must be present in "attributes for faceting"
* on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.
* @propType {string} attribute - the name of the attribute in the record
* @propType {string} [defaultRefinement] - the value of the item selected by default
* @propType {number} [limit=10] - the minimum number of diplayed items
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @themeKey ais-MenuSelect - the root div of the widget
* @themeKey ais-MenuSelect-noRefinement - the root div of the widget when there is no refinement
* @themeKey ais-MenuSelect-select - the `<select>`
* @themeKey ais-MenuSelect-option - the select `<option>`
* @translationkey seeAllOption - The label of the option to select to remove the refinement
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, MenuSelect } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <MenuSelect attribute="categories" />
* </InstantSearch>
* );
*/
var MenuSelectWidget = function MenuSelectWidget(props) {
return React__default.createElement(PanelWrapper, props, React__default.createElement(MenuSelect$1, props));
};
var MenuSelect$2 = connectMenu(MenuSelectWidget);
var cx$c = createClassNames('NumericMenu');
var NumericMenu =
/*#__PURE__*/
function (_Component) {
_inherits(NumericMenu, _Component);
function NumericMenu() {
var _getPrototypeOf2;
var _this;
_classCallCheck(this, NumericMenu);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(NumericMenu)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(_assertThisInitialized(_this), "renderItem", function (item) {
var _this$props = _this.props,
refine = _this$props.refine,
translate = _this$props.translate;
return React__default.createElement("label", {
className: cx$c('label')
}, React__default.createElement("input", {
className: cx$c('radio'),
type: "radio",
checked: item.isRefined,
disabled: item.noRefinement,
onChange: function onChange() {
return refine(item.value);
}
}), React__default.createElement("span", {
className: cx$c('labelText')
}, item.value === '' ? translate('all') : item.label));
});
return _this;
}
_createClass(NumericMenu, [{
key: "render",
value: function render() {
var _this$props2 = this.props,
items = _this$props2.items,
canRefine = _this$props2.canRefine,
className = _this$props2.className;
return React__default.createElement(List, {
renderItem: this.renderItem,
showMore: false,
canRefine: canRefine,
cx: cx$c,
items: items.map(function (item) {
return _objectSpread({}, item, {
key: item.value
});
}),
className: className
});
}
}]);
return NumericMenu;
}(React.Component);
_defineProperty(NumericMenu, "propTypes", {
items: propTypes.arrayOf(propTypes.shape({
label: propTypes.node.isRequired,
value: propTypes.string.isRequired,
isRefined: propTypes.bool.isRequired,
noRefinement: propTypes.bool.isRequired
})).isRequired,
canRefine: propTypes.bool.isRequired,
refine: propTypes.func.isRequired,
translate: propTypes.func.isRequired,
className: propTypes.string
});
_defineProperty(NumericMenu, "defaultProps", {
className: ''
});
var NumericMenu$1 = translatable({
all: 'All'
})(NumericMenu);
/**
* NumericMenu is a widget used for selecting the range value of a numeric attribute.
* @name NumericMenu
* @kind widget
* @requirements The attribute passed to the `attribute` prop must be holding numerical values.
* @propType {string} attribute - the name of the attribute in the records
* @propType {{label: string, start: number, end: number}[]} items - List of options. With a text label, and upper and lower bounds.
* @propType {string} [defaultRefinement] - the value of the item selected by default, follow the format "min:max".
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @themeKey ais-NumericMenu - the root div of the widget
* @themeKey ais-NumericMenu--noRefinement - the root div of the widget when there is no refinement
* @themeKey ais-NumericMenu-list - the list of all refinement items
* @themeKey ais-NumericMenu-item - the refinement list item
* @themeKey ais-NumericMenu-item--selected - the selected refinement list item
* @themeKey ais-NumericMenu-label - the label of each refinement item
* @themeKey ais-NumericMenu-radio - the radio input of each refinement item
* @themeKey ais-NumericMenu-labelText - the label text of each refinement item
* @translationkey all - The label of the largest range added automatically by react instantsearch
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, NumericMenu } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient
* indexName="instant_search"
* >
* <NumericMenu
* attribute="price"
* items={[
* { end: 10, label: '< $10' },
* { start: 10, end: 100, label: '$10 - $100' },
* { start: 100, end: 500, label: '$100 - $500' },
* { start: 500, label: '> $500' },
* ]}
* />
* </InstantSearch>
* );
*/
var NumericMenuWidget = function NumericMenuWidget(props) {
return React__default.createElement(PanelWrapper, props, React__default.createElement(NumericMenu$1, props));
};
var NumericMenu$2 = connectNumericMenu(NumericMenuWidget);
var LinkList =
/*#__PURE__*/
function (_Component) {
_inherits(LinkList, _Component);
function LinkList() {
_classCallCheck(this, LinkList);
return _possibleConstructorReturn(this, _getPrototypeOf(LinkList).apply(this, arguments));
}
_createClass(LinkList, [{
key: "render",
value: function render() {
var _this$props = this.props,
cx = _this$props.cx,
createURL = _this$props.createURL,
items = _this$props.items,
onSelect = _this$props.onSelect,
canRefine = _this$props.canRefine;
return React__default.createElement("ul", {
className: cx('list', !canRefine && 'list--noRefinement')
}, items.map(function (item) {
return React__default.createElement("li", {
key: item.key === undefined ? item.value : item.key,
className: cx('item', item.selected && !item.disabled && 'item--selected', item.disabled && 'item--disabled', item.modifier)
}, item.disabled ? React__default.createElement("span", {
className: cx('link')
}, item.label === undefined ? item.value : item.label) : React__default.createElement(Link, {
className: cx('link', item.selected && 'link--selected'),
"aria-label": item.ariaLabel,
href: createURL(item.value),
onClick: function onClick() {
return onSelect(item.value);
}
}, item.label === undefined ? item.value : item.label));
}));
}
}]);
return LinkList;
}(React.Component);
_defineProperty(LinkList, "propTypes", {
cx: propTypes.func.isRequired,
createURL: propTypes.func.isRequired,
items: propTypes.arrayOf(propTypes.shape({
value: propTypes.oneOfType([propTypes.string, propTypes.number, propTypes.object]).isRequired,
key: propTypes.oneOfType([propTypes.string, propTypes.number]),
label: propTypes.node,
modifier: propTypes.string,
ariaLabel: propTypes.string,
disabled: propTypes.bool
})),
onSelect: propTypes.func.isRequired,
canRefine: propTypes.bool.isRequired
});
var cx$d = createClassNames('Pagination'); // Determines the size of the widget (the number of pages displayed - that the user can directly click on)
function calculateSize(padding, maxPages) {
return Math.min(2 * padding + 1, maxPages);
}
function calculatePaddingLeft(currentPage, padding, maxPages, size) {
if (currentPage <= padding) {
return currentPage;
}
if (currentPage >= maxPages - padding) {
return size - (maxPages - currentPage);
}
return padding + 1;
} // Retrieve the correct page range to populate the widget
function getPages(currentPage, maxPages, padding) {
var size = calculateSize(padding, maxPages); // If the widget size is equal to the max number of pages, return the entire page range
if (size === maxPages) return range({
start: 1,
end: maxPages + 1
});
var paddingLeft = calculatePaddingLeft(currentPage, padding, maxPages, size);
var paddingRight = size - paddingLeft;
var first = currentPage - paddingLeft;
var last = currentPage + paddingRight;
return range({
start: first + 1,
end: last + 1
});
}
var Pagination =
/*#__PURE__*/
function (_Component) {
_inherits(Pagination, _Component);
function Pagination() {
_classCallCheck(this, Pagination);
return _possibleConstructorReturn(this, _getPrototypeOf(Pagination).apply(this, arguments));
}
_createClass(Pagination, [{
key: "getItem",
value: function getItem(modifier, translationKey, value) {
var _this$props = this.props,
nbPages = _this$props.nbPages,
totalPages = _this$props.totalPages,
translate = _this$props.translate;
return {
key: "".concat(modifier, ".").concat(value),
modifier: modifier,
disabled: value < 1 || value >= Math.min(totalPages, nbPages),
label: translate(translationKey, value),
value: value,
ariaLabel: translate("aria".concat(capitalize(translationKey)), value)
};
}
}, {
key: "render",
value: function render() {
var _this$props2 = this.props,
ListComponent = _this$props2.listComponent,
nbPages = _this$props2.nbPages,
totalPages = _this$props2.totalPages,
currentRefinement = _this$props2.currentRefinement,
padding = _this$props2.padding,
showFirst = _this$props2.showFirst,
showPrevious = _this$props2.showPrevious,
showNext = _this$props2.showNext,
showLast = _this$props2.showLast,
refine = _this$props2.refine,
createURL = _this$props2.createURL,
canRefine = _this$props2.canRefine,
translate = _this$props2.translate,
className = _this$props2.className,
otherProps = _objectWithoutProperties(_this$props2, ["listComponent", "nbPages", "totalPages", "currentRefinement", "padding", "showFirst", "showPrevious", "showNext", "showLast", "refine", "createURL", "canRefine", "translate", "className"]);
var maxPages = Math.min(nbPages, totalPages);
var lastPage = maxPages;
var items = [];
if (showFirst) {
items.push({
key: 'first',
modifier: 'item--firstPage',
disabled: currentRefinement === 1,
label: translate('first'),
value: 1,
ariaLabel: translate('ariaFirst')
});
}
if (showPrevious) {
items.push({
key: 'previous',
modifier: 'item--previousPage',
disabled: currentRefinement === 1,
label: translate('previous'),
value: currentRefinement - 1,
ariaLabel: translate('ariaPrevious')
});
}
items = items.concat(getPages(currentRefinement, maxPages, padding).map(function (value) {
return {
key: value,
modifier: 'item--page',
label: translate('page', value),
value: value,
selected: value === currentRefinement,
ariaLabel: translate('ariaPage', value)
};
}));
if (showNext) {
items.push({
key: 'next',
modifier: 'item--nextPage',
disabled: currentRefinement === lastPage || lastPage <= 1,
label: translate('next'),
value: currentRefinement + 1,
ariaLabel: translate('ariaNext')
});
}
if (showLast) {
items.push({
key: 'last',
modifier: 'item--lastPage',
disabled: currentRefinement === lastPage || lastPage <= 1,
label: translate('last'),
value: lastPage,
ariaLabel: translate('ariaLast')
});
}
return React__default.createElement("div", {
className: classnames(cx$d('', !canRefine && '-noRefinement'), className)
}, React__default.createElement(ListComponent, _extends({}, otherProps, {
cx: cx$d,
items: items,
onSelect: refine,
createURL: createURL,
canRefine: canRefine
})));
}
}]);
return Pagination;
}(React.Component);
_defineProperty(Pagination, "propTypes", {
nbPages: propTypes.number.isRequired,
currentRefinement: propTypes.number.isRequired,
refine: propTypes.func.isRequired,
createURL: propTypes.func.isRequired,
canRefine: propTypes.bool.isRequired,
translate: propTypes.func.isRequired,
listComponent: propTypes.func,
showFirst: propTypes.bool,
showPrevious: propTypes.bool,
showNext: propTypes.bool,
showLast: propTypes.bool,
padding: propTypes.number,
totalPages: propTypes.number,
className: propTypes.string
});
_defineProperty(Pagination, "defaultProps", {
listComponent: LinkList,
showFirst: true,
showPrevious: true,
showNext: true,
showLast: false,
padding: 3,
totalPages: Infinity,
className: ''
});
var Pagination$1 = translatable({
previous: '‹',
next: '›',
first: '«',
last: '»',
page: function page(currentRefinement) {
return currentRefinement.toString();
},
ariaPrevious: 'Previous page',
ariaNext: 'Next page',
ariaFirst: 'First page',
ariaLast: 'Last page',
ariaPage: function ariaPage(currentRefinement) {
return "Page ".concat(currentRefinement.toString());
}
})(Pagination);
/**
* The Pagination widget displays a simple pagination system allowing the user to
* change the current page.
* @name Pagination
* @kind widget
* @propType {boolean} [showFirst=true] - Display the first page link.
* @propType {boolean} [showLast=false] - Display the last page link.
* @propType {boolean} [showPrevious=true] - Display the previous page link.
* @propType {boolean} [showNext=true] - Display the next page link.
* @propType {number} [padding=3] - How many page links to display around the current page.
* @propType {number} [totalPages=Infinity] - Maximum number of pages to display.
* @themeKey ais-Pagination - the root div of the widget
* @themeKey ais-Pagination--noRefinement - the root div of the widget when there is no refinement
* @themeKey ais-Pagination-list - the list of all pagination items
* @themeKey ais-Pagination-list--noRefinement - the list of all pagination items when there is no refinement
* @themeKey ais-Pagination-item - the pagination list item
* @themeKey ais-Pagination-item--firstPage - the "first" pagination list item
* @themeKey ais-Pagination-item--lastPage - the "last" pagination list item
* @themeKey ais-Pagination-item--previousPage - the "previous" pagination list item
* @themeKey ais-Pagination-item--nextPage - the "next" pagination list item
* @themeKey ais-Pagination-item--page - the "page" pagination list item
* @themeKey ais-Pagination-item--selected - the selected pagination list item
* @themeKey ais-Pagination-item--disabled - the disabled pagination list item
* @themeKey ais-Pagination-link - the pagination clickable element
* @translationKey previous - Label value for the previous page link
* @translationKey next - Label value for the next page link
* @translationKey first - Label value for the first page link
* @translationKey last - Label value for the last page link
* @translationkey page - Label value for a page item. You get function(currentRefinement) and you need to return a string
* @translationKey ariaPrevious - Accessibility label value for the previous page link
* @translationKey ariaNext - Accessibility label value for the next page link
* @translationKey ariaFirst - Accessibility label value for the first page link
* @translationKey ariaLast - Accessibility label value for the last page link
* @translationkey ariaPage - Accessibility label value for a page item. You get function(currentRefinement) and you need to return a string
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, Pagination } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <Pagination />
* </InstantSearch>
* );
*/
var PaginationWidget = function PaginationWidget(props) {
return React__default.createElement(PanelWrapper, props, React__default.createElement(Pagination$1, props));
};
var Pagination$2 = connectPagination(PaginationWidget);
var cx$e = createClassNames('PoweredBy');
/* eslint-disable max-len */
var AlgoliaLogo = function AlgoliaLogo() {
return React__default.createElement("svg", {
xmlns: "http://www.w3.org/2000/svg",
baseProfile: "basic",
viewBox: "0 0 1366 362",
width: "100",
height: "27",
className: cx$e('logo')
}, React__default.createElement("linearGradient", {
id: "g",
x1: "428.258",
x2: "434.145",
y1: "404.15",
y2: "409.85",
gradientUnits: "userSpaceOnUse",
gradientTransform: "matrix(94.045 0 0 -94.072 -40381.527 38479.52)"
}, React__default.createElement("stop", {
offset: "0",
stopColor: "#00AEFF"
}), React__default.createElement("stop", {
offset: "1",
stopColor: "#3369E7"
})), React__default.createElement("path", {
d: "M61.8 15.4h242.8c23.9 0 43.4 19.4 43.4 43.4v242.9c0 23.9-19.4 43.4-43.4 43.4H61.8c-23.9 0-43.4-19.4-43.4-43.4v-243c0-23.9 19.4-43.3 43.4-43.3z",
fill: "url(#g)"
}), React__default.createElement("path", {
d: "M187 98.7c-51.4 0-93.1 41.7-93.1 93.2S135.6 285 187 285s93.1-41.7 93.1-93.2-41.6-93.1-93.1-93.1zm0 158.8c-36.2 0-65.6-29.4-65.6-65.6s29.4-65.6 65.6-65.6 65.6 29.4 65.6 65.6-29.3 65.6-65.6 65.6zm0-117.8v48.9c0 1.4 1.5 2.4 2.8 1.7l43.4-22.5c1-.5 1.3-1.7.8-2.7-9-15.8-25.7-26.6-45-27.3-1 0-2 .8-2 1.9zm-60.8-35.9l-5.7-5.7c-5.6-5.6-14.6-5.6-20.2 0l-6.8 6.8c-5.6 5.6-5.6 14.6 0 20.2l5.6 5.6c.9.9 2.2.7 3-.2 3.3-4.5 6.9-8.8 10.9-12.8 4.1-4.1 8.3-7.7 12.9-11 1-.6 1.1-2 .3-2.9zM217.5 89V77.7c0-7.9-6.4-14.3-14.3-14.3h-33.3c-7.9 0-14.3 6.4-14.3 14.3v11.6c0 1.3 1.2 2.2 2.5 1.9 9.3-2.7 19.1-4.1 29-4.1 9.5 0 18.9 1.3 28 3.8 1.2.3 2.4-.6 2.4-1.9z",
fill: "#FFFFFF"
}), React__default.createElement("path", {
d: "M842.5 267.6c0 26.7-6.8 46.2-20.5 58.6-13.7 12.4-34.6 18.6-62.8 18.6-10.3 0-31.7-2-48.8-5.8l6.3-31c14.3 3 33.2 3.8 43.1 3.8 15.7 0 26.9-3.2 33.6-9.6s10-15.9 10-28.5v-6.4c-3.9 1.9-9 3.8-15.3 5.8-6.3 1.9-13.6 2.9-21.8 2.9-10.8 0-20.6-1.7-29.5-5.1-8.9-3.4-16.6-8.4-22.9-15-6.3-6.6-11.3-14.9-14.8-24.8s-5.3-27.6-5.3-40.6c0-12.2 1.9-27.5 5.6-37.7 3.8-10.2 9.2-19 16.5-26.3 7.2-7.3 16-12.9 26.3-17s22.4-6.7 35.5-6.7c12.7 0 24.4 1.6 35.8 3.5 11.4 1.9 21.1 3.9 29 6.1v155.2zm-108.7-77.2c0 16.4 3.6 34.6 10.8 42.2 7.2 7.6 16.5 11.4 27.9 11.4 6.2 0 12.1-.9 17.6-2.6 5.5-1.7 9.9-3.7 13.4-6.1v-97.1c-2.8-.6-14.5-3-25.8-3.3-14.2-.4-25 5.4-32.6 14.7-7.5 9.3-11.3 25.6-11.3 40.8zm294.3 0c0 13.2-1.9 23.2-5.8 34.1s-9.4 20.2-16.5 27.9c-7.1 7.7-15.6 13.7-25.6 17.9s-25.4 6.6-33.1 6.6c-7.7-.1-23-2.3-32.9-6.6-9.9-4.3-18.4-10.2-25.5-17.9-7.1-7.7-12.6-17-16.6-27.9s-6-20.9-6-34.1c0-13.2 1.8-25.9 5.8-36.7 4-10.8 9.6-20 16.8-27.7s15.8-13.6 25.6-17.8c9.9-4.2 20.8-6.2 32.6-6.2s22.7 2.1 32.7 6.2c10 4.2 18.6 10.1 25.6 17.8 7.1 7.7 12.6 16.9 16.6 27.7 4.2 10.8 6.3 23.5 6.3 36.7zm-40 .1c0-16.9-3.7-31-10.9-40.8-7.2-9.9-17.3-14.8-30.2-14.8-12.9 0-23 4.9-30.2 14.8-7.2 9.9-10.7 23.9-10.7 40.8 0 17.1 3.6 28.6 10.8 38.5 7.2 10 17.3 14.9 30.2 14.9 12.9 0 23-5 30.2-14.9 7.2-10 10.8-21.4 10.8-38.5zm127.1 86.4c-64.1.3-64.1-51.8-64.1-60.1L1051 32l39.1-6.2v183.6c0 4.7 0 34.5 25.1 34.6v32.9zm68.9 0h-39.3V108.1l39.3-6.2v175zm-19.7-193.5c13.1 0 23.8-10.6 23.8-23.7S1177.6 36 1164.4 36s-23.8 10.6-23.8 23.7 10.7 23.7 23.8 23.7zm117.4 18.6c12.9 0 23.8 1.6 32.6 4.8 8.8 3.2 15.9 7.7 21.1 13.4s8.9 13.5 11.1 21.7c2.3 8.2 3.4 17.2 3.4 27.1v100.6c-6 1.3-15.1 2.8-27.3 4.6s-25.9 2.7-41.1 2.7c-10.1 0-19.4-1-27.7-2.9-8.4-1.9-15.5-5-21.5-9.3-5.9-4.3-10.5-9.8-13.9-16.6-3.3-6.8-5-16.4-5-26.4 0-9.6 1.9-15.7 5.6-22.3 3.8-6.6 8.9-12 15.3-16.2 6.5-4.2 13.9-7.2 22.4-9s17.4-2.7 26.6-2.7c4.3 0 8.8.3 13.6.8s9.8 1.4 15.2 2.7v-6.4c0-4.5-.5-8.8-1.6-12.8-1.1-4.1-3-7.6-5.6-10.7-2.7-3.1-6.2-5.5-10.6-7.2s-10-3-16.7-3c-9 0-17.2 1.1-24.7 2.4-7.5 1.3-13.7 2.8-18.4 4.5l-4.7-32.1c4.9-1.7 12.2-3.4 21.6-5.1s19.5-2.6 30.3-2.6zm3.3 141.9c12 0 20.9-.7 27.1-1.9v-39.8c-2.2-.6-5.3-1.3-9.4-1.9-4.1-.6-8.6-1-13.6-1-4.3 0-8.7.3-13.1 1-4.4.6-8.4 1.8-11.9 3.5s-6.4 4.1-8.5 7.2c-2.2 3.1-3.2 4.9-3.2 9.6 0 9.2 3.2 14.5 9 18 5.9 3.6 13.7 5.3 23.6 5.3zM512.9 103c12.9 0 23.8 1.6 32.6 4.8 8.8 3.2 15.9 7.7 21.1 13.4 5.3 5.8 8.9 13.5 11.1 21.7 2.3 8.2 3.4 17.2 3.4 27.1v100.6c-6 1.3-15.1 2.8-27.3 4.6-12.2 1.8-25.9 2.7-41.1 2.7-10.1 0-19.4-1-27.7-2.9-8.4-1.9-15.5-5-21.5-9.3-5.9-4.3-10.5-9.8-13.9-16.6-3.3-6.8-5-16.4-5-26.4 0-9.6 1.9-15.7 5.6-22.3 3.8-6.6 8.9-12 15.3-16.2 6.5-4.2 13.9-7.2 22.4-9s17.4-2.7 26.6-2.7c4.3 0 8.8.3 13.6.8 4.7.5 9.8 1.4 15.2 2.7v-6.4c0-4.5-.5-8.8-1.6-12.8-1.1-4.1-3-7.6-5.6-10.7-2.7-3.1-6.2-5.5-10.6-7.2-4.4-1.7-10-3-16.7-3-9 0-17.2 1.1-24.7 2.4-7.5 1.3-13.7 2.8-18.4 4.5l-4.7-32.1c4.9-1.7 12.2-3.4 21.6-5.1 9.4-1.8 19.5-2.6 30.3-2.6zm3.4 142c12 0 20.9-.7 27.1-1.9v-39.8c-2.2-.6-5.3-1.3-9.4-1.9-4.1-.6-8.6-1-13.6-1-4.3 0-8.7.3-13.1 1-4.4.6-8.4 1.8-11.9 3.5s-6.4 4.1-8.5 7.2c-2.2 3.1-3.2 4.9-3.2 9.6 0 9.2 3.2 14.5 9 18s13.7 5.3 23.6 5.3zm158.5 31.9c-64.1.3-64.1-51.8-64.1-60.1L610.6 32l39.1-6.2v183.6c0 4.7 0 34.5 25.1 34.6v32.9z",
fill: "#182359"
}));
};
/* eslint-enable max-len */
var PoweredBy =
/*#__PURE__*/
function (_Component) {
_inherits(PoweredBy, _Component);
function PoweredBy() {
_classCallCheck(this, PoweredBy);
return _possibleConstructorReturn(this, _getPrototypeOf(PoweredBy).apply(this, arguments));
}
_createClass(PoweredBy, [{
key: "render",
value: function render() {
var _this$props = this.props,
url = _this$props.url,
translate = _this$props.translate,
className = _this$props.className;
return React__default.createElement("div", {
className: classnames(cx$e(''), className)
}, React__default.createElement("span", {
className: cx$e('text')
}, translate('searchBy')), ' ', React__default.createElement("a", {
href: url,
target: "_blank",
className: cx$e('link'),
"aria-label": "Algolia",
rel: "noopener noreferrer"
}, React__default.createElement(AlgoliaLogo, null)));
}
}]);
return PoweredBy;
}(React.Component);
_defineProperty(PoweredBy, "propTypes", {
url: propTypes.string.isRequired,
translate: propTypes.func.isRequired,
className: propTypes.string
});
var PoweredBy$1 = translatable({
searchBy: 'Search by'
})(PoweredBy);
/**
* PoweredBy displays an Algolia logo.
*
* Algolia requires that you use this widget if you are on a [community or free plan](https://www.algolia.com/pricing).
* @name PoweredBy
* @kind widget
* @themeKey ais-PoweredBy - the root div of the widget
* @themeKey ais-PoweredBy-text - the text of the widget
* @themeKey ais-PoweredBy-link - the link of the logo
* @themeKey ais-PoweredBy-logo - the logo of the widget
* @translationKey searchBy - Label value for the powered by
* @example
* import React from 'react';
* import { InstantSearch, PoweredBy } from 'react-instantsearch-dom';
* import algoliasearch from 'algoliasearch/lite';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <PoweredBy />
* </InstantSearch>
* );
*/
var PoweredBy$2 = connectPoweredBy(PoweredBy$1);
var cx$f = createClassNames('RangeInput');
var RawRangeInput =
/*#__PURE__*/
function (_Component) {
_inherits(RawRangeInput, _Component);
function RawRangeInput(props) {
var _this;
_classCallCheck(this, RawRangeInput);
_this = _possibleConstructorReturn(this, _getPrototypeOf(RawRangeInput).call(this, props));
_defineProperty(_assertThisInitialized(_this), "onSubmit", function (e) {
e.preventDefault();
_this.props.refine({
min: _this.state.from,
max: _this.state.to
});
});
_this.state = _this.normalizeStateForRendering(props);
return _this;
}
_createClass(RawRangeInput, [{
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
if (this.props.canRefine && (prevProps.currentRefinement.min !== this.props.currentRefinement.min || prevProps.currentRefinement.max !== this.props.currentRefinement.max)) {
this.setState(this.normalizeStateForRendering(this.props));
}
}
}, {
key: "normalizeStateForRendering",
value: function normalizeStateForRendering(props) {
var canRefine = props.canRefine,
rangeMin = props.min,
rangeMax = props.max;
var _props$currentRefinem = props.currentRefinement,
valueMin = _props$currentRefinem.min,
valueMax = _props$currentRefinem.max;
return {
from: canRefine && valueMin !== undefined && valueMin !== rangeMin ? valueMin : '',
to: canRefine && valueMax !== undefined && valueMax !== rangeMax ? valueMax : ''
};
}
}, {
key: "normalizeRangeForRendering",
value: function normalizeRangeForRendering(_ref) {
var canRefine = _ref.canRefine,
min = _ref.min,
max = _ref.max;
var hasMin = min !== undefined;
var hasMax = max !== undefined;
return {
min: canRefine && hasMin && hasMax ? min : '',
max: canRefine && hasMin && hasMax ? max : ''
};
}
}, {
key: "render",
value: function render() {
var _this2 = this;
var _this$state = this.state,
from = _this$state.from,
to = _this$state.to;
var _this$props = this.props,
precision = _this$props.precision,
translate = _this$props.translate,
canRefine = _this$props.canRefine,
className = _this$props.className;
var _this$normalizeRangeF = this.normalizeRangeForRendering(this.props),
min = _this$normalizeRangeF.min,
max = _this$normalizeRangeF.max;
var step = 1 / Math.pow(10, precision);
return React__default.createElement("div", {
className: classnames(cx$f('', !canRefine && '-noRefinement'), className)
}, React__default.createElement("form", {
className: cx$f('form'),
onSubmit: this.onSubmit
}, React__default.createElement("input", {
className: cx$f('input', 'input--min'),
type: "number",
min: min,
max: max,
value: from,
step: step,
placeholder: min,
disabled: !canRefine,
onChange: function onChange(e) {
return _this2.setState({
from: e.currentTarget.value
});
}
}), React__default.createElement("span", {
className: cx$f('separator')
}, translate('separator')), React__default.createElement("input", {
className: cx$f('input', 'input--max'),
type: "number",
min: min,
max: max,
value: to,
step: step,
placeholder: max,
disabled: !canRefine,
onChange: function onChange(e) {
return _this2.setState({
to: e.currentTarget.value
});
}
}), React__default.createElement("button", {
className: cx$f('submit'),
type: "submit"
}, translate('submit'))));
}
}]);
return RawRangeInput;
}(React.Component);
_defineProperty(RawRangeInput, "propTypes", {
canRefine: propTypes.bool.isRequired,
precision: propTypes.number.isRequired,
translate: propTypes.func.isRequired,
refine: propTypes.func.isRequired,
min: propTypes.number,
max: propTypes.number,
currentRefinement: propTypes.shape({
min: propTypes.number,
max: propTypes.number
}),
className: propTypes.string
});
_defineProperty(RawRangeInput, "defaultProps", {
currentRefinement: {},
className: ''
});
var RangeInput = translatable({
submit: 'ok',
separator: 'to'
})(RawRangeInput);
/**
* RangeInput allows a user to select a numeric range using a minimum and maximum input.
* @name RangeInput
* @kind widget
* @requirements The attribute passed to the `attribute` prop must be present in “attributes for faceting”
* on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.
* The values inside the attribute must be JavaScript numbers (not strings).
* @propType {string} attribute - the name of the attribute in the record
* @propType {{min: number, max: number}} [defaultRefinement] - Default state of the widget containing the start and the end of the range.
* @propType {number} [min] - Minimum value. When this isn't set, the minimum value will be automatically computed by Algolia using the data in the index.
* @propType {number} [max] - Maximum value. When this isn't set, the maximum value will be automatically computed by Algolia using the data in the index.
* @propType {number} [precision=0] - Number of digits after decimal point to use.
* @themeKey ais-RangeInput - the root div of the widget
* @themeKey ais-RangeInput-form - the wrapping form
* @themeKey ais-RangeInput-label - the label wrapping inputs
* @themeKey ais-RangeInput-input - the input (number)
* @themeKey ais-RangeInput-input--min - the minimum input
* @themeKey ais-RangeInput-input--max - the maximum input
* @themeKey ais-RangeInput-separator - the separator word used between the two inputs
* @themeKey ais-RangeInput-button - the submit button
* @translationKey submit - Label value for the submit button
* @translationKey separator - Label value for the input separator
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, RangeInput } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <RangeInput attribute="price" />
* </InstantSearch>
* );
*/
var RangeInputWidget = function RangeInputWidget(props) {
return React__default.createElement(PanelWrapper, props, React__default.createElement(RangeInput, props));
};
var RangeInput$1 = connectRange(RangeInputWidget);
/**
* Since a lot of sliders already exist, we did not include one by default.
* However you can easily connect React InstantSearch to an existing one
* using the [connectRange connector](connectors/connectRange.html).
*
* @name RangeSlider
* @requirements To connect any slider to Algolia, the underlying attribute used must be holding numerical values.
* @kind widget
* @example
*
* // Here's an example showing how to connect the AirBnb Rheostat Slider to React InstantSearch
* // using the range connector. ⚠️ This example only works with the version 2.x of Rheostat.
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Rheostat from 'rheostat';
import { connectRange } from 'react-instantsearch-dom';
class Range extends React.Component {
static propTypes = {
min: PropTypes.number,
max: PropTypes.number,
currentRefinement: PropTypes.object,
refine: PropTypes.func.isRequired,
canRefine: PropTypes.bool.isRequired
};
state = { currentValues: { min: this.props.min, max: this.props.max } };
componentDidUpdate(prevProps) {
if (
this.props.canRefine &&
(prevProps.currentRefinement.min !== this.props.currentRefinement.min ||
prevProps.currentRefinement.max !== this.props.currentRefinement.max)
) {
this.setState({
currentValues: {
min: this.props.currentRefinement.min,
max: this.props.currentRefinement.max,
},
});
}
}
onValuesUpdated = sliderState => {
this.setState({
currentValues: { min: sliderState.values[0], max: sliderState.values[1] }
});
};
onChange = sliderState => {
if (
this.props.currentRefinement.min !== sliderState.values[0] ||
this.props.currentRefinement.max !== sliderState.values[1]
) {
this.props.refine({
min: sliderState.values[0],
max: sliderState.values[1]
});
}
};
render() {
const { min, max, currentRefinement } = this.props;
const { currentValues } = this.state;
return min !== max ? (
<div>
<Rheostat
className="ais-RangeSlider"
min={min}
max={max}
values={[currentRefinement.min, currentRefinement.max]}
onChange={this.onChange}
onValuesUpdated={this.onValuesUpdated}
/>
<div style={{ display: "flex", justifyContent: "space-between" }}>
<div>{currentValues.min}</div>
<div>{currentValues.max}</div>
</div>
</div>
) : null;
}
}
const ConnectedRange = connectRange(Range);
*/
var RangeSlider = (function () {
return React__default.createElement("div", null, "We do not provide any Slider, see the documentation to learn how to connect one easily:", React__default.createElement("a", {
target: "_blank",
rel: "noopener noreferrer",
href: "https://www.algolia.com/doc/api-reference/widgets/range-slider/react/"
}, "https://www.algolia.com/doc/api-reference/widgets/range-slider/react/"));
});
var cx$g = createClassNames('RatingMenu');
var RatingMenu =
/*#__PURE__*/
function (_Component) {
_inherits(RatingMenu, _Component);
function RatingMenu() {
_classCallCheck(this, RatingMenu);
return _possibleConstructorReturn(this, _getPrototypeOf(RatingMenu).apply(this, arguments));
}
_createClass(RatingMenu, [{
key: "onClick",
value: function onClick(min, max, e) {
e.preventDefault();
e.stopPropagation();
if (min === this.props.currentRefinement.min && max === this.props.currentRefinement.max) {
this.props.refine({
min: this.props.min,
max: this.props.max
});
} else {
this.props.refine({
min: min,
max: max
});
}
}
}, {
key: "buildItem",
value: function buildItem(_ref) {
var max = _ref.max,
lowerBound = _ref.lowerBound,
count = _ref.count,
translate = _ref.translate,
createURL = _ref.createURL,
isLastSelectableItem = _ref.isLastSelectableItem;
var disabled = !count;
var isCurrentMinLower = this.props.currentRefinement.min < lowerBound;
var selected = isLastSelectableItem && isCurrentMinLower || !disabled && lowerBound === this.props.currentRefinement.min && max === this.props.currentRefinement.max;
var icons = [];
var rating = 0;
for (var icon = 0; icon < max; icon++) {
if (icon < lowerBound) {
rating++;
}
icons.push([React__default.createElement("svg", {
key: icon,
className: cx$g('starIcon', icon >= lowerBound ? 'starIcon--empty' : 'starIcon--full'),
"aria-hidden": "true",
width: "24",
height: "24"
}, React__default.createElement("use", {
xlinkHref: "#".concat(cx$g(icon >= lowerBound ? 'starEmptySymbol' : 'starSymbol'))
})), ' ']);
} // The last item of the list (the default item), should not
// be clickable if it is selected.
var isLastAndSelect = isLastSelectableItem && selected;
var onClickHandler = disabled || isLastAndSelect ? {} : {
href: createURL({
min: lowerBound,
max: max
}),
onClick: this.onClick.bind(this, lowerBound, max)
};
return React__default.createElement("li", {
key: lowerBound,
className: cx$g('item', selected && 'item--selected', disabled && 'item--disabled')
}, React__default.createElement("a", _extends({
className: cx$g('link'),
"aria-label": "".concat(rating).concat(translate('ratingLabel'))
}, onClickHandler), icons, React__default.createElement("span", {
className: cx$g('label'),
"aria-hidden": "true"
}, translate('ratingLabel')), ' ', React__default.createElement("span", {
className: cx$g('count')
}, count)));
}
}, {
key: "render",
value: function render() {
var _this = this;
var _this$props = this.props,
min = _this$props.min,
max = _this$props.max,
translate = _this$props.translate,
count = _this$props.count,
createURL = _this$props.createURL,
canRefine = _this$props.canRefine,
className = _this$props.className; // min & max are always set when there is a results, otherwise it means
// that we don't want to render anything since we don't have any values.
var limitMin = min !== undefined && min >= 0 ? min : 1;
var limitMax = max !== undefined && max >= 0 ? max : 0;
var inclusiveLength = limitMax - limitMin + 1;
var values = count.map(function (item) {
return _objectSpread({}, item, {
value: parseFloat(item.value)
});
}).filter(function (item) {
return item.value >= limitMin && item.value <= limitMax;
});
var items = range({
start: 0,
end: Math.max(inclusiveLength, 0)
}).map(function (index) {
var element = find$2(values, function (item) {
return item.value === limitMax - index;
});
var placeholder = {
value: limitMax - index,
count: 0,
total: 0
};
return element || placeholder;
}).reduce(function (acc, item, index) {
return acc.concat(_objectSpread({}, item, {
total: index === 0 ? item.count : acc[index - 1].total + item.count
}));
}, []).map(function (item, index, arr) {
return _this.buildItem({
lowerBound: item.value,
count: item.total,
isLastSelectableItem: arr.length - 1 === index,
max: limitMax,
translate: translate,
createURL: createURL
});
});
return React__default.createElement("div", {
className: classnames(cx$g('', !canRefine && '-noRefinement'), className)
}, React__default.createElement("svg", {
xmlns: "http://www.w3.org/2000/svg",
style: {
display: 'none'
}
}, React__default.createElement("symbol", {
id: cx$g('starSymbol'),
viewBox: "0 0 24 24"
}, React__default.createElement("path", {
d: "M12 .288l2.833 8.718h9.167l-7.417 5.389 2.833 8.718-7.416-5.388-7.417 5.388 2.833-8.718-7.416-5.389h9.167z"
})), React__default.createElement("symbol", {
id: cx$g('starEmptySymbol'),
viewBox: "0 0 24 24"
}, React__default.createElement("path", {
d: "M12 6.76l1.379 4.246h4.465l-3.612 2.625 1.379 4.246-3.611-2.625-3.612 2.625 1.379-4.246-3.612-2.625h4.465l1.38-4.246zm0-6.472l-2.833 8.718h-9.167l7.416 5.389-2.833 8.718 7.417-5.388 7.416 5.388-2.833-8.718 7.417-5.389h-9.167l-2.833-8.718z"
}))), React__default.createElement("ul", {
className: cx$g('list', !canRefine && 'list--noRefinement')
}, items));
}
}]);
return RatingMenu;
}(React.Component);
_defineProperty(RatingMenu, "propTypes", {
translate: propTypes.func.isRequired,
refine: propTypes.func.isRequired,
createURL: propTypes.func.isRequired,
min: propTypes.number,
max: propTypes.number,
currentRefinement: propTypes.shape({
min: propTypes.number,
max: propTypes.number
}),
count: propTypes.arrayOf(propTypes.shape({
value: propTypes.string,
count: propTypes.number
})),
canRefine: propTypes.bool.isRequired,
className: propTypes.string
});
_defineProperty(RatingMenu, "defaultProps", {
className: ''
});
var RatingMenu$1 = translatable({
ratingLabel: ' & Up'
})(RatingMenu);
/**
* RatingMenu lets the user refine search results by clicking on stars.
*
* The stars are based on the selected `attribute`.
* @requirements The attribute passed to the `attribute` prop must be holding numerical values.
* @name RatingMenu
* @kind widget
* @requirements The attribute passed to the `attribute` prop must be present in “attributes for faceting”
* on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.
* The values inside the attribute must be JavaScript numbers (not strings).
* @propType {string} attribute - the name of the attribute in the record
* @propType {number} [min] - Minimum value for the rating. When this isn't set, the minimum value will be automatically computed by Algolia using the data in the index.
* @propType {number} [max] - Maximum value for the rating. When this isn't set, the maximum value will be automatically computed by Algolia using the data in the index.
* @propType {{min: number, max: number}} [defaultRefinement] - Default state of the widget containing the lower bound (end) and the max for the rating.
* @themeKey ais-RatingMenu - the root div of the widget
* @themeKey ais-RatingMenu--noRefinement - the root div of the widget when there is no refinement
* @themeKey ais-RatingMenu-list - the list of ratings
* @themeKey ais-RatingMenu-list--noRefinement - the list of ratings when there is no refinement
* @themeKey ais-RatingMenu-item - the rating list item
* @themeKey ais-RatingMenu-item--selected - the selected rating list item
* @themeKey ais-RatingMenu-item--disabled - the disabled rating list item
* @themeKey ais-RatingMenu-link - the rating clickable item
* @themeKey ais-RatingMenu-starIcon - the star icon
* @themeKey ais-RatingMenu-starIcon--full - the filled star icon
* @themeKey ais-RatingMenu-starIcon--empty - the empty star icon
* @themeKey ais-RatingMenu-label - the label used after the stars
* @themeKey ais-RatingMenu-count - the count of ratings for a specific item
* @translationKey ratingLabel - Label value for the rating link
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, RatingMenu } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <RatingMenu attribute="rating" />
* </InstantSearch>
* );
*/
var RatingMenuWidget = function RatingMenuWidget(props) {
return React__default.createElement(PanelWrapper, props, React__default.createElement(RatingMenu$1, props));
};
var RatingMenu$2 = connectRange(RatingMenuWidget);
var cx$h = createClassNames('RefinementList');
var RefinementList$1 =
/*#__PURE__*/
function (_Component) {
_inherits(RefinementList, _Component);
function RefinementList() {
var _getPrototypeOf2;
var _this;
_classCallCheck(this, RefinementList);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(RefinementList)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(_assertThisInitialized(_this), "state", {
query: ''
});
_defineProperty(_assertThisInitialized(_this), "selectItem", function (item, resetQuery) {
resetQuery();
_this.props.refine(item.value);
});
_defineProperty(_assertThisInitialized(_this), "renderItem", function (item, resetQuery) {
var label = _this.props.isFromSearch ? React__default.createElement(Highlight$2, {
attribute: "label",
hit: item
}) : item.label;
return React__default.createElement("label", {
className: cx$h('label')
}, React__default.createElement("input", {
className: cx$h('checkbox'),
type: "checkbox",
checked: item.isRefined,
onChange: function onChange() {
return _this.selectItem(item, resetQuery);
}
}), React__default.createElement("span", {
className: cx$h('labelText')
}, label), ' ', React__default.createElement("span", {
className: cx$h('count')
}, item.count.toLocaleString()));
});
return _this;
}
_createClass(RefinementList, [{
key: "render",
value: function render() {
var _this$props = this.props,
translate = _this$props.translate,
items = _this$props.items,
showMore = _this$props.showMore,
limit = _this$props.limit,
showMoreLimit = _this$props.showMoreLimit,
isFromSearch = _this$props.isFromSearch,
searchForItems = _this$props.searchForItems,
searchable = _this$props.searchable,
canRefine = _this$props.canRefine,
className = _this$props.className;
return React__default.createElement(List, {
renderItem: this.renderItem,
selectItem: this.selectItem,
cx: cx$h,
translate: translate,
items: items,
showMore: showMore,
limit: limit,
showMoreLimit: showMoreLimit,
isFromSearch: isFromSearch,
searchForItems: searchForItems,
searchable: searchable,
canRefine: canRefine,
className: className,
query: this.state.query
});
}
}]);
return RefinementList;
}(React.Component);
_defineProperty(RefinementList$1, "propTypes", {
translate: propTypes.func.isRequired,
refine: propTypes.func.isRequired,
searchForItems: propTypes.func.isRequired,
searchable: propTypes.bool,
createURL: propTypes.func.isRequired,
items: propTypes.arrayOf(propTypes.shape({
label: propTypes.string.isRequired,
value: propTypes.arrayOf(propTypes.string).isRequired,
count: propTypes.number.isRequired,
isRefined: propTypes.bool.isRequired
})),
isFromSearch: propTypes.bool.isRequired,
canRefine: propTypes.bool.isRequired,
showMore: propTypes.bool,
limit: propTypes.number,
showMoreLimit: propTypes.number,
transformItems: propTypes.func,
className: propTypes.string
});
_defineProperty(RefinementList$1, "defaultProps", {
className: ''
});
var RefinementList$2 = translatable({
showMore: function showMore(extended) {
return extended ? 'Show less' : 'Show more';
},
noResults: 'No results',
submit: null,
reset: null,
resetTitle: 'Clear the search query.',
submitTitle: 'Submit your search query.',
placeholder: 'Search here…'
})(RefinementList$1);
/**
* The RefinementList component displays a list that let the end user choose multiple values for a specific facet.
* @name RefinementList
* @kind widget
* @propType {string} attribute - the name of the attribute in the record
* @propType {boolean} [searchable=false] - true if the component should display an input to search for facet values. <br> In order to make this feature work, you need to make the attribute searchable [using the API](https://www.algolia.com/doc/guides/searching/faceting/?language=js#declaring-a-searchable-attribute-for-faceting) or [the dashboard](https://www.algolia.com/explorer/display/).
* @propType {string} [operator=or] - How to apply the refinements. Possible values: 'or' or 'and'.
* @propType {boolean} [showMore=false] - true if the component should display a button that will expand the number of items
* @propType {number} [limit=10] - the minimum number of displayed items
* @propType {number} [showMoreLimit=20] - the maximum number of displayed items. Only used when showMore is set to `true`
* @propType {string[]} [defaultRefinement] - the values of the items selected by default
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @themeKey ais-RefinementList - the root div of the widget
* @themeKey ais-RefinementList--noRefinement - the root div of the widget when there is no refinement
* @themeKey ais-RefinementList-searchBox - the search box of the widget. See [the SearchBox documentation](widgets/SearchBox.html#classnames) for the classnames and translation keys of the SearchBox.
* @themeKey ais-RefinementList-list - the list of refinement items
* @themeKey ais-RefinementList-item - the refinement list item
* @themeKey ais-RefinementList-item--selected - the refinement selected list item
* @themeKey ais-RefinementList-label - the label of each refinement item
* @themeKey ais-RefinementList-checkbox - the checkbox input of each refinement item
* @themeKey ais-RefinementList-labelText - the label text of each refinement item
* @themeKey ais-RefinementList-count - the count of values for each item
* @themeKey ais-RefinementList-noResults - the div displayed when there are no results
* @themeKey ais-RefinementList-showMore - the button used to display more categories
* @themeKey ais-RefinementList-showMore--disabled - the disabled button used to display more categories
* @translationkey showMore - The label of the show more button. Accepts one parameters, a boolean that is true if the values are expanded
* @translationkey noResults - The label of the no results text when no search for facet values results are found.
* @requirements The attribute passed to the `attribute` prop must be present in "attributes for faceting"
* on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.
*
* If you are using the `searchable` prop, you'll also need to make the attribute searchable using
* the [dashboard](https://www.algolia.com/explorer/display/) or using the [API](https://www.algolia.com/doc/guides/searching/faceting/#search-for-facet-values).
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, RefinementList } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <RefinementList attribute="brand" />
* </InstantSearch>
* );
*/
var RefinementListWidget = function RefinementListWidget(props) {
return React__default.createElement(PanelWrapper, props, React__default.createElement(RefinementList$2, props));
};
var RefinementList$3 = connectRefinementList(RefinementListWidget);
var cx$i = createClassNames('ScrollTo');
var ScrollTo =
/*#__PURE__*/
function (_Component) {
_inherits(ScrollTo, _Component);
function ScrollTo() {
_classCallCheck(this, ScrollTo);
return _possibleConstructorReturn(this, _getPrototypeOf(ScrollTo).apply(this, arguments));
}
_createClass(ScrollTo, [{
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
var _this$props = this.props,
value = _this$props.value,
hasNotChanged = _this$props.hasNotChanged;
if (value !== prevProps.value && hasNotChanged) {
this.el.scrollIntoView();
}
}
}, {
key: "render",
value: function render() {
var _this = this;
return React__default.createElement("div", {
ref: function ref(_ref) {
return _this.el = _ref;
},
className: cx$i('')
}, this.props.children);
}
}]);
return ScrollTo;
}(React.Component);
_defineProperty(ScrollTo, "propTypes", {
value: propTypes.any,
children: propTypes.node,
hasNotChanged: propTypes.bool
});
/**
* The ScrollTo component will make the page scroll to the component wrapped by it when one of the
* [search state](guide/Search_state.html) prop is updated. By default when the page number changes,
* the scroll goes to the wrapped component.
*
* @name ScrollTo
* @kind widget
* @propType {string} [scrollOn="page"] - Widget state key on which to listen for changes.
* @themeKey ais-ScrollTo - the root div of the widget
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, ScrollTo, Hits } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <ScrollTo>
* <Hits />
* </ScrollTo>
* </InstantSearch>
* );
*/
var ScrollTo$1 = connectScrollTo(ScrollTo);
/**
* The SearchBox component displays a search box that lets the user search for a specific query.
* @name SearchBox
* @kind widget
* @propType {string[]} [focusShortcuts=['s','/']] - List of keyboard shortcuts that focus the search box. Accepts key names and key codes.
* @propType {boolean} [autoFocus=false] - Should the search box be focused on render?
* @propType {boolean} [searchAsYouType=true] - Should we search on every change to the query? If you disable this option, new searches will only be triggered by clicking the search button or by pressing the enter key while the search box is focused.
* @propType {function} [onSubmit] - Intercept submit event sent from the SearchBox form container.
* @propType {function} [onReset] - Listen to `reset` event sent from the SearchBox form container.
* @propType {function} [on*] - Listen to any events sent from the search input itself.
* @propType {node} [submit] - Change the apparence of the default submit button (magnifying glass).
* @propType {node} [reset] - Change the apparence of the default reset button (cross).
* @propType {node} [loadingIndicator] - Change the apparence of the default loading indicator (spinning circle).
* @propType {string} [defaultRefinement] - Provide default refinement value when component is mounted.
* @propType {boolean} [showLoadingIndicator=false] - Display that the search is loading. This only happens after a certain amount of time to avoid a blinking effect. This timer can be configured with `stalledSearchDelay` props on <InstantSearch>. By default, the value is 200ms.
* @themeKey ais-SearchBox - the root div of the widget
* @themeKey ais-SearchBox-form - the wrapping form
* @themeKey ais-SearchBox-input - the search input
* @themeKey ais-SearchBox-submit - the submit button
* @themeKey ais-SearchBox-submitIcon - the default magnifier icon used with the search input
* @themeKey ais-SearchBox-reset - the reset button used to clear the content of the input
* @themeKey ais-SearchBox-resetIcon - the default reset icon used inside the reset button
* @themeKey ais-SearchBox-loadingIndicator - the loading indicator container
* @themeKey ais-SearchBox-loadingIcon - the default loading icon
* @translationkey submitTitle - The submit button title
* @translationkey resetTitle - The reset button title
* @translationkey placeholder - The label of the input placeholder
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, SearchBox } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <SearchBox />
* </InstantSearch>
* );
*/
var SearchBox$2 = connectSearchBox(SearchBox$1);
var cx$j = createClassNames('Snippet');
var Snippet = function Snippet(props) {
return React__default.createElement(Highlighter, _extends({}, props, {
highlightProperty: "_snippetResult",
cx: cx$j
}));
};
/**
* Renders any attribute from an hit into its highlighted snippet form when relevant.
*
* Read more about it in the [Highlighting results](guide/Highlighting_results.html) guide.
* @name Snippet
* @kind widget
* @requirements To use this widget, the attribute name passed to the `attribute` prop must be
* present in "Attributes to snippet" on the Algolia dashboard or configured as `attributesToSnippet`
* via a set settings call to the Algolia API.
* @propType {string} attribute - location of the highlighted snippet attribute in the hit (the corresponding element can be either a string or an array of strings)
* @propType {object} hit - hit object containing the highlighted snippet attribute
* @propType {string} [tagName='em'] - tag to be used for highlighted parts of the attribute
* @propType {string} [nonHighlightedTagName='span'] - tag to be used for the parts of the hit that are not highlighted
* @propType {node} [separator=',<space>'] - symbol used to separate the elements of the array in case the attribute points to an array of strings.
* @themeKey ais-Snippet - the root span of the widget
* @themeKey ais-Snippet-highlighted - the highlighted text
* @themeKey ais-Snippet-nonHighlighted - the normal text
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, SearchBox, Hits, Snippet } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const Hit = ({ hit }) => (
* <div>
* <Snippet attribute="description" hit={hit} />
* </div>
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <SearchBox defaultRefinement="adjustable" />
* <Hits hitComponent={Hit} />
* </InstantSearch>
* );
*/
var Snippet$1 = connectHighlight(Snippet);
var cx$k = createClassNames('SortBy');
var SortBy =
/*#__PURE__*/
function (_Component) {
_inherits(SortBy, _Component);
function SortBy() {
_classCallCheck(this, SortBy);
return _possibleConstructorReturn(this, _getPrototypeOf(SortBy).apply(this, arguments));
}
_createClass(SortBy, [{
key: "render",
value: function render() {
var _this$props = this.props,
items = _this$props.items,
currentRefinement = _this$props.currentRefinement,
refine = _this$props.refine,
className = _this$props.className;
return React__default.createElement("div", {
className: classnames(cx$k(''), className)
}, React__default.createElement(Select, {
cx: cx$k,
items: items,
selectedItem: currentRefinement,
onSelect: refine
}));
}
}]);
return SortBy;
}(React.Component);
_defineProperty(SortBy, "propTypes", {
items: propTypes.arrayOf(propTypes.shape({
label: propTypes.string,
value: propTypes.string.isRequired
})).isRequired,
currentRefinement: propTypes.string.isRequired,
refine: propTypes.func.isRequired,
className: propTypes.string
});
_defineProperty(SortBy, "defaultProps", {
className: ''
});
/**
* The SortBy component displays a list of indexes allowing a user to change the hits are sorting.
* @name SortBy
* @requirements Algolia handles sorting by creating replica indices. [Read more about sorting](https://www.algolia.com/doc/guides/relevance/sorting/) on
* the Algolia website.
* @kind widget
* @propType {{value: string, label: string}[]} items - The list of indexes to search in.
* @propType {string} defaultRefinement - The default selected index.
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @themeKey ais-SortBy - the root div of the widget
* @themeKey ais-SortBy-select - the select
* @themeKey ais-SortBy-option - the select option
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, SortBy } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <SortBy
* defaultRefinement="instant_search"
* items={[
* { value: 'instant_search', label: 'Featured' },
* { value: 'instant_search_price_asc', label: 'Price asc.' },
* { value: 'instant_search_price_desc', label: 'Price desc.' },
* ]}
* />
* </InstantSearch>
* );
*/
var SortBy$1 = connectSortBy(SortBy);
var cx$l = createClassNames('Stats');
var Stats =
/*#__PURE__*/
function (_Component) {
_inherits(Stats, _Component);
function Stats() {
_classCallCheck(this, Stats);
return _possibleConstructorReturn(this, _getPrototypeOf(Stats).apply(this, arguments));
}
_createClass(Stats, [{
key: "render",
value: function render() {
var _this$props = this.props,
translate = _this$props.translate,
nbHits = _this$props.nbHits,
processingTimeMS = _this$props.processingTimeMS,
className = _this$props.className;
return React__default.createElement("div", {
className: classnames(cx$l(''), className)
}, React__default.createElement("span", {
className: cx$l('text')
}, translate('stats', nbHits, processingTimeMS)));
}
}]);
return Stats;
}(React.Component);
_defineProperty(Stats, "propTypes", {
translate: propTypes.func.isRequired,
nbHits: propTypes.number.isRequired,
processingTimeMS: propTypes.number.isRequired,
className: propTypes.string
});
_defineProperty(Stats, "defaultProps", {
className: ''
});
var Stats$1 = translatable({
stats: function stats(n, ms) {
return "".concat(n.toLocaleString(), " results found in ").concat(ms.toLocaleString(), "ms");
}
})(Stats);
/**
* The Stats component displays the total number of matching hits and the time it took to get them (time spent in the Algolia server).
* @name Stats
* @kind widget
* @themeKey ais-Stats - the root div of the widget
* @themeKey ais-Stats-text - the text of the widget - the count of items for each item
* @translationkey stats - The string displayed by the stats widget. You get function(n, ms) and you need to return a string. n is a number of hits retrieved, ms is a processed time.
* @example
* import React from 'react';
* import { InstantSearch, Stats, Hits } from 'react-instantsearch-dom';
* import algoliasearch from 'algoliasearch/lite';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <Stats />
* <Hits />
* </InstantSearch>
* );
*/
var Stats$2 = connectStats(Stats$1);
var cx$m = createClassNames('ToggleRefinement');
var ToggleRefinement = function ToggleRefinement(_ref) {
var currentRefinement = _ref.currentRefinement,
label = _ref.label,
canRefine = _ref.canRefine,
refine = _ref.refine,
className = _ref.className;
return React__default.createElement("div", {
className: classnames(cx$m('', !canRefine && '-noRefinement'), className)
}, React__default.createElement("label", {
className: cx$m('label')
}, React__default.createElement("input", {
className: cx$m('checkbox'),
type: "checkbox",
checked: currentRefinement,
onChange: function onChange(event) {
return refine(event.target.checked);
}
}), React__default.createElement("span", {
className: cx$m('labelText')
}, label)));
};
ToggleRefinement.defaultProps = {
className: ''
};
/**
* The ToggleRefinement provides an on/off filtering feature based on an attribute value.
* @name ToggleRefinement
* @kind widget
* @requirements To use this widget, you'll need an attribute to toggle on.
*
* You can't toggle on null or not-null values. If you want to address this particular use-case you'll need to compute an
* extra boolean attribute saying if the value exists or not. See this [thread](https://discourse.algolia.com/t/how-to-create-a-toggle-for-the-absence-of-a-string-attribute/2460) for more details.
*
* @propType {string} attribute - Name of the attribute on which to apply the `value` refinement. Required when `value` is present.
* @propType {string} label - Label for the toggle.
* @propType {any} value - Value of the refinement to apply on `attribute` when checked.
* @propType {boolean} [defaultRefinement=false] - Default state of the widget. Should the toggle be checked by default?
* @themeKey ais-ToggleRefinement - the root div of the widget
* @themeKey ais-ToggleRefinement-list - the list of toggles
* @themeKey ais-ToggleRefinement-item - the toggle list item
* @themeKey ais-ToggleRefinement-label - the label of each toggle item
* @themeKey ais-ToggleRefinement-checkbox - the checkbox input of each toggle item
* @themeKey ais-ToggleRefinement-labelText - the label text of each toggle item
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, ToggleRefinement } from 'react-instantsearch-dom';
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <ToggleRefinement
* attribute="free_shipping"
* label="Free Shipping"
* value={true}
* />
* </InstantSearch>
* );
*/
var ToggleRefinement$1 = connectToggleRefinement(ToggleRefinement);
var ANONYMOUS_TOKEN_COOKIE_KEY = '_ALGOLIA';
function getCookie(name) {
var prefix = "".concat(name, "=");
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i];
while (cookie.charAt(0) === ' ') {
cookie = cookie.substring(1);
}
if (cookie.indexOf(prefix) === 0) {
return cookie.substring(prefix.length, cookie.length);
}
}
return undefined;
}
function getInsightsAnonymousUserToken() {
return getCookie(ANONYMOUS_TOKEN_COOKIE_KEY);
}
exports.Breadcrumb = Breadcrumb$2;
exports.ClearRefinements = ClearRefinements$2;
exports.Configure = Configure;
exports.CurrentRefinements = CurrentRefinements$2;
exports.ExperimentalConfigureRelatedItems = ConfigureRelatedItems$1;
exports.HierarchicalMenu = HierarchicalMenu$2;
exports.Highlight = Highlight$2;
exports.Hits = Hits$1;
exports.HitsPerPage = HitsPerPage$1;
exports.Index = IndexWrapper;
exports.InfiniteHits = InfiniteHits$2;
exports.InstantSearch = InstantSearch;
exports.Menu = Menu$2;
exports.MenuSelect = MenuSelect$2;
exports.NumericMenu = NumericMenu$2;
exports.Pagination = Pagination$2;
exports.Panel = Panel;
exports.PoweredBy = PoweredBy$2;
exports.RangeInput = RangeInput$1;
exports.RangeSlider = RangeSlider;
exports.RatingMenu = RatingMenu$2;
exports.RefinementList = RefinementList$3;
exports.ScrollTo = ScrollTo$1;
exports.SearchBox = SearchBox$2;
exports.Snippet = Snippet$1;
exports.SortBy = SortBy$1;
exports.Stats = Stats$2;
exports.ToggleRefinement = ToggleRefinement$1;
exports.getInsightsAnonymousUserToken = getInsightsAnonymousUserToken;
Object.defineProperty(exports, '__esModule', { value: true });
}));
//# sourceMappingURL=Dom.js.map
|
src/containers/Home/Home.js
|
phonne/Chatroom
|
import React, { Component } from 'react';
import { Link } from 'react-router';
import { CounterButton, GithubButton } from 'components';
import config from '../../config';
export default class Home extends Component {
render() {
const styles = require('./Home.scss');
// require the logo image both from client and server
const logoImage = require('./logo.png');
return (
<div className={styles.home}>
<div className={styles.masthead}>
<div className="container">
<div className={styles.logo}>
<p>
<img src={logoImage}/>
</p>
</div>
<h1>{config.app.title}</h1>
<h2>{config.app.description}</h2>
<p>
<a className={styles.github} href="https://github.com/erikras/react-redux-universal-hot-example"
target="_blank">
<i className="fa fa-github"/> View on Github
</a>
</p>
<GithubButton user="erikras"
repo="react-redux-universal-hot-example"
type="star"
width={160}
height={30}
count large/>
<GithubButton user="erikras"
repo="react-redux-universal-hot-example"
type="fork"
width={160}
height={30}
count large/>
<p className={styles.humility}>
Created and maintained by <a href="https://twitter.com/erikras" target="_blank">@erikras</a>.
</p>
</div>
</div>
<div className="container">
<div className={styles.counterContainer}>
<CounterButton multireducerKey="counter1"/>
<CounterButton multireducerKey="counter2"/>
<CounterButton multireducerKey="counter3"/>
</div>
<p>This starter boilerplate app uses the following technologies:</p>
<ul>
<li>
<del>Isomorphic</del>
{' '}
<a href="https://medium.com/@mjackson/universal-javascript-4761051b7ae9">Universal</a> rendering
</li>
<li>Both client and server make calls to load data from separate API server</li>
<li><a href="https://github.com/facebook/react" target="_blank">React</a></li>
<li><a href="https://github.com/rackt/react-router" target="_blank">React Router</a></li>
<li><a href="http://expressjs.com" target="_blank">Express</a></li>
<li><a href="http://babeljs.io" target="_blank">Babel</a> for ES6 and ES7 magic</li>
<li><a href="http://webpack.github.io" target="_blank">Webpack</a> for bundling</li>
<li><a href="http://webpack.github.io/docs/webpack-dev-middleware.html" target="_blank">Webpack Dev Middleware</a>
</li>
<li><a href="https://github.com/glenjamin/webpack-hot-middleware" target="_blank">Webpack Hot Middleware</a></li>
<li><a href="https://github.com/rackt/redux" target="_blank">Redux</a>'s futuristic <a
href="https://facebook.github.io/react/blog/2014/05/06/flux.html" target="_blank">Flux</a> implementation
</li>
<li><a href="https://github.com/gaearon/redux-devtools" target="_blank">Redux Dev Tools</a> for next
generation DX (developer experience).
Watch <a href="https://www.youtube.com/watch?v=xsSnOQynTHs" target="_blank">Dan Abramov's talk</a>.
</li>
<li><a href="https://github.com/rackt/redux-router" target="_blank">Redux Router</a> Keep
your router state in your Redux store
</li>
<li><a href="http://eslint.org" target="_blank">ESLint</a> to maintain a consistent code style</li>
<li><a href="https://github.com/erikras/redux-form" target="_blank">redux-form</a> to manage form state
in Redux
</li>
<li><a href="https://github.com/erikras/multireducer" target="_blank">multireducer</a> combine several
identical reducer states into one key-based reducer</li>
<li><a href="https://github.com/webpack/style-loader" target="_blank">style-loader</a> and <a
href="https://github.com/jtangelder/sass-loader" target="_blank">sass-loader</a> to allow import of
stylesheets
</li>
<li><a href="https://github.com/shakacode/bootstrap-sass-loader" target="_blank">bootstrap-sass-loader</a> and <a
href="https://github.com/gowravshekar/font-awesome-webpack" target="_blank">font-awesome-webpack</a> to customize Bootstrap and FontAwesome
</li>
<li><a href="http://socket.io/">socket.io</a> for real-time communication</li>
</ul>
<h3>Features demonstrated in this project</h3>
<dl>
<dt>Multiple components subscribing to same redux store slice</dt>
<dd>
The <code>App.js</code> that wraps all the pages contains an <code>InfoBar</code> component
that fetches data from the server initially, but allows for the user to refresh the data from
the client. <code>About.js</code> contains a <code>MiniInfoBar</code> that displays the same
data.
</dd>
<dt>Server-side data loading</dt>
<dd>
The <Link to="/widgets">Widgets page</Link> demonstrates how to fetch data asynchronously from
some source that is needed to complete the server-side rendering. <code>Widgets.js</code>'s
<code>fetchData()</code> function is called before the widgets page is loaded, on either the server
or the client, allowing all the widget data to be loaded and ready for the page to render.
</dd>
<dt>Data loading errors</dt>
<dd>
The <Link to="/widgets">Widgets page</Link> also demonstrates how to deal with data loading
errors in Redux. The API endpoint that delivers the widget data intentionally fails 33% of
the time to highlight this. The <code>clientMiddleware</code> sends an error action which
the <code>widgets</code> reducer picks up and saves to the Redux state for presenting to the user.
</dd>
<dt>Session based login</dt>
<dd>
On the <Link to="/login">Login page</Link> you can submit a username which will be sent to the server
and stored in the session. Subsequent refreshes will show that you are still logged in.
</dd>
<dt>Redirect after state change</dt>
<dd>
After you log in, you will be redirected to a Login Success page. This <strike>magic</strike> logic
is performed in <code>componentWillReceiveProps()</code> in <code>App.js</code>, but it could
be done in any component that listens to the appropriate store slice, via Redux's <code>@connect</code>,
and pulls the router from the context.
</dd>
<dt>Auth-required views</dt>
<dd>
The aforementioned Login Success page is only visible to you if you are logged in. If you try
to <Link to="/loginSuccess">go there</Link> when you are not logged in, you will be forwarded back
to this home page. This <strike>magic</strike> logic is performed by the
<code>onEnter</code> hook within <code>routes.js</code>.
</dd>
<dt>Forms</dt>
<dd>
The <Link to="/survey">Survey page</Link> uses the
still-experimental <a href="https://github.com/erikras/redux-form" target="_blank">redux-form</a> to
manage form state inside the Redux store. This includes immediate client-side validation.
</dd>
<dt>WebSockets / socket.io</dt>
<dd>
The <Link to="/chat">Chat</Link> uses the socket.io technology for real-time
communication between clients. You need to <Link to="/login">login</Link> first.
</dd>
</dl>
<h3>From the author</h3>
<p>
I cobbled this together from a wide variety of similar "starter" repositories. As I post this in June 2015,
all of these libraries are right at the bleeding edge of web development. They may fall out of fashion as
quickly as they have come into it, but I personally believe that this stack is the future of web development
and will survive for several years. I'm building my new projects like this, and I recommend that you do,
too.
</p>
<p>Thanks for taking the time to check this out.</p>
<p>– Erik Rasmussen</p>
</div>
</div>
);
}
}
|
public/node_modules/reactify/node_modules/react-tools/src/core/ReactCompositeComponent.js
|
rohansingh/cion
|
/**
* Copyright 2013-2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in 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 ReactComponent = require('ReactComponent');
var ReactContext = require('ReactContext');
var ReactCurrentOwner = require('ReactCurrentOwner');
var ReactElement = require('ReactElement');
var ReactElementValidator = require('ReactElementValidator');
var ReactEmptyComponent = require('ReactEmptyComponent');
var ReactErrorUtils = require('ReactErrorUtils');
var ReactLegacyElement = require('ReactLegacyElement');
var ReactOwner = require('ReactOwner');
var ReactPerf = require('ReactPerf');
var ReactPropTransferer = require('ReactPropTransferer');
var ReactPropTypeLocations = require('ReactPropTypeLocations');
var ReactPropTypeLocationNames = require('ReactPropTypeLocationNames');
var ReactUpdates = require('ReactUpdates');
var assign = require('Object.assign');
var instantiateReactComponent = require('instantiateReactComponent');
var invariant = require('invariant');
var keyMirror = require('keyMirror');
var keyOf = require('keyOf');
var monitorCodeUse = require('monitorCodeUse');
var mapObject = require('mapObject');
var shouldUpdateReactComponent = require('shouldUpdateReactComponent');
var warning = require('warning');
var MIXINS_KEY = keyOf({mixins: null});
/**
* 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
});
var injectedMixins = [];
/**
* 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,
/**
* 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) {
validateTypeDef(
Constructor,
childContextTypes,
ReactPropTypeLocations.childContext
);
Constructor.childContextTypes = assign(
{},
Constructor.childContextTypes,
childContextTypes
);
},
contextTypes: function(Constructor, contextTypes) {
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) {
validateTypeDef(
Constructor,
propTypes,
ReactPropTypeLocations.prop
);
Constructor.propTypes = assign(
{},
Constructor.propTypes,
propTypes
);
},
statics: function(Constructor, statics) {
mixStaticSpecIntoComponent(Constructor, statics);
}
};
function getDeclarationErrorAddendum(component) {
var owner = component._owner || null;
if (owner && owner.constructor && owner.constructor.displayName) {
return ' Check the render method of `' + owner.constructor.displayName +
'`.';
}
return '';
}
function validateTypeDef(Constructor, typeDef, location) {
for (var propName in typeDef) {
if (typeDef.hasOwnProperty(propName)) {
invariant(
typeof typeDef[propName] == 'function',
'%s: %s type `%s` is invalid; it must be a function, usually from ' +
'React.PropTypes.',
Constructor.displayName || 'ReactCompositeComponent',
ReactPropTypeLocationNames[location],
propName
);
}
}
}
function validateMethodOverride(proto, name) {
var specPolicy = ReactCompositeComponentInterface.hasOwnProperty(name) ?
ReactCompositeComponentInterface[name] :
null;
// 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(
ReactCurrentOwner.current == null,
'replaceState(...): Cannot update during an existing state transition ' +
'(such as within `render`). Render methods should be a pure function ' +
'of props and state.'
);
invariant(compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING,
'replaceState(...): Cannot update while unmounting component. This ' +
'usually means you called setState() on an unmounted component.'
);
}
/**
* Mixin helper which handles policy validation and reserved
* specification keys when building `ReactCompositeComponent` classses.
*/
function mixSpecIntoComponent(Constructor, spec) {
if (!spec) {
return;
}
invariant(
!ReactLegacyElement.isValidFactory(spec),
'ReactCompositeComponent: You\'re attempting to ' +
'use a component class as a mixin. Instead, just use a regular object.'
);
invariant(
!ReactElement.isValidElement(spec),
'ReactCompositeComponent: You\'re attempting to ' +
'use a component as a mixin. Instead, just use a regular object.'
);
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 ReactCompositeComponent methods (in the "interface").
// 2. Overridden methods (that were mixed in).
var isCompositeComponentMethod =
ReactCompositeComponentInterface.hasOwnProperty(name);
var isAlreadyDefined = proto.hasOwnProperty(name);
var markedDontBind = property && property.__reactDontBind;
var isFunction = typeof property === 'function';
var shouldAutoBind =
isFunction &&
!isCompositeComponentMethod &&
!isAlreadyDefined &&
!markedDontBind;
if (shouldAutoBind) {
if (!proto.__reactAutoBindMap) {
proto.__reactAutoBindMap = {};
}
proto.__reactAutoBindMap[name] = property;
proto[name] = property;
} else {
if (isAlreadyDefined) {
var specPolicy = ReactCompositeComponentInterface[name];
// These cases should already be caught by validateMethodOverride
invariant(
isCompositeComponentMethod && (
specPolicy === SpecPolicy.DEFINE_MANY_MERGED ||
specPolicy === SpecPolicy.DEFINE_MANY
),
'ReactCompositeComponent: Unexpected spec policy %s for key %s ' +
'when mixing in component specs.',
specPolicy,
name
);
// For methods which are defined more than once, call the existing
// methods before calling the new property, merging if appropriate.
if (specPolicy === 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 (__DEV__) {
// Add verbose displayName to the function, which helps when looking
// at profiling tools.
if (typeof property === 'function' && spec.displayName) {
proto[name].displayName = spec.displayName + '_' + name;
}
}
}
}
}
}
}
function mixStaticSpecIntoComponent(Constructor, statics) {
if (!statics) {
return;
}
for (var name in statics) {
var property = statics[name];
if (!statics.hasOwnProperty(name)) {
continue;
}
var isReserved = name in RESERVED_SPEC_KEYS;
invariant(
!isReserved,
'ReactCompositeComponent: You are attempting to define a reserved ' +
'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' +
'as an instance property instead; it will still be accessible on the ' +
'constructor.',
name
);
var isInherited = name in Constructor;
invariant(
!isInherited,
'ReactCompositeComponent: You are attempting to define ' +
'`%s` on your component more than once. This conflict may be ' +
'due to a mixin.',
name
);
Constructor[name] = property;
}
}
/**
* Merge two objects, but throw if both contain the same key.
*
* @param {object} one The first object, which is mutated.
* @param {object} two The second object
* @return {object} one after it has been mutated to contain everything in two.
*/
function mergeObjectsWithNoDuplicateKeys(one, two) {
invariant(
one && two && typeof one === 'object' && typeof two === 'object',
'mergeObjectsWithNoDuplicateKeys(): Cannot merge non-objects'
);
mapObject(two, function(value, key) {
invariant(
one[key] === undefined,
'mergeObjectsWithNoDuplicateKeys(): ' +
'Tried to merge two objects with the same key: `%s`. This conflict ' +
'may be due to a mixin; in particular, this may be caused by two ' +
'getInitialState() or getDefaultProps() methods returning objects ' +
'with clashing keys.',
key
);
one[key] = 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() {
var a = one.apply(this, arguments);
var b = two.apply(this, arguments);
if (a == null) {
return b;
} else if (b == null) {
return a;
}
return mergeObjectsWithNoDuplicateKeys(a, b);
};
}
/**
* 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-|RECEIVE|-0-| UN |--->0 |
* | | | |PROPS | |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
});
/**
* @lends {ReactCompositeComponent.prototype}
*/
var ReactCompositeComponentMixin = {
/**
* Base constructor for all composite component.
*
* @param {ReactElement} element
* @final
* @internal
*/
construct: function(element) {
// Children can be either an array or more than one argument
ReactComponent.Mixin.construct.apply(this, arguments);
ReactOwner.Mixin.construct.apply(this, arguments);
this.state = null;
this._pendingState = null;
// This is the public post-processed context. The real context and pending
// context lives on the element.
this.context = 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|ReactServerRenderingTransaction} 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;
if (this.__reactAutoBindMap) {
this._bindAutoBindMethods();
}
this.context = this._processContext(this._currentElement._context);
this.props = this._processProps(this.props);
this.state = this.getInitialState ? this.getInitialState() : null;
invariant(
typeof this.state === 'object' && !Array.isArray(this.state),
'%s.getInitialState(): must return an object or null',
this.constructor.displayName || 'ReactCompositeComponent'
);
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 = instantiateReactComponent(
this._renderValidatedComponent(),
this._currentElement.type // The wrapping type
);
// 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.componentDidMount, this);
}
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._renderedComponent.unmountComponent();
this._renderedComponent = null;
ReactComponent.Mixin.unmountComponent.call(this);
// 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) {
invariant(
typeof partialState === 'object' || partialState == null,
'setState(...): takes an object of state variables to update.'
);
if (__DEV__){
warning(
partialState != null,
'setState(...): You passed an undefined or null state object; ' +
'instead, use forceUpdate().'
);
}
// Merge with `_pendingState` if it exists, otherwise with existing state.
this.replaceState(
assign({}, 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;
if (this._compositeLifeCycleState !== CompositeLifeCycle.MOUNTING) {
// 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.
// TODO: The callback here is ignored when setState is called from
// componentWillMount. Either fix it or disallow doing so completely in
// favor of getInitialState.
ReactUpdates.enqueueUpdate(this, callback);
}
},
/**
* 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 = null;
var contextTypes = this.constructor.contextTypes;
if (contextTypes) {
maskedContext = {};
for (var contextName in contextTypes) {
maskedContext[contextName] = context[contextName];
}
if (__DEV__) {
this._checkPropTypes(
contextTypes,
maskedContext,
ReactPropTypeLocations.context
);
}
}
return maskedContext;
},
/**
* @param {object} currentContext
* @return {object}
* @private
*/
_processChildContext: function(currentContext) {
var childContext = this.getChildContext && this.getChildContext();
var displayName = this.constructor.displayName || 'ReactCompositeComponent';
if (childContext) {
invariant(
typeof this.constructor.childContextTypes === 'object',
'%s.getChildContext(): childContextTypes must be defined in order to ' +
'use getChildContext().',
displayName
);
if (__DEV__) {
this._checkPropTypes(
this.constructor.childContextTypes,
childContext,
ReactPropTypeLocations.childContext
);
}
for (var name in childContext) {
invariant(
name in this.constructor.childContextTypes,
'%s.getChildContext(): key "%s" is not defined in childContextTypes.',
displayName,
name
);
}
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 (__DEV__) {
var propTypes = this.constructor.propTypes;
if (propTypes) {
this._checkPropTypes(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.constructor.displayName;
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error =
propTypes[propName](props, propName, componentName, location);
if (error instanceof Error) {
// We may want to extend this logic for similar errors in
// renderComponent calls, so I'm abstracting it away into
// a function to minimize refactoring in the future
var addendum = getDeclarationErrorAddendum(this);
warning(false, error.message + addendum);
}
}
}
},
/**
* If any of `_pendingElement`, `_pendingState`, or `_pendingForceUpdate`
* is set, update the component.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
performUpdateIfNecessary: function(transaction) {
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;
}
if (this._pendingElement == null &&
this._pendingState == null &&
!this._pendingForceUpdate) {
return;
}
var nextContext = this.context;
var nextProps = this.props;
var nextElement = this._currentElement;
if (this._pendingElement != null) {
nextElement = this._pendingElement;
nextContext = this._processContext(nextElement._context);
nextProps = this._processProps(nextElement.props);
this._pendingElement = null;
this._compositeLifeCycleState = CompositeLifeCycle.RECEIVING_PROPS;
if (this.componentWillReceiveProps) {
this.componentWillReceiveProps(nextProps, nextContext);
}
}
this._compositeLifeCycleState = null;
var nextState = this._pendingState || this.state;
this._pendingState = null;
var shouldUpdate =
this._pendingForceUpdate ||
!this.shouldComponentUpdate ||
this.shouldComponentUpdate(nextProps, nextState, nextContext);
if (__DEV__) {
if (typeof shouldUpdate === "undefined") {
console.warn(
(this.constructor.displayName || 'ReactCompositeComponent') +
'.shouldComponentUpdate(): Returned undefined instead of a ' +
'boolean value. Make sure to return true or false.'
);
}
}
if (shouldUpdate) {
this._pendingForceUpdate = false;
// Will set `this.props`, `this.state` and `this.context`.
this._performComponentUpdate(
nextElement,
nextProps,
nextState,
nextContext,
transaction
);
} else {
// If it's determined that a component should not update, we still want
// to set props and state.
this._currentElement = nextElement;
this.props = nextProps;
this.state = nextState;
this.context = nextContext;
// Owner cannot change because shouldUpdateReactComponent doesn't allow
// it. TODO: Remove this._owner completely.
this._owner = nextElement._owner;
}
},
/**
* 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
* @private
*/
_performComponentUpdate: function(
nextElement,
nextProps,
nextState,
nextContext,
transaction
) {
var prevElement = this._currentElement;
var prevProps = this.props;
var prevState = this.state;
var prevContext = this.context;
if (this.componentWillUpdate) {
this.componentWillUpdate(nextProps, nextState, nextContext);
}
this._currentElement = nextElement;
this.props = nextProps;
this.state = nextState;
this.context = nextContext;
// Owner cannot change because shouldUpdateReactComponent doesn't allow
// it. TODO: Remove this._owner completely.
this._owner = nextElement._owner;
this.updateComponent(
transaction,
prevElement
);
if (this.componentDidUpdate) {
transaction.getReactMountReady().enqueue(
this.componentDidUpdate.bind(this, prevProps, prevState, prevContext),
this
);
}
},
receiveComponent: function(nextElement, transaction) {
if (nextElement === this._currentElement &&
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 a element created outside a composite to be
// deeply mutated and reused.
return;
}
ReactComponent.Mixin.receiveComponent.call(
this,
nextElement,
transaction
);
},
/**
* 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 {ReactElement} prevElement
* @internal
* @overridable
*/
updateComponent: ReactPerf.measure(
'ReactCompositeComponent',
'updateComponent',
function(transaction, prevParentElement) {
ReactComponent.Mixin.updateComponent.call(
this,
transaction,
prevParentElement
);
var prevComponentInstance = this._renderedComponent;
var prevElement = prevComponentInstance._currentElement;
var nextElement = this._renderValidatedComponent();
if (shouldUpdateReactComponent(prevElement, nextElement)) {
prevComponentInstance.receiveComponent(nextElement, transaction);
} else {
// These two IDs are actually the same! But nothing should rely on that.
var thisID = this._rootNodeID;
var prevComponentID = prevComponentInstance._rootNodeID;
prevComponentInstance.unmountComponent();
this._renderedComponent = instantiateReactComponent(
nextElement,
this._currentElement.type
);
var nextMarkup = this._renderedComponent.mountComponent(
thisID,
transaction,
this._mountDepth + 1
);
ReactComponent.BackendIDOperations.dangerouslyReplaceNodeWithMarkupByID(
prevComponentID,
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.UNMOUNTING &&
ReactCurrentOwner.current == null,
'forceUpdate(...): Cannot force an update while unmounting component ' +
'or within a `render` function.'
);
this._pendingForceUpdate = true;
ReactUpdates.enqueueUpdate(this, callback);
},
/**
* @private
*/
_renderValidatedComponent: ReactPerf.measure(
'ReactCompositeComponent',
'_renderValidatedComponent',
function() {
var renderedComponent;
var previousContext = ReactContext.current;
ReactContext.current = this._processChildContext(
this._currentElement._context
);
ReactCurrentOwner.current = this;
try {
renderedComponent = this.render();
if (renderedComponent === null || renderedComponent === false) {
renderedComponent = ReactEmptyComponent.getEmptyComponent();
ReactEmptyComponent.registerNullComponentID(this._rootNodeID);
} else {
ReactEmptyComponent.deregisterNullComponentID(this._rootNodeID);
}
} finally {
ReactContext.current = previousContext;
ReactCurrentOwner.current = null;
}
invariant(
ReactElement.isValidElement(renderedComponent),
'%s.render(): A valid ReactComponent must be returned. You may have ' +
'returned undefined, an array or some other invalid object.',
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(ReactErrorUtils.guard(
method,
this.constructor.displayName + '.' + autoBindKey
));
}
},
/**
* Binds a method to the component.
*
* @param {function} method Method to be bound.
* @private
*/
_bindAutoBindMethod: function(method) {
var component = this;
var boundMethod = method.bind(component);
if (__DEV__) {
boundMethod.__reactBoundContext = component;
boundMethod.__reactBoundMethod = method;
boundMethod.__reactBoundArguments = null;
var componentName = component.constructor.displayName;
var _bind = boundMethod.bind;
boundMethod.bind = function(newThis, ...args) {
// 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) {
monitorCodeUse('react_bind_warning', { component: componentName });
console.warn(
'bind(): React component methods may only be bound to the ' +
'component instance. See ' + componentName
);
} else if (!args.length) {
monitorCodeUse('react_bind_warning', { component: componentName });
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 = args;
return reboundMethod;
};
}
return boundMethod;
}
};
var ReactCompositeComponentBase = function() {};
assign(
ReactCompositeComponentBase.prototype,
ReactComponent.Mixin,
ReactOwner.Mixin,
ReactPropTransferer.Mixin,
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(props) {
// This constructor is overridden by mocks. The argument is used
// by mocks to assert on what gets mounted. This will later be used
// by the stand-alone class implementation.
};
Constructor.prototype = new ReactCompositeComponentBase();
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();
}
invariant(
Constructor.prototype.render,
'createClass(...): Class specification must implement a `render` method.'
);
if (__DEV__) {
if (Constructor.prototype.componentShouldUpdate) {
monitorCodeUse(
'react_component_should_update_warning',
{ component: spec.displayName }
);
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;
}
}
if (__DEV__) {
return ReactLegacyElement.wrapFactory(
ReactElementValidator.createFactory(Constructor)
);
}
return ReactLegacyElement.wrapFactory(
ReactElement.createFactory(Constructor)
);
},
injection: {
injectMixin: function(mixin) {
injectedMixins.push(mixin);
}
}
};
module.exports = ReactCompositeComponent;
|
lib/cli/generators/REACT_NATIVE_SCRIPTS/template/storybook/stories/index.js
|
jribeiro/storybook
|
import React from 'react';
import { Text } from 'react-native';
import { storiesOf } from '@storybook/react-native';
import { action } from '@storybook/addon-actions';
import { linkTo } from '@storybook/addon-links';
import Button from './Button';
import CenterView from './CenterView';
import Welcome from './Welcome';
storiesOf('Welcome', module).add('to Storybook', () => <Welcome showApp={linkTo('Button')} />);
storiesOf('Button', module)
.addDecorator(getStory =>
<CenterView>
{getStory()}
</CenterView>
)
.add('with text', () =>
<Button onPress={action('clicked-text')}>
<Text>Hello Button</Text>
</Button>
)
.add('with some emoji', () =>
<Button onPress={action('clicked-emoji')}>
<Text>😀 😎 👍 💯</Text>
</Button>
);
|
MovieApp/app/components/containers/MoviePage/index.js
|
Ronny25/Ronny25.github.io
|
//Libraries
import React, { Component } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { Link } from 'react-router';
//Actions
import { fetchMovie, fetchRecommendations, fetchGenres, fetchSimilar } from '../../../redux/actions/MoviePageActions';
//Constants
import { imageBaseUrl, noPosterUrl } from '../../../redux/constants/App';
//Modules
import Loading from '../../modules/Loading';
import MovieCard from '../../modules/MovieCard';
class MoviePage extends Component {
constructor(props, context) {
super(props, context);
this.state = {};
this.onStarClick = this.onStarClick.bind(this);
}
componentWillMount() {
let localData = JSON.parse(localStorage.getItem('favourite')) ? JSON.parse(localStorage.getItem('favourite')) : [];
if (localData.length >= 1) {
localData.map(item => {
return this.setState({
[item.id]: true
});
});
}
}
componentWillReceiveProps(nextProps) {
if (this.props.params.id !== nextProps.params.id) {
this.props.pageActions.fetchMovie(nextProps.params.id);
this.props.pageActions.fetchRecommendations(nextProps.params.id);
this.props.pageActions.fetchSimilar(nextProps.params.id);
}
}
componentDidMount() {
this.props.pageActions.fetchMovie(this.props.params.id);
this.props.pageActions.fetchGenres();
this.props.pageActions.fetchRecommendations(this.props.params.id);
this.props.pageActions.fetchSimilar(this.props.params.id);
}
onStarClick() {
let localData = JSON.parse(localStorage.getItem('favourite')) ? JSON.parse(localStorage.getItem('favourite')) : [];
if (this.state[this.props.data.id]) {
this.setState({
[this.props.data.id]: false
});
localData.map((item, index) => {
if (item.id === this.props.data.id) {
return localData.splice(index, 1);
}
});
} else {
this.setState({
[this.props.data.id]: true
});
localData.push(this.props.data);
}
localStorage.clear('favourite');
localStorage.setItem('favourite', JSON.stringify(localData));
}
render() {
const pageData = this.props.data;
const allGenres = this.props.genres;
const recommendations = this.props.recommendations;
const similar = this.props.similar;
return (
<div className='movie-page' >
<Link to='/' className='backToMainLink'>Search for new movie</Link>
<Link to='/favourites' className='toFavouritesLink'>Go to Favourites</Link>
{this.props.fetching && !!pageData && !!similar &&
<Loading />
}
{!this.props.fetching && !!pageData.id &&
<div className='movie-content'>
<div className='movie-content__poster'>
{!!pageData.poster_path &&
<a href={`${imageBaseUrl}/original${pageData.poster_path}`} target='_blanc'>
<img src={`${imageBaseUrl}/w500${pageData.poster_path}`} alt={`${pageData.title} poster`}/>
</a>
}
{pageData.poster_path === null &&
<img src={`${noPosterUrl}`} alt='no poster found'/>
}
</div>
<h1 className='movie-content__title'>{pageData.title}</h1>
<h2 className='movie-content__tagline'>{pageData.tagline}</h2>
<div className='movie-content__ratings'>
<span
className={
this.state[pageData.id] ?
'movie-content__star added' :
'movie-content__star'
}
onClick={this.onStarClick}
>☆</span>
<span className='movie-content__grade'>{pageData.vote_average}</span>
</div>
<h6 className='movie-content__genres'><span>Genres: </span>{
pageData.genres.map((genre, index) => {
return <p key={index}>{genre.name}</p>
})
}</h6>
<h6 className='movie-content__budget'>Budget: ${pageData.budget}</h6>
<h6 className='movie-content__revenue'>Revenue: ${pageData.revenue}</h6>
<p className='movie-content__description'>{pageData.overview}</p>
<p className='movie-content__homeLink'>Homepage:
<a href={pageData.homepage} target='_blanc'>{pageData.homepage}</a>
</p>
{recommendations.length > 0 &&
<div>
<h2 className='movie-header'>Recommendations</h2>
<div className='movies-list'>
{recommendations.map((movie, index) => {
if (index >= 4) {
return true;
}
return (
<MovieCard
key={index}
data={movie}
allGenres={allGenres}
/>
);
})}
</div>
</div>
}
{similar.length > 0 &&
<div>
<h2 className='movie-header'>Similar</h2>
<div className='movies-list'>
{similar.map((movie, index) => {
if (index >= 4) {
return true;
}
return (
<MovieCard
key={index}
data={movie}
allGenres={allGenres}
/>
);
})}
</div>
</div>
}
</div>
}
</div>
);
}
}
function mapStateToProps(state) {
const { moviePage } = state;
const {
fetching,
data,
genres,
recommendations,
similar
} = moviePage || {
fetching: true,
data: [],
genres: [],
recommendations: [],
similar: []
};
return {
data,
genres,
recommendations,
similar,
fetching
}
}
function mapDispatchToProps(dispatch) {
return {
pageActions: bindActionCreators({ fetchMovie, fetchGenres, fetchRecommendations, fetchSimilar }, dispatch)
}
}
export default connect(mapStateToProps, mapDispatchToProps)(MoviePage);
|
index.js
|
petterh/react-native-android-activity
|
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
import React, { Component } from 'react';
import {
AppRegistry,
Button,
NativeEventEmitter,
NativeModules,
Platform,
StyleSheet,
Text,
TextInput,
View
} from 'react-native';
import BatchedBridge from "react-native/Libraries/BatchedBridge/BatchedBridge";
export class ExposedToJava {
extraMessage = "Be aware that this way of calling JavaScript is officially undocumented.\n\nIf possible, use events instead!";
setMessage(message) {
this.extraMessage = message;
}
/**
* If this is called from an activity that doesn't forward Android life-cycle events
* to React Native, the alert will appear to do nothing.
*/
alert(message) {
alert(message + "\n\n" + this.extraMessage);
}
}
const exposedToJava = new ExposedToJava();
BatchedBridge.registerCallableModule("JavaScriptVisibleToJava", exposedToJava);
const activityStarter = NativeModules.ActivityStarter;
const eventEmitterModule = NativeModules.EventEmitter;
export default class ActivityDemoComponent extends Component {
constructor(props) {
super(props);
this.state = { text: 'Demo text for custom edit menu' };
}
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native ({this.props.buildType})!
</Text>
<Text style={styles.instructions}>
<Text>To get started, edit </Text>
<Text style={styles.bold}>index.js</Text>
<Text>.</Text>
</Text>
<Text style={styles.instructions}>
Double tap R on your keyboard to reload,{'\n'}
Shake or press menu button for dev menu
</Text>
{
Platform.select({
android: (
<TextInput
style={styles.textInput}
value={this.state.text}
onChangeText={(text) => this.setState({text})}
/>)
})
}
<View style={styles.buttonContainer}>
<Button
onPress={() => activityStarter.navigateToExample()}
title='Start example activity'
/>
<Button
onPress={() => activityStarter.dialNumber('+1 (234) 567-8910')}
title='Dial +1 (234) 567-8910'
/>
<Button
onPress={() => activityStarter.getActivityName((name) => { alert(name); })}
title='Get activity name'
/>
<Button
onPress={async () => {
try {
var name = await activityStarter.getActivityNameAsPromise();
alert(name);
} catch (e) {
alert("Error: " + e.message);
}
}}
title='Get activity name as promise'
/>
<Button
onPress={() => NativeModules.Clipboard.setString("Copied to clipboard from JavaScript!")}
title='Copy to clipboard'
/>
<Button
onPress={() => activityStarter.callJavaScript()}
title='Call JavaScript from Java'
/>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
bold: {
fontWeight: "bold",
},
buttonContainer: {
height: 300,
width: "80%",
justifyContent: 'space-between',
marginTop: 30,
},
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#E5ECFF',
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
textInput: {
backgroundColor: 'white',
borderColor: 'gray',
borderWidth: 1,
height: 40,
marginTop: 20,
textAlign: "center",
width: "80%",
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
});
AppRegistry.registerComponent('ActivityDemoComponent', () => ActivityDemoComponent);
const eventEmitter = new NativeEventEmitter(eventEmitterModule);
eventEmitter.addListener(eventEmitterModule.MyEventName, (params) => {
exposedToJava.setMessage(params);
alert(params);
});
|
docs/src/sections/PaginationSection.js
|
Lucifier129/react-bootstrap
|
import React from 'react';
import Anchor from '../Anchor';
import PropTable from '../PropTable';
import ReactPlayground from '../ReactPlayground';
import Samples from '../Samples';
export default function PaginationSection() {
return (
<div className="bs-docs-section">
<h2 className="page-header">
<Anchor id="pagination">Pagination</Anchor> <small>Pagination</small>
</h2>
<p>Provide pagination links for your site or app with the multi-page pagination component. Set <code>items</code> to the number of pages. <code>activePage</code> prop dictates which page is active</p>
<ReactPlayground codeText={Samples.PaginationBasic} />
<h4><Anchor id="pagination-more">More options</Anchor></h4>
<p>such as <code>first</code>, <code>last</code>, <code>previous</code>, <code>next</code> and <code>ellipsis</code>.</p>
<ReactPlayground codeText={Samples.PaginationAdvanced} />
<h3><Anchor id="pagination-props">Props</Anchor></h3>
<PropTable component="Pagination"/>
</div>
);
}
|
src/Tooltip/index.js
|
xDae/styled-bootstrap
|
// @flow
import React from 'react';
import StyledTooltip from './StyledTooltip';
type Props = {
children: any,
placement: string
};
const Tooltip = ({ children, ...props }: Props) => (
<StyledTooltip {...props}>
<div />
<div>{children}</div>
</StyledTooltip>
);
export default Tooltip;
|
src/components/app/App.js
|
husa/e-clock
|
import './app.styl';
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import FadeIn from '../../common/animations/FadeIn';
import Intro from '../../containers/intro/Intro';
import Clock from '../../containers/clock/Clock';
import Date from '../../containers/date/Date';
import Dock from '../../containers/dock/Dock';
import DocTitleUpdater from '../../containers/docTitleUpdater/DocTitleUpdater';
import Settings from '../../containers/settings/Settings';
import CurrentWeather from '../../containers/weather/Current';
import WeatherForecast from '../../containers/weather/Forecast';
import WeatherError from '../../components/weather/Error';
class App extends React.Component {
constructor(...args) {
super(...args);
this.state = {
hidingIntro: false,
};
this.timeout = null;
}
UNSAFE_componentWillReceiveProps(nextProps) {
if (this.props.intro === true && nextProps.intro === false) {
this.setState({ hidingIntro: true });
setTimeout(() => {
this.setState({ hidingIntro: false });
}, 800);
}
}
getBackground() {
const { settings } = this.props;
const priority = settings.backgroundPriority;
switch (priority) {
case 'color': {
const background = settings.backgroundColor;
return { background };
}
case 'gradient': {
const angle = settings.backgroundGradientAngle;
const colors = settings.backgroundGradient.split(',');
const background = `linear-gradient(${angle}, ${colors[0]} 10%, ${colors[1]} 90%)`;
return { background };
}
case 'pattern': {
const pattern = settings.backgroundPattern;
const backgroundImage = `url(img/patterns/${pattern}.png)`;
return { backgroundImage };
}
case 'image': {
const image = settings.backgroundImage;
const backgroundImage = `url(img/backgrounds/${image}.jpg)`;
return { backgroundImage };
}
case 'url': {
const image = settings.backgroundImageUrl;
const backgroundImage = `url(${image})`;
return { backgroundImage };
}
default:
return {};
}
}
getStyle() {
const { color } = this.props.settings;
return Object.assign(
{
color,
fill: color,
},
this.getBackground(),
);
}
getLayout() {
let component;
if (this.state.hidingIntro) {
component = null;
} else if (this.props.intro || this.state.hidingIntro) {
component = <Intro />;
} else {
component = this.getComponents();
}
return <FadeIn>{component}</FadeIn>;
}
getWeather(WeatherComponent, key, prefix = null) {
if (!this.props.settings.displayWeather) return null;
if (
!this.props.weather ||
(this.props.weather && this.props.weather.loading) ||
(this.props.weather && this.props.weather.error)
) {
return null;
}
return [prefix, <WeatherComponent key={key} />];
}
getWeatherError() {
const { weather, settings } = this.props;
if (!settings.displayWeather) return null;
if (!weather || (weather && !weather.error)) return null;
return (
<div className='app__weather-error'>
<WeatherError error={weather.error} />
</div>
);
}
getComponents() {
const { fontSize, fontFamily, displayDate } = this.props.settings;
const style = {
fontFamily,
fontSize: `${fontSize}rem`,
};
return (
<div className='app__content' style={style}>
<div className='app__clock'>
<Clock />
</div>
<div className='app__current'>
<Date />
{this.getWeather(
CurrentWeather,
'current-weather',
displayDate ? (
<span className='separator' key='separator'>
|
</span>
) : null,
)}
</div>
<div className='app__weather'>
{this.getWeatherError()}
{this.getWeather(WeatherForecast, 'weather-forecast')}
</div>
</div>
);
}
render() {
const style = this.getStyle();
const className = classNames('app', `app--${this.props.settings.backgroundPriority}`);
return (
<div id='app' style={style} className={className}>
{this.getLayout()}
<DocTitleUpdater />
<Dock />
<Settings />
</div>
);
}
}
App.propTypes = {
settings: PropTypes.object,
intro: PropTypes.bool,
};
export default App;
|
ajax/libs/redux-form/3.0.12/redux-form.js
|
Piicksarn/cdnjs
|
(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["ReduxForm"] = factory(require("react"));
else
root["ReduxForm"] = factory(root["React"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_22__) {
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;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _react = __webpack_require__(22);
var _react2 = _interopRequireDefault(_react);
var _createAll2 = __webpack_require__(24);
var _createAll3 = _interopRequireDefault(_createAll2);
var _createAll = _createAll3['default'](false, _react2['default']);
var actionTypes = _createAll.actionTypes;
var blur = _createAll.blur;
var change = _createAll.change;
var destroy = _createAll.destroy;
var focus = _createAll.focus;
var reducer = _createAll.reducer;
var reduxForm = _createAll.reduxForm;
var initialize = _createAll.initialize;
var initializeWithKey = _createAll.initializeWithKey;
var reset = _createAll.reset;
var startAsyncValidation = _createAll.startAsyncValidation;
var startSubmit = _createAll.startSubmit;
var stopAsyncValidation = _createAll.stopAsyncValidation;
var stopSubmit = _createAll.stopSubmit;
var touch = _createAll.touch;
var untouch = _createAll.untouch;
exports.actionTypes = actionTypes;
exports.blur = blur;
exports.change = change;
exports.destroy = destroy;
exports.focus = focus;
exports.reducer = reducer;
exports.reduxForm = reduxForm;
exports.initialize = initialize;
exports.initializeWithKey = initializeWithKey;
exports.reset = reset;
exports.startAsyncValidation = startAsyncValidation;
exports.startSubmit = startSubmit;
exports.stopAsyncValidation = stopAsyncValidation;
exports.stopSubmit = stopSubmit;
exports.touch = touch;
exports.untouch = untouch;
/***/ },
/* 1 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports['default'] = isValid;
function isValid(error) {
if (Array.isArray(error)) {
return error.reduce(function (valid, errorValue) {
return valid && isValid(errorValue);
}, true);
}
if (error && typeof error === 'object') {
return Object.keys(error).reduce(function (valid, key) {
return valid && isValid(error[key]);
}, true);
}
return !error;
}
module.exports = exports['default'];
/***/ },
/* 2 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
var BLUR = 'redux-form/BLUR';
exports.BLUR = BLUR;
var CHANGE = 'redux-form/CHANGE';
exports.CHANGE = CHANGE;
var DESTROY = 'redux-form/DESTROY';
exports.DESTROY = DESTROY;
var FOCUS = 'redux-form/FOCUS';
exports.FOCUS = FOCUS;
var INITIALIZE = 'redux-form/INITIALIZE';
exports.INITIALIZE = INITIALIZE;
var RESET = 'redux-form/RESET';
exports.RESET = RESET;
var START_ASYNC_VALIDATION = 'redux-form/START_ASYNC_VALIDATION';
exports.START_ASYNC_VALIDATION = START_ASYNC_VALIDATION;
var START_SUBMIT = 'redux-form/START_SUBMIT';
exports.START_SUBMIT = START_SUBMIT;
var STOP_ASYNC_VALIDATION = 'redux-form/STOP_ASYNC_VALIDATION';
exports.STOP_ASYNC_VALIDATION = STOP_ASYNC_VALIDATION;
var STOP_SUBMIT = 'redux-form/STOP_SUBMIT';
exports.STOP_SUBMIT = STOP_SUBMIT;
var SUBMIT_FAILED = 'redux-form/SUBMIT_FAILED';
exports.SUBMIT_FAILED = SUBMIT_FAILED;
var TOUCH = 'redux-form/TOUCH';
exports.TOUCH = TOUCH;
var UNTOUCH = 'redux-form/UNTOUCH';
exports.UNTOUCH = UNTOUCH;
/***/ },
/* 3 */
/***/ function(module, exports) {
/**
* Maps all the values in the given object through the given function and saves them, by key, to a result object
*/
"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"] = mapValues;
function mapValues(obj, fn) {
return obj ? Object.keys(obj).reduce(function (accumulator, key) {
var _extends2;
return _extends({}, accumulator, (_extends2 = {}, _extends2[key] = fn(obj[key], key), _extends2));
}, {}) : obj;
}
module.exports = exports["default"];
/***/ },
/* 4 */
/***/ function(module, exports) {
module.exports = isPromise;
function isPromise(obj) {
return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
}
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.blur = blur;
exports.change = change;
exports.destroy = destroy;
exports.focus = focus;
exports.initialize = initialize;
exports.reset = reset;
exports.startAsyncValidation = startAsyncValidation;
exports.startSubmit = startSubmit;
exports.stopAsyncValidation = stopAsyncValidation;
exports.stopSubmit = stopSubmit;
exports.submitFailed = submitFailed;
exports.touch = touch;
exports.untouch = untouch;
var _actionTypes = __webpack_require__(2);
function blur(field, value) {
return { type: _actionTypes.BLUR, field: field, value: value };
}
function change(field, value) {
return { type: _actionTypes.CHANGE, field: field, value: value };
}
function destroy() {
return { type: _actionTypes.DESTROY };
}
function focus(field) {
return { type: _actionTypes.FOCUS, field: field };
}
function initialize(data) {
return { type: _actionTypes.INITIALIZE, data: data };
}
function reset() {
return { type: _actionTypes.RESET };
}
function startAsyncValidation() {
return { type: _actionTypes.START_ASYNC_VALIDATION };
}
function startSubmit() {
return { type: _actionTypes.START_SUBMIT };
}
function stopAsyncValidation(errors) {
return { type: _actionTypes.STOP_ASYNC_VALIDATION, errors: errors };
}
function stopSubmit(errors) {
return { type: _actionTypes.STOP_SUBMIT, errors: errors };
}
function submitFailed() {
return { type: _actionTypes.SUBMIT_FAILED };
}
function touch() {
for (var _len = arguments.length, fields = Array(_len), _key = 0; _key < _len; _key++) {
fields[_key] = arguments[_key];
}
return { type: _actionTypes.TOUCH, fields: fields };
}
function untouch() {
for (var _len2 = arguments.length, fields = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
fields[_key2] = arguments[_key2];
}
return { type: _actionTypes.UNTOUCH, fields: fields };
}
/***/ },
/* 6 */
/***/ 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'] = bindActionData;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _mapValues = __webpack_require__(3);
var _mapValues2 = _interopRequireDefault(_mapValues);
/**
* Adds additional properties to the results of the function or map of functions passed
*/
function bindActionData(action, data) {
if (typeof action === 'function') {
return function () {
return _extends({}, action.apply(undefined, arguments), data);
};
}
if (typeof action === 'object') {
return _mapValues2['default'](action, function (value) {
return bindActionData(value, data);
});
}
return action;
}
module.exports = exports['default'];
/***/ },
/* 7 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
var dataKey = 'value';
exports.dataKey = dataKey;
var createOnDragStart = function createOnDragStart(name, getValue) {
return function (event) {
event.dataTransfer.setData(dataKey, getValue());
};
};
exports['default'] = createOnDragStart;
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _isEvent = __webpack_require__(9);
var _isEvent2 = _interopRequireDefault(_isEvent);
var getSelectedValues = function getSelectedValues(options) {
var result = [];
if (options) {
for (var index = 0; index < options.length; index++) {
var option = options[index];
if (option.selected) {
result.push(option.value);
}
}
}
return result;
};
var getValue = function getValue(event, isReactNative) {
if (_isEvent2['default'](event)) {
if (!isReactNative && event.nativeEvent && event.nativeEvent.text !== undefined) {
return event.nativeEvent.text;
}
if (isReactNative && event.nativeEvent !== undefined) {
return event.nativeEvent.text;
}
var _event$target = event.target;
var type = _event$target.type;
var value = _event$target.value;
var checked = _event$target.checked;
var files = _event$target.files;
var dataTransfer = event.dataTransfer;
if (type === 'checkbox') {
return checked;
}
if (type === 'file') {
return files || dataTransfer && dataTransfer.files;
}
if (type === 'select-multiple') {
return getSelectedValues(event.target.options);
}
return value;
}
// not an event, so must be either our value or an object containing our value in the 'value' key
return event && typeof event === 'object' && event.value !== undefined ? event.value : // extract value from { value: value } structure. https://github.com/nikgraf/belle/issues/58
event;
};
exports['default'] = getValue;
module.exports = exports['default'];
/***/ },
/* 9 */
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
var isEvent = function isEvent(candidate) {
return !!(candidate && candidate.stopPropagation && candidate.preventDefault);
};
exports["default"] = isEvent;
module.exports = exports["default"];
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _isEvent = __webpack_require__(9);
var _isEvent2 = _interopRequireDefault(_isEvent);
var silenceEvent = function silenceEvent(event) {
var is = _isEvent2['default'](event);
if (is) {
event.preventDefault();
}
return is;
};
exports['default'] = silenceEvent;
module.exports = exports['default'];
/***/ },
/* 11 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports['default'] = getDisplayName;
function getDisplayName(Comp) {
return Comp.displayName || Comp.name || 'Component';
}
module.exports = exports['default'];
/***/ },
/* 12 */
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
var getValues = function getValues(fields, form) {
return fields.reduce(function (accumulator, field) {
accumulator[field] = form[field] ? form[field].value : undefined;
return accumulator;
}, {});
};
exports["default"] = getValues;
module.exports = exports["default"];
/***/ },
/* 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 }; }
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 _actionTypes = __webpack_require__(2);
var _mapValues = __webpack_require__(3);
var _mapValues2 = _interopRequireDefault(_mapValues);
var initialState = {
_active: undefined,
_asyncValidating: false,
_error: undefined,
_submitting: false,
_submitFailed: false
};
exports.initialState = initialState;
var getValues = function getValues(state) {
return Object.keys(state).reduce(function (accumulator, name) {
if (name[0] !== '_') {
accumulator[name] = state[name].value;
}
return accumulator;
}, {});
};
exports.getValues = getValues;
var reducer = function reducer() {
var state = arguments.length <= 0 || arguments[0] === undefined ? initialState : arguments[0];
var _extends2, _extends3, _extends4;
var action = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
switch (action.type) {
case _actionTypes.BLUR:
return _extends({}, state, (_extends2 = {}, _extends2[action.field] = _extends({}, state[action.field], {
value: action.value === undefined ? (state[action.field] || {}).value : action.value,
touched: !!(action.touch || (state[action.field] || {}).touched)
}), _extends2._active = undefined, _extends2));
case _actionTypes.CHANGE:
return _extends({}, state, (_extends3 = {}, _extends3[action.field] = _extends({}, state[action.field], {
value: action.value,
touched: !!(action.touch || (state[action.field] || {}).touched),
asyncError: undefined,
submitError: undefined
}), _extends3));
case _actionTypes.DESTROY:
return undefined;
case _actionTypes.FOCUS:
return _extends({}, state, (_extends4 = {}, _extends4[action.field] = _extends({}, state[action.field], {
visited: true
}), _extends4._active = action.field, _extends4));
case _actionTypes.INITIALIZE:
return _extends({}, _mapValues2['default'](action.data, function (value) {
return {
initial: value,
value: value
};
}), {
_asyncValidating: false,
_active: undefined,
_error: undefined,
_submitting: false,
_submitFailed: false
});
case _actionTypes.RESET:
return _extends({}, _mapValues2['default'](state, function (field, name) {
return name[0] === '_' ? field : {
initial: field.initial,
value: field.initial
};
}), {
_active: undefined,
_asyncValidating: false,
_error: undefined,
_submitting: false,
_submitFailed: false
});
case _actionTypes.START_ASYNC_VALIDATION:
return _extends({}, state, {
_asyncValidating: true
});
case _actionTypes.START_SUBMIT:
return _extends({}, state, {
_submitting: true
});
case _actionTypes.STOP_ASYNC_VALIDATION:
return _extends({}, _mapValues2['default'](state, function (value) {
return value && value.asyncError ? _extends({}, value, { asyncError: undefined }) : value;
}), _mapValues2['default'](action.errors, function (error, key) {
return _extends({}, state[key], {
asyncError: error
});
}), {
_asyncValidating: false,
_error: action.errors && action.errors._error
});
case _actionTypes.STOP_SUBMIT:
return _extends({}, state, action.errors ? _mapValues2['default'](action.errors, function (error, key) {
return _extends({}, state[key], {
submitError: error
});
}) : {}, {
_error: action.errors && action.errors._error,
_submitting: false,
_submitFailed: !!(action.errors && Object.keys(action.errors).length)
});
case _actionTypes.SUBMIT_FAILED:
return _extends({}, state, {
_submitFailed: true
});
case _actionTypes.TOUCH:
return _extends({}, state, action.fields.reduce(function (accumulator, field) {
accumulator[field] = _extends({}, state[field], {
touched: true
});
return accumulator;
}, {}));
case _actionTypes.UNTOUCH:
return _extends({}, state, action.fields.reduce(function (accumulator, field) {
accumulator[field] = _extends({}, state[field], {
touched: false
});
return accumulator;
}, {}));
default:
return state;
}
};
function formReducer() {
var state = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var _extends10;
var action = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var form = action.form;
var key = action.key;
var rest = _objectWithoutProperties(action, ['form', 'key']);
if (!form) {
return state;
}
if (key) {
var _extends7, _extends8;
if (action.type === _actionTypes.DESTROY) {
var _extends6;
return _extends({}, state, (_extends6 = {}, _extends6[form] = state[form] && Object.keys(state[form]).reduce(function (accumulator, stateKey) {
var _extends5;
return stateKey === key ? accumulator : _extends({}, accumulator, (_extends5 = {}, _extends5[stateKey] = state[form][stateKey], _extends5));
}, {}), _extends6));
}
return _extends({}, state, (_extends8 = {}, _extends8[form] = _extends({}, state[form], (_extends7 = {}, _extends7[key] = reducer((state[form] || {})[key], rest), _extends7)), _extends8));
}
if (action.type === _actionTypes.DESTROY) {
return Object.keys(state).reduce(function (accumulator, formName) {
var _extends9;
return formName === form ? accumulator : _extends({}, accumulator, (_extends9 = {}, _extends9[formName] = state[formName], _extends9));
}, {});
}
return _extends({}, state, (_extends10 = {}, _extends10[form] = reducer(state[form], rest), _extends10));
}
/**
* Adds additional functionality to the reducer
*/
function decorate(target) {
target.plugin = function plugin(reducers) {
var _this = this;
return decorate(function () {
var state = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var action = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var result = _this(state, action);
return _extends({}, result, _mapValues2['default'](reducers, function (pluginReducer, key) {
return pluginReducer(result[key] || initialState, action);
}));
});
};
target.normalize = function normalize(normalizers) {
var _this2 = this;
return decorate(function () {
var state = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var action = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var result = _this2(state, action);
return _extends({}, result, _mapValues2['default'](normalizers, function (formNormalizers, form) {
var previousValues = getValues(_extends({}, initialState, state[form]));
var formResult = _extends({}, initialState, result[form]);
return _extends({}, formResult, _mapValues2['default'](formNormalizers, function (fieldNormalizer, field) {
return _extends({}, formResult[field], {
value: fieldNormalizer(formResult[field] ? formResult[field].value : undefined, // value
state[form] && state[form][field] ? state[form][field].value : undefined, // previous value
getValues(formResult), // all field values
previousValues) // all previous field values
});
}));
}));
});
};
return target;
}
exports['default'] = decorate(formReducer);
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
var pSlice = Array.prototype.slice;
var objectKeys = __webpack_require__(40);
var isArguments = __webpack_require__(39);
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;
}
/***/ },
/* 15 */
/***/ 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
};
module.exports = function hoistNonReactStatics(targetComponent, sourceComponent) {
var keys = Object.getOwnPropertyNames(sourceComponent);
for (var i=0; i<keys.length; ++i) {
if (!REACT_STATICS[keys[i]] && !KNOWN_STATICS[keys[i]]) {
targetComponent[keys[i]] = sourceComponent[keys[i]];
}
}
return targetComponent;
};
/***/ },
/* 16 */
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = createStoreShape;
function createStoreShape(PropTypes) {
return PropTypes.shape({
subscribe: PropTypes.func.isRequired,
dispatch: PropTypes.func.isRequired,
getState: PropTypes.func.isRequired
});
}
module.exports = exports["default"];
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports['default'] = createStore;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _utilsIsPlainObject = __webpack_require__(20);
var _utilsIsPlainObject2 = _interopRequireDefault(_utilsIsPlainObject);
/**
* These are private action types reserved by Redux.
* For any unknown actions, you must return the current state.
* If the current state is undefined, you must return the initial state.
* Do not reference these action types directly in your code.
*/
var ActionTypes = {
INIT: '@@redux/INIT'
};
exports.ActionTypes = ActionTypes;
/**
* Creates a Redux store that holds the state tree.
* The only way to change the data in the store is to call `dispatch()` on it.
*
* There should only be a single store in your app. To specify how different
* parts of the state tree respond to actions, you may combine several reducers
* into a single reducer function by using `combineReducers`.
*
* @param {Function} reducer A function that returns the next state tree, given
* the current state tree and the action to handle.
*
* @param {any} [initialState] The initial state. You may optionally specify it
* to hydrate the state from the server in universal apps, or to restore a
* previously serialized user session.
* If you use `combineReducers` to produce the root reducer function, this must be
* an object with the same shape as `combineReducers` keys.
*
* @returns {Store} A Redux store that lets you read the state, dispatch actions
* and subscribe to changes.
*/
function createStore(reducer, initialState) {
if (typeof reducer !== 'function') {
throw new Error('Expected the reducer to be a function.');
}
var currentReducer = reducer;
var currentState = initialState;
var listeners = [];
var isDispatching = false;
/**
* Reads the state tree managed by the store.
*
* @returns {any} The current state tree of your application.
*/
function getState() {
return currentState;
}
/**
* Adds a change listener. It will be called any time an action is dispatched,
* and some part of the state tree may potentially have changed. You may then
* call `getState()` to read the current state tree inside the callback.
*
* @param {Function} listener A callback to be invoked on every dispatch.
* @returns {Function} A function to remove this change listener.
*/
function subscribe(listener) {
listeners.push(listener);
var isSubscribed = true;
return function unsubscribe() {
if (!isSubscribed) {
return;
}
isSubscribed = false;
var index = listeners.indexOf(listener);
listeners.splice(index, 1);
};
}
/**
* Dispatches an action. It is the only way to trigger a state change.
*
* The `reducer` function, used to create the store, will be called with the
* current state tree and the given `action`. Its return value will
* be considered the **next** state of the tree, and the change listeners
* will be notified.
*
* The base implementation only supports plain object actions. If you want to
* dispatch a Promise, an Observable, a thunk, or something else, you need to
* wrap your store creating function into the corresponding middleware. For
* example, see the documentation for the `redux-thunk` package. Even the
* middleware will eventually dispatch plain object actions using this method.
*
* @param {Object} action A plain object representing “what changed”. It is
* a good idea to keep actions serializable so you can record and replay user
* sessions, or use the time travelling `redux-devtools`. An action must have
* a `type` property which may not be `undefined`. It is a good idea to use
* string constants for action types.
*
* @returns {Object} For convenience, the same action object you dispatched.
*
* Note that, if you use a custom middleware, it may wrap `dispatch()` to
* return something else (for example, a Promise you can await).
*/
function dispatch(action) {
if (!_utilsIsPlainObject2['default'](action)) {
throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');
}
if (typeof action.type === 'undefined') {
throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?');
}
if (isDispatching) {
throw new Error('Reducers may not dispatch actions.');
}
try {
isDispatching = true;
currentState = currentReducer(currentState, action);
} finally {
isDispatching = false;
}
listeners.slice().forEach(function (listener) {
return listener();
});
return action;
}
/**
* Replaces the reducer currently used by the store to calculate the state.
*
* You might need this if your app implements code splitting and you want to
* load some of the reducers dynamically. You might also need this if you
* implement a hot reloading mechanism for Redux.
*
* @param {Function} nextReducer The reducer for the store to use instead.
* @returns {void}
*/
function replaceReducer(nextReducer) {
currentReducer = nextReducer;
dispatch({ type: ActionTypes.INIT });
}
// When a store is created, an "INIT" action is dispatched so that every
// reducer returns their initial state. This effectively populates
// the initial state tree.
dispatch({ type: ActionTypes.INIT });
return {
dispatch: dispatch,
subscribe: subscribe,
getState: getState,
replaceReducer: replaceReducer
};
}
/***/ },
/* 18 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _createStore = __webpack_require__(17);
var _createStore2 = _interopRequireDefault(_createStore);
var _utilsCombineReducers = __webpack_require__(53);
var _utilsCombineReducers2 = _interopRequireDefault(_utilsCombineReducers);
var _utilsBindActionCreators = __webpack_require__(52);
var _utilsBindActionCreators2 = _interopRequireDefault(_utilsBindActionCreators);
var _utilsApplyMiddleware = __webpack_require__(51);
var _utilsApplyMiddleware2 = _interopRequireDefault(_utilsApplyMiddleware);
var _utilsCompose = __webpack_require__(19);
var _utilsCompose2 = _interopRequireDefault(_utilsCompose);
exports.createStore = _createStore2['default'];
exports.combineReducers = _utilsCombineReducers2['default'];
exports.bindActionCreators = _utilsBindActionCreators2['default'];
exports.applyMiddleware = _utilsApplyMiddleware2['default'];
exports.compose = _utilsCompose2['default'];
/***/ },
/* 19 */
/***/ function(module, exports) {
/**
* Composes single-argument functions from right to left.
*
* @param {...Function} funcs The functions to compose.
* @returns {Function} A function obtained by composing functions from right to
* left. For example, compose(f, g, h) is identical to arg => f(g(h(arg))).
*/
"use strict";
exports.__esModule = true;
exports["default"] = compose;
function compose() {
for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
funcs[_key] = arguments[_key];
}
return function (arg) {
return funcs.reduceRight(function (composed, f) {
return f(composed);
}, arg);
};
}
module.exports = exports["default"];
/***/ },
/* 20 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports['default'] = isPlainObject;
var fnToString = function fnToString(fn) {
return Function.prototype.toString.call(fn);
};
/**
* @param {any} obj The object to inspect.
* @returns {boolean} True if the argument appears to be a plain object.
*/
function isPlainObject(obj) {
if (!obj || typeof obj !== 'object') {
return false;
}
var proto = typeof obj.constructor === 'function' ? Object.getPrototypeOf(obj) : Object.prototype;
if (proto === null) {
return true;
}
var constructor = proto.constructor;
return typeof constructor === 'function' && constructor instanceof constructor && fnToString(constructor) === fnToString(Object);
}
module.exports = exports['default'];
/***/ },
/* 21 */
/***/ function(module, exports) {
/**
* Applies a function to every key-value pair inside an object.
*
* @param {Object} obj The source object.
* @param {Function} fn The mapper function that receives the value and the key.
* @returns {Object} A new object that contains the mapped values for the keys.
*/
"use strict";
exports.__esModule = true;
exports["default"] = mapValues;
function mapValues(obj, fn) {
return Object.keys(obj).reduce(function (result, key) {
result[key] = fn(obj[key], key);
return result;
}, {});
}
module.exports = exports["default"];
/***/ },
/* 22 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_22__;
/***/ },
/* 23 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _isPromise = __webpack_require__(4);
var _isPromise2 = _interopRequireDefault(_isPromise);
var _isValid = __webpack_require__(1);
var _isValid2 = _interopRequireDefault(_isValid);
var asyncValidation = function asyncValidation(fn, start, stop) {
start();
var promise = fn();
if (!_isPromise2['default'](promise)) {
throw new Error('asyncValidate function passed to reduxForm must return a promise');
}
var handleErrors = function handleErrors(rejected) {
return function (errors) {
if (!_isValid2['default'](errors)) {
stop(errors);
return Promise.reject();
} else if (rejected) {
stop();
throw new Error('Asynchronous validation promise was rejected without errors.');
}
stop();
return Promise.resolve();
};
};
return promise.then(handleErrors(false), handleErrors(true));
};
exports['default'] = asyncValidation;
module.exports = exports['default'];
/***/ },
/* 24 */
/***/ 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'] = createAll;
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 _reducer = __webpack_require__(13);
var _reducer2 = _interopRequireDefault(_reducer);
var _createReduxForm = __webpack_require__(26);
var _createReduxForm2 = _interopRequireDefault(_createReduxForm);
var _mapValues = __webpack_require__(3);
var _mapValues2 = _interopRequireDefault(_mapValues);
var _bindActionData = __webpack_require__(6);
var _bindActionData2 = _interopRequireDefault(_bindActionData);
var _actions = __webpack_require__(5);
var actions = _interopRequireWildcard(_actions);
var _actionTypes = __webpack_require__(2);
var actionTypes = _interopRequireWildcard(_actionTypes);
// bind form as first parameter of action creators
var boundActions = _extends({}, _mapValues2['default'](_extends({}, actions, {
initializeWithKey: function initializeWithKey(key, data) {
return _bindActionData2['default'](actions.initialize, { key: key })(data);
},
destroy: function destroy(key) {
return _bindActionData2['default'](actions.destroy, { key: key })();
}
}), function (action) {
return function (form) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return _bindActionData2['default'](action, { form: form }).apply(undefined, args);
};
}));
var blur = boundActions.blur;
var change = boundActions.change;
var destroy = boundActions.destroy;
var focus = boundActions.focus;
var initialize = boundActions.initialize;
var initializeWithKey = boundActions.initializeWithKey;
var reset = boundActions.reset;
var startAsyncValidation = boundActions.startAsyncValidation;
var startSubmit = boundActions.startSubmit;
var stopAsyncValidation = boundActions.stopAsyncValidation;
var stopSubmit = boundActions.stopSubmit;
var submitFailed = boundActions.submitFailed;
var touch = boundActions.touch;
var untouch = boundActions.untouch;
function createAll(isReactNative, React) {
return {
actionTypes: actionTypes,
blur: blur,
change: change,
destroy: destroy,
focus: focus,
reducer: _reducer2['default'],
initialize: initialize,
initializeWithKey: initializeWithKey,
reduxForm: _createReduxForm2['default'](isReactNative, React),
reset: reset,
startAsyncValidation: startAsyncValidation,
startSubmit: startSubmit,
stopAsyncValidation: stopAsyncValidation,
stopSubmit: stopSubmit,
submitFailed: submitFailed,
touch: touch,
untouch: untouch
};
}
module.exports = exports['default'];
/***/ },
/* 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; };
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; } }
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 _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 _reactRedux = __webpack_require__(47);
var _actions = __webpack_require__(5);
var importedActions = _interopRequireWildcard(_actions);
var _getDisplayName = __webpack_require__(11);
var _getDisplayName2 = _interopRequireDefault(_getDisplayName);
var _reducer = __webpack_require__(13);
var _deepEqual = __webpack_require__(14);
var _deepEqual2 = _interopRequireDefault(_deepEqual);
var _bindActionData = __webpack_require__(6);
var _bindActionData2 = _interopRequireDefault(_bindActionData);
var _getValues = __webpack_require__(12);
var _getValues2 = _interopRequireDefault(_getValues);
var _isValid = __webpack_require__(1);
var _isValid2 = _interopRequireDefault(_isValid);
var _readFields = __webpack_require__(35);
var _readFields2 = _interopRequireDefault(_readFields);
var _handleSubmit2 = __webpack_require__(33);
var _handleSubmit3 = _interopRequireDefault(_handleSubmit2);
var _asyncValidation = __webpack_require__(23);
var _asyncValidation2 = _interopRequireDefault(_asyncValidation);
var _eventsSilenceEvents = __webpack_require__(32);
var _eventsSilenceEvents2 = _interopRequireDefault(_eventsSilenceEvents);
var _eventsSilenceEvent = __webpack_require__(10);
var _eventsSilenceEvent2 = _interopRequireDefault(_eventsSilenceEvent);
var _wrapMapDispatchToProps = __webpack_require__(37);
var _wrapMapDispatchToProps2 = _interopRequireDefault(_wrapMapDispatchToProps);
var _wrapMapStateToProps = __webpack_require__(38);
var _wrapMapStateToProps2 = _interopRequireDefault(_wrapMapStateToProps);
/**
* Creates a HOC that knows how to create redux-connected sub-components.
*/
var createHigherOrderComponent = function createHigherOrderComponent(config, isReactNative, React, WrappedComponent, mapStateToProps, mapDispatchToProps) {
var Component = React.Component;
var PropTypes = React.PropTypes;
return function (reduxMountPoint, formName, formKey, getFormState) {
var ReduxForm = (function (_Component) {
_inherits(ReduxForm, _Component);
function ReduxForm(props) {
_classCallCheck(this, ReduxForm);
_Component.call(this, props);
// bind functions
this.asyncValidate = this.asyncValidate.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
this.fields = _readFields2['default'](props, {}, this.asyncValidate, isReactNative);
}
ReduxForm.prototype.componentWillMount = function componentWillMount() {
var _props = this.props;
var initialize = _props.initialize;
var initialValues = _props.initialValues;
if (initialValues) {
initialize(initialValues);
}
};
ReduxForm.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (!_deepEqual2['default'](this.props.fields, nextProps.fields) || !_deepEqual2['default'](this.props.form, nextProps.form)) {
this.fields = _readFields2['default'](nextProps, this.fields, this.asyncValidate, isReactNative);
}
if (!_deepEqual2['default'](this.props.initialValues, nextProps.initialValues)) {
this.props.initialize(nextProps.initialValues);
}
};
ReduxForm.prototype.componentWillUnmount = function componentWillUnmount() {
if (config.destroyOnUnmount) {
this.props.destroy();
}
};
ReduxForm.prototype.asyncValidate = function asyncValidate(name, value) {
var _this = this;
var _props2 = this.props;
var asyncValidate = _props2.asyncValidate;
var dispatch = _props2.dispatch;
var fields = _props2.fields;
var form = _props2.form;
var startAsyncValidation = _props2.startAsyncValidation;
var stopAsyncValidation = _props2.stopAsyncValidation;
var validate = _props2.validate;
if (asyncValidate) {
var _ret = (function () {
var values = _getValues2['default'](fields, form);
if (name) {
values[name] = value;
}
var syncErrors = validate(values, _this.props);
// if blur validating, only run async validate if sync validation passes
if (!name || _isValid2['default'](syncErrors[name])) {
return {
v: _asyncValidation2['default'](function () {
return asyncValidate(values, dispatch, _this.props);
}, startAsyncValidation, stopAsyncValidation)
};
}
})();
if (typeof _ret === 'object') return _ret.v;
}
};
ReduxForm.prototype.handleSubmit = function handleSubmit(submitOrEvent) {
var _this2 = this;
var _props3 = this.props;
var onSubmit = _props3.onSubmit;
var fields = _props3.fields;
var form = _props3.form;
var check = function check(submit) {
if (!submit || typeof submit !== 'function') {
throw new Error('You must either pass handleSubmit() an onSubmit function or pass onSubmit as a prop');
}
return submit;
};
var values = _getValues2['default'](fields, form);
return !submitOrEvent || _eventsSilenceEvent2['default'](submitOrEvent) ?
// submitOrEvent is an event: fire submit
_handleSubmit3['default'](check(onSubmit), values, this.props, this.asyncValidate) :
// submitOrEvent is the submit function: return deferred submit thunk
_eventsSilenceEvents2['default'](function (event) {
_eventsSilenceEvent2['default'](event);
_handleSubmit3['default'](check(submitOrEvent), values, _this2.props, _this2.asyncValidate);
});
};
ReduxForm.prototype.render = function render() {
var _this3 = this;
var allFields = this.fields;
var _props4 = this.props;
var asyncBlurFields = _props4.asyncBlurFields;
var blur = _props4.blur;
var change = _props4.change;
var destroy = _props4.destroy;
var focus = _props4.focus;
var fields = _props4.fields;
var form = _props4.form;
var initialValues = _props4.initialValues;
var initialize = _props4.initialize;
var onSubmit = _props4.onSubmit;
var reset = _props4.reset;
var returnRejectedSubmitPromise = _props4.returnRejectedSubmitPromise;
var startAsyncValidation = _props4.startAsyncValidation;
var startSubmit = _props4.startSubmit;
var stopAsyncValidation = _props4.stopAsyncValidation;
var stopSubmit = _props4.stopSubmit;
var submitFailed = _props4.submitFailed;
var touch = _props4.touch;
var untouch = _props4.untouch;
var validate = _props4.validate;
var passableProps = _objectWithoutProperties(_props4, ['asyncBlurFields', 'blur', 'change', 'destroy', 'focus', 'fields', 'form', 'initialValues', 'initialize', 'onSubmit', 'reset', 'returnRejectedSubmitPromise', 'startAsyncValidation', 'startSubmit', 'stopAsyncValidation', 'stopSubmit', 'submitFailed', 'touch', 'untouch', 'validate']);
var _allFields$_meta = allFields._meta;
var allPristine = _allFields$_meta.allPristine;
var allValid = _allFields$_meta.allValid;
var errors = _allFields$_meta.errors;
var formError = _allFields$_meta.formError;
var values = _allFields$_meta.values;
return React.createElement(WrappedComponent, _extends({}, passableProps, { // contains dispatch
// State:
active: form._active,
asyncValidating: form._asyncValidating,
dirty: !allPristine,
error: formError,
errors: errors,
fields: allFields,
formKey: formKey,
invalid: !allValid,
pristine: allPristine,
submitting: form._submitting,
submitFailed: form._submitFailed,
valid: allValid,
values: values,
// Actions:
asyncValidate: _eventsSilenceEvents2['default'](function () {
return _this3.asyncValidate();
}),
// ^ doesn't just pass this.asyncValidate to disallow values passing
destroyForm: _eventsSilenceEvents2['default'](destroy),
handleSubmit: this.handleSubmit,
initializeForm: _eventsSilenceEvents2['default'](initialize),
resetForm: _eventsSilenceEvents2['default'](reset),
touch: _eventsSilenceEvents2['default'](function () {
return touch.apply(undefined, arguments);
}),
touchAll: _eventsSilenceEvents2['default'](function () {
return touch.apply(undefined, fields);
}),
untouch: _eventsSilenceEvents2['default'](function () {
return untouch.apply(undefined, arguments);
}),
untouchAll: _eventsSilenceEvents2['default'](function () {
return untouch.apply(undefined, fields);
})
}));
};
return ReduxForm;
})(Component);
ReduxForm.displayName = 'ReduxForm(' + _getDisplayName2['default'](WrappedComponent) + ')';
ReduxForm.WrappedComponent = WrappedComponent;
ReduxForm.propTypes = {
// props:
asyncBlurFields: PropTypes.arrayOf(PropTypes.string),
asyncValidate: PropTypes.func,
dispatch: PropTypes.func.isRequired,
fields: PropTypes.arrayOf(PropTypes.string).isRequired,
form: PropTypes.object,
initialValues: PropTypes.any,
onSubmit: PropTypes.func,
validate: PropTypes.func,
readonly: PropTypes.bool,
returnRejectedSubmitPromise: PropTypes.bool,
// actions:
blur: PropTypes.func.isRequired,
change: PropTypes.func.isRequired,
destroy: PropTypes.func.isRequired,
focus: PropTypes.func.isRequired,
initialize: PropTypes.func.isRequired,
reset: PropTypes.func.isRequired,
startAsyncValidation: PropTypes.func.isRequired,
startSubmit: PropTypes.func.isRequired,
stopAsyncValidation: PropTypes.func.isRequired,
stopSubmit: PropTypes.func.isRequired,
submitFailed: PropTypes.func.isRequired,
touch: PropTypes.func.isRequired,
untouch: PropTypes.func.isRequired
};
ReduxForm.defaultProps = {
asyncBlurFields: [],
form: _reducer.initialState,
readonly: false,
returnRejectedSubmitPromise: false,
validate: function validate() {
return {};
}
};
// bind touch flags to blur and change
var unboundActions = _extends({}, importedActions, {
blur: _bindActionData2['default'](importedActions.blur, {
touch: !!config.touchOnBlur
}),
change: _bindActionData2['default'](importedActions.change, {
touch: !!config.touchOnChange
})
});
// make redux connector with or without form key
var decorate = formKey !== undefined && formKey !== null ? _reactRedux.connect(_wrapMapStateToProps2['default'](mapStateToProps, function (state) {
var formState = getFormState(state, reduxMountPoint);
if (!formState) {
throw new Error('You need to mount the redux-form reducer at "' + reduxMountPoint + '"');
}
return formState && formState[formName] && formState[formName][formKey];
}), _wrapMapDispatchToProps2['default'](mapDispatchToProps, _bindActionData2['default'](unboundActions, { form: formName, key: formKey }))) : _reactRedux.connect(_wrapMapStateToProps2['default'](mapStateToProps, function (state) {
var formState = getFormState(state, reduxMountPoint);
if (!formState) {
throw new Error('You need to mount the redux-form reducer at "' + reduxMountPoint + '"');
}
return formState && formState[formName];
}), _wrapMapDispatchToProps2['default'](mapDispatchToProps, _bindActionData2['default'](unboundActions, { form: formName })));
return decorate(ReduxForm);
};
};
exports['default'] = createHigherOrderComponent;
module.exports = exports['default'];
/***/ },
/* 26 */
/***/ 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 }; }
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 _createReduxFormConnector = __webpack_require__(27);
var _createReduxFormConnector2 = _interopRequireDefault(_createReduxFormConnector);
var _hoistNonReactStatics = __webpack_require__(15);
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
/**
* The decorator that is the main API to redux-form
*/
var createReduxForm = function createReduxForm(isReactNative, React) {
var Component = React.Component;
var reduxFormConnector = _createReduxFormConnector2['default'](isReactNative, React);
return function (config, mapStateToProps, mapDispatchToProps) {
return function (WrappedComponent) {
var ReduxFormConnector = reduxFormConnector(WrappedComponent, mapStateToProps, mapDispatchToProps);
var configWithDefaults = _extends({
touchOnBlur: true,
touchOnChange: false,
destroyOnUnmount: true
}, config);
var ConnectedForm = (function (_Component) {
_inherits(ConnectedForm, _Component);
function ConnectedForm() {
_classCallCheck(this, ConnectedForm);
_Component.apply(this, arguments);
}
ConnectedForm.prototype.render = function render() {
return React.createElement(ReduxFormConnector, _extends({}, configWithDefaults, this.props));
};
return ConnectedForm;
})(Component);
return _hoistNonReactStatics2['default'](ConnectedForm, WrappedComponent);
};
};
};
exports['default'] = createReduxForm;
module.exports = exports['default'];
/***/ },
/* 27 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
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 _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 _reactLazyCache = __webpack_require__(42);
var _reactLazyCache2 = _interopRequireDefault(_reactLazyCache);
var _getDisplayName = __webpack_require__(11);
var _getDisplayName2 = _interopRequireDefault(_getDisplayName);
var _createHigherOrderComponent = __webpack_require__(25);
var _createHigherOrderComponent2 = _interopRequireDefault(_createHigherOrderComponent);
/**
* This component tracks props that affect how the form is mounted to the store. Normally these should not change,
* but if they do, the connected components below it need to be redefined.
*/
var createReduxFormConnector = function createReduxFormConnector(isReactNative, React) {
return function (WrappedComponent, mapStateToProps, mapDispatchToProps) {
var Component = React.Component;
var PropTypes = React.PropTypes;
var ReduxFormConnector = (function (_Component) {
_inherits(ReduxFormConnector, _Component);
function ReduxFormConnector(props) {
_classCallCheck(this, ReduxFormConnector);
_Component.call(this, props);
this.cache = _reactLazyCache2['default'](this, {
ReduxForm: {
params: [
// props that effect how redux-form connects to the redux store
'reduxMountPoint', 'form', 'formKey', 'getFormState'],
fn: _createHigherOrderComponent2['default'](props, isReactNative, React, WrappedComponent, mapStateToProps, mapDispatchToProps)
}
});
}
ReduxFormConnector.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
this.cache.componentWillReceiveProps(nextProps);
};
ReduxFormConnector.prototype.render = function render() {
var ReduxForm = this.cache.ReduxForm;
// remove some redux-form config-only props
var _props = this.props;
var reduxMountPoint = _props.reduxMountPoint;
var destroyOnUnmount = _props.destroyOnUnmount;
var form = _props.form;
var getFormState = _props.getFormState;
var touchOnBlur = _props.touchOnBlur;
var touchOnChange = _props.touchOnChange;
var passableProps = _objectWithoutProperties(_props, ['reduxMountPoint', 'destroyOnUnmount', 'form', 'getFormState', 'touchOnBlur', 'touchOnChange']);
return React.createElement(ReduxForm, passableProps);
};
return ReduxFormConnector;
})(Component);
ReduxFormConnector.displayName = 'ReduxFormConnector(' + _getDisplayName2['default'](WrappedComponent) + ')';
ReduxFormConnector.WrappedComponent = WrappedComponent;
ReduxFormConnector.propTypes = {
destroyOnUnmount: PropTypes.bool,
reduxMountPoint: PropTypes.string,
form: PropTypes.string.isRequired,
formKey: PropTypes.string,
getFormState: PropTypes.func,
touchOnBlur: PropTypes.bool,
touchOnChange: PropTypes.bool
};
ReduxFormConnector.defaultProps = {
reduxMountPoint: 'form',
getFormState: function getFormState(state, reduxMountPoint) {
return state[reduxMountPoint];
}
};
return ReduxFormConnector;
};
};
exports['default'] = createReduxFormConnector;
module.exports = exports['default'];
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _getValue = __webpack_require__(8);
var _getValue2 = _interopRequireDefault(_getValue);
var createOnBlur = function createOnBlur(name, blur, isReactNative, afterBlur) {
return function (event) {
var value = _getValue2['default'](event, isReactNative);
blur(name, value);
if (afterBlur) {
afterBlur(name, value);
}
};
};
exports['default'] = createOnBlur;
module.exports = exports['default'];
/***/ },
/* 29 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _getValue = __webpack_require__(8);
var _getValue2 = _interopRequireDefault(_getValue);
var createOnChange = function createOnChange(name, change, isReactNative) {
return function (event) {
return change(name, _getValue2['default'](event, isReactNative));
};
};
exports['default'] = createOnChange;
module.exports = exports['default'];
/***/ },
/* 30 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _createOnDragStart = __webpack_require__(7);
var createOnDrop = function createOnDrop(name, change) {
return function (event) {
change(name, event.dataTransfer.getData(_createOnDragStart.dataKey));
};
};
exports['default'] = createOnDrop;
module.exports = exports['default'];
/***/ },
/* 31 */
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
var createOnFocus = function createOnFocus(name, focus) {
return function () {
return focus(name);
};
};
exports["default"] = createOnFocus;
module.exports = exports["default"];
/***/ },
/* 32 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _silenceEvent = __webpack_require__(10);
var _silenceEvent2 = _interopRequireDefault(_silenceEvent);
var silenceEvents = function silenceEvents(fn) {
return function (event) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return _silenceEvent2['default'](event) ? fn.apply(undefined, args) : fn.apply(undefined, [event].concat(args));
};
};
exports['default'] = silenceEvents;
module.exports = exports['default'];
/***/ },
/* 33 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _isPromise = __webpack_require__(4);
var _isPromise2 = _interopRequireDefault(_isPromise);
var _isValid = __webpack_require__(1);
var _isValid2 = _interopRequireDefault(_isValid);
var handleSubmit = function handleSubmit(submit, values, props, asyncValidate) {
var dispatch = props.dispatch;
var fields = props.fields;
var startSubmit = props.startSubmit;
var stopSubmit = props.stopSubmit;
var submitFailed = props.submitFailed;
var returnRejectedSubmitPromise = props.returnRejectedSubmitPromise;
var touch = props.touch;
var validate = props.validate;
var syncErrors = validate(values, props);
touch.apply(undefined, fields); // touch all fields
if (_isValid2['default'](syncErrors)) {
var doSubmit = function doSubmit() {
var result = submit(values, dispatch);
if (_isPromise2['default'](result)) {
startSubmit();
return result.then(function (submitResult) {
stopSubmit();
return submitResult;
}, function (submitError) {
stopSubmit(submitError);
if (returnRejectedSubmitPromise) {
return Promise.reject(submitError);
}
});
}
return result;
};
var asyncValidateResult = asyncValidate();
return _isPromise2['default'](asyncValidateResult) ?
// asyncValidateResult will be rejected if async validation failed
asyncValidateResult.then(doSubmit, function () {
submitFailed();
return returnRejectedSubmitPromise ? Promise.reject() : Promise.resolve();
}) : doSubmit(); // no async validation, so submit
}
submitFailed();
};
exports['default'] = handleSubmit;
module.exports = exports['default'];
/***/ },
/* 34 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports['default'] = isPristine;
function isPristine(initial, data) {
if (initial === data) {
return true;
}
if (typeof initial === 'boolean' || typeof data === 'boolean') {
return initial === data;
} else if (initial instanceof Date && data instanceof Date) {
return initial.getDate() === data.getDate();
} else if (initial && typeof initial === 'object') {
if (!data || typeof data !== 'object') {
return false;
}
var initialKeys = Object.keys(initial);
var dataKeys = Object.keys(data);
if (initialKeys.length !== dataKeys.length) {
return false;
}
for (var index = 0; index < dataKeys.length; index++) {
var key = dataKeys[index];
if (!isPristine(initial[key], data[key])) {
return false;
}
}
} else if (initial || data) {
// allow '' to equate to undefined or null
return initial === data;
}
return true;
}
module.exports = exports['default'];
/***/ },
/* 35 */
/***/ 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 _eventsCreateOnBlur = __webpack_require__(28);
var _eventsCreateOnBlur2 = _interopRequireDefault(_eventsCreateOnBlur);
var _eventsCreateOnChange = __webpack_require__(29);
var _eventsCreateOnChange2 = _interopRequireDefault(_eventsCreateOnChange);
var _eventsCreateOnDragStart = __webpack_require__(7);
var _eventsCreateOnDragStart2 = _interopRequireDefault(_eventsCreateOnDragStart);
var _eventsCreateOnDrop = __webpack_require__(30);
var _eventsCreateOnDrop2 = _interopRequireDefault(_eventsCreateOnDrop);
var _eventsCreateOnFocus = __webpack_require__(31);
var _eventsCreateOnFocus2 = _interopRequireDefault(_eventsCreateOnFocus);
var _isPristine = __webpack_require__(34);
var _isPristine2 = _interopRequireDefault(_isPristine);
var _isValid = __webpack_require__(1);
var _isValid2 = _interopRequireDefault(_isValid);
var _getValues = __webpack_require__(12);
var _getValues2 = _interopRequireDefault(_getValues);
var _silencePromise = __webpack_require__(36);
var _silencePromise2 = _interopRequireDefault(_silencePromise);
/**
* Reads props and generates (or updates) field structure
*/
var readFields = function readFields(props, myFields, asyncValidate, isReactNative) {
var asyncBlurFields = props.asyncBlurFields;
var blur = props.blur;
var change = props.change;
var fields = props.fields;
var focus = props.focus;
var form = props.form;
var initialValues = props.initialValues;
var readonly = props.readonly;
var validate = props.validate;
var values = _getValues2['default'](fields, form);
var syncErrors = validate(values, props);
var errors = {};
var formError = syncErrors._error || form._error;
var allValid = !formError;
var allPristine = true;
var fieldObjects = fields.reduce(function (accumulator, name) {
var field = myFields[name] || {};
var diff = {};
// create field if it does not exist
if (field.name !== name) {
var onChange = _eventsCreateOnChange2['default'](name, change, isReactNative);
var initialValue = initialValues && initialValues[name];
field.name = name;
field.defaultChecked = initialValue === true;
field.defaultValue = initialValue;
if (!readonly) {
field.onBlur = _eventsCreateOnBlur2['default'](name, blur, isReactNative, ~asyncBlurFields.indexOf(name) && function (blurName, blurValue) {
return _silencePromise2['default'](asyncValidate(blurName, blurValue));
});
field.onChange = onChange;
field.onDragStart = _eventsCreateOnDragStart2['default'](name, function () {
return field.value;
});
field.onDrop = _eventsCreateOnDrop2['default'](name, change);
field.onFocus = _eventsCreateOnFocus2['default'](name, focus);
field.onUpdate = onChange; // alias to support belle. https://github.com/nikgraf/belle/issues/58
}
field.valid = true;
field.invalid = false;
}
// update field value
var formField = form[name] || {};
if (field.value !== formField.value) {
diff.value = formField.value;
diff.checked = typeof formField.value === 'boolean' ? formField.value : undefined;
}
// update dirty/pristine
var pristine = _isPristine2['default'](formField.value, formField.initial);
if (field.pristine !== pristine) {
diff.dirty = !pristine;
diff.pristine = pristine;
}
// update field error
var error = syncErrors[name] || formField.submitError || formField.asyncError;
if (error !== field.error) {
diff.error = error;
}
var valid = _isValid2['default'](error);
if (field.valid !== valid) {
diff.invalid = !valid;
diff.valid = valid;
}
if (error) {
errors[name] = error;
}
var active = form._active === name;
if (active !== field.active) {
diff.active = active;
}
var touched = !!formField.touched;
if (touched !== field.touched) {
diff.touched = touched;
}
var visited = !!formField.visited;
if (visited !== field.visited) {
diff.visited = visited;
}
var result = Object.keys(diff).length ? _extends({}, field, diff) : field;
if (result.invalid) {
allValid = false;
}
if (result.dirty) {
allPristine = false;
}
accumulator[name] = result;
return accumulator;
}, {});
Object.defineProperty(fieldObjects, '_meta', {
value: {
allPristine: allPristine,
allValid: allValid,
values: values,
errors: errors,
formError: formError
}
});
return fieldObjects;
};
exports['default'] = readFields;
module.exports = exports['default'];
/***/ },
/* 36 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _isPromise = __webpack_require__(4);
var _isPromise2 = _interopRequireDefault(_isPromise);
var noop = function noop() {
return undefined;
};
var silencePromise = function silencePromise(promise) {
return _isPromise2['default'](promise) ? promise.then(noop, noop) : promise;
};
exports['default'] = silencePromise;
module.exports = exports['default'];
/***/ },
/* 37 */
/***/ 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 _redux = __webpack_require__(18);
var wrapMapDispatchToProps = function wrapMapDispatchToProps(mapDispatchToProps, actionCreators) {
if (mapDispatchToProps) {
if (typeof mapDispatchToProps === 'function') {
if (mapDispatchToProps.length > 1) {
return function (dispatch, ownProps) {
return _extends({}, mapDispatchToProps(dispatch, ownProps), _redux.bindActionCreators(actionCreators, dispatch), {
dispatch: dispatch
});
};
}
return function (dispatch) {
return _extends({}, mapDispatchToProps(dispatch), _redux.bindActionCreators(actionCreators, dispatch), {
dispatch: dispatch
});
};
}
return function (dispatch) {
return _extends({}, _redux.bindActionCreators(mapDispatchToProps, dispatch), _redux.bindActionCreators(actionCreators, dispatch), {
dispatch: dispatch
});
};
}
return function (dispatch) {
return _extends({}, _redux.bindActionCreators(actionCreators, dispatch), {
dispatch: dispatch
});
};
};
exports['default'] = wrapMapDispatchToProps;
module.exports = exports['default'];
/***/ },
/* 38 */
/***/ function(module, exports) {
'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 wrapMapStateToProps = function wrapMapStateToProps(mapStateToProps, getForm) {
if (mapStateToProps) {
if (typeof mapStateToProps !== 'function') {
throw new Error('mapStateToProps must be a function');
}
if (mapStateToProps.length > 1) {
return function (state, ownProps) {
return _extends({}, mapStateToProps(state, ownProps), {
form: getForm(state)
});
};
}
return function (state) {
return _extends({}, mapStateToProps(state), {
form: getForm(state)
});
};
}
return function (state) {
return {
form: getForm(state)
};
};
};
exports['default'] = wrapMapStateToProps;
module.exports = exports['default'];
/***/ },
/* 39 */
/***/ 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;
};
/***/ },
/* 40 */
/***/ 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;
}
/***/ },
/* 41 */
/***/ 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.
*
* @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 (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(
'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;
/***/ },
/* 42 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _lazyCache = __webpack_require__(43);
var _lazyCache2 = _interopRequireDefault(_lazyCache);
exports['default'] = _lazyCache2['default'];
module.exports = exports['default'];
/***/ },
/* 43 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports['default'] = lazyCache;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _deepEqual = __webpack_require__(14);
var _deepEqual2 = _interopRequireDefault(_deepEqual);
function lazyCache(component, calculators) {
var allProps = [];
var cache = {};
var api = {};
var uncache = function uncache(changedProp) {
Object.keys(cache).forEach(function (key) {
if (~cache[key].props.indexOf(changedProp)) {
delete cache[key].value;
uncache(key);
}
});
};
Object.keys(calculators).forEach(function (key) {
var fn = calculators[key].fn;
var props = calculators[key].params;
props.forEach(function (param) {
if (! ~allProps.indexOf(param)) {
allProps.push(param);
}
});
cache[key] = { props: props };
Object.defineProperty(api, key, {
get: function get() {
var cached = cache[key];
if (cached && cached.value !== undefined) {
return cached.value;
}
var params = props.map(function (prop) {
return component.props[prop] || api[prop];
});
var value = fn.apply(undefined, params);
cache[key] = { props: props, value: value };
return value;
}
});
});
api.componentWillReceiveProps = function (nextProps) {
var diffProps = [];
allProps.forEach(function (prop) {
if (!_deepEqual2['default'](component.props[prop], nextProps[prop])) {
diffProps.push(prop);
}
});
diffProps.forEach(uncache);
};
return api;
}
module.exports = exports['default'];
/***/ },
/* 44 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports['default'] = createAll;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _createProvider = __webpack_require__(46);
var _createProvider2 = _interopRequireDefault(_createProvider);
var _createConnect = __webpack_require__(45);
var _createConnect2 = _interopRequireDefault(_createConnect);
function createAll(React) {
var Provider = _createProvider2['default'](React);
var connect = _createConnect2['default'](React);
return { Provider: Provider, connect: connect };
}
module.exports = exports['default'];
/***/ },
/* 45 */
/***/ 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'] = createConnect;
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 _utilsCreateStoreShape = __webpack_require__(16);
var _utilsCreateStoreShape2 = _interopRequireDefault(_utilsCreateStoreShape);
var _utilsShallowEqual = __webpack_require__(49);
var _utilsShallowEqual2 = _interopRequireDefault(_utilsShallowEqual);
var _utilsIsPlainObject = __webpack_require__(48);
var _utilsIsPlainObject2 = _interopRequireDefault(_utilsIsPlainObject);
var _utilsWrapActionCreators = __webpack_require__(50);
var _utilsWrapActionCreators2 = _interopRequireDefault(_utilsWrapActionCreators);
var _hoistNonReactStatics = __webpack_require__(15);
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
var _invariant = __webpack_require__(41);
var _invariant2 = _interopRequireDefault(_invariant);
var defaultMapStateToProps = function defaultMapStateToProps() {
return {};
};
var defaultMapDispatchToProps = function defaultMapDispatchToProps(dispatch) {
return { dispatch: dispatch };
};
var defaultMergeProps = function defaultMergeProps(stateProps, dispatchProps, parentProps) {
return _extends({}, parentProps, stateProps, dispatchProps);
};
function getDisplayName(Component) {
return Component.displayName || Component.name || 'Component';
}
// Helps track hot reloading.
var nextVersion = 0;
function createConnect(React) {
var Component = React.Component;
var PropTypes = React.PropTypes;
var storeShape = _utilsCreateStoreShape2['default'](PropTypes);
return function connect(mapStateToProps, mapDispatchToProps, mergeProps) {
var options = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3];
var shouldSubscribe = Boolean(mapStateToProps);
var finalMapStateToProps = mapStateToProps || defaultMapStateToProps;
var finalMapDispatchToProps = _utilsIsPlainObject2['default'](mapDispatchToProps) ? _utilsWrapActionCreators2['default'](mapDispatchToProps) : mapDispatchToProps || defaultMapDispatchToProps;
var finalMergeProps = mergeProps || defaultMergeProps;
var shouldUpdateStateProps = finalMapStateToProps.length > 1;
var shouldUpdateDispatchProps = finalMapDispatchToProps.length > 1;
var _options$pure = options.pure;
var pure = _options$pure === undefined ? true : _options$pure;
// Helps track hot reloading.
var version = nextVersion++;
function computeStateProps(store, props) {
var state = store.getState();
var stateProps = shouldUpdateStateProps ? finalMapStateToProps(state, props) : finalMapStateToProps(state);
_invariant2['default'](_utilsIsPlainObject2['default'](stateProps), '`mapStateToProps` must return an object. Instead received %s.', stateProps);
return stateProps;
}
function computeDispatchProps(store, props) {
var dispatch = store.dispatch;
var dispatchProps = shouldUpdateDispatchProps ? finalMapDispatchToProps(dispatch, props) : finalMapDispatchToProps(dispatch);
_invariant2['default'](_utilsIsPlainObject2['default'](dispatchProps), '`mapDispatchToProps` must return an object. Instead received %s.', dispatchProps);
return dispatchProps;
}
function _computeNextState(stateProps, dispatchProps, parentProps) {
var mergedProps = finalMergeProps(stateProps, dispatchProps, parentProps);
_invariant2['default'](_utilsIsPlainObject2['default'](mergedProps), '`mergeProps` must return an object. Instead received %s.', mergedProps);
return mergedProps;
}
return function wrapWithConnect(WrappedComponent) {
var Connect = (function (_Component) {
_inherits(Connect, _Component);
Connect.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
if (!pure) {
this.updateStateProps(nextProps);
this.updateDispatchProps(nextProps);
this.updateState(nextProps);
return true;
}
var storeChanged = nextState.storeState !== this.state.storeState;
var propsChanged = !_utilsShallowEqual2['default'](nextProps, this.props);
var mapStateProducedChange = false;
var dispatchPropsChanged = false;
if (storeChanged || propsChanged && shouldUpdateStateProps) {
mapStateProducedChange = this.updateStateProps(nextProps);
}
if (propsChanged && shouldUpdateDispatchProps) {
dispatchPropsChanged = this.updateDispatchProps(nextProps);
}
if (propsChanged || mapStateProducedChange || dispatchPropsChanged) {
this.updateState(nextProps);
return true;
}
return false;
};
function Connect(props, context) {
_classCallCheck(this, Connect);
_Component.call(this, props, context);
this.version = version;
this.store = props.store || context.store;
_invariant2['default'](this.store, 'Could not find "store" in either the context or ' + ('props of "' + this.constructor.displayName + '". ') + 'Either wrap the root component in a <Provider>, ' + ('or explicitly pass "store" as a prop to "' + this.constructor.displayName + '".'));
this.stateProps = computeStateProps(this.store, props);
this.dispatchProps = computeDispatchProps(this.store, props);
this.state = { storeState: null };
this.updateState();
}
Connect.prototype.computeNextState = function computeNextState() {
var props = arguments.length <= 0 || arguments[0] === undefined ? this.props : arguments[0];
return _computeNextState(this.stateProps, this.dispatchProps, props);
};
Connect.prototype.updateStateProps = function updateStateProps() {
var props = arguments.length <= 0 || arguments[0] === undefined ? this.props : arguments[0];
var nextStateProps = computeStateProps(this.store, props);
if (_utilsShallowEqual2['default'](nextStateProps, this.stateProps)) {
return false;
}
this.stateProps = nextStateProps;
return true;
};
Connect.prototype.updateDispatchProps = function updateDispatchProps() {
var props = arguments.length <= 0 || arguments[0] === undefined ? this.props : arguments[0];
var nextDispatchProps = computeDispatchProps(this.store, props);
if (_utilsShallowEqual2['default'](nextDispatchProps, this.dispatchProps)) {
return false;
}
this.dispatchProps = nextDispatchProps;
return true;
};
Connect.prototype.updateState = function updateState() {
var props = arguments.length <= 0 || arguments[0] === undefined ? this.props : arguments[0];
this.nextState = this.computeNextState(props);
};
Connect.prototype.isSubscribed = function isSubscribed() {
return typeof this.unsubscribe === 'function';
};
Connect.prototype.trySubscribe = function trySubscribe() {
if (shouldSubscribe && !this.unsubscribe) {
this.unsubscribe = this.store.subscribe(this.handleChange.bind(this));
this.handleChange();
}
};
Connect.prototype.tryUnsubscribe = function tryUnsubscribe() {
if (this.unsubscribe) {
this.unsubscribe();
this.unsubscribe = null;
}
};
Connect.prototype.componentDidMount = function componentDidMount() {
this.trySubscribe();
};
Connect.prototype.componentWillUnmount = function componentWillUnmount() {
this.tryUnsubscribe();
};
Connect.prototype.handleChange = function handleChange() {
if (!this.unsubscribe) {
return;
}
this.setState({
storeState: this.store.getState()
});
};
Connect.prototype.getWrappedInstance = function getWrappedInstance() {
return this.refs.wrappedInstance;
};
Connect.prototype.render = function render() {
return React.createElement(WrappedComponent, _extends({ ref: 'wrappedInstance'
}, this.nextState));
};
return Connect;
})(Component);
Connect.displayName = 'Connect(' + getDisplayName(WrappedComponent) + ')';
Connect.WrappedComponent = WrappedComponent;
Connect.contextTypes = {
store: storeShape
};
Connect.propTypes = {
store: storeShape
};
if (true) {
Connect.prototype.componentWillUpdate = function componentWillUpdate() {
if (this.version === version) {
return;
}
// We are hot reloading!
this.version = version;
// Update the state and bindings.
this.trySubscribe();
this.updateStateProps();
this.updateDispatchProps();
this.updateState();
};
}
return _hoistNonReactStatics2['default'](Connect, WrappedComponent);
};
};
}
module.exports = exports['default'];
/***/ },
/* 46 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports['default'] = createProvider;
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 _utilsCreateStoreShape = __webpack_require__(16);
var _utilsCreateStoreShape2 = _interopRequireDefault(_utilsCreateStoreShape);
function isUsingOwnerContext(React) {
var version = React.version;
if (typeof version !== 'string') {
return true;
}
var sections = version.split('.');
var major = parseInt(sections[0], 10);
var minor = parseInt(sections[1], 10);
return major === 0 && minor === 13;
}
function createProvider(React) {
var Component = React.Component;
var PropTypes = React.PropTypes;
var Children = React.Children;
var storeShape = _utilsCreateStoreShape2['default'](PropTypes);
var requireFunctionChild = isUsingOwnerContext(React);
var didWarnAboutChild = false;
function warnAboutFunctionChild() {
if (didWarnAboutChild || requireFunctionChild) {
return;
}
didWarnAboutChild = true;
console.error( // eslint-disable-line no-console
'With React 0.14 and later versions, you no longer need to ' + 'wrap <Provider> child into a function.');
}
function warnAboutElementChild() {
if (didWarnAboutChild || !requireFunctionChild) {
return;
}
didWarnAboutChild = true;
console.error( // eslint-disable-line no-console
'With React 0.13, you need to ' + 'wrap <Provider> child into a function. ' + 'This restriction will be removed with React 0.14.');
}
var didWarnAboutReceivingStore = false;
function warnAboutReceivingStore() {
if (didWarnAboutReceivingStore) {
return;
}
didWarnAboutReceivingStore = true;
console.error( // eslint-disable-line no-console
'<Provider> does not support changing `store` on the fly. ' + 'It is most likely that you see this error because you updated to ' + 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' + 'automatically. See https://github.com/rackt/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.');
}
var Provider = (function (_Component) {
_inherits(Provider, _Component);
Provider.prototype.getChildContext = function getChildContext() {
return { store: this.store };
};
function Provider(props, context) {
_classCallCheck(this, Provider);
_Component.call(this, props, context);
this.store = props.store;
}
Provider.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
var store = this.store;
var nextStore = nextProps.store;
if (store !== nextStore) {
warnAboutReceivingStore();
}
};
Provider.prototype.render = function render() {
var children = this.props.children;
if (typeof children === 'function') {
warnAboutFunctionChild();
children = children();
} else {
warnAboutElementChild();
}
return Children.only(children);
};
return Provider;
})(Component);
Provider.childContextTypes = {
store: storeShape.isRequired
};
Provider.propTypes = {
store: storeShape.isRequired,
children: (requireFunctionChild ? PropTypes.func : PropTypes.element).isRequired
};
return Provider;
}
module.exports = exports['default'];
/***/ },
/* 47 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _react = __webpack_require__(22);
var _react2 = _interopRequireDefault(_react);
var _componentsCreateAll = __webpack_require__(44);
var _componentsCreateAll2 = _interopRequireDefault(_componentsCreateAll);
var _createAll = _componentsCreateAll2['default'](_react2['default']);
var Provider = _createAll.Provider;
var connect = _createAll.connect;
exports.Provider = Provider;
exports.connect = connect;
/***/ },
/* 48 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports['default'] = isPlainObject;
var fnToString = function fnToString(fn) {
return Function.prototype.toString.call(fn);
};
/**
* @param {any} obj The object to inspect.
* @returns {boolean} True if the argument appears to be a plain object.
*/
function isPlainObject(obj) {
if (!obj || typeof obj !== 'object') {
return false;
}
var proto = typeof obj.constructor === 'function' ? Object.getPrototypeOf(obj) : Object.prototype;
if (proto === null) {
return true;
}
var constructor = proto.constructor;
return typeof constructor === 'function' && constructor instanceof constructor && fnToString(constructor) === fnToString(Object);
}
module.exports = exports['default'];
/***/ },
/* 49 */
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = shallowEqual;
function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
// Test for A's keys different from B.
var hasOwn = Object.prototype.hasOwnProperty;
for (var i = 0; i < keysA.length; i++) {
if (!hasOwn.call(objB, keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
return false;
}
}
return true;
}
module.exports = exports["default"];
/***/ },
/* 50 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports['default'] = wrapActionCreators;
var _redux = __webpack_require__(18);
function wrapActionCreators(actionCreators) {
return function (dispatch) {
return _redux.bindActionCreators(actionCreators, dispatch);
};
}
module.exports = exports['default'];
/***/ },
/* 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; };
exports['default'] = applyMiddleware;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _compose = __webpack_require__(19);
var _compose2 = _interopRequireDefault(_compose);
/**
* Creates a store enhancer that applies middleware to the dispatch method
* of the Redux store. This is handy for a variety of tasks, such as expressing
* asynchronous actions in a concise manner, or logging every action payload.
*
* See `redux-thunk` package as an example of the Redux middleware.
*
* Because middleware is potentially asynchronous, this should be the first
* store enhancer in the composition chain.
*
* Note that each middleware will be given the `dispatch` and `getState` functions
* as named arguments.
*
* @param {...Function} middlewares The middleware chain to be applied.
* @returns {Function} A store enhancer applying the middleware.
*/
function applyMiddleware() {
for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {
middlewares[_key] = arguments[_key];
}
return function (next) {
return function (reducer, initialState) {
var store = next(reducer, initialState);
var _dispatch = store.dispatch;
var chain = [];
var middlewareAPI = {
getState: store.getState,
dispatch: function dispatch(action) {
return _dispatch(action);
}
};
chain = middlewares.map(function (middleware) {
return middleware(middlewareAPI);
});
_dispatch = _compose2['default'].apply(undefined, chain)(store.dispatch);
return _extends({}, store, {
dispatch: _dispatch
});
};
};
}
module.exports = exports['default'];
/***/ },
/* 52 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports['default'] = bindActionCreators;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _utilsMapValues = __webpack_require__(21);
var _utilsMapValues2 = _interopRequireDefault(_utilsMapValues);
function bindActionCreator(actionCreator, dispatch) {
return function () {
return dispatch(actionCreator.apply(undefined, arguments));
};
}
/**
* Turns an object whose values are action creators, into an object with the
* same keys, but with every function wrapped into a `dispatch` call so they
* may be invoked directly. This is just a convenience method, as you can call
* `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
*
* For convenience, you can also pass a single function as the first argument,
* and get a function in return.
*
* @param {Function|Object} actionCreators An object whose values are action
* creator functions. One handy way to obtain it is to use ES6 `import * as`
* syntax. You may also pass a single function.
*
* @param {Function} dispatch The `dispatch` function available on your Redux
* store.
*
* @returns {Function|Object} The object mimicking the original object, but with
* every action creator wrapped into the `dispatch` call. If you passed a
* function as `actionCreators`, the return value will also be a single
* function.
*/
function bindActionCreators(actionCreators, dispatch) {
if (typeof actionCreators === 'function') {
return bindActionCreator(actionCreators, dispatch);
}
if (typeof actionCreators !== 'object' || actionCreators === null || actionCreators === undefined) {
// eslint-disable-line no-eq-null
throw new Error('bindActionCreators expected an object or a function, instead received ' + (actionCreators === null ? 'null' : typeof actionCreators) + '. ' + 'Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');
}
return _utilsMapValues2['default'](actionCreators, function (actionCreator) {
return bindActionCreator(actionCreator, dispatch);
});
}
module.exports = exports['default'];
/***/ },
/* 53 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports['default'] = combineReducers;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _createStore = __webpack_require__(17);
var _utilsIsPlainObject = __webpack_require__(20);
var _utilsIsPlainObject2 = _interopRequireDefault(_utilsIsPlainObject);
var _utilsMapValues = __webpack_require__(21);
var _utilsMapValues2 = _interopRequireDefault(_utilsMapValues);
var _utilsPick = __webpack_require__(54);
var _utilsPick2 = _interopRequireDefault(_utilsPick);
/* eslint-disable no-console */
function getUndefinedStateErrorMessage(key, action) {
var actionType = action && action.type;
var actionName = actionType && '"' + actionType.toString() + '"' || 'an action';
return 'Reducer "' + key + '" returned undefined handling ' + actionName + '. ' + 'To ignore an action, you must explicitly return the previous state.';
}
function getUnexpectedStateKeyWarningMessage(inputState, outputState, action) {
var reducerKeys = Object.keys(outputState);
var argumentName = action && action.type === _createStore.ActionTypes.INIT ? 'initialState argument passed to createStore' : 'previous state received by the reducer';
if (reducerKeys.length === 0) {
return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
}
if (!_utilsIsPlainObject2['default'](inputState)) {
return 'The ' + argumentName + ' has unexpected type of "' + ({}).toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + '". Expected argument to be an object with the following ' + ('keys: "' + reducerKeys.join('", "') + '"');
}
var unexpectedKeys = Object.keys(inputState).filter(function (key) {
return reducerKeys.indexOf(key) < 0;
});
if (unexpectedKeys.length > 0) {
return 'Unexpected ' + (unexpectedKeys.length > 1 ? 'keys' : 'key') + ' ' + ('"' + unexpectedKeys.join('", "') + '" found in ' + argumentName + '. ') + 'Expected to find one of the known reducer keys instead: ' + ('"' + reducerKeys.join('", "') + '". Unexpected keys will be ignored.');
}
}
function assertReducerSanity(reducers) {
Object.keys(reducers).forEach(function (key) {
var reducer = reducers[key];
var initialState = reducer(undefined, { type: _createStore.ActionTypes.INIT });
if (typeof initialState === 'undefined') {
throw new Error('Reducer "' + key + '" returned undefined during initialization. ' + 'If the state passed to the reducer is undefined, you must ' + 'explicitly return the initial state. The initial state may ' + 'not be undefined.');
}
var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.');
if (typeof reducer(undefined, { type: type }) === 'undefined') {
throw new Error('Reducer "' + key + '" returned undefined when probed with a random type. ' + ('Don\'t try to handle ' + _createStore.ActionTypes.INIT + ' or other actions in "redux/*" ') + 'namespace. They are considered private. Instead, you must return the ' + 'current state for any unknown actions, unless it is undefined, ' + 'in which case you must return the initial state, regardless of the ' + 'action type. The initial state may not be undefined.');
}
});
}
/**
* Turns an object whose values are different reducer functions, into a single
* reducer function. It will call every child reducer, and gather their results
* into a single state object, whose keys correspond to the keys of the passed
* reducer functions.
*
* @param {Object} reducers An object whose values correspond to different
* reducer functions that need to be combined into one. One handy way to obtain
* it is to use ES6 `import * as reducers` syntax. The reducers may never return
* undefined for any action. Instead, they should return their initial state
* if the state passed to them was undefined, and the current state for any
* unrecognized action.
*
* @returns {Function} A reducer function that invokes every reducer inside the
* passed object, and builds a state object with the same shape.
*/
function combineReducers(reducers) {
var finalReducers = _utilsPick2['default'](reducers, function (val) {
return typeof val === 'function';
});
var sanityError;
try {
assertReducerSanity(finalReducers);
} catch (e) {
sanityError = e;
}
var defaultState = _utilsMapValues2['default'](finalReducers, function () {
return undefined;
});
return function combination(state, action) {
if (state === undefined) state = defaultState;
if (sanityError) {
throw sanityError;
}
var hasChanged = false;
var finalState = _utilsMapValues2['default'](finalReducers, function (reducer, key) {
var previousStateForKey = state[key];
var nextStateForKey = reducer(previousStateForKey, action);
if (typeof nextStateForKey === 'undefined') {
var errorMessage = getUndefinedStateErrorMessage(key, action);
throw new Error(errorMessage);
}
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
return nextStateForKey;
});
if (true) {
var warningMessage = getUnexpectedStateKeyWarningMessage(state, finalState, action);
if (warningMessage) {
console.error(warningMessage);
}
}
return hasChanged ? finalState : state;
};
}
module.exports = exports['default'];
/***/ },
/* 54 */
/***/ function(module, exports) {
/**
* Picks key-value pairs from an object where values satisfy a predicate.
*
* @param {Object} obj The object to pick from.
* @param {Function} fn The predicate the values must satisfy to be copied.
* @returns {Object} The object with the values that satisfied the predicate.
*/
"use strict";
exports.__esModule = true;
exports["default"] = pick;
function pick(obj, fn) {
return Object.keys(obj).reduce(function (result, key) {
if (fn(obj[key])) {
result[key] = obj[key];
}
return result;
}, {});
}
module.exports = exports["default"];
/***/ }
/******/ ])
});
;
|
wp-includes/js/jquery/jquery.js
|
trevorgreenleaf/zoom
|
/*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.3",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b="length"in a&&a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function qa(){}qa.prototype=d.filters=d.pseudos,d.setFilters=new qa,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function ra(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;
return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function aa(){return!0}function ba(){return!1}function ca(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},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(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==ca()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===ca()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?aa:ba):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:ba,isPropagationStopped:ba,isImmediatePropagationStopped:ba,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=aa,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=aa,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=aa,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=ba;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=ba),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function da(a){var b=ea.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var ea="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fa=/ jQuery\d+="(?:null|\d+)"/g,ga=new RegExp("<(?:"+ea+")[\\s/>]","i"),ha=/^\s+/,ia=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ja=/<([\w:]+)/,ka=/<tbody/i,la=/<|&#?\w+;/,ma=/<(?:script|style|link)/i,na=/checked\s*(?:[^=]|=\s*.checked.)/i,oa=/^$|\/(?:java|ecma)script/i,pa=/^true\/(.*)/,qa=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ra={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:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sa=da(y),ta=sa.appendChild(y.createElement("div"));ra.optgroup=ra.option,ra.tbody=ra.tfoot=ra.colgroup=ra.caption=ra.thead,ra.th=ra.td;function ua(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ua(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function va(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wa(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xa(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function ya(a){var b=pa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function za(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Aa(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Ba(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xa(b).text=a.text,ya(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!ga.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ta.innerHTML=a.outerHTML,ta.removeChild(f=ta.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ua(f),h=ua(a),g=0;null!=(e=h[g]);++g)d[g]&&Ba(e,d[g]);if(b)if(c)for(h=h||ua(a),d=d||ua(f),g=0;null!=(e=h[g]);g++)Aa(e,d[g]);else Aa(a,f);return d=ua(f,"script"),d.length>0&&za(d,!i&&ua(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=da(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(la.test(f)){h=h||o.appendChild(b.createElement("div")),i=(ja.exec(f)||["",""])[1].toLowerCase(),l=ra[i]||ra._default,h.innerHTML=l[1]+f.replace(ia,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&ha.test(f)&&p.push(b.createTextNode(ha.exec(f)[0])),!k.tbody){f="table"!==i||ka.test(f)?"<table>"!==l[1]||ka.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ua(p,"input"),va),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ua(o.appendChild(f),"script"),g&&za(h),c)){e=0;while(f=h[e++])oa.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ua(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&za(ua(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ua(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fa,""):void 0;if(!("string"!=typeof a||ma.test(a)||!k.htmlSerialize&&ga.test(a)||!k.leadingWhitespace&&ha.test(a)||ra[(ja.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ia,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ua(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ua(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&na.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ua(i,"script"),xa),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ua(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,ya),j=0;f>j;j++)d=g[j],oa.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qa,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Ca,Da={};function Ea(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fa(a){var b=y,c=Da[a];return c||(c=Ea(a,b),"none"!==c&&c||(Ca=(Ca||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Ca[0].contentWindow||Ca[0].contentDocument).document,b.write(),b.close(),c=Ea(a,b),Ca.detach()),Da[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Ga=/^margin/,Ha=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ia,Ja,Ka=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ia=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Ha.test(g)&&Ga.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ia=function(a){return a.currentStyle},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Ha.test(g)&&!Ka.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function La(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight),b.removeChild(i)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Ma=/alpha\([^)]*\)/i,Na=/opacity\s*=\s*([^)]*)/,Oa=/^(none|table(?!-c[ea]).+)/,Pa=new RegExp("^("+S+")(.*)$","i"),Qa=new RegExp("^([+-])=("+S+")","i"),Ra={position:"absolute",visibility:"hidden",display:"block"},Sa={letterSpacing:"0",fontWeight:"400"},Ta=["Webkit","O","Moz","ms"];function Ua(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Ta.length;while(e--)if(b=Ta[e]+c,b in a)return b;return d}function Va(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fa(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wa(a,b,c){var d=Pa.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xa(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Ya(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ia(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Ja(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ha.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xa(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Ja(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ua(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qa.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ua(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Ja(a,b,d)),"normal"===f&&b in Sa&&(f=Sa[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Oa.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Ra,function(){return Ya(a,b,d)}):Ya(a,b,d):void 0},set:function(a,c,d){var e=d&&Ia(a);return Wa(a,c,d?Xa(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Na.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Ma,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Ma.test(f)?f.replace(Ma,e):f+" "+e)}}),m.cssHooks.marginRight=La(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Ja,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Ga.test(a)||(m.cssHooks[a+b].set=Wa)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ia(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Va(this,!0)},hide:function(){return Va(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Za(a,b,c,d,e){
return new Za.prototype.init(a,b,c,d,e)}m.Tween=Za,Za.prototype={constructor:Za,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")},cur:function(){var a=Za.propHooks[this.prop];return a&&a.get?a.get(this):Za.propHooks._default.get(this)},run:function(a){var b,c=Za.propHooks[this.prop];return this.options.duration?this.pos=b=m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Za.propHooks._default.set(this),this}},Za.prototype.init.prototype=Za.prototype,Za.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Za.propHooks.scrollTop=Za.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Za.prototype.init,m.fx.step={};var $a,_a,ab=/^(?:toggle|show|hide)$/,bb=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cb=/queueHooks$/,db=[ib],eb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bb.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bb.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fb(){return setTimeout(function(){$a=void 0}),$a=m.now()}function gb(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hb(a,b,c){for(var d,e=(eb[b]||[]).concat(eb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ib(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fa(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fa(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ab.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fa(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hb(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jb(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kb(a,b,c){var d,e,f=0,g=db.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$a||fb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$a||fb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jb(k,j.opts.specialEasing);g>f;f++)if(d=db[f].call(j,a,k,j.opts))return d;return m.map(k,hb,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kb,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],eb[c]=eb[c]||[],eb[c].unshift(b)},prefilter:function(a,b){b?db.unshift(a):db.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kb(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gb(b,!0),a,d,e)}}),m.each({slideDown:gb("show"),slideUp:gb("hide"),slideToggle:gb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($a=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$a=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_a||(_a=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_a),_a=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lb=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lb,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mb,nb,ob=m.expr.attrHandle,pb=/^(?:checked|selected)$/i,qb=k.getSetAttribute,rb=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nb:mb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rb&&qb||!pb.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qb?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nb={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rb&&qb||!pb.test(c)?a.setAttribute(!qb&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=ob[b]||m.find.attr;ob[b]=rb&&qb||!pb.test(b)?function(a,b,d){var e,f;return d||(f=ob[b],ob[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,ob[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rb&&qb||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mb&&mb.set(a,b,c)}}),qb||(mb={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},ob.id=ob.name=ob.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mb.set},m.attrHooks.contenteditable={set:function(a,b,c){mb.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sb=/^(?:input|select|textarea|button|object)$/i,tb=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sb.test(a.nodeName)||tb.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var ub=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ub," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ub," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ub," ").indexOf(b)>=0)return!0;return!1}}),m.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(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vb=m.now(),wb=/\?/,xb=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xb,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yb,zb,Ab=/#.*$/,Bb=/([?&])_=[^&]*/,Cb=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Db=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Eb=/^(?:GET|HEAD)$/,Fb=/^\/\//,Gb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hb={},Ib={},Jb="*/".concat("*");try{zb=location.href}catch(Kb){zb=y.createElement("a"),zb.href="",zb=zb.href}yb=Gb.exec(zb.toLowerCase())||[];function Lb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mb(a,b,c,d){var e={},f=a===Ib;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nb(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Ob(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zb,type:"GET",isLocal:Db.test(yb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jb,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":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nb(Nb(a,m.ajaxSettings),b):Nb(m.ajaxSettings,a)},ajaxPrefilter:Lb(Hb),ajaxTransport:Lb(Ib),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cb.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zb)+"").replace(Ab,"").replace(Fb,yb[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gb.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yb[1]&&c[2]===yb[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yb[3]||("http:"===yb[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mb(Hb,k,b,v),2===t)return v;h=m.event&&k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Eb.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wb.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bb.test(e)?e.replace(Bb,"$1_="+vb++):e+(wb.test(e)?"&":"?")+"_="+vb++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jb+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mb(Ib,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Ob(k,v,c)),u=Pb(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qb=/%20/g,Rb=/\[\]$/,Sb=/\r?\n/g,Tb=/^(?:submit|button|image|reset|file)$/i,Ub=/^(?:input|select|textarea|keygen)/i;function Vb(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rb.test(a)?d(a,e):Vb(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vb(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vb(c,a[c],b,e);return d.join("&").replace(Qb,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Ub.test(this.nodeName)&&!Tb.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sb,"\r\n")}}):{name:b.name,value:c.replace(Sb,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zb()||$b()}:Zb;var Wb=0,Xb={},Yb=m.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Xb)Xb[a](void 0,!0)}),k.cors=!!Yb&&"withCredentials"in Yb,Yb=k.ajax=!!Yb,Yb&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wb;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xb[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xb[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zb(){try{return new a.XMLHttpRequest}catch(b){}}function $b(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _b=[],ac=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_b.pop()||m.expando+"_"+vb++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ac.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ac.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ac,"$1"+e):b.jsonp!==!1&&(b.url+=(wb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_b.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bc=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bc)return bc.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cc=a.document.documentElement;function dc(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dc(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cc;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cc})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dc(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=La(k.pixelPosition,function(a,c){return c?(c=Ja(a,b),Ha.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ec=a.jQuery,fc=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fc),b&&a.jQuery===m&&(a.jQuery=ec),m},typeof b===K&&(a.jQuery=a.$=m),m});
jQuery.noConflict();
|
ajax/libs/Sly/1.3.0/sly.js
|
lobbin/cdnjs
|
/*!
* sly 1.3.0 - 30th Nov 2014
* https://github.com/darsain/sly
*
* Licensed under the MIT license.
* http://opensource.org/licenses/MIT
*/
;(function ($, w, undefined) {
'use strict';
var pluginName = 'sly';
var className = 'Sly';
var namespace = pluginName;
// Local WindowAnimationTiming interface
var cAF = w.cancelAnimationFrame || w.cancelRequestAnimationFrame;
var rAF = w.requestAnimationFrame;
// Support indicators
var transform, gpuAcceleration;
// Other global values
var $doc = $(document);
var dragInitEvents = 'touchstart.' + namespace + ' mousedown.' + namespace;
var dragMouseEvents = 'mousemove.' + namespace + ' mouseup.' + namespace;
var dragTouchEvents = 'touchmove.' + namespace + ' touchend.' + namespace;
var wheelEvent = (document.implementation.hasFeature('Event.wheel', '3.0') ? 'wheel.' : 'mousewheel.') + namespace;
var clickEvent = 'click.' + namespace;
var mouseDownEvent = 'mousedown.' + namespace;
var interactiveElements = ['INPUT', 'SELECT', 'BUTTON', 'TEXTAREA'];
var tmpArray = [];
var time;
// Math shorthands
var abs = Math.abs;
var sqrt = Math.sqrt;
var pow = Math.pow;
var round = Math.round;
var max = Math.max;
var min = Math.min;
// Keep track of last fired global wheel event
var lastGlobalWheel = 0;
$doc.on(wheelEvent, function () {
lastGlobalWheel = +new Date();
});
/**
* Sly.
*
* @class
*
* @param {Element} frame DOM element of sly container.
* @param {Object} options Object with options.
* @param {Object} callbackMap Callbacks map.
*/
function Sly(frame, options, callbackMap) {
// Extend options
var o = $.extend({}, Sly.defaults, options);
// Private variables
var self = this;
var parallax = isNumber(frame);
// Frame
var $frame = $(frame);
var $slidee = $frame.children().eq(0);
var frameSize = 0;
var slideeSize = 0;
var pos = {
start: 0,
center: 0,
end: 0,
cur: 0,
dest: 0
};
// Scrollbar
var $sb = $(o.scrollBar).eq(0);
var $handle = $sb.children().eq(0);
var sbSize = 0;
var handleSize = 0;
var hPos = {
start: 0,
end: 0,
cur: 0
};
// Pagesbar
var $pb = $(o.pagesBar);
var $pages = 0;
var pages = [];
// Items
var $items = 0;
var items = [];
var rel = {
firstItem: 0,
lastItem: 0,
centerItem: 0,
activeItem: -1,
activePage: 0
};
// Styles
var frameStyles = new StyleRestorer($frame[0]);
var slideeStyles = new StyleRestorer($slidee[0]);
var sbStyles = new StyleRestorer($sb[0]);
var handleStyles = new StyleRestorer($handle[0]);
// Navigation type booleans
var basicNav = o.itemNav === 'basic';
var forceCenteredNav = o.itemNav === 'forceCentered';
var centeredNav = o.itemNav === 'centered' || forceCenteredNav;
var itemNav = !parallax && (basicNav || centeredNav || forceCenteredNav);
// Miscellaneous
var $scrollSource = o.scrollSource ? $(o.scrollSource) : $frame;
var $dragSource = o.dragSource ? $(o.dragSource) : $frame;
var $forwardButton = $(o.forward);
var $backwardButton = $(o.backward);
var $prevButton = $(o.prev);
var $nextButton = $(o.next);
var $prevPageButton = $(o.prevPage);
var $nextPageButton = $(o.nextPage);
var callbacks = {};
var last = {};
var animation = {};
var move = {};
var dragging = {
released: 1
};
var scrolling = {
last: 0,
delta: 0,
resetTime: 200
};
var renderID = 0;
var historyID = 0;
var cycleID = 0;
var continuousID = 0;
var i, l;
// Normalizing frame
if (!parallax) {
frame = $frame[0];
}
// Expose properties
self.initialized = 0;
self.frame = frame;
self.slidee = $slidee[0];
self.pos = pos;
self.rel = rel;
self.items = items;
self.pages = pages;
self.isPaused = 0;
self.options = o;
self.dragging = dragging;
/**
* (Re)Loading function.
*
* Populate arrays, set sizes, bind events, ...
*
* @return {Void}
*/
function load() {
if (!self.initialized) {
return;
}
// Local variables
var lastItemsCount = 0;
var lastPagesCount = pages.length;
// Save old position
pos.old = $.extend({}, pos);
// Reset global variables
frameSize = parallax ? 0 : $frame[o.horizontal ? 'width' : 'height']();
sbSize = $sb[o.horizontal ? 'width' : 'height']();
slideeSize = parallax ? frame : $slidee[o.horizontal ? 'outerWidth' : 'outerHeight']();
pages.length = 0;
// Set position limits & relatives
pos.start = 0;
pos.end = max(slideeSize - frameSize, 0);
// Sizes & offsets for item based navigations
if (itemNav) {
// Save the number of current items
lastItemsCount = items.length;
// Reset itemNav related variables
$items = $slidee.children(o.itemSelector);
items.length = 0;
// Needed variables
var paddingStart = getPx($slidee, o.horizontal ? 'paddingLeft' : 'paddingTop');
var paddingEnd = getPx($slidee, o.horizontal ? 'paddingRight' : 'paddingBottom');
var borderBox = $($items).css('boxSizing') === 'border-box';
var areFloated = $items.css('float') !== 'none';
var ignoredMargin = 0;
var lastItemIndex = $items.length - 1;
var lastItem;
// Reset slideeSize
slideeSize = 0;
// Iterate through items
$items.each(function (i, element) {
// Item
var $item = $(element);
var itemSize = $item[o.horizontal ? 'outerWidth' : 'outerHeight']();
var itemMarginStart = getPx($item, o.horizontal ? 'marginLeft' : 'marginTop');
var itemMarginEnd = getPx($item, o.horizontal ? 'marginRight' : 'marginBottom');
var itemSizeFull = itemSize + itemMarginStart + itemMarginEnd;
var singleSpaced = !itemMarginStart || !itemMarginEnd;
var item = {};
item.el = element;
item.size = singleSpaced ? itemSize : itemSizeFull;
item.half = item.size / 2;
item.start = slideeSize + (singleSpaced ? itemMarginStart : 0);
item.center = item.start - round(frameSize / 2 - item.size / 2);
item.end = item.start - frameSize + item.size;
// Account for slidee padding
if (!i) {
slideeSize += paddingStart;
}
// Increment slidee size for size of the active element
slideeSize += itemSizeFull;
// Try to account for vertical margin collapsing in vertical mode
// It's not bulletproof, but should work in 99% of cases
if (!o.horizontal && !areFloated) {
// Subtract smaller margin, but only when top margin is not 0, and this is not the first element
if (itemMarginEnd && itemMarginStart && i > 0) {
slideeSize -= min(itemMarginStart, itemMarginEnd);
}
}
// Things to be done on last item
if (i === lastItemIndex) {
item.end += paddingEnd;
slideeSize += paddingEnd;
ignoredMargin = singleSpaced ? itemMarginEnd : 0;
}
// Add item object to items array
items.push(item);
lastItem = item;
});
// Resize SLIDEE to fit all items
$slidee[0].style[o.horizontal ? 'width' : 'height'] = (borderBox ? slideeSize: slideeSize - paddingStart - paddingEnd) + 'px';
// Adjust internal SLIDEE size for last margin
slideeSize -= ignoredMargin;
// Set limits
if (items.length) {
pos.start = items[0][forceCenteredNav ? 'center' : 'start'];
pos.end = forceCenteredNav ? lastItem.center : frameSize < slideeSize ? lastItem.end : pos.start;
} else {
pos.start = pos.end = 0;
}
}
// Calculate SLIDEE center position
pos.center = round(pos.end / 2 + pos.start / 2);
// Update relative positions
updateRelatives();
// Scrollbar
if ($handle.length && sbSize > 0) {
// Stretch scrollbar handle to represent the visible area
if (o.dynamicHandle) {
handleSize = pos.start === pos.end ? sbSize : round(sbSize * frameSize / slideeSize);
handleSize = within(handleSize, o.minHandleSize, sbSize);
$handle[0].style[o.horizontal ? 'width' : 'height'] = handleSize + 'px';
} else {
handleSize = $handle[o.horizontal ? 'outerWidth' : 'outerHeight']();
}
hPos.end = sbSize - handleSize;
if (!renderID) {
syncScrollbar();
}
}
// Pages
if (!parallax && frameSize > 0) {
var tempPagePos = pos.start;
var pagesHtml = '';
// Populate pages array
if (itemNav) {
$.each(items, function (i, item) {
if (forceCenteredNav) {
pages.push(item.center);
} else if (item.start + item.size > tempPagePos && tempPagePos <= pos.end) {
tempPagePos = item.start;
pages.push(tempPagePos);
tempPagePos += frameSize;
if (tempPagePos > pos.end && tempPagePos < pos.end + frameSize) {
pages.push(pos.end);
}
}
});
} else {
while (tempPagePos - frameSize < pos.end) {
pages.push(tempPagePos);
tempPagePos += frameSize;
}
}
// Pages bar
if ($pb[0] && lastPagesCount !== pages.length) {
for (var i = 0; i < pages.length; i++) {
pagesHtml += o.pageBuilder.call(self, i);
}
$pages = $pb.html(pagesHtml).children();
$pages.eq(rel.activePage).addClass(o.activeClass);
}
}
// Extend relative variables object with some useful info
rel.slideeSize = slideeSize;
rel.frameSize = frameSize;
rel.sbSize = sbSize;
rel.handleSize = handleSize;
// Activate requested position
if (itemNav) {
if (!self.initialized) {
activate(o.startAt);
self[centeredNav ? 'toCenter' : 'toStart'](o.startAt);
} else if (rel.activeItem >= items.length || lastItemsCount === 0 && items.length > 0) {
// Activate last item if previous active has been removed, or first item
// when there were no items before, and new got appended.
activate(rel.activeItem >= items.length ? items.length - 1 : 0, !lastItemsCount);
}
// Fix possible overflowing
var activeItem = items[rel.activeItem];
slideTo(centeredNav && activeItem ? activeItem.center : within(pos.dest, pos.start, pos.end));
} else {
if (!self.initialized) {
slideTo(o.startAt, 1);
} else {
// Fix possible overflowing
slideTo(within(pos.dest, pos.start, pos.end));
}
}
// Trigger load event
trigger('load');
}
self.reload = load;
/**
* Animate to a position.
*
* @param {Int} newPos New position.
* @param {Bool} immediate Reposition immediately without an animation.
* @param {Bool} dontAlign Do not align items, use the raw position passed in first argument.
*
* @return {Void}
*/
function slideTo(newPos, immediate, dontAlign) {
// Align items
if (itemNav && dragging.released && !dontAlign) {
var tempRel = getRelatives(newPos);
var isNotBordering = newPos > pos.start && newPos < pos.end;
if (centeredNav) {
if (isNotBordering) {
newPos = items[tempRel.centerItem].center;
}
if (forceCenteredNav && o.activateMiddle) {
activate(tempRel.centerItem);
}
} else if (isNotBordering) {
newPos = items[tempRel.firstItem].start;
}
}
// Handle overflowing position limits
if (dragging.init && dragging.slidee && o.elasticBounds) {
if (newPos > pos.end) {
newPos = pos.end + (newPos - pos.end) / 6;
} else if (newPos < pos.start) {
newPos = pos.start + (newPos - pos.start) / 6;
}
} else {
newPos = within(newPos, pos.start, pos.end);
}
// Update the animation object
animation.start = +new Date();
animation.time = 0;
animation.from = pos.cur;
animation.to = newPos;
animation.delta = newPos - pos.cur;
animation.tweesing = dragging.tweese || dragging.init && !dragging.slidee;
animation.immediate = !animation.tweesing && (immediate || dragging.init && dragging.slidee || !o.speed);
// Reset dragging tweesing request
dragging.tweese = 0;
// Start animation rendering
if (newPos !== pos.dest) {
pos.dest = newPos;
trigger('change');
if (!renderID) {
render();
}
}
// Reset next cycle timeout
resetCycle();
// Synchronize states
updateRelatives();
updateButtonsState();
syncPagesbar();
}
/**
* Render animation frame.
*
* @return {Void}
*/
function render() {
if (!self.initialized) {
return;
}
// If first render call, wait for next animationFrame
if (!renderID) {
renderID = rAF(render);
if (dragging.released) {
trigger('moveStart');
}
return;
}
// If immediate repositioning is requested, don't animate.
if (animation.immediate) {
pos.cur = animation.to;
}
// Use tweesing for animations without known end point
else if (animation.tweesing) {
animation.tweeseDelta = animation.to - pos.cur;
// Fuck Zeno's paradox
if (abs(animation.tweeseDelta) < 0.1) {
pos.cur = animation.to;
} else {
pos.cur += animation.tweeseDelta * (dragging.released ? o.swingSpeed : o.syncSpeed);
}
}
// Use tweening for basic animations with known end point
else {
animation.time = min(+new Date() - animation.start, o.speed);
pos.cur = animation.from + animation.delta * jQuery.easing[o.easing](animation.time/o.speed, animation.time, 0, 1, o.speed);
}
// If there is nothing more to render break the rendering loop, otherwise request new animation frame.
if (animation.to === pos.cur) {
pos.cur = animation.to;
dragging.tweese = renderID = 0;
} else {
renderID = rAF(render);
}
trigger('move');
// Update SLIDEE position
if (!parallax) {
if (transform) {
$slidee[0].style[transform] = gpuAcceleration + (o.horizontal ? 'translateX' : 'translateY') + '(' + (-pos.cur) + 'px)';
} else {
$slidee[0].style[o.horizontal ? 'left' : 'top'] = -round(pos.cur) + 'px';
}
}
// When animation reached the end, and dragging is not active, trigger moveEnd
if (!renderID && dragging.released) {
trigger('moveEnd');
}
syncScrollbar();
}
/**
* Synchronizes scrollbar with the SLIDEE.
*
* @return {Void}
*/
function syncScrollbar() {
if ($handle.length) {
hPos.cur = pos.start === pos.end ? 0 : (((dragging.init && !dragging.slidee) ? pos.dest : pos.cur) - pos.start) / (pos.end - pos.start) * hPos.end;
hPos.cur = within(round(hPos.cur), hPos.start, hPos.end);
if (last.hPos !== hPos.cur) {
last.hPos = hPos.cur;
if (transform) {
$handle[0].style[transform] = gpuAcceleration + (o.horizontal ? 'translateX' : 'translateY') + '(' + hPos.cur + 'px)';
} else {
$handle[0].style[o.horizontal ? 'left' : 'top'] = hPos.cur + 'px';
}
}
}
}
/**
* Synchronizes pagesbar with SLIDEE.
*
* @return {Void}
*/
function syncPagesbar() {
if ($pages[0] && last.page !== rel.activePage) {
last.page = rel.activePage;
$pages.removeClass(o.activeClass).eq(rel.activePage).addClass(o.activeClass);
trigger('activePage', last.page);
}
}
/**
* Returns the position object.
*
* @param {Mixed} item
*
* @return {Object}
*/
self.getPos = function (item) {
if (itemNav) {
var index = getIndex(item);
return index !== -1 ? items[index] : false;
} else {
var $item = $slidee.find(item).eq(0);
if ($item[0]) {
var offset = o.horizontal ? $item.offset().left - $slidee.offset().left : $item.offset().top - $slidee.offset().top;
var size = $item[o.horizontal ? 'outerWidth' : 'outerHeight']();
return {
start: offset,
center: offset - frameSize / 2 + size / 2,
end: offset - frameSize + size,
size: size
};
} else {
return false;
}
}
};
/**
* Continuous move in a specified direction.
*
* @param {Bool} forward True for forward movement, otherwise it'll go backwards.
* @param {Int} speed Movement speed in pixels per frame. Overrides options.moveBy value.
*
* @return {Void}
*/
self.moveBy = function (speed) {
move.speed = speed;
// If already initiated, or there is nowhere to move, abort
if (dragging.init || !move.speed || pos.cur === (move.speed > 0 ? pos.end : pos.start)) {
return;
}
// Initiate move object
move.lastTime = +new Date();
move.startPos = pos.cur;
// Set dragging as initiated
continuousInit('button');
dragging.init = 1;
// Start movement
trigger('moveStart');
cAF(continuousID);
moveLoop();
};
/**
* Continuous movement loop.
*
* @return {Void}
*/
function moveLoop() {
// If there is nowhere to move anymore, stop
if (!move.speed || pos.cur === (move.speed > 0 ? pos.end : pos.start)) {
self.stop();
}
// Request new move loop if it hasn't been stopped
continuousID = dragging.init ? rAF(moveLoop) : 0;
// Update move object
move.now = +new Date();
move.pos = pos.cur + (move.now - move.lastTime) / 1000 * move.speed;
// Slide
slideTo(dragging.init ? move.pos : round(move.pos));
// Normally, this is triggered in render(), but if there
// is nothing to render, we have to do it manually here.
if (!dragging.init && pos.cur === pos.dest) {
trigger('moveEnd');
}
// Update times for future iteration
move.lastTime = move.now;
}
/**
* Stops continuous movement.
*
* @return {Void}
*/
self.stop = function () {
if (dragging.source === 'button') {
dragging.init = 0;
dragging.released = 1;
}
};
/**
* Activate previous item.
*
* @return {Void}
*/
self.prev = function () {
self.activate(rel.activeItem - 1);
};
/**
* Activate next item.
*
* @return {Void}
*/
self.next = function () {
self.activate(rel.activeItem + 1);
};
/**
* Activate previous page.
*
* @return {Void}
*/
self.prevPage = function () {
self.activatePage(rel.activePage - 1);
};
/**
* Activate next page.
*
* @return {Void}
*/
self.nextPage = function () {
self.activatePage(rel.activePage + 1);
};
/**
* Slide SLIDEE by amount of pixels.
*
* @param {Int} delta Pixels/Items. Positive means forward, negative means backward.
* @param {Bool} immediate Reposition immediately without an animation.
*
* @return {Void}
*/
self.slideBy = function (delta, immediate) {
if (!delta) {
return;
}
if (itemNav) {
self[centeredNav ? 'toCenter' : 'toStart'](
within((centeredNav ? rel.centerItem : rel.firstItem) + o.scrollBy * delta, 0, items.length)
);
} else {
slideTo(pos.dest + delta, immediate);
}
};
/**
* Animate SLIDEE to a specific position.
*
* @param {Int} pos New position.
* @param {Bool} immediate Reposition immediately without an animation.
*
* @return {Void}
*/
self.slideTo = function (pos, immediate) {
slideTo(pos, immediate);
};
/**
* Core method for handling `toLocation` methods.
*
* @param {String} location
* @param {Mixed} item
* @param {Bool} immediate
*
* @return {Void}
*/
function to(location, item, immediate) {
// Optional arguments logic
if (type(item) === 'boolean') {
immediate = item;
item = undefined;
}
if (item === undefined) {
slideTo(pos[location], immediate);
} else {
// You can't align items to sides of the frame
// when centered navigation type is enabled
if (centeredNav && location !== 'center') {
return;
}
var itemPos = self.getPos(item);
if (itemPos) {
slideTo(itemPos[location], immediate, !centeredNav);
}
}
}
/**
* Animate element or the whole SLIDEE to the start of the frame.
*
* @param {Mixed} item Item DOM element, or index starting at 0. Omitting will animate SLIDEE.
* @param {Bool} immediate Reposition immediately without an animation.
*
* @return {Void}
*/
self.toStart = function (item, immediate) {
to('start', item, immediate);
};
/**
* Animate element or the whole SLIDEE to the end of the frame.
*
* @param {Mixed} item Item DOM element, or index starting at 0. Omitting will animate SLIDEE.
* @param {Bool} immediate Reposition immediately without an animation.
*
* @return {Void}
*/
self.toEnd = function (item, immediate) {
to('end', item, immediate);
};
/**
* Animate element or the whole SLIDEE to the center of the frame.
*
* @param {Mixed} item Item DOM element, or index starting at 0. Omitting will animate SLIDEE.
* @param {Bool} immediate Reposition immediately without an animation.
*
* @return {Void}
*/
self.toCenter = function (item, immediate) {
to('center', item, immediate);
};
/**
* Get the index of an item in SLIDEE.
*
* @param {Mixed} item Item DOM element.
*
* @return {Int} Item index, or -1 if not found.
*/
function getIndex(item) {
return item != null ?
isNumber(item) ?
item >= 0 && item < items.length ? item : -1 :
$items.index(item) :
-1;
}
// Expose getIndex without lowering the compressibility of it,
// as it is used quite often throughout Sly.
self.getIndex = getIndex;
/**
* Get index of an item in SLIDEE based on a variety of input types.
*
* @param {Mixed} item DOM element, positive or negative integer.
*
* @return {Int} Item index, or -1 if not found.
*/
function getRelativeIndex(item) {
return getIndex(isNumber(item) && item < 0 ? item + items.length : item);
}
/**
* Activates an item.
*
* @param {Mixed} item Item DOM element, or index starting at 0.
*
* @return {Mixed} Activated item index or false on fail.
*/
function activate(item, force) {
var index = getIndex(item);
if (!itemNav || index < 0) {
return false;
}
// Update classes, last active index, and trigger active event only when there
// has been a change. Otherwise just return the current active index.
if (last.active !== index || force) {
// Update classes
$items.eq(rel.activeItem).removeClass(o.activeClass);
$items.eq(index).addClass(o.activeClass);
last.active = rel.activeItem = index;
updateButtonsState();
trigger('active', index);
}
return index;
}
/**
* Activates an item and helps with further navigation when o.smart is enabled.
*
* @param {Mixed} item Item DOM element, or index starting at 0.
* @param {Bool} immediate Whether to reposition immediately in smart navigation.
*
* @return {Void}
*/
self.activate = function (item, immediate) {
var index = activate(item);
// Smart navigation
if (o.smart && index !== false) {
// When centeredNav is enabled, center the element.
// Otherwise, determine where to position the element based on its current position.
// If the element is currently on the far end side of the frame, assume that user is
// moving forward and animate it to the start of the visible frame, and vice versa.
if (centeredNav) {
self.toCenter(index, immediate);
} else if (index >= rel.lastItem) {
self.toStart(index, immediate);
} else if (index <= rel.firstItem) {
self.toEnd(index, immediate);
} else {
resetCycle();
}
}
};
/**
* Activates a page.
*
* @param {Int} index Page index, starting from 0.
* @param {Bool} immediate Whether to reposition immediately without animation.
*
* @return {Void}
*/
self.activatePage = function (index, immediate) {
if (isNumber(index)) {
slideTo(pages[within(index, 0, pages.length - 1)], immediate);
}
};
/**
* Return relative positions of items based on their visibility within FRAME.
*
* @param {Int} slideePos Position of SLIDEE.
*
* @return {Void}
*/
function getRelatives(slideePos) {
slideePos = within(isNumber(slideePos) ? slideePos : pos.dest, pos.start, pos.end);
var relatives = {};
var centerOffset = forceCenteredNav ? 0 : frameSize / 2;
// Determine active page
if (!parallax) {
for (var p = 0, pl = pages.length; p < pl; p++) {
if (slideePos >= pos.end || p === pages.length - 1) {
relatives.activePage = pages.length - 1;
break;
}
if (slideePos <= pages[p] + centerOffset) {
relatives.activePage = p;
break;
}
}
}
// Relative item indexes
if (itemNav) {
var first = false;
var last = false;
var center = false;
// From start
for (var i = 0, il = items.length; i < il; i++) {
// First item
if (first === false && slideePos <= items[i].start + items[i].half) {
first = i;
}
// Center item
if (center === false && slideePos <= items[i].center + items[i].half) {
center = i;
}
// Last item
if (i === il - 1 || slideePos <= items[i].end + items[i].half) {
last = i;
break;
}
}
// Safe assignment, just to be sure the false won't be returned
relatives.firstItem = isNumber(first) ? first : 0;
relatives.centerItem = isNumber(center) ? center : relatives.firstItem;
relatives.lastItem = isNumber(last) ? last : relatives.centerItem;
}
return relatives;
}
/**
* Update object with relative positions.
*
* @param {Int} newPos
*
* @return {Void}
*/
function updateRelatives(newPos) {
$.extend(rel, getRelatives(newPos));
}
/**
* Disable navigation buttons when needed.
*
* Adds disabledClass, and when the button is <button> or <input>, activates :disabled state.
*
* @return {Void}
*/
function updateButtonsState() {
var isStart = pos.dest <= pos.start;
var isEnd = pos.dest >= pos.end;
var slideePosState = isStart ? 1 : isEnd ? 2 : 3;
// Update paging buttons only if there has been a change in SLIDEE position
if (last.slideePosState !== slideePosState) {
last.slideePosState = slideePosState;
if ($prevPageButton.is('button,input')) {
$prevPageButton.prop('disabled', isStart);
}
if ($nextPageButton.is('button,input')) {
$nextPageButton.prop('disabled', isEnd);
}
$prevPageButton.add($backwardButton)[isStart ? 'addClass' : 'removeClass'](o.disabledClass);
$nextPageButton.add($forwardButton)[isEnd ? 'addClass' : 'removeClass'](o.disabledClass);
}
// Forward & Backward buttons need a separate state caching because we cannot "property disable"
// them while they are being used, as disabled buttons stop emitting mouse events.
if (last.fwdbwdState !== slideePosState && dragging.released) {
last.fwdbwdState = slideePosState;
if ($backwardButton.is('button,input')) {
$backwardButton.prop('disabled', isStart);
}
if ($forwardButton.is('button,input')) {
$forwardButton.prop('disabled', isEnd);
}
}
// Item navigation
if (itemNav) {
var isFirst = rel.activeItem === 0;
var isLast = rel.activeItem >= items.length - 1;
var itemsButtonState = isFirst ? 1 : isLast ? 2 : 3;
if (last.itemsButtonState !== itemsButtonState) {
last.itemsButtonState = itemsButtonState;
if ($prevButton.is('button,input')) {
$prevButton.prop('disabled', isFirst);
}
if ($nextButton.is('button,input')) {
$nextButton.prop('disabled', isLast);
}
$prevButton[isFirst ? 'addClass' : 'removeClass'](o.disabledClass);
$nextButton[isLast ? 'addClass' : 'removeClass'](o.disabledClass);
}
}
}
/**
* Resume cycling.
*
* @param {Int} priority Resume pause with priority lower or equal than this. Used internally for pauseOnHover.
*
* @return {Void}
*/
self.resume = function (priority) {
if (!o.cycleBy || !o.cycleInterval || o.cycleBy === 'items' && !items[0] || priority < self.isPaused) {
return;
}
self.isPaused = 0;
if (cycleID) {
cycleID = clearTimeout(cycleID);
} else {
trigger('resume');
}
cycleID = setTimeout(function () {
trigger('cycle');
switch (o.cycleBy) {
case 'items':
self.activate(rel.activeItem >= items.length - 1 ? 0 : rel.activeItem + 1);
break;
case 'pages':
self.activatePage(rel.activePage >= pages.length - 1 ? 0 : rel.activePage + 1);
break;
}
}, o.cycleInterval);
};
/**
* Pause cycling.
*
* @param {Int} priority Pause priority. 100 is default. Used internally for pauseOnHover.
*
* @return {Void}
*/
self.pause = function (priority) {
if (priority < self.isPaused) {
return;
}
self.isPaused = priority || 100;
if (cycleID) {
cycleID = clearTimeout(cycleID);
trigger('pause');
}
};
/**
* Toggle cycling.
*
* @return {Void}
*/
self.toggle = function () {
self[cycleID ? 'pause' : 'resume']();
};
/**
* Updates a signle or multiple option values.
*
* @param {Mixed} name Name of the option that should be updated, or object that will extend the options.
* @param {Mixed} value New option value.
*
* @return {Void}
*/
self.set = function (name, value) {
if ($.isPlainObject(name)) {
$.extend(o, name);
} else if (o.hasOwnProperty(name)) {
o[name] = value;
}
};
/**
* Add one or multiple items to the SLIDEE end, or a specified position index.
*
* @param {Mixed} element Node element, or HTML string.
* @param {Int} index Index of a new item position. By default item is appended at the end.
*
* @return {Void}
*/
self.add = function (element, index) {
var $element = $(element);
if (itemNav) {
// Insert the element(s)
if (index == null || !items[0] || index >= items.length) {
$element.appendTo($slidee);
} else if (items.length) {
$element.insertBefore(items[index].el);
}
// Adjust the activeItem index
if (index <= rel.activeItem) {
last.active = rel.activeItem += $element.length;
}
} else {
$slidee.append($element);
}
// Reload
load();
};
/**
* Remove an item from SLIDEE.
*
* @param {Mixed} element Item index, or DOM element.
* @param {Int} index Index of a new item position. By default item is appended at the end.
*
* @return {Void}
*/
self.remove = function (element) {
if (itemNav) {
var index = getRelativeIndex(element);
if (index > -1) {
// Remove the element
$items.eq(index).remove();
// If the current item is being removed, activate new one after reload
var reactivate = index === rel.activeItem;
// Adjust the activeItem index
if (index < rel.activeItem) {
last.active = --rel.activeItem;
}
// Reload
load();
// Activate new item at the removed position
if (reactivate) {
last.active = null;
self.activate(rel.activeItem);
}
}
} else {
$(element).remove();
load();
}
};
/**
* Helps re-arranging items.
*
* @param {Mixed} item Item DOM element, or index starting at 0. Use negative numbers to select items from the end.
* @param {Mixed} position Item insertion anchor. Accepts same input types as item argument.
* @param {Bool} after Insert after instead of before the anchor.
*
* @return {Void}
*/
function moveItem(item, position, after) {
item = getRelativeIndex(item);
position = getRelativeIndex(position);
// Move only if there is an actual change requested
if (item > -1 && position > -1 && item !== position && (!after || position !== item - 1) && (after || position !== item + 1)) {
$items.eq(item)[after ? 'insertAfter' : 'insertBefore'](items[position].el);
var shiftStart = item < position ? item : (after ? position : position - 1);
var shiftEnd = item > position ? item : (after ? position + 1 : position);
var shiftsUp = item > position;
// Update activeItem index
if (item === rel.activeItem) {
last.active = rel.activeItem = after ? (shiftsUp ? position + 1 : position) : (shiftsUp ? position : position - 1);
} else if (rel.activeItem > shiftStart && rel.activeItem < shiftEnd) {
last.active = rel.activeItem += shiftsUp ? 1 : -1;
}
// Reload
load();
}
}
/**
* Move item after the target anchor.
*
* @param {Mixed} item Item to be moved. Can be DOM element or item index.
* @param {Mixed} position Target position anchor. Can be DOM element or item index.
*
* @return {Void}
*/
self.moveAfter = function (item, position) {
moveItem(item, position, 1);
};
/**
* Move item before the target anchor.
*
* @param {Mixed} item Item to be moved. Can be DOM element or item index.
* @param {Mixed} position Target position anchor. Can be DOM element or item index.
*
* @return {Void}
*/
self.moveBefore = function (item, position) {
moveItem(item, position);
};
/**
* Registers callbacks.
*
* @param {Mixed} name Event name, or callbacks map.
* @param {Mixed} fn Callback, or an array of callback functions.
*
* @return {Void}
*/
self.on = function (name, fn) {
// Callbacks map
if (type(name) === 'object') {
for (var key in name) {
if (name.hasOwnProperty(key)) {
self.on(key, name[key]);
}
}
// Callback
} else if (type(fn) === 'function') {
var names = name.split(' ');
for (var n = 0, nl = names.length; n < nl; n++) {
callbacks[names[n]] = callbacks[names[n]] || [];
if (callbackIndex(names[n], fn) === -1) {
callbacks[names[n]].push(fn);
}
}
// Callbacks array
} else if (type(fn) === 'array') {
for (var f = 0, fl = fn.length; f < fl; f++) {
self.on(name, fn[f]);
}
}
};
/**
* Registers callbacks to be executed only once.
*
* @param {Mixed} name Event name, or callbacks map.
* @param {Mixed} fn Callback, or an array of callback functions.
*
* @return {Void}
*/
self.one = function (name, fn) {
function proxy() {
fn.apply(self, arguments);
self.off(name, proxy);
}
self.on(name, proxy);
};
/**
* Remove one or all callbacks.
*
* @param {String} name Event name.
* @param {Mixed} fn Callback, or an array of callback functions. Omit to remove all callbacks.
*
* @return {Void}
*/
self.off = function (name, fn) {
if (fn instanceof Array) {
for (var f = 0, fl = fn.length; f < fl; f++) {
self.off(name, fn[f]);
}
} else {
var names = name.split(' ');
for (var n = 0, nl = names.length; n < nl; n++) {
callbacks[names[n]] = callbacks[names[n]] || [];
if (fn == null) {
callbacks[names[n]].length = 0;
} else {
var index = callbackIndex(names[n], fn);
if (index !== -1) {
callbacks[names[n]].splice(index, 1);
}
}
}
}
};
/**
* Returns callback array index.
*
* @param {String} name Event name.
* @param {Function} fn Function
*
* @return {Int} Callback array index, or -1 if isn't registered.
*/
function callbackIndex(name, fn) {
for (var i = 0, l = callbacks[name].length; i < l; i++) {
if (callbacks[name][i] === fn) {
return i;
}
}
return -1;
}
/**
* Reset next cycle timeout.
*
* @return {Void}
*/
function resetCycle() {
if (dragging.released && !self.isPaused) {
self.resume();
}
}
/**
* Calculate SLIDEE representation of handle position.
*
* @param {Int} handlePos
*
* @return {Int}
*/
function handleToSlidee(handlePos) {
return round(within(handlePos, hPos.start, hPos.end) / hPos.end * (pos.end - pos.start)) + pos.start;
}
/**
* Keeps track of a dragging delta history.
*
* @return {Void}
*/
function draggingHistoryTick() {
// Looking at this, I know what you're thinking :) But as we need only 4 history states, doing it this way
// as opposed to a proper loop is ~25 bytes smaller (when minified with GCC), a lot faster, and doesn't
// generate garbage. The loop version would create 2 new variables on every tick. Unexaptable!
dragging.history[0] = dragging.history[1];
dragging.history[1] = dragging.history[2];
dragging.history[2] = dragging.history[3];
dragging.history[3] = dragging.delta;
}
/**
* Initialize continuous movement.
*
* @return {Void}
*/
function continuousInit(source) {
dragging.released = 0;
dragging.source = source;
dragging.slidee = source === 'slidee';
}
/**
* Dragging initiator.
*
* @param {Event} event
*
* @return {Void}
*/
function dragInit(event) {
var isTouch = event.type === 'touchstart';
var source = event.data.source;
var isSlidee = source === 'slidee';
// Ignore when already in progress, or interactive element in non-touch navivagion
if (dragging.init || !isTouch && isInteractive(event.target)) {
return;
}
// Handle dragging conditions
if (source === 'handle' && (!o.dragHandle || hPos.start === hPos.end)) {
return;
}
// SLIDEE dragging conditions
if (isSlidee && !(isTouch ? o.touchDragging : o.mouseDragging && event.which < 2)) {
return;
}
if (!isTouch) {
// prevents native image dragging in Firefox
stopDefault(event);
}
// Reset dragging object
continuousInit(source);
// Properties used in dragHandler
dragging.init = 0;
dragging.$source = $(event.target);
dragging.touch = isTouch;
dragging.pointer = isTouch ? event.originalEvent.touches[0] : event;
dragging.initX = dragging.pointer.pageX;
dragging.initY = dragging.pointer.pageY;
dragging.initPos = isSlidee ? pos.cur : hPos.cur;
dragging.start = +new Date();
dragging.time = 0;
dragging.path = 0;
dragging.delta = 0;
dragging.locked = 0;
dragging.history = [0, 0, 0, 0];
dragging.pathToLock = isSlidee ? isTouch ? 30 : 10 : 0;
// Bind dragging events
$doc.on(isTouch ? dragTouchEvents : dragMouseEvents, dragHandler);
// Pause ongoing cycle
self.pause(1);
// Add dragging class
(isSlidee ? $slidee : $handle).addClass(o.draggedClass);
// Trigger moveStart event
trigger('moveStart');
// Keep track of a dragging path history. This is later used in the
// dragging release swing calculation when dragging SLIDEE.
if (isSlidee) {
historyID = setInterval(draggingHistoryTick, 10);
}
}
/**
* Handler for dragging scrollbar handle or SLIDEE.
*
* @param {Event} event
*
* @return {Void}
*/
function dragHandler(event) {
dragging.released = event.type === 'mouseup' || event.type === 'touchend';
dragging.pointer = dragging.touch ? event.originalEvent[dragging.released ? 'changedTouches' : 'touches'][0] : event;
dragging.pathX = dragging.pointer.pageX - dragging.initX;
dragging.pathY = dragging.pointer.pageY - dragging.initY;
dragging.path = sqrt(pow(dragging.pathX, 2) + pow(dragging.pathY, 2));
dragging.delta = o.horizontal ? dragging.pathX : dragging.pathY;
if (!dragging.init) {
if (o.horizontal ? abs(dragging.pathX) > abs(dragging.pathY) : abs(dragging.pathX) < abs(dragging.pathY)) {
dragging.init = 1;
} else {
return dragEnd();
}
}
stopDefault(event);
// Disable click on a source element, as it is unwelcome when dragging
if (!dragging.locked && dragging.path > dragging.pathToLock && dragging.slidee) {
dragging.locked = 1;
dragging.$source.on(clickEvent, disableOneEvent);
}
// Cancel dragging on release
if (dragging.released) {
dragEnd();
// Adjust path with a swing on mouse release
if (o.releaseSwing && dragging.slidee) {
dragging.swing = (dragging.delta - dragging.history[0]) / 40 * 300;
dragging.delta += dragging.swing;
dragging.tweese = abs(dragging.swing) > 10;
}
}
slideTo(dragging.slidee ? round(dragging.initPos - dragging.delta) : handleToSlidee(dragging.initPos + dragging.delta));
}
/**
* Stops dragging and cleans up after it.
*
* @return {Void}
*/
function dragEnd() {
clearInterval(historyID);
$doc.off(dragging.touch ? dragTouchEvents : dragMouseEvents, dragHandler);
(dragging.slidee ? $slidee : $handle).removeClass(o.draggedClass);
// Make sure that disableOneEvent is not active in next tick.
setTimeout(function () {
dragging.$source.off(clickEvent, disableOneEvent);
});
// Resume ongoing cycle
self.resume(1);
// Normally, this is triggered in render(), but if there
// is nothing to render, we have to do it manually here.
if (pos.cur === pos.dest && dragging.init) {
trigger('moveEnd');
}
dragging.init = 0;
}
/**
* Check whether element is interactive.
*
* @return {Boolean}
*/
function isInteractive(element) {
return ~$.inArray(element.nodeName, interactiveElements) || $(element).is(o.interactive);
}
/**
* Continuous movement cleanup on mouseup.
*
* @return {Void}
*/
function movementReleaseHandler() {
self.stop();
$doc.off('mouseup', movementReleaseHandler);
}
/**
* Buttons navigation handler.
*
* @param {Event} event
*
* @return {Void}
*/
function buttonsHandler(event) {
/*jshint validthis:true */
stopDefault(event);
switch (this) {
case $forwardButton[0]:
case $backwardButton[0]:
self.moveBy($forwardButton.is(this) ? o.moveBy : -o.moveBy);
$doc.on('mouseup', movementReleaseHandler);
break;
case $prevButton[0]:
self.prev();
break;
case $nextButton[0]:
self.next();
break;
case $prevPageButton[0]:
self.prevPage();
break;
case $nextPageButton[0]:
self.nextPage();
break;
}
}
/**
* Mouse wheel delta normalization.
*
* @param {Event} event
*
* @return {Int}
*/
function normalizeWheelDelta(event) {
// wheelDelta needed only for IE8-
scrolling.curDelta = ((o.horizontal ? event.deltaY || event.deltaX : event.deltaY) || -event.wheelDelta);
scrolling.curDelta /= event.deltaMode === 1 ? 3 : 100;
if (!itemNav) {
return scrolling.curDelta;
}
time = +new Date();
if (scrolling.last < time - scrolling.resetTime) {
scrolling.delta = 0;
}
scrolling.last = time;
scrolling.delta += scrolling.curDelta;
if (abs(scrolling.delta) < 1) {
scrolling.finalDelta = 0;
} else {
scrolling.finalDelta = round(scrolling.delta / 1);
scrolling.delta %= 1;
}
return scrolling.finalDelta;
}
/**
* Mouse scrolling handler.
*
* @param {Event} event
*
* @return {Void}
*/
function scrollHandler(event) {
// Don't hijack global scrolling
var time = +new Date();
if (lastGlobalWheel + 300 > time) {
lastGlobalWheel = time;
return;
}
// Ignore if there is no scrolling to be done
if (!o.scrollBy || pos.start === pos.end) {
return;
}
var delta = normalizeWheelDelta(event.originalEvent);
// Trap scrolling only when necessary and/or requested
if (o.scrollTrap || delta > 0 && pos.dest < pos.end || delta < 0 && pos.dest > pos.start) {
stopDefault(event, 1);
}
self.slideBy(o.scrollBy * delta);
}
/**
* Scrollbar click handler.
*
* @param {Event} event
*
* @return {Void}
*/
function scrollbarHandler(event) {
// Only clicks on scroll bar. Ignore the handle.
if (o.clickBar && event.target === $sb[0]) {
stopDefault(event);
// Calculate new handle position and sync SLIDEE to it
slideTo(handleToSlidee((o.horizontal ? event.pageX - $sb.offset().left : event.pageY - $sb.offset().top) - handleSize / 2));
}
}
/**
* Keyboard input handler.
*
* @param {Event} event
*
* @return {Void}
*/
function keyboardHandler(event) {
if (!o.keyboardNavBy) {
return;
}
switch (event.which) {
// Left or Up
case o.horizontal ? 37 : 38:
stopDefault(event);
self[o.keyboardNavBy === 'pages' ? 'prevPage' : 'prev']();
break;
// Right or Down
case o.horizontal ? 39 : 40:
stopDefault(event);
self[o.keyboardNavBy === 'pages' ? 'nextPage' : 'next']();
break;
}
}
/**
* Click on item activation handler.
*
* @param {Event} event
*
* @return {Void}
*/
function activateHandler(event) {
/*jshint validthis:true */
// Ignore clicks on interactive elements.
if (isInteractive(this)) {
event.stopPropagation();
return;
}
// Accept only events from direct SLIDEE children.
if (this.parentNode === $slidee[0]) {
self.activate(this);
}
}
/**
* Click on page button handler.
*
* @param {Event} event
*
* @return {Void}
*/
function activatePageHandler() {
/*jshint validthis:true */
// Accept only events from direct pages bar children.
if (this.parentNode === $pb[0]) {
self.activatePage($pages.index(this));
}
}
/**
* Pause on hover handler.
*
* @param {Event} event
*
* @return {Void}
*/
function pauseOnHoverHandler(event) {
if (o.pauseOnHover) {
self[event.type === 'mouseenter' ? 'pause' : 'resume'](2);
}
}
/**
* Trigger callbacks for event.
*
* @param {String} name Event name.
* @param {Mixed} argX Arguments passed to callbacks.
*
* @return {Void}
*/
function trigger(name, arg1) {
if (callbacks[name]) {
l = callbacks[name].length;
// Callbacks will be stored and executed from a temporary array to not
// break the execution queue when one of the callbacks unbinds itself.
tmpArray.length = 0;
for (i = 0; i < l; i++) {
tmpArray.push(callbacks[name][i]);
}
// Execute the callbacks
for (i = 0; i < l; i++) {
tmpArray[i].call(self, name, arg1);
}
}
}
/**
* Destroys instance and everything it created.
*
* @return {Void}
*/
self.destroy = function () {
// Unbind all events
$doc
.add($scrollSource)
.add($handle)
.add($sb)
.add($pb)
.add($forwardButton)
.add($backwardButton)
.add($prevButton)
.add($nextButton)
.add($prevPageButton)
.add($nextPageButton)
.unbind('.' + namespace);
// Remove classes
$prevButton
.add($nextButton)
.add($prevPageButton)
.add($nextPageButton)
.removeClass(o.disabledClass);
if ($items) {
$items.eq(rel.activeItem).removeClass(o.activeClass);
}
// Remove page items
$pb.empty();
if (!parallax) {
// Unbind events from frame
$frame.unbind('.' + namespace);
// Restore original styles
frameStyles.restore();
slideeStyles.restore();
sbStyles.restore();
handleStyles.restore();
// Remove the instance from element data storage
$.removeData(frame, namespace);
}
// Clean up collections
items.length = pages.length = 0;
last = {};
// Reset initialized status and return the instance
self.initialized = 0;
return self;
};
/**
* Initialize.
*
* @return {Object}
*/
self.init = function () {
if (self.initialized) {
return;
}
// Register callbacks map
self.on(callbackMap);
// Save styles
var holderProps = ['overflow', 'position'];
var movableProps = ['position', 'webkitTransform', 'msTransform', 'transform', 'left', 'top', 'width', 'height'];
frameStyles.save.apply(frameStyles, holderProps);
sbStyles.save.apply(sbStyles, holderProps);
slideeStyles.save.apply(slideeStyles, movableProps);
handleStyles.save.apply(handleStyles, movableProps);
// Set required styles
var $movables = $handle;
if (!parallax) {
$movables = $movables.add($slidee);
$frame.css('overflow', 'hidden');
if (!transform && $frame.css('position') === 'static') {
$frame.css('position', 'relative');
}
}
if (transform) {
if (gpuAcceleration) {
$movables.css(transform, gpuAcceleration);
}
} else {
if ($sb.css('position') === 'static') {
$sb.css('position', 'relative');
}
$movables.css({ position: 'absolute' });
}
// Navigation buttons
if (o.forward) {
$forwardButton.on(mouseDownEvent, buttonsHandler);
}
if (o.backward) {
$backwardButton.on(mouseDownEvent, buttonsHandler);
}
if (o.prev) {
$prevButton.on(clickEvent, buttonsHandler);
}
if (o.next) {
$nextButton.on(clickEvent, buttonsHandler);
}
if (o.prevPage) {
$prevPageButton.on(clickEvent, buttonsHandler);
}
if (o.nextPage) {
$nextPageButton.on(clickEvent, buttonsHandler);
}
// Scrolling navigation
$scrollSource.on(wheelEvent, scrollHandler);
// Clicking on scrollbar navigation
if ($sb[0]) {
$sb.on(clickEvent, scrollbarHandler);
}
// Click on items navigation
if (itemNav && o.activateOn) {
$frame.on(o.activateOn + '.' + namespace, '*', activateHandler);
}
// Pages navigation
if ($pb[0] && o.activatePageOn) {
$pb.on(o.activatePageOn + '.' + namespace, '*', activatePageHandler);
}
// Dragging navigation
$dragSource.on(dragInitEvents, { source: 'slidee' }, dragInit);
// Scrollbar dragging navigation
if ($handle) {
$handle.on(dragInitEvents, { source: 'handle' }, dragInit);
}
// Keyboard navigation
$doc.bind('keydown.' + namespace, keyboardHandler);
if (!parallax) {
// Pause on hover
$frame.on('mouseenter.' + namespace + ' mouseleave.' + namespace, pauseOnHoverHandler);
// Reset native FRAME element scroll
$frame.on('scroll.' + namespace, resetScroll);
}
// Mark instance as initialized
self.initialized = 1;
// Load
load();
// Initiate automatic cycling
if (o.cycleBy && !parallax) {
self[o.startPaused ? 'pause' : 'resume']();
}
// Return instance
return self;
};
}
/**
* Return type of the value.
*
* @param {Mixed} value
*
* @return {String}
*/
function type(value) {
if (value == null) {
return String(value);
}
if (typeof value === 'object' || typeof value === 'function') {
return Object.prototype.toString.call(value).match(/\s([a-z]+)/i)[1].toLowerCase() || 'object';
}
return typeof value;
}
/**
* Event preventDefault & stopPropagation helper.
*
* @param {Event} event Event object.
* @param {Bool} noBubbles Cancel event bubbling.
*
* @return {Void}
*/
function stopDefault(event, noBubbles) {
event.preventDefault();
if (noBubbles) {
event.stopPropagation();
}
}
/**
* Disables an event it was triggered on and unbinds itself.
*
* @param {Event} event
*
* @return {Void}
*/
function disableOneEvent(event) {
/*jshint validthis:true */
stopDefault(event, 1);
$(this).off(event.type, disableOneEvent);
}
/**
* Resets native element scroll values to 0.
*
* @return {Void}
*/
function resetScroll() {
/*jshint validthis:true */
this.scrollLeft = 0;
this.scrollTop = 0;
}
/**
* Check if variable is a number.
*
* @param {Mixed} value
*
* @return {Boolean}
*/
function isNumber(value) {
return !isNaN(parseFloat(value)) && isFinite(value);
}
/**
* Parse style to pixels.
*
* @param {Object} $item jQuery object with element.
* @param {Property} property CSS property to get the pixels from.
*
* @return {Int}
*/
function getPx($item, property) {
return 0 | round(String($item.css(property)).replace(/[^\-0-9.]/g, ''));
}
/**
* Make sure that number is within the limits.
*
* @param {Number} number
* @param {Number} min
* @param {Number} max
*
* @return {Number}
*/
function within(number, min, max) {
return number < min ? min : number > max ? max : number;
}
/**
* Saves element styles for later restoration.
*
* Example:
* var styles = new StyleRestorer(frame);
* styles.save('position');
* element.style.position = 'absolute';
* styles.restore(); // restores to state before the assignment above
*
* @param {Element} element
*/
function StyleRestorer(element) {
var self = {};
self.style = {};
self.save = function () {
if (!element) return;
for (var i = 0; i < arguments.length; i++) {
self.style[arguments[i]] = element.style[arguments[i]];
}
return self;
};
self.restore = function () {
if (!element) return;
for (var prop in self.style) {
if (self.style.hasOwnProperty(prop)) element.style[prop] = self.style[prop];
}
return self;
};
return self;
}
// Local WindowAnimationTiming interface polyfill
(function (w) {
rAF = w.requestAnimationFrame
|| w.webkitRequestAnimationFrame
|| fallback;
/**
* Fallback implementation.
*/
var prev = new Date().getTime();
function fallback(fn) {
var curr = new Date().getTime();
var ms = Math.max(0, 16 - (curr - prev));
var req = setTimeout(fn, ms);
prev = curr;
return req;
}
/**
* Cancel.
*/
var cancel = w.cancelAnimationFrame
|| w.webkitCancelAnimationFrame
|| w.clearTimeout;
cAF = function(id){
cancel.call(w, id);
};
}(window));
// Feature detects
(function () {
var prefixes = ['', 'webkit', 'moz', 'ms', 'o'];
var el = document.createElement('div');
function testProp(prop) {
for (var p = 0, pl = prefixes.length; p < pl; p++) {
var prefixedProp = prefixes[p] ? prefixes[p] + prop.charAt(0).toUpperCase() + prop.slice(1) : prop;
if (el.style[prefixedProp] != null) {
return prefixedProp;
}
}
}
// Global support indicators
transform = testProp('transform');
gpuAcceleration = testProp('perspective') ? 'translateZ(0) ' : '';
}());
// Expose class globally
w[className] = Sly;
// jQuery proxy
$.fn[pluginName] = function (options, callbackMap) {
var method, methodArgs;
// Attributes logic
if (!$.isPlainObject(options)) {
if (type(options) === 'string' || options === false) {
method = options === false ? 'destroy' : options;
methodArgs = Array.prototype.slice.call(arguments, 1);
}
options = {};
}
// Apply to all elements
return this.each(function (i, element) {
// Call with prevention against multiple instantiations
var plugin = $.data(element, namespace);
if (!plugin && !method) {
// Create a new object if it doesn't exist yet
plugin = $.data(element, namespace, new Sly(element, options, callbackMap).init());
} else if (plugin && method) {
// Call method
if (plugin[method]) {
plugin[method].apply(plugin, methodArgs);
}
}
});
};
// Default options
Sly.defaults = {
horizontal: false, // Switch to horizontal mode.
// Item based navigation
itemNav: null, // Item navigation type. Can be: 'basic', 'centered', 'forceCentered'.
itemSelector: null, // Select only items that match this selector.
smart: false, // Repositions the activated item to help with further navigation.
activateOn: null, // Activate an item on this event. Can be: 'click', 'mouseenter', ...
activateMiddle: false, // Always activate the item in the middle of the FRAME. forceCentered only.
// Scrolling
scrollSource: null, // Element for catching the mouse wheel scrolling. Default is FRAME.
scrollBy: 0, // Pixels or items to move per one mouse scroll. 0 to disable scrolling.
scrollHijack: 300, // Milliseconds since last wheel event after which it is acceptable to hijack global scroll.
scrollTrap: false, // Don't bubble scrolling when hitting scrolling limits.
// Dragging
dragSource: null, // Selector or DOM element for catching dragging events. Default is FRAME.
mouseDragging: false, // Enable navigation by dragging the SLIDEE with mouse cursor.
touchDragging: false, // Enable navigation by dragging the SLIDEE with touch events.
releaseSwing: false, // Ease out on dragging swing release.
swingSpeed: 0.2, // Swing synchronization speed, where: 1 = instant, 0 = infinite.
elasticBounds: false, // Stretch SLIDEE position limits when dragging past FRAME boundaries.
interactive: null, // Selector for special interactive elements.
// Scrollbar
scrollBar: null, // Selector or DOM element for scrollbar container.
dragHandle: false, // Whether the scrollbar handle should be draggable.
dynamicHandle: false, // Scrollbar handle represents the ratio between hidden and visible content.
minHandleSize: 50, // Minimal height or width (depends on sly direction) of a handle in pixels.
clickBar: false, // Enable navigation by clicking on scrollbar.
syncSpeed: 0.5, // Handle => SLIDEE synchronization speed, where: 1 = instant, 0 = infinite.
// Pagesbar
pagesBar: null, // Selector or DOM element for pages bar container.
activatePageOn: null, // Event used to activate page. Can be: click, mouseenter, ...
pageBuilder: // Page item generator.
function (index) {
return '<li>' + (index + 1) + '</li>';
},
// Navigation buttons
forward: null, // Selector or DOM element for "forward movement" button.
backward: null, // Selector or DOM element for "backward movement" button.
prev: null, // Selector or DOM element for "previous item" button.
next: null, // Selector or DOM element for "next item" button.
prevPage: null, // Selector or DOM element for "previous page" button.
nextPage: null, // Selector or DOM element for "next page" button.
// Automated cycling
cycleBy: null, // Enable automatic cycling by 'items' or 'pages'.
cycleInterval: 5000, // Delay between cycles in milliseconds.
pauseOnHover: false, // Pause cycling when mouse hovers over the FRAME.
startPaused: false, // Whether to start in paused sate.
// Mixed options
moveBy: 300, // Speed in pixels per second used by forward and backward buttons.
speed: 0, // Animations speed in milliseconds. 0 to disable animations.
easing: 'swing', // Easing for duration based (tweening) animations.
startAt: 0, // Starting offset in pixels or items.
keyboardNavBy: null, // Enable keyboard navigation by 'items' or 'pages'.
// Classes
draggedClass: 'dragged', // Class for dragged elements (like SLIDEE or scrollbar handle).
activeClass: 'active', // Class for active items and pages.
disabledClass: 'disabled' // Class for disabled navigation elements.
};
}(jQuery, window));
|
docs/src/app/components/pages/components/Drawer/ExampleOpenSecondary.js
|
nathanmarks/material-ui
|
import React from 'react';
import Drawer from 'material-ui/Drawer';
import AppBar from 'material-ui/AppBar';
import RaisedButton from 'material-ui/RaisedButton';
export default class DrawerOpenRightExample extends React.Component {
constructor(props) {
super(props);
this.state = {open: false};
}
handleToggle = () => this.setState({open: !this.state.open});
render() {
return (
<div>
<RaisedButton
label="Toggle Drawer"
onTouchTap={this.handleToggle}
/>
<Drawer width={200} openSecondary={true} open={this.state.open} >
<AppBar title="AppBar" />
</Drawer>
</div>
);
}
}
|
ajax/libs/analytics.js/2.3.2/analytics.min.js
|
mohitbhatia1994/cdnjs
|
(function outer(modules,cache,entries){var global=function(){return this}();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+'"')}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);if(name)cache[name]=cache[id];return cache[id].exports}for(var id in entries){if(entries[id]){global[entries[id]]=require(id)}else{require(id)}}require.duo=true;require.cache=cache;require.modules=modules;return require})({1:[function(require,module,exports){var Integrations=require("analytics.js-integrations");var Analytics=require("./analytics");var each=require("each");var analytics=module.exports=exports=new Analytics;analytics.require=require;exports.VERSION=require("./version");each(Integrations,function(name,Integration){analytics.use(Integration)})},{"./analytics":2,"./version":3,"analytics.js-integrations":4,each:5}],2:[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;exports=module.exports=Analytics;exports.cookie=cookie;exports.store=store;function Analytics(){this.Integrations={};this._integrations={};this._readied=false;this._timeout=300;this._user=user;bind.all(this);var self=this;this.on("initialize",function(settings,options){if(options.initialPageview)self.page()});this.on("initialize",function(){self._parseQuery()})}Emitter(Analytics.prototype);Analytics.prototype.use=function(plugin){plugin(this);return this};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};Analytics.prototype.init=Analytics.prototype.initialize=function(settings,options){settings=settings||{};options=options||{};this._options(options);this._readied=false;var self=this;each(settings,function(name){var Integration=self.Integrations[name];if(!Integration)delete settings[name]});each(settings,function(name,opts){var Integration=self.Integrations[name];var integration=new Integration(clone(opts));self.add(integration)});var integrations=this._integrations;user.load();group.load();var ready=after(size(integrations),function(){self._readied=true;self.emit("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()});this.initialized=true;this.emit("initialize",settings,options);return this};Analytics.prototype.add=function(integration){this._integrations[integration.name]=integration;return this};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();user.identify(id,traits);id=user.id();traits=user.traits();this._invoke("identify",new Identify({options:options,traits:traits,userId:id}));this.emit("identify",id,traits,options);this._callback(fn);return this};Analytics.prototype.user=function(){return user};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();group.identify(id,traits);id=group.id();traits=group.traits();this._invoke("group",new Group({options:options,traits:traits,groupId:id}));this.emit("group",id,traits,options);this._callback(fn);return this};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",new Track({properties:properties,options:options,event:event}));this.emit("track",event,properties,options);this._callback(fn);return this};Analytics.prototype.trackClick=Analytics.prototype.trackLink=function(links,event,properties){if(!links)return this;if(is.element(links))links=[links];var self=this;each(links,function(el){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};Analytics.prototype.trackSubmit=Analytics.prototype.trackForm=function(forms,event,properties){if(!forms)return this;if(is.element(forms))forms=[forms];var self=this;each(forms,function(el){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()})}var $=window.jQuery||window.Zepto;if($){$(el).submit(handler)}else{on(el,"submit",handler)}});return this};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",new Page({properties:properties,category:category,options:options,name:name}));this.emit("page",category,name,properties,options);this._callback(fn);return this};Analytics.prototype.pageview=function(url,options){var properties={};if(url)properties.path=url;this.page(properties);return this};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",new Alias({options:options,from:from,to:to}));this.emit("alias",to,from,options);this._callback(fn);return this};Analytics.prototype.ready=function(fn){if(!is.fn(fn))return this;this._readied?callback.async(fn):this.once("ready",fn);return this};Analytics.prototype.timeout=function(timeout){this._timeout=timeout};Analytics.prototype.debug=function(str){if(0==arguments.length||str){debug.enable("analytics:"+(str||"*"))}else{debug.disable()}};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};Analytics.prototype._callback=function(fn){callback.async(fn,this._timeout);return this};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};Analytics.prototype.push=function(args){var method=args.shift();if(!this[method])return;this[method].apply(this,args)};Analytics.prototype._parseQuery=function(){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};function canonicalPath(){var canon=canonical();if(!canon)return window.location.pathname;var parsed=url.parse(canon);return parsed.pathname}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)}},{"./cookie":6,"./group":7,"./store":8,"./user":9,after:10,bind:11,callback:12,canonical:13,clone:14,debug:15,defaults:16,each:5,emitter:17,is:18,"is-email":19,"is-meta":20,"new-date":21,event:22,prevent:23,querystring:24,object:25,url:26,facade:27}],6:[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");function Cookie(options){this.options(options)}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:31536e6,path:"/",domain:domain});this.set("ajs:test",true);if(!this.get("ajs:test")){debug("fallback to domain=null");this._options.domain=null}this.remove("ajs:test")};Cookie.prototype.set=function(key,value){try{value=json.stringify(value);cookie(key,value,clone(this._options));return true}catch(e){return false}};Cookie.prototype.get=function(key){try{var value=cookie(key);value=value?json.parse(value):null;return value}catch(e){return null}};Cookie.prototype.remove=function(key){try{cookie(key,null,clone(this._options));return true}catch(e){return false}};module.exports=bind.all(new Cookie);module.exports.Cookie=Cookie},{debug:15,bind:11,cookie:28,clone:14,defaults:16,json:29,"top-domain":30}],15:[function(require,module,exports){if("undefined"==typeof window){module.exports=require("./lib/debug")}else{module.exports=require("./debug")}},{"./lib/debug":31,"./debug":32}],31:[function(require,module,exports){var tty=require("tty");module.exports=debug;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+"$"))}});var colors=[6,2,3,4,5,1];var prev={};var prevColor=0;var isatty=tty.isatty(2);function color(){return colors[prevColor++%colors.length]}function humanize(ms){var sec=1e3,min=60*1e3,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"}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=" [9"+c+"m"+name+" "+"[3"+c+"m[90m"+fmt+"[3"+c+"m"+" +"+humanize(ms)+"[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}function coerce(val){if(val instanceof Error)return val.stack||val.message;return val}},{}],32:[function(require,module,exports){module.exports=debug;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);window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}}debug.names=[];debug.skips=[];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+"$"))}}};debug.disable=function(){debug.enable("")};debug.humanize=function(ms){var sec=1e3,min=60*1e3,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"};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};function coerce(val){if(val instanceof Error)return val.stack||val.message;return val}try{if(window.localStorage)debug.enable(localStorage.debug)}catch(e){}},{}],11:[function(require,module,exports){try{var bind=require("bind")}catch(e){var bind=require("bind-component")}var bindAll=require("bind-all");module.exports=exports=bind;exports.all=bindAll;exports.methods=bindMethods;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:33,"bind-all":34}],33:[function(require,module,exports){var slice=[].slice;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)))}}},{}],34:[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:33,type:35}],35:[function(require,module,exports){var toString=Object.prototype.toString;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}},{}],28:[function(require,module,exports){var encode=encodeURIComponent;var decode=decodeURIComponent;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()}};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}function all(){return parse(document.cookie)}function get(name){return all()[name]}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}},{}],14:[function(require,module,exports){var type;try{type=require("type")}catch(e){type=require("type-component")}module.exports=clone;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":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:return obj}}},{type:35}],16:[function(require,module,exports){"use strict";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};module.exports=defaults},{}],29:[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":36}],36:[function(require,module,exports){(function(){"use strict";var JSON=module.exports={};function f(n){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){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){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}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{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}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={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else if(typeof space==="string"){indent=space}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}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){var j;function walk(holder,key){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)}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)})}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,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}})()},{}],30:[function(require,module,exports){var parse=require("url").parse;module.exports=domain;var regexp=/[a-z0-9][a-z0-9\-]*[a-z0-9]\.[a-z\.]{2,6}$/i;function domain(url){var host=parse(url).hostname;var match=host.match(regexp);return match?match[0]:""}},{url:26}],26:[function(require,module,exports){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)}};exports.isAbsolute=function(url){if(0==url.indexOf("//"))return true;if(~url.indexOf("://"))return true;return false};exports.isRelative=function(url){return!exports.isAbsolute(url)};exports.isCrossDomain=function(url){url=exports.parse(url);return url.hostname!=location.hostname||url.port!=location.port||url.protocol!=location.protocol}},{}],7:[function(require,module,exports){var debug=require("debug")("analytics:group");var Entity=require("./entity");var inherit=require("inherit");var bind=require("bind");Group.defaults={persist:true,cookie:{key:"ajs_group_id"},localStorage:{key:"ajs_group_properties"}};function Group(options){this.defaults=Group.defaults;this.debug=debug;Entity.call(this,options)}inherit(Group,Entity);module.exports=bind.all(new Group);module.exports.Group=Group},{"./entity":37,debug:15,inherit:38,bind:11}],37:[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");module.exports=Entity;function Entity(options){this.options(options)}Entity.prototype.options=function(options){if(arguments.length===0)return this._options;options||(options={});defaults(options,this.defaults||{});this._options=options};Entity.prototype.id=function(id){switch(arguments.length){case 0:return this._getId();case 1:return this._setId(id)}};Entity.prototype._getId=function(){var ret=this._options.persist?cookie.get(this._options.cookie.key):this._id;return ret===undefined?null:ret};Entity.prototype._setId=function(id){if(this._options.persist){cookie.set(this._options.cookie.key,id)}else{this._id=id}};Entity.prototype.properties=Entity.prototype.traits=function(traits){switch(arguments.length){case 0:return this._getTraits();case 1:return this._setTraits(traits)}};Entity.prototype._getTraits=function(){var ret=this._options.persist?store.get(this._options.localStorage.key):this._traits;return ret?traverse(clone(ret)):{}};Entity.prototype._setTraits=function(traits){traits||(traits={});if(this._options.persist){store.set(this._options.localStorage.key,traits)}else{this._traits=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()};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};Entity.prototype.logout=function(){this.id(null);this.traits({});cookie.remove(this._options.cookie.key);store.remove(this._options.localStorage.key)};Entity.prototype.reset=function(){this.logout();this.options({})};Entity.prototype.load=function(){this.id(cookie.get(this._options.cookie.key));this.traits(store.get(this._options.localStorage.key))}},{"./cookie":6,"./store":8,"isodate-traverse":39,defaults:16,extend:40,clone:14}],8:[function(require,module,exports){var bind=require("bind");var defaults=require("defaults");var store=require("store.js");function Store(options){this.options(options)}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};Store.prototype.set=function(key,value){if(!this.enabled)return false;return store.set(key,value)};Store.prototype.get=function(key){if(!this.enabled)return null;return store.get(key)};Store.prototype.remove=function(key){if(!this.enabled)return false;return store.remove(key)};module.exports=bind.all(new Store);module.exports.Store=Store},{bind:11,defaults:16,"store.js":41}],41:[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}};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;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){storage=doc.createElement("div");storageOwner=doc.body}function withIEStorage(storeFunction){return function(){var args=Array.prototype.slice.call(arguments,0);args.unshift(storage);storageOwner.appendChild(storage);storage.addBehavior("#default#userData");storage.load(localStorageName);var result=storeFunction.apply(store,args);storageOwner.removeChild(storage);return result}}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:29}],39:[function(require,module,exports){var is=require("is");var isodate=require("isodate");var each;try{each=require("each")}catch(err){each=require("each-component")}module.exports=traverse;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}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}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:42,isodate:43,each:5}],42:[function(require,module,exports){var isEmpty=require("is-empty");try{var typeOf=require("type")}catch(e){var typeOf=require("component-type")}var types=["arguments","array","boolean","date","element","function","null","number","object","regexp","string","undefined"];for(var i=0,type;type=types[i];i++)exports[type]=generate(type);exports.fn=exports["function"];exports.empty=isEmpty;exports.nan=function(val){return exports.number(val)&&val!=val};function generate(type){return function(value){return type===typeOf(value)}}},{"is-empty":44,type:35,"component-type":35}],44:[function(require,module,exports){module.exports=isEmpty;var has=Object.prototype.hasOwnProperty;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}},{}],43:[function(require,module,exports){var matcher=/^(\d{4})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:([ T])(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;exports.parse=function(iso){var numericKeys=[1,5,6,7,11,12];var arr=matcher.exec(iso);var offset=0;if(!arr)return new Date(iso);for(var i=0,val;val=numericKeys[i];i++){arr[val]=parseInt(arr[val],10)||0}arr[2]=parseInt(arr[2],10)||1;arr[3]=parseInt(arr[3],10)||1;arr[2]--;arr[8]=arr[8]?(arr[8]+"00").substring(0,3):0;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)};exports.is=function(string,strict){if(strict&&false===/^\d{4}-\d{2}-\d{2}/.test(string))return false;return matcher.test(string)}},{}],5:[function(require,module,exports){var type=require("type");var has=Object.prototype.hasOwnProperty;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)}};function string(obj,fn){for(var i=0;i<obj.length;++i){fn(obj.charAt(i),i)}}function object(obj,fn){for(var key in obj){if(has.call(obj,key)){fn(key,obj[key])}}}function array(obj,fn){for(var i=0;i<obj.length;++i){fn(obj[i],i)}}},{type:35}],40:[function(require,module,exports){module.exports=function extend(object){var args=Array.prototype.slice.call(arguments,1);for(var i=0,source;source=args[i];i++){if(!source)continue;for(var property in source){object[property]=source[property]}}return object}},{}],38:[function(require,module,exports){module.exports=function(a,b){var fn=function(){};fn.prototype=b.prototype;a.prototype=new fn;a.prototype.constructor=a}},{}],9:[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={persist:true,cookie:{key:"ajs_user_id",oldKey:"ajs_user"},localStorage:{key:"ajs_user_traits"}};function User(options){this.defaults=User.defaults;this.debug=debug;Entity.call(this,options)}inherit(User,Entity);User.prototype.load=function(){if(this._loadOldCookie())return;Entity.prototype.load.call(this)};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};module.exports=bind.all(new User);module.exports.User=User},{"./entity":37,"./cookie":6,debug:15,inherit:38,bind:11}],10:[function(require,module,exports){module.exports=function after(times,func){if(times<=0)return func();return function(){if(--times<1){return func.apply(this,arguments)}}}},{}],12:[function(require,module,exports){var next=require("next-tick");module.exports=callback;function callback(fn){if("function"===typeof fn)fn()}callback.async=function(fn,wait){if("function"!==typeof fn)return;if(!wait)return next(fn);setTimeout(fn,wait)};callback.sync=callback},{"next-tick":45}],45:[function(require,module,exports){"use strict";if(typeof setImmediate=="function"){module.exports=function(f){setImmediate(f)}}else if(typeof process!="undefined"&&typeof process.nextTick=="function"){module.exports=process.nextTick}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)}}},{}],13:[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")}}},{}],17:[function(require,module,exports){var index=require("indexof");module.exports=Emitter;function Emitter(obj){if(obj)return mixin(obj)}function mixin(obj){for(var key in Emitter.prototype){obj[key]=Emitter.prototype[key]}return obj}Emitter.prototype.on=Emitter.prototype.addEventListener=function(event,fn){this._callbacks=this._callbacks||{};(this._callbacks[event]=this._callbacks[event]||[]).push(fn);return this};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};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(event,fn){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var callbacks=this._callbacks[event];if(!callbacks)return this;if(1==arguments.length){delete this._callbacks[event];return this}var i=index(callbacks,fn._off||fn);if(~i)callbacks.splice(i,1);return this};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};Emitter.prototype.listeners=function(event){this._callbacks=this._callbacks||{};return this._callbacks[event]||[]};Emitter.prototype.hasListeners=function(event){return!!this.listeners(event).length}},{indexof:46}],46:[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}},{}],18:[function(require,module,exports){var isEmpty=require("is-empty");try{var typeOf=require("type")}catch(e){var typeOf=require("component-type")}var types=["arguments","array","boolean","date","element","function","null","number","object","regexp","string","undefined"];for(var i=0,type;type=types[i];i++)exports[type]=generate(type);exports.fn=exports["function"];exports.empty=isEmpty;exports.nan=function(val){return exports.number(val)&&val!=val};function generate(type){return function(value){return type===typeOf(value)}}},{"is-empty":44,type:35,"component-type":35}],19:[function(require,module,exports){module.exports=isEmail;var matcher=/.+\@.+\..+/;function isEmail(string){return matcher.test(string)}},{}],20:[function(require,module,exports){module.exports=function isMeta(e){if(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)return true;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}},{}],21:[function(require,module,exports){var is=require("is");var isodate=require("isodate");var milliseconds=require("./milliseconds");var seconds=require("./seconds");module.exports=function newDate(val){if(is.date(val))return val;if(is.number(val))return new Date(toMs(val));if(isodate.is(val))return isodate.parse(val);if(milliseconds.is(val))return milliseconds.parse(val);if(seconds.is(val))return seconds.parse(val);return new Date(val)};function toMs(num){if(num<315576e5)return num*1e3;return num}},{"./milliseconds":47,"./seconds":48,is:49,isodate:43}],47:[function(require,module,exports){var matcher=/\d{13}/;exports.is=function(string){return matcher.test(string)};exports.parse=function(millis){millis=parseInt(millis,10);return new Date(millis)}},{}],48:[function(require,module,exports){var matcher=/\d{10}/;exports.is=function(string){return matcher.test(string)};exports.parse=function(seconds){var millis=parseInt(seconds,10)*1e3;return new Date(millis)}},{}],49:[function(require,module,exports){var isEmpty=require("is-empty"),typeOf=require("type");var types=["arguments","array","boolean","date","element","function","null","number","object","regexp","string","undefined"];for(var i=0,type;type=types[i];i++)exports[type]=generate(type);exports.fn=exports["function"];exports.empty=isEmpty;exports.nan=function(val){return exports.number(val)&&val!=val};function generate(type){return function(value){return type===typeOf(value)}}},{"is-empty":44,type:35}],22:[function(require,module,exports){exports.bind=function(el,type,fn,capture){if(el.addEventListener){el.addEventListener(type,fn,capture||false)}else{el.attachEvent("on"+type,fn)}return fn};exports.unbind=function(el,type,fn,capture){if(el.removeEventListener){el.removeEventListener(type,fn,capture||false)}else{el.detachEvent("on"+type,fn)}return fn}},{}],23:[function(require,module,exports){module.exports=function(e){e=e||window.event;return e.preventDefault?e.preventDefault():e.returnValue=false}},{}],24:[function(require,module,exports){var encode=encodeURIComponent;var decode=decodeURIComponent;var trim=require("trim");var type=require("type");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};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:50,type:35}],50:[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*$/,"")}},{}],25:[function(require,module,exports){var has=Object.prototype.hasOwnProperty;exports.keys=Object.keys||function(obj){var keys=[];for(var key in obj){if(has.call(obj,key)){keys.push(key)}}return keys};exports.values=function(obj){var vals=[];for(var key in obj){if(has.call(obj,key)){vals.push(obj[key])}}return vals};exports.merge=function(a,b){for(var key in b){if(has.call(b,key)){a[key]=b[key]}}return a};exports.length=function(obj){return exports.keys(obj).length};exports.isEmpty=function(obj){return 0==exports.length(obj)}},{}],27:[function(require,module,exports){var Facade=require("./facade");module.exports=Facade;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":51,"./alias":52,"./group":53,"./identify":54,"./track":55,"./page":56,"./screen":57}],51:[function(require,module,exports){var clone=require("./utils").clone;var isEnabled=require("./is-enabled");var objCase=require("obj-case");var traverse=require("isodate-traverse");module.exports=Facade;function Facade(obj){if(!obj.hasOwnProperty("timestamp"))obj.timestamp=new Date;else obj.timestamp=new Date(obj.timestamp);this.obj=obj}Facade.prototype.proxy=function(field){var fields=field.split(".");field=fields.shift();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)};Facade.prototype.field=function(field){var obj=this.obj[field];return transform(obj)};Facade.proxy=function(field){return function(){return this.proxy(field)}};Facade.field=function(field){return function(){return this.field(field)}};Facade.prototype.json=function(){var ret=clone(this.obj);if(this.type)ret.type=this.type();return ret};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||{}};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(options.providers&&options.providers.hasOwnProperty(integration)){enabled=options.providers[integration]}if(options.hasOwnProperty(integration)){var settings=options[integration];if(typeof settings==="boolean"){enabled=settings}else{enabled=true}}return enabled?true:false};Facade.prototype.integrations=function(){return this.obj.integrations||this.proxy("options.providers")||this.options()};Facade.prototype.active=function(){var active=this.proxy("options.active");if(active===null||active===undefined)active=true;return active};Facade.prototype.sessionId=Facade.prototype.anonymousId=function(){return this.field("anonymousId")||this.field("sessionId")};Facade.prototype.groupId=Facade.proxy("options.groupId");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};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};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");function transform(obj){var cloned=clone(obj);traverse(cloned);return cloned}},{"./utils":58,"./is-enabled":59,"obj-case":60,"isodate-traverse":39}],58:[function(require,module,exports){try{exports.inherit=require("inherit");exports.clone=require("clone")}catch(e){exports.inherit=require("inherit-component");exports.clone=require("clone-component")}},{inherit:61,clone:62}],61:[function(require,module,exports){module.exports=function(a,b){var fn=function(){};fn.prototype=b.prototype;a.prototype=new fn;a.prototype.constructor=a}},{}],62:[function(require,module,exports){var type;try{type=require("component-type")}catch(_){type=require("type")}module.exports=clone;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":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:return obj}}},{"component-type":35,type:35}],59:[function(require,module,exports){var disabled={Salesforce:true,Marketo:true};module.exports=function(integration){return!disabled[integration]}},{}],60:[function(require,module,exports){var Case=require("case");var identity=function(_){return _};var cases=[identity,Case.upper,Case.lower,Case.snake,Case.pascal,Case.camel,Case.constant,Case.title,Case.capital,Case.sentence];module.exports=module.exports.find=multiple(find);module.exports.replace=function(obj,key,val){multiple(replace).apply(this,arguments);return obj};module.exports.del=function(obj,key){multiple(del).apply(this,arguments);return obj};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)}}function find(obj,key){for(var i=0;i<cases.length;i++){var cased=cases[i](key);if(obj.hasOwnProperty(cased))return obj[cased]}}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}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":63}],63:[function(require,module,exports){var cases=require("./cases");module.exports=exports=determineCase;function determineCase(string){for(var key in cases){if(key=="none")continue;var convert=cases[key];if(convert(string)==string)return key}return null}exports.add=function(name,convert){exports[name]=cases[name]=convert};for(var key in cases){exports.add(key,cases[key])}},{"./cases":64}],64:[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");exports.camel=camel;exports.pascal=pascal;exports.dot=dot;exports.slug=slug;exports.snake=snake;exports.space=space;exports.constant=constant;exports.capital=capital;exports.title=title;exports.sentence=sentence;exports.lower=function(string){return none(string).toLowerCase()};exports.upper=function(string){return none(string).toUpperCase()};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};exports.none=none},{"to-camel-case":65,"to-capital-case":66,"to-constant-case":67,"to-dot-case":68,"to-no-case":69,"to-pascal-case":70,"to-sentence-case":71,"to-slug-case":72,"to-snake-case":73,"to-space-case":74,"to-title-case":75}],65:[function(require,module,exports){var toSpace=require("to-space-case");module.exports=toCamelCase;function toCamelCase(string){return toSpace(string).replace(/\s(\w)/g,function(matches,letter){return letter.toUpperCase()})}},{"to-space-case":74}],74:[function(require,module,exports){var clean=require("to-no-case");module.exports=toSpaceCase;function toSpaceCase(string){return clean(string).replace(/[\W_]+(.|$)/g,function(matches,match){return match?" "+match:""})}},{"to-no-case":69}],69:[function(require,module,exports){module.exports=toNoCase;var hasSpace=/\s/;var hasCamel=/[a-z][A-Z]/;var hasSeparator=/[\W_]/;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()}var separatorSplitter=/[\W_]+(.|$)/g;function unseparate(string){return string.replace(separatorSplitter,function(m,next){return next?" "+next:""})}var camelSplitter=/(.)([A-Z]+)/g;function uncamelize(string){return string.replace(camelSplitter,function(m,previous,uppers){return previous+" "+uppers.toLowerCase().split("").join(" ")})}},{}],66:[function(require,module,exports){var clean=require("to-no-case");module.exports=toCapitalCase;function toCapitalCase(string){return clean(string).replace(/(^|\s)(\w)/g,function(matches,previous,letter){return previous+letter.toUpperCase()})}},{"to-no-case":69}],67:[function(require,module,exports){var snake=require("to-snake-case");module.exports=toConstantCase;function toConstantCase(string){return snake(string).toUpperCase()}},{"to-snake-case":73}],73:[function(require,module,exports){var toSpace=require("to-space-case");module.exports=toSnakeCase;function toSnakeCase(string){return toSpace(string).replace(/\s/g,"_")}},{"to-space-case":74}],68:[function(require,module,exports){var toSpace=require("to-space-case");module.exports=toDotCase;function toDotCase(string){return toSpace(string).replace(/\s/g,".")}},{"to-space-case":74}],70:[function(require,module,exports){var toSpace=require("to-space-case");module.exports=toPascalCase;function toPascalCase(string){return toSpace(string).replace(/(?:^|\s)(\w)/g,function(matches,letter){return letter.toUpperCase()})}},{"to-space-case":74}],71:[function(require,module,exports){var clean=require("to-no-case");module.exports=toSentenceCase;function toSentenceCase(string){return clean(string).replace(/[a-z]/i,function(letter){return letter.toUpperCase()})}},{"to-no-case":69}],72:[function(require,module,exports){var toSpace=require("to-space-case");module.exports=toSlugCase;function toSlugCase(string){return toSpace(string).replace(/\s/g,"-")}},{"to-space-case":74}],75:[function(require,module,exports){var capital=require("to-capital-case"),escape=require("escape-regexp"),map=require("map"),minors=require("title-case-minors");module.exports=toTitleCase;var escaped=map(minors,escape);var minorMatcher=new RegExp("[^^]\\b("+escaped.join("|")+")\\b","ig");var colonMatcher=/:\s*(\w)/g;function toTitleCase(string){return capital(string).replace(minorMatcher,function(minor){return minor.toLowerCase()}).replace(colonMatcher,function(letter){return letter.toUpperCase()})}},{"to-capital-case":66,"escape-regexp":76,map:77,"title-case-minors":78}],76:[function(require,module,exports){module.exports=function(str){return String(str).replace(/([.*+?=^!:${}()|[\]\/\\])/g,"\\$1")}},{}],77:[function(require,module,exports){var each=require("each");module.exports=function map(obj,iterator){var arr=[];each(obj,function(o){arr.push(iterator.apply(null,arguments))});return arr}},{each:79}],79:[function(require,module,exports){try{var type=require("type")}catch(err){var type=require("component-type")}var toFunction=require("to-function");var has=Object.prototype.hasOwnProperty;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)}};function string(obj,fn,ctx){for(var i=0;i<obj.length;++i){fn.call(ctx,obj.charAt(i),i)}}function object(obj,fn,ctx){for(var key in obj){if(has.call(obj,key)){fn.call(ctx,key,obj[key])}}}function array(obj,fn,ctx){for(var i=0;i<obj.length;++i){fn.call(ctx,obj[i],i)}}},{type:35,"component-type":35,"to-function":80}],80:[function(require,module,exports){var expr;try{expr=require("props")}catch(e){expr=require("component-props")}module.exports=toFunction;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)}}function defaultToFunction(val){return function(obj){return val===obj}}function regexpToFunction(re){return function(obj){return re.test(obj)}}function stringToFunction(str){if(/^ *\W+/.test(str))return new Function("_","return _ "+str);return new Function("_","return "+get(str))}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}}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+")";str=stripNested(prop,str,val)}return str}function stripNested(prop,str,val){return str.replace(new RegExp("(\\.)?"+prop,"g"),function($0,$1){return $1?$0:val})}},{props:81,"component-props":81}],81:[function(require,module,exports){var globals=/\b(this|Array|Date|Object|Math|JSON)\b/g;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};function props(str){return str.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g,"").replace(globals,"").match(/[$a-zA-Z_]\w*/g)||[]}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(_)})}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}function prefixed(str){return function(_){return str+_}}},{}],78:[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"]},{}],52:[function(require,module,exports){var inherit=require("./utils").inherit;var Facade=require("./facade");module.exports=Alias;function Alias(dictionary){Facade.call(this,dictionary)}inherit(Alias,Facade);Alias.prototype.type=Alias.prototype.action=function(){return"alias"};Alias.prototype.from=Alias.prototype.previousId=function(){return this.field("previousId")||this.field("from")};Alias.prototype.to=Alias.prototype.userId=function(){return this.field("userId")||this.field("to")}},{"./utils":58,"./facade":51}],53:[function(require,module,exports){var inherit=require("./utils").inherit;var Facade=require("./facade");var newDate=require("new-date");module.exports=Group;function Group(dictionary){Facade.call(this,dictionary)}inherit(Group,Facade);Group.prototype.type=Group.prototype.action=function(){return"group"};Group.prototype.groupId=Facade.field("groupId");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)};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};Group.prototype.properties=function(){return this.field("traits")||this.field("properties")||{}}},{"./utils":58,"./facade":51,"new-date":21}],54:[function(require,module,exports){var Facade=require("./facade");var isEmail=require("is-email");var newDate=require("new-date");var utils=require("./utils");var trim=require("trim");var inherit=utils.inherit;var clone=utils.clone;module.exports=Identify;function Identify(dictionary){Facade.call(this,dictionary)}inherit(Identify,Facade);Identify.prototype.type=Identify.prototype.action=function(){return"identify"};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;delete ret[alias]}return ret};Identify.prototype.email=function(){var email=this.proxy("traits.email");if(email)return email;var userId=this.userId();if(isEmail(userId))return userId};Identify.prototype.created=function(){var created=this.proxy("traits.created")||this.proxy("traits.createdAt");if(created)return newDate(created)};Identify.prototype.companyCreated=function(){var created=this.proxy("traits.company.created")||this.proxy("traits.company.createdAt");if(created)return newDate(created)};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)};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]};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))};Identify.prototype.uid=function(){return this.userId()||this.username()||this.email()};Identify.prototype.description=function(){return this.proxy("traits.description")||this.proxy("traits.background")};Identify.prototype.username=Facade.proxy("traits.username");Identify.prototype.website=Facade.proxy("traits.website");Identify.prototype.phone=Facade.proxy("traits.phone");Identify.prototype.address=Facade.proxy("traits.address");Identify.prototype.avatar=Facade.proxy("traits.avatar")},{"./facade":51,"./utils":58,"is-email":19,"new-date":21,trim:50}],55:[function(require,module,exports){var inherit=require("./utils").inherit;var clone=require("./utils").clone;var Facade=require("./facade");var Identify=require("./identify");var isEmail=require("is-email");module.exports=Track;function Track(dictionary){Facade.call(this,dictionary)}inherit(Track,Facade);Track.prototype.type=Track.prototype.action=function(){return"track"};Track.prototype.event=Facade.field("event");Track.prototype.value=Facade.proxy("properties.value");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");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");Track.prototype.orderId=function(){return this.proxy("properties.id")||this.proxy("properties.orderId")};Track.prototype.subtotal=function(){var subtotal=this.obj.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};Track.prototype.products=function(){var props=this.obj.properties||{};return props.products||[]};Track.prototype.quantity=function(){var props=this.obj.properties||{};return props.quantity||1};Track.prototype.currency=function(){var props=this.obj.properties||{};return props.currency||"USD"};Track.prototype.referrer=Facade.proxy("properties.referrer");Track.prototype.query=Facade.proxy("options.query");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};Track.prototype.username=function(){return this.proxy("traits.username")||this.proxy("properties.username")||this.userId()||this.sessionId()};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};Track.prototype.revenue=function(){var revenue=this.proxy("properties.revenue");var event=this.event();if(!revenue&&event&&event.match(/completed ?order/i)){revenue=this.proxy("properties.total")}return currency(revenue)};Track.prototype.cents=function(){var revenue=this.revenue();return"number"!=typeof revenue?this.value()||0:revenue*100};Track.prototype.identify=function(){var json=this.json();json.traits=this.traits();return new Identify(json)};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":58,"./facade":51,"./identify":54,"is-email":19}],56:[function(require,module,exports){var inherit=require("./utils").inherit;var Facade=require("./facade");var Track=require("./track");module.exports=Page;function Page(dictionary){Facade.call(this,dictionary)}inherit(Page,Facade);Page.prototype.type=Page.prototype.action=function(){return"page"};Page.prototype.category=Facade.field("category");Page.prototype.name=Facade.field("name");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};Page.prototype.fullName=function(){var category=this.category();var name=this.name();return name&&category?category+" "+name:name};Page.prototype.event=function(name){return name?"Viewed "+name+" Page":"Loaded a Page"};Page.prototype.track=function(name){var props=this.properties();return new Track({event:this.event(name),properties:props})}},{"./utils":58,"./facade":51,"./track":55}],57:[function(require,module,exports){var inherit=require("./utils").inherit;var Page=require("./page");var Track=require("./track");module.exports=Screen;function Screen(dictionary){Page.call(this,dictionary)}inherit(Screen,Page);Screen.prototype.type=Screen.prototype.action=function(){return"screen"};Screen.prototype.event=function(name){return name?"Viewed "+name+" Screen":"Loaded a Screen"};Screen.prototype.track=function(name){var props=this.properties();return new Track({event:this.event(name),properties:props})}},{"./utils":58,"./page":56,"./track":55}],3:[function(require,module,exports){module.exports="2.3.2"},{}],4:[function(require,module,exports){var each=require("each");var plugins=require("./integrations.js");each(plugins,function(plugin){var name=(plugin.Integration||plugin).prototype.name;exports[name]=plugin})},{"./integrations.js":82,each:5}],82:[function(require,module,exports){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-ads"),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/hubspot"),require("./lib/improvely"),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/userfox"),require("./lib/uservoice"),require("./lib/vero"),require("./lib/visual-website-optimizer"),require("./lib/webengage"),require("./lib/woopra"),require("./lib/yandex-metrica")]
},{"./lib/adroll":83,"./lib/adwords":84,"./lib/alexa":85,"./lib/amplitude":86,"./lib/appcues":87,"./lib/awesm":88,"./lib/awesomatic":89,"./lib/bing-ads":90,"./lib/bronto":91,"./lib/bugherd":92,"./lib/bugsnag":93,"./lib/chartbeat":94,"./lib/churnbee":95,"./lib/clicktale":96,"./lib/clicky":97,"./lib/comscore":98,"./lib/crazy-egg":99,"./lib/curebit":100,"./lib/customerio":101,"./lib/drip":102,"./lib/errorception":103,"./lib/evergage":104,"./lib/facebook-ads":105,"./lib/foxmetrics":106,"./lib/frontleaf":107,"./lib/gauges":108,"./lib/get-satisfaction":109,"./lib/google-analytics":110,"./lib/google-tag-manager":111,"./lib/gosquared":112,"./lib/heap":113,"./lib/hellobar":114,"./lib/hittail":115,"./lib/hubspot":116,"./lib/improvely":117,"./lib/inspectlet":118,"./lib/intercom":119,"./lib/keen-io":120,"./lib/kenshoo":121,"./lib/kissmetrics":122,"./lib/klaviyo":123,"./lib/leadlander":124,"./lib/livechat":125,"./lib/lucky-orange":126,"./lib/lytics":127,"./lib/mixpanel":128,"./lib/mojn":129,"./lib/mouseflow":130,"./lib/mousestats":131,"./lib/navilytics":132,"./lib/olark":133,"./lib/optimizely":134,"./lib/perfect-audience":135,"./lib/pingdom":136,"./lib/piwik":137,"./lib/preact":138,"./lib/qualaroo":139,"./lib/quantcast":140,"./lib/rollbar":141,"./lib/saasquatch":142,"./lib/sentry":143,"./lib/snapengage":144,"./lib/spinnakr":145,"./lib/tapstream":146,"./lib/trakio":147,"./lib/twitter-ads":148,"./lib/usercycle":149,"./lib/userfox":150,"./lib/uservoice":151,"./lib/vero":152,"./lib/visual-website-optimizer":153,"./lib/webengage":154,"./lib/woopra":155,"./lib/yandex-metrica":156}],83:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var snake=require("to-snake-case");var useHttps=require("use-https");var is=require("is");var has=Object.prototype.hasOwnProperty;var AdRoll=module.exports=integration("AdRoll").assumesPageview().global("__adroll_loaded").global("adroll_adv_id").global("adroll_pix_id").global("adroll_custom_data").option("events",{}).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">');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)};AdRoll.prototype.loaded=function(){return window.__adroll};AdRoll.prototype.page=function(page){var name=page.fullName();this.track(page.track(name))};AdRoll.prototype.track=function(track){var events=this.options.events;var event=track.event();var data={};var user=this.analytics.user();if(user.id())data.user_id=user.id();if(has.call(events,event)){event=events[event];var total=track.revenue()||track.total()||0;var orderId=track.orderId()||0;data.adroll_conversion_value_in_dollars=total;data.order_id=orderId}data.adroll_segments=snake(event);window.__adroll.record_user(data)}},{"segmentio/analytics.js-integration":157,"to-snake-case":158,"use-https":159,is:18}],157:[function(require,module,exports){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");module.exports=createIntegration;function createIntegration(name){function Integration(options){if(options&&options.addIntegration){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}},{"./protos":160,"./statics":161,bind:162,callback:12,clone:14,debug:163,defaults:16,slug:164}],160:[function(require,module,exports){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");var setTimeout=window.setTimeout;var setInterval=window.setInterval;var onerror=null;var onload=null;Emitter(exports);exports.initialize=function(){var ready=this.ready;tick(ready)};exports.loaded=function(){return false};exports.load=function(cb){callback.async(cb)};exports.page=function(page){};exports.track=function(track){};exports.map=function(obj,str){var a=normalize(str);var ret=[];if(!obj)return ret;if("object"==type(obj)){for(var k in obj){var item=obj[k];var b=normalize(k);if(b==a)ret.push(item)}}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};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};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})};exports.flush=function(){this._ready=true;var call;while(call=this._queue.shift())this[call.method].apply(this,call.args)};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};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);delete attrs.src;each(attrs,function(key,val){el.setAttribute(key,val)});break;case"iframe":el=loadIframe(attrs,fn);break}return el};exports.locals=function(locals){locals=locals||{};var cache=Math.floor((new Date).getTime()/36e5);if(!locals.hasOwnProperty("cache"))locals.cache=cache;each(this.options,function(key,val){if(!locals.hasOwnProperty(key))locals[key]=val});return locals};exports.ready=function(){this.emit("ready")};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)};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)}};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)}}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}},{"./events":165,"segmentio/load-script":166,"to-no-case":167,callback:12,emitter:17,"next-tick":45,assert:168,after:10,"component/each":79,type:35,"yields/fmt":169}],165:[function(require,module,exports){module.exports={removedProduct:/removed[ _]?product/i,viewedProduct:/viewed[ _]?product/i,addedProduct:/added[ _]?product/i,completedOrder:/completed[ _]?order/i}},{}],166:[function(require,module,exports){var onload=require("script-onload");var tick=require("next-tick");var type=require("type");module.exports=function loadScript(options,fn){if(!options)throw new Error("Cant load nothing...");if("string"==type(options))options={src:options};var https=document.location.protocol==="https:"||document.location.protocol==="chrome-extension:";if(options.src&&options.src.indexOf("//")===0){options.src=https?"https:"+options.src:"http:"+options.src}if(https&&options.https)options.src=options.https;else if(!https&&options.http)options.src=options.http;var script=document.createElement("script");script.type="text/javascript";script.async=true;script.src=options.src;if("function"==type(fn)){onload(script,fn)}tick(function(){var firstScript=document.getElementsByTagName("script")[0];firstScript.parentNode.insertBefore(script,firstScript)});return script}},{"script-onload":170,"next-tick":45,type:35}],170:[function(require,module,exports){module.exports=function(el,fn){return el.addEventListener?add(el,fn):attach(el,fn)};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)}function attach(el,fn){el.attachEvent("onreadystatechange",function(e){if(!/complete|loaded/.test(el.readyState))return;fn(null,e)})}},{}],167:[function(require,module,exports){module.exports=toNoCase;var hasSpace=/\s/;var hasSeparator=/[\W_]/;function toNoCase(string){if(hasSpace.test(string))return string.toLowerCase();if(hasSeparator.test(string))return unseparate(string).toLowerCase();return uncamelize(string).toLowerCase()}var separatorSplitter=/[\W_]+(.|$)/g;function unseparate(string){return string.replace(separatorSplitter,function(m,next){return next?" "+next:""})}var camelSplitter=/(.)([A-Z]+)/g;function uncamelize(string){return string.replace(camelSplitter,function(m,previous,uppers){return previous+" "+uppers.toLowerCase().split("").join(" ")})}},{}],168:[function(require,module,exports){var equals=require("equals");var fmt=require("fmt");var stack=require("stack");module.exports=exports=function(expr,msg){if(expr)return;throw new Error(msg||message())};exports.equal=function(actual,expected,msg){if(actual==expected)return;throw new Error(msg||fmt("Expected %o to equal %o.",actual,expected))};exports.notEqual=function(actual,expected,msg){if(actual!=expected)return;throw new Error(msg||fmt("Expected %o not to equal %o.",actual,expected))};exports.deepEqual=function(actual,expected,msg){if(equals(actual,expected))return;throw new Error(msg||fmt("Expected %o to deeply equal %o.",actual,expected))};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))};exports.strictEqual=function(actual,expected,msg){if(actual===expected)return;throw new Error(msg||fmt("Expected %o to strictly equal %o.",actual,expected))};exports.notStrictEqual=function(actual,expected,msg){if(actual!==expected)return;throw new Error(msg||fmt("Expected %o not to strictly equal %o.",actual,expected))};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))}};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))}};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()}function get(script){var xhr=new XMLHttpRequest;xhr.open("GET",script,false);xhr.send(null);return xhr.responseText}},{equals:171,fmt:169,stack:172}],171:[function(require,module,exports){var type=require("type");module.exports=equals;equals.compare=compare;function equals(){var i=arguments.length-1;while(i>0){if(!compare(arguments[i],arguments[--i]))return false}return true}function compare(a,b,memos){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={};types.number=function(a){return a!==a};types["function"]=function(a,b,memos){return a.toString()===b.toString()&&types.object(a,b,memos)&&compare(a.prototype,b.prototype)};types.date=function(a,b){return+a===+b};types.regexp=function(a,b){return a.toString()===b.toString()};types.element=function(a,b){return a.outerHTML===b.outerHTML};types.textnode=function(a,b){return a.textContent===b.textContent};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);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);function compareObjects(a,b,memos){var ka=getEnumerableProperties(a);var kb=getEnumerableProperties(b);var i=ka.length;if(i!==kb.length)return false;ka.sort();kb.sort();while(i--)if(ka[i]!==kb[i])return false;memos.push([a,b]);i=ka.length;while(i--){var key=ka[i];if(!compare(a[key],b[key],memos))return false}return true}function getEnumerableProperties(object){var result=[];for(var k in object)if(k!=="constructor"){result.push(k)}return result}},{type:173}],173:[function(require,module,exports){var toString={}.toString;var DomNode=typeof window!="undefined"?window.Node:Function;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"}},{}],169:[function(require,module,exports){module.exports=fmt;fmt.o=JSON.stringify;fmt.s=String;fmt.d=parseInt;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})}},{}],172:[function(require,module,exports){module.exports=stack;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}},{}],161:[function(require,module,exports){var after=require("after");var domify=require("component/domify");var each=require("component/each");var Emitter=require("emitter");Emitter(exports);exports.option=function(key,value){this.prototype.defaults[key]=value;return this};exports.mapping=function(name){this.option(name,[]);this.prototype[name]=function(str){return this.map(this.options[name],str)};return this};exports.global=function(key){this.prototype.globals.push(key);return this};exports.assumesPageview=function(){this.prototype._assumesPageview=true;return this};exports.readyOnLoad=function(){this.prototype._readyOnLoad=true;return this};exports.readyOnInitialize=function(){this.prototype._readyOnInitialize=true;return this};exports.tag=function(name,str){if(null==str){str=name;name="library"}this.prototype.templates[name]=objectify(str);return this};function objectify(str){str=str.replace(' src="',' data-src="');var el=domify(str);var attrs={};each(el.attributes,function(attr){var name="data-src"==attr.name?"src":attr.name;attrs[name]=attr.value});return{type:el.tagName.toLowerCase(),attrs:attrs}}},{after:10,"component/domify":174,"component/each":79,emitter:17}],174:[function(require,module,exports){module.exports=parse;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>"];function parse(html){if("string"!=typeof html)throw new TypeError("String expected");var m=/<([\w:]+)/.exec(html);if(!m)return document.createTextNode(html);html=html.replace(/^\s+|\s+$/g,"");var tag=m[1];if(tag=="body"){var el=document.createElement("html");el.innerHTML=html;return el.removeChild(el.lastChild)}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;if(el.firstChild==el.lastChild){return el.removeChild(el.firstChild)}var fragment=document.createDocumentFragment();while(el.firstChild){fragment.appendChild(el.removeChild(el.firstChild))}return fragment}},{}],162:[function(require,module,exports){var bind=require("bind"),bindAll=require("bind-all");module.exports=exports=bind;exports.all=bindAll;exports.methods=bindMethods;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:33,"bind-all":34}],163:[function(require,module,exports){if("undefined"==typeof window){module.exports=require("./lib/debug")}else{module.exports=require("./debug")}},{"./lib/debug":175,"./debug":176}],175:[function(require,module,exports){var tty=require("tty");module.exports=debug;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+"$"))}});var colors=[6,2,3,4,5,1];var prev={};var prevColor=0;var isatty=tty.isatty(2);function color(){return colors[prevColor++%colors.length]}function humanize(ms){var sec=1e3,min=60*1e3,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"}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=" [9"+c+"m"+name+" "+"[3"+c+"m[90m"+fmt+"[3"+c+"m"+" +"+humanize(ms)+"[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}function coerce(val){if(val instanceof Error)return val.stack||val.message;return val}},{}],176:[function(require,module,exports){module.exports=debug;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);window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}}debug.names=[];debug.skips=[];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+"$"))}}};debug.disable=function(){debug.enable("")};debug.humanize=function(ms){var sec=1e3,min=60*1e3,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"};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};function coerce(val){if(val instanceof Error)return val.stack||val.message;return val}try{if(window.localStorage)debug.enable(localStorage.debug)}catch(e){}},{}],164:[function(require,module,exports){module.exports=function(str,options){options||(options={});return str.toLowerCase().replace(options.replace||/[^a-z0-9]/g," ").replace(/^ +| +$/g,"").replace(/ +/g,options.separator||"-")}},{}],158:[function(require,module,exports){var toSpace=require("to-space-case");module.exports=toSnakeCase;function toSnakeCase(string){return toSpace(string).replace(/\s/g,"_")}},{"to-space-case":177}],177:[function(require,module,exports){var clean=require("to-no-case");module.exports=toSpaceCase;function toSpaceCase(string){return clean(string).replace(/[\W_]+(.|$)/g,function(matches,match){return match?" "+match:""})}},{"to-no-case":69}],159:[function(require,module,exports){module.exports=function(url){switch(arguments.length){case 0:return check();case 1:return transform(url)}};function transform(url){return check()?"https:"+url:"http:"+url}function check(){return location.protocol=="https:"||location.protocol=="chrome-extension:"}},{}],84:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var onbody=require("on-body");var domify=require("domify");var Queue=require("queue");var has=Object.prototype.hasOwnProperty;var q=new Queue({concurrency:1,timeout:2e3});var AdWords=module.exports=integration("AdWords").option("conversionId","").option("remarketing",false).option("events",{}).tag("conversion",'<script src="//www.googleadservices.com/pagead/conversion.js">');AdWords.prototype.initialize=function(){onbody(this.ready)};AdWords.prototype.loaded=function(){return!!document.body};AdWords.prototype.page=function(page){var remarketing=this.options.remarketing;var id=this.options.conversionId;if(remarketing)this.remarketing(id)};AdWords.prototype.track=function(track){var id=this.options.conversionId;var events=this.options.events;var event=track.event();if(!has.call(events,event))return;return this.conversion({value:track.revenue()||0,label:events[event],conversionId:id})};AdWords.prototype.conversion=function(obj,fn){this.enqueue({google_conversion_id:obj.conversionId,google_conversion_language:"en",google_conversion_format:"3",google_conversion_color:"ffffff",google_conversion_label:obj.label,google_conversion_value:obj.value,google_remarketing_only:false},fn)};AdWords.prototype.remarketing=function(id){this.enqueue({google_conversion_id:id,google_remarketing_only:true})};AdWords.prototype.enqueue=function(obj,fn){this.debug("sending %o",obj);var self=this;q.push(function(next){self.globalize(obj);self.shim();self.load("conversion",function(){if(fn)fn();next()})})};AdWords.prototype.globalize=function(obj){for(var name in obj){if(obj.hasOwnProperty(name)){window[name]=obj[name]}}};AdWords.prototype.shim=function(){var self=this;var write=document.write;document.write=append;function append(str){var el=domify(str);if(!el.src)return write(str);if(!/googleadservices/.test(el.src))return write(str);self.debug("append %o",el);document.body.appendChild(el);document.write=write}}},{"segmentio/analytics.js-integration":157,"on-body":178,domify:179,queue:180}],178:[function(require,module,exports){var each=require("each");var body=false;var callbacks=[];module.exports=function onBody(callback){if(body){call(callback)}else{callbacks.push(callback)}};var interval=setInterval(function(){if(!document.body)return;body=true;each(callbacks,call);clearInterval(interval)},5);function call(callback){callback(document.body)}},{each:79}],179:[function(require,module,exports){module.exports=parse;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>"];function parse(html){if("string"!=typeof html)throw new TypeError("String expected");html=html.replace(/^\s+|\s+$/g,"");var m=/<([\w:]+)/.exec(html);if(!m)return document.createTextNode(html);var tag=m[1];if(tag=="body"){var el=document.createElement("html");el.innerHTML=html;return el.removeChild(el.lastChild)}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;if(el.firstChild==el.lastChild){return el.removeChild(el.firstChild)}var fragment=document.createDocumentFragment();while(el.firstChild){fragment.appendChild(el.removeChild(el.firstChild))}return fragment}},{}],180:[function(require,module,exports){var Emitter;var bind;try{Emitter=require("emitter");bind=require("bind")}catch(err){Emitter=require("component-emitter");bind=require("component-bind")}module.exports=Queue;function Queue(options){options=options||{};this.timeout=options.timeout||0;this.concurrency=options.concurrency||1;this.pending=0;this.jobs=[]}Emitter(Queue.prototype);Queue.prototype.length=function(){return this.pending+this.jobs.length};Queue.prototype.push=function(fn,cb){this.jobs.push([fn,cb]);setTimeout(bind(this,this.run),0)};Queue.prototype.run=function(){while(this.pending<this.concurrency){var job=this.jobs.shift();if(!job)break;this.exec(job)}};Queue.prototype.exec=function(job){var self=this;var ms=this.timeout;var fn=job[0];var cb=job[1];if(ms)fn=timeout(fn,ms);this.pending++;fn(function(err,res){cb&&cb(err,res);self.pending--;self.run()})};function timeout(fn,ms){return function(cb){var done;var id=setTimeout(function(){done=true;var err=new Error("Timeout of "+ms+"ms exceeded");err.timeout=timeout;cb(err)},ms);fn(function(err,res){if(done)return;clearTimeout(id);cb(err,res)})}}},{emitter:181,bind:33,"component-emitter":181,"component-bind":33}],181:[function(require,module,exports){module.exports=Emitter;function Emitter(obj){if(obj)return mixin(obj)}function mixin(obj){for(var key in Emitter.prototype){obj[key]=Emitter.prototype[key]}return obj}Emitter.prototype.on=Emitter.prototype.addEventListener=function(event,fn){this._callbacks=this._callbacks||{};(this._callbacks[event]=this._callbacks[event]||[]).push(fn);return this};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};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(event,fn){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var callbacks=this._callbacks[event];if(!callbacks)return this;if(1==arguments.length){delete this._callbacks[event];return this}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};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};Emitter.prototype.listeners=function(event){this._callbacks=this._callbacks||{};return this._callbacks[event]||[]};Emitter.prototype.hasListeners=function(event){return!!this.listeners(event).length}},{}],85:[function(require,module,exports){var integration=require("segmentio/analytics.js-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">');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()})};Alexa.prototype.loaded=function(){return!!window.atrk}},{"segmentio/analytics.js-integration":157}],86:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var Amplitude=module.exports=integration("Amplitude").assumesPageview().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">');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)};Amplitude.prototype.loaded=function(){return!!(window.amplitude&&window.amplitude.options)};Amplitude.prototype.page=function(page){var properties=page.properties();var category=page.category();var name=page.fullName();var opts=this.options;if(opts.trackAllPages){this.track(page.track())}if(category&&opts.trackCategorizedPages){this.track(page.track(category))}if(name&&opts.trackNamedPages){this.track(page.track(name))}};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)};Amplitude.prototype.track=function(track){var props=track.properties();var event=track.event();window.amplitude.logEvent(event,props)}},{"segmentio/analytics.js-integration":157}],87:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var load=require("load-script");var is=require("is");module.exports=exports=function(analytics){analytics.addIntegration(Appcues)};var Appcues=exports.Integration=integration("Appcues").assumesPageview().global("Appcues").global("AppcuesIdentity").option("appcuesId","").option("userId","").option("userEmail","");
Appcues.prototype.initialize=function(){this.load(function(){window.Appcues.init()})};Appcues.prototype.loaded=function(){return is.object(window.Appcues)};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)};Appcues.prototype.identify=function(identify){window.Appcues.identify(identify.traits())}},{"segmentio/analytics.js-integration":157,"load-script":166,is:18}],88:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var Awesm=module.exports=integration("awe.sm").assumesPageview().global("AWESM").option("apiKey","").option("events",{}).tag('<script src="//widgets.awe.sm/v3/widgets.js?key={{ apiKey }}&async=true">');Awesm.prototype.initialize=function(page){window.AWESM={api_key:this.options.apiKey};this.load(this.ready)};Awesm.prototype.loaded=function(){return!!(window.AWESM&&window.AWESM._exists)};Awesm.prototype.track=function(track){var event=track.event();var goal=this.options.events[event];if(!goal)return;var user=this.analytics.user();window.AWESM.convert(goal,track.cents(),null,user.id())}},{"segmentio/analytics.js-integration":157}],89:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var is=require("is");var noop=function(){};var onBody=require("on-body");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">');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()})})};Awesomatic.prototype.loaded=function(){return is.object(window.Awesomatic)}},{"segmentio/analytics.js-integration":157,is:18,"on-body":178}],90:[function(require,module,exports){var integration=require("segmentio/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 has=Object.prototype.hasOwnProperty;var noop=function(){};var Bing=module.exports=integration("Bing Ads").option("siteId","").option("domainId","").option("events",{}).tag('<script id="mstag_tops" src="//flex.msn.com/mstag/site/{{ siteId }}/mstag.js">');Bing.prototype.initialize=function(page){if(!window.mstag){window.mstag={loadTag:noop,time:(new Date).getTime(),_write:writeToAppend}}var self=this;onbody(function(){self.load(function(){var loaded=bind(self,self.loaded);when(loaded,self.ready)})})};Bing.prototype.loaded=function(){return!!(window.mstag&&window.mstag.loadTag!==noop)};Bing.prototype.track=function(track){var events=this.options.events;var traits=track.traits();var event=track.event();if(!has.call(events,event))return;var goal=events[event];var revenue=track.revenue()||0;window.mstag.loadTag("analytics",{domainId:this.options.domainId,revenue:revenue,dedup:"1",type:"1",actionid:goal})};function writeToAppend(str){var first=document.getElementsByTagName("script")[0];var el=domify(str);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)}},{"segmentio/analytics.js-integration":157,"on-body":178,domify:179,extend:40,bind:33,when:182}],182:[function(require,module,exports){var callback=require("callback");module.exports=when;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:12}],91:[function(require,module,exports){var integration=require("segmentio/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");var Bronto=module.exports=integration("Bronto").global("__bta").option("siteId","").option("host","").tag('<script src="//p.bm23.com/bta.js">');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()})};Bronto.prototype.loaded=function(){return this.bta};Bronto.prototype.track=function(track){var revenue=track.revenue();var event=track.event();var type="number"==typeof revenue?"$":"t";this.bta.addConversionLegacy(type,event,revenue)};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();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()})});this.bta.addOrder({order_id:track.orderId(),email:email,items:items})}},{"segmentio/analytics.js-integration":157,facade:27,"load-pixel":183,querystring:184,each:5}],183:[function(require,module,exports){var stringify=require("querystring").stringify;var sub=require("substitute");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}};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:184,substitute:185}],184:[function(require,module,exports){var encode=encodeURIComponent;var decode=decodeURIComponent;var trim=require("trim");var type=require("type");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};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:50,type:35}],185:[function(require,module,exports){module.exports=substitute;function substitute(str,obj,expr){if(!obj)throw new TypeError("expected an object");expr=expr||/:(\w+)/g;return str.replace(expr,function(_,prop){return null!=obj[prop]?obj[prop]:_})}},{}],92:[function(require,module,exports){var integration=require("segmentio/analytics.js-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 }}">');BugHerd.prototype.initialize=function(page){window.BugHerdConfig={feedback:{hide:!this.options.showFeedbackTab}};this.load(this.ready)};BugHerd.prototype.loaded=function(){return!!window._bugHerd}},{"segmentio/analytics.js-integration":157}],93:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var is=require("is");var extend=require("extend");var onError=require("on-error");var Bugsnag=module.exports=integration("Bugsnag").global("Bugsnag").option("apiKey","").tag('<script src="//d2wy8f7a9ursnm.cloudfront.net/bugsnag-2.min.js">');Bugsnag.prototype.initialize=function(page){var self=this;this.load(function(){window.Bugsnag.apiKey=self.options.apiKey;self.ready()})};Bugsnag.prototype.loaded=function(){return is.object(window.Bugsnag)};Bugsnag.prototype.identify=function(identify){window.Bugsnag.metaData=window.Bugsnag.metaData||{};extend(window.Bugsnag.metaData,identify.traits())}},{"segmentio/analytics.js-integration":157,is:18,extend:40,"on-error":186}],186:[function(require,module,exports){module.exports=onError;var callbacks=[];if("function"==typeof window.onerror)callbacks.push(window.onerror);window.onerror=handler;function handler(){for(var i=0,fn;fn=callbacks[i];i++)fn.apply(this,arguments)}function onError(fn){callbacks.push(fn);if(window.onerror!=handler){callbacks.push(window.onerror);window.onerror=handler}}},{}],94:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var defaults=require("defaults");var onBody=require("on-body");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">');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();self.load(self.ready)})};Chartbeat.prototype.loaded=function(){return!!window.pSUPERFLY};Chartbeat.prototype.page=function(page){var props=page.properties();var name=page.fullName();window.pSUPERFLY.virtualPage(props.path,name||props.title)}},{"segmentio/analytics.js-integration":157,defaults:187,"on-body":178}],187:[function(require,module,exports){module.exports=defaults;function defaults(dest,defaults){for(var prop in defaults){if(!(prop in dest)){dest[prop]=defaults[prop]}}return dest}},{}],95:[function(require,module,exports){var push=require("global-queue")("_cbq");var integration=require("segmentio/analytics.js-integration");var has=Object.prototype.hasOwnProperty;var supported={activation:true,changePlan:true,register:true,refund:true,charge:true,cancel:true,login:true};var ChurnBee=module.exports=integration("ChurnBee").global("_cbq").global("ChurnBee").option("events",{}).option("apiKey","").tag('<script src="//api.churnbee.com/cb.js">');ChurnBee.prototype.initialize=function(page){push("_setApiKey",this.options.apiKey);this.load(this.ready)};ChurnBee.prototype.loaded=function(){return!!window.ChurnBee};ChurnBee.prototype.track=function(track){var events=this.options.events;var event=track.event();if(has.call(events,event))event=events[event];if(true!=supported[event])return;push(event,track.properties({revenue:"amount"}))}},{"global-queue":188,"segmentio/analytics.js-integration":157}],188:[function(require,module,exports){module.exports=generate;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)}}},{}],96:[function(require,module,exports){var date=require("load-date");var domify=require("domify");var each=require("each");var integration=require("segmentio/analytics.js-integration");var is=require("is");var useHttps=require("use-https");var onBody=require("on-body");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",.01).option("partitionId","").tag('<script src="{{src}}">');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()})};ClickTale.prototype.loaded=function(){return is.fn(window.ClickTale)};ClickTale.prototype.identify=function(identify){var id=identify.userId();window.ClickTaleSetUID(id);each(identify.traits(),function(key,value){window.ClickTaleField(key,value)})};ClickTale.prototype.track=function(track){window.ClickTaleEvent(track.event())}},{"load-date":189,domify:179,each:5,"segmentio/analytics.js-integration":157,is:18,"use-https":159,"on-body":178}],189:[function(require,module,exports){var time=new Date,perf=window.performance;if(perf&&perf.timing&&perf.timing.responseEnd){time=new Date(perf.timing.responseEnd)}module.exports=time},{}],97:[function(require,module,exports){var Identify=require("facade").Identify;var extend=require("extend");var integration=require("segmentio/analytics.js-integration");var is=require("is");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>');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)};Clicky.prototype.loaded=function(){return is.object(window.clicky)};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)};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())};Clicky.prototype.track=function(track){window.clicky.goal(track.event(),track.revenue())}},{facade:27,extend:40,"segmentio/analytics.js-integration":157,is:18}],98:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var useHttps=require("use-https");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">');Comscore.prototype.initialize=function(page){window._comscore=window._comscore||[this.options];var name=useHttps()?"https":"http";this.load(name,this.ready)};Comscore.prototype.loaded=function(){return!!window.COMSCORE}},{"segmentio/analytics.js-integration":157,"use-https":159}],99:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var CrazyEgg=module.exports=integration("Crazy Egg").assumesPageview().global("CE2").option("accountNumber","").tag('<script src="//dnn506yrbagrg.cloudfront.net/pages/scripts/{{ path }}.js?{{ cache }}">');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()/36e5);this.load({path:path,cache:cache},this.ready)};CrazyEgg.prototype.loaded=function(){return!!window.CE2}},{"segmentio/analytics.js-integration":157}],100:[function(require,module,exports){var integration=require("segmentio/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");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">');Curebit.prototype.initialize=function(page){push("init",{site_id:this.options.siteId,server:this.options.server});this.load(this.ready);this.page=throttle(bind(this,this.page),250)};Curebit.prototype.loaded=function(){return!!window.curebit};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)})};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(identify.email()){settings.affiliate_member={email:identify.email(),first_name:identify.firstName(),last_name:identify.lastName(),customer_id:identify.userId()}}push("register_affiliate",settings)};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})}},{"segmentio/analytics.js-integration":157,"global-queue":188,facade:27,throttle:190,"to-iso-string":191,clone:192,each:5,bind:33}],190:[function(require,module,exports){module.exports=throttle;function throttle(func,wait){var rtn;var last=0;return function throttled(){var now=(new Date).getTime();var delta=now-last;if(delta>=wait){rtn=func.apply(this,arguments);last=now}return rtn}}},{}],191:[function(require,module,exports){module.exports=toIsoString;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()/1e3).toFixed(3)).slice(2,5)+"Z"}function pad(number){var n=number.toString();return n.length===1?"0"+n:n}},{}],192:[function(require,module,exports){var type;try{type=require("type")}catch(e){type=require("type-component")}module.exports=clone;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":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:return obj}}},{type:35}],101:[function(require,module,exports){var alias=require("alias");var convertDates=require("convert-dates");var Identify=require("facade").Identify;var integration=require("segmentio/analytics.js-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 }}">');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)};Customerio.prototype.loaded=function(){return!!(window._cio&&window._cio.pageHasLoaded)};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)};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}))};Customerio.prototype.track=function(track){var properties=track.properties();properties=convertDates(properties,convertDate);window._cio.track(track.event(),properties)};function convertDate(date){return Math.floor(date.getTime()/1e3)}},{alias:193,"convert-dates":194,facade:27,"segmentio/analytics.js-integration":157}],193:[function(require,module,exports){var type=require("type");try{var clone=require("clone")}catch(e){var clone=require("clone-component")}module.exports=alias;function alias(obj,method){switch(type(method)){case"object":return aliasByDictionary(clone(obj),method);case"function":return aliasByFunction(clone(obj),method)}}function aliasByDictionary(obj,aliases){for(var key in aliases){if(undefined===obj[key])continue;obj[aliases[key]]=obj[key];delete obj[key]}return obj}function aliasByFunction(obj,convert){var output={};for(var key in obj)output[convert(key)]=obj[key];return output}},{type:35,clone:62}],194:[function(require,module,exports){var is=require("is");try{var clone=require("clone")}catch(e){var clone=require("clone-component")}module.exports=convertDates;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:18,clone:14}],102:[function(require,module,exports){var alias=require("alias");var integration=require("segmentio/analytics.js-integration");var is=require("is");var load=require("load-script");var push=require("global-queue")("_dcq");var Drip=module.exports=integration("Drip").assumesPageview().global("dc").global("_dcq").global("_dcs").option("account","").tag('<script src="//tag.getdrip.com/{{ account }}.js">');Drip.prototype.initialize=function(page){window._dcq=window._dcq||[];window._dcs=window._dcs||{};window._dcs.account=this.options.account;this.load(this.ready)};Drip.prototype.loaded=function(){return is.object(window.dc)};Drip.prototype.track=function(track){var props=track.properties();var cents=Math.round(track.cents());props.action=track.event();if(cents)props.value=cents;delete props.revenue;push("track",props)}},{alias:193,"segmentio/analytics.js-integration":157,is:18,"load-script":166,"global-queue":188}],103:[function(require,module,exports){var extend=require("extend");var integration=require("segmentio/analytics.js-integration");var onError=require("on-error");var push=require("global-queue")("_errs");var Errorception=module.exports=integration("Errorception").assumesPageview().global("_errs").option("projectId","").option("meta",true).tag('<script src="//beacon.errorception.com/{{ projectId }}.js">');Errorception.prototype.initialize=function(page){window._errs=window._errs||[this.options.projectId];onError(push);this.load(this.ready)};Errorception.prototype.loaded=function(){return!!(window._errs&&window._errs.push!==Array.prototype.push)};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:40,"segmentio/analytics.js-integration":157,"on-error":186,"global-queue":188}],104:[function(require,module,exports){var each=require("each");var integration=require("segmentio/analytics.js-integration");var push=require("global-queue")("_aaq");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">');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)};Evergage.prototype.loaded=function(){return!!(window._aaq&&window._aaq.push!==Array.prototype.push)};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)};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")})};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")})};Evergage.prototype.track=function(track){push("trackAction",track.event(),track.properties())}},{each:5,"segmentio/analytics.js-integration":157,"global-queue":188}],105:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var push=require("global-queue")("_fbq");var has=Object.prototype.hasOwnProperty;var Facebook=module.exports=integration("Facebook Ads").global("_fbq").option("currency","USD").option("events",{}).tag('<script src="//connect.facebook.net/en_US/fbds.js">');Facebook.prototype.initialize=function(page){window._fbq=window._fbq||[];this.load(this.ready);window._fbq.loaded=true};Facebook.prototype.loaded=function(){return!!(window._fbq&&window._fbq.loaded)};Facebook.prototype.track=function(track){var events=this.options.events;var traits=track.traits();var event=track.event();var revenue=track.revenue()||0;var data=track.properties();if(has.call(events,event)){event=events[event];data={value:String(revenue.toFixed(2)),currency:this.options.currency}}push("track",event,data)}},{"segmentio/analytics.js-integration":157,"global-queue":188}],106:[function(require,module,exports){var push=require("global-queue")("_fxm");var integration=require("segmentio/analytics.js-integration");var Track=require("facade").Track;var each=require("each");var FoxMetrics=module.exports=integration("FoxMetrics").assumesPageview().global("_fxm").option("appId","").tag('<script src="//d35tca7vmefkrc.cloudfront.net/scripts/{{ appId }}.js">');FoxMetrics.prototype.initialize=function(page){window._fxm=window._fxm||[];this.load(this.ready)};FoxMetrics.prototype.loaded=function(){return!!(window._fxm&&window._fxm.appId)};FoxMetrics.prototype.page=function(page){var properties=page.proxy("properties");var category=page.category();var name=page.name();this._category=category;push("_fxm.pages.view",properties.title,name,category,properties.url,properties.referrer)};FoxMetrics.prototype.identify=function(identify){var id=identify.userId();if(!id)return;push("_fxm.visitor.profile",id,identify.firstName(),identify.lastName(),identify.email(),identify.address(),undefined,undefined,identify.traits())};FoxMetrics.prototype.track=function(track){var props=track.properties();var category=this._category||props.category;push(track.event(),category,props)};FoxMetrics.prototype.viewedProduct=function(track){ecommerce("productview",track)};FoxMetrics.prototype.removedProduct=function(track){ecommerce("removecartitem",track)};FoxMetrics.prototype.addedProduct=function(track){ecommerce("cartitem",track)};FoxMetrics.prototype.completedOrder=function(track){var orderId=track.orderId();push("_fxm.ecommerce.order",orderId,track.subtotal(),track.shipping(),track.tax(),track.city(),track.state(),track.zip(),track.quantity());each(track.products(),function(product){var track=new Track({properties:product});ecommerce("purchaseitem",track,[track.quantity(),track.price(),orderId])})};function ecommerce(event,track,arr){push.apply(null,["_fxm.ecommerce."+event,track.id()||track.sku(),track.name(),track.category()].concat(arr||[]))}},{"global-queue":188,"segmentio/analytics.js-integration":157,facade:27,each:5}],107:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var is=require("is");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">');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);this.load({baseUrl:window._flBaseUrl},this.ready)};Frontleaf.prototype.loaded=function(){return is.array(window._fl)&&window._fl.ready===true};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())})}};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())})}};Frontleaf.prototype.page=function(page){var category=page.category();var name=page.fullName();var opts=this.options;if(category&&opts.trackCategorizedPages){this.track(page.track(category))}if(name&&opts.trackNamedPages){this.track(page.track(name))}};Frontleaf.prototype.track=function(track){var event=track.event();this._push("event",event,clean(track.properties()))};Frontleaf.prototype._push=function(command){var args=[].slice.call(arguments,1);window._fl.push(function(t){t[command].apply(command,args)})};function clean(obj){var ret={};var excludeKeys=["id","name","firstName","lastName"];var len=excludeKeys.length;for(var i=0;i<len;i++){clear(obj,excludeKeys[i])}obj=flatten(obj);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}function clear(obj,key){if(obj.hasOwnProperty(key)){delete obj[key]}}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}},{"segmentio/analytics.js-integration":157,is:18}],108:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var push=require("global-queue")("_gauges");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 }}">');Gauges.prototype.initialize=function(page){window._gauges=window._gauges||[];
this.load(this.ready)};Gauges.prototype.loaded=function(){return!!(window._gauges&&window._gauges.push!==Array.prototype.push)};Gauges.prototype.page=function(page){push("track")}},{"segmentio/analytics.js-integration":157,"global-queue":188}],109:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var onBody=require("on-body");var GetSatisfaction=module.exports=integration("Get Satisfaction").assumesPageview().global("GSFN").option("widgetId","").tag('<script src="https://loader.engage.gsfn.us/loader.js">');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)});this.load(function(){window.GSFN.loadWidget(widget,{containerId:id});self.ready()})};GetSatisfaction.prototype.loaded=function(){return!!window.GSFN}},{"segmentio/analytics.js-integration":157,"on-body":178}],110:[function(require,module,exports){var integration=require("segmentio/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;module.exports=exports=function(analytics){analytics.addIntegration(GA);group=analytics.group();user=analytics.user()};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">');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});GA.prototype.initialize=function(){var opts=this.options;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,siteSpeedSampleRate:opts.siteSpeedSampleRate,allowLinker:true});if(opts.doubleClick){window.ga("require","displayfeatures")}if(opts.sendUserId&&user.id()){window.ga("set","&uid",user.id())}if(opts.anonymizeIp)window.ga("set","anonymizeIp",true);var custom=metrics(user.traits(),opts);if(length(custom))window.ga("set",custom);this.load("library",this.ready)};GA.prototype.loaded=function(){return!!window.gaplugins};GA.prototype.page=function(page){var category=page.category();var props=page.properties();var name=page.fullName();var pageview={};var track;this._category=category;window.ga("send","pageview",{page:path(props,this.options),title:name||props.title,location:props.url});if(category&&this.options.trackCategorizedPages){track=page.track(category);this.track(track,{noninteraction:true})}if(name&&this.options.trackNamedPages){track=page.track(name);this.track(track,{noninteraction:true})}};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})};GA.prototype.completedOrder=function(track){var total=track.total()||track.revenue()||0;var orderId=track.orderId();var products=track.products();var props=track.properties();if(!orderId)return;if(!this.ecommerce){window.ga("require","ecommerce","ecommerce.js");this.ecommerce=true}window.ga("ecommerce:addTransaction",{affiliation:props.affiliation,shipping:track.shipping(),revenue:total,tax:track.tax(),id:orderId});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})});window.ga("ecommerce:send")};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)}};GA.prototype.loadedClassic=function(){return!!(window._gaq&&window._gaq.push!==Array.prototype.push)};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));if(category&&this.options.trackCategorizedPages){track=page.track(category);this.track(track,{noninteraction:true})}if(name&&this.options.trackNamedPages){track=page.track(name);this.track(track,{noninteraction:true})}};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)};GA.prototype.completedOrderClassic=function(track){var total=track.total()||track.revenue()||0;var orderId=track.orderId();var products=track.products()||[];var props=track.properties();if(!orderId)return;push("_addTrans",orderId,props.affiliation,total,track.tax(),track.shipping(),track.city(),track.state(),track.country());each(products,function(product){var track=new Track({properties:product});push("_addItem",orderId,track.sku(),track.name(),track.category(),track.price(),track.quantity())});push("_trackTrans")};function path(properties,options){if(!properties)return;var str=properties.path;if(options.includeSearch&&properties.search)str+=properties.search;return str}function formatValue(value){if(!value||value<0)return 0;return Math.round(value)}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);if(null==value)continue;ret[key]=value}return ret}},{"segmentio/analytics.js-integration":157,"global-queue":188,object:25,canonical:13,"use-https":159,facade:27,callback:12,"load-script":166,"obj-case":60,each:5,type:35,url:26,is:18}],111:[function(require,module,exports){var push=require("global-queue")("dataLayer",{wrap:false});var integration=require("segmentio/analytics.js-integration");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">');GTM.prototype.initialize=function(){push({"gtm.start":+new Date,event:"gtm.js"});this.load(this.ready)};GTM.prototype.loaded=function(){return!!(window.dataLayer&&[].push!=window.dataLayer.push)};GTM.prototype.page=function(page){var category=page.category();var props=page.properties();var name=page.fullName();var opts=this.options;var track;if(opts.trackAllPages){this.track(page.track())}if(category&&opts.trackCategorizedPages){this.track(page.track(category))}if(name&&opts.trackNamedPages){this.track(page.track(name))}};GTM.prototype.track=function(track){var props=track.properties();props.event=track.event();push(props)}},{"global-queue":188,"segmentio/analytics.js-integration":157}],112:[function(require,module,exports){var integration=require("segmentio/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");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">');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)};GoSquared.prototype.loaded=function(){return!!(window._gs&&window._gs.v)};GoSquared.prototype.page=function(page){var props=page.properties();var name=page.fullName();push("track",props.path,name||props.title)};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)};GoSquared.prototype.track=function(track){push("event",track.event(),track.properties())};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)};function push(){var _gs=window._gs=window._gs||function(){(_gs.q=_gs.q||[]).push(arguments)};_gs.apply(null,arguments)}},{"segmentio/analytics.js-integration":157,facade:27,callback:12,"load-script":166,"on-body":178,each:5}],113:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var alias=require("alias");var Heap=module.exports=integration("Heap").assumesPageview().global("heap").global("_heapid").option("apiKey","").tag('<script src="//d36lvucg9kzous.cloudfront.net">');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)};Heap.prototype.loaded=function(){return window.heap&&window.heap.appid};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)};Heap.prototype.track=function(track){window.heap.track(track.event(),track.properties())}},{"segmentio/analytics.js-integration":157,alias:193}],114:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var Hellobar=module.exports=integration("Hello Bar").assumesPageview().global("_hbq").option("apiKey","").tag('<script src="//s3.amazonaws.com/scripts.hellobar.com/{{ apiKey }}.js">');Hellobar.prototype.initialize=function(page){window._hbq=window._hbq||[];this.load(this.ready)};Hellobar.prototype.loaded=function(){return!!(window._hbq&&window._hbq.push!==Array.prototype.push)}},{"segmentio/analytics.js-integration":157}],115:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var is=require("is");var HitTail=module.exports=integration("HitTail").assumesPageview().global("htk").option("siteId","").tag('<script src="//{{ siteId }}.hittail.com/mlt.js">');HitTail.prototype.initialize=function(page){this.load(this.ready)};HitTail.prototype.loaded=function(){return is.fn(window.htk)}},{"segmentio/analytics.js-integration":157,is:18}],116:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var push=require("global-queue")("_hsq");var convert=require("convert-dates");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">');HubSpot.prototype.initialize=function(page){window._hsq=[];var cache=Math.ceil(new Date/3e5)*3e5;this.load({cache:cache},this.ready)};HubSpot.prototype.loaded=function(){return!!(window._hsq&&window._hsq.push!==Array.prototype.push)};HubSpot.prototype.page=function(page){push("_trackPageview")};HubSpot.prototype.identify=function(identify){if(!identify.email())return;var traits=identify.traits();traits=convertDates(traits);push("identify",traits)};HubSpot.prototype.track=function(track){var props=track.properties();props=convertDates(props);push("trackEvent",track.event(),props)};function convertDates(properties){return convert(properties,function(date){return date.getTime()})}},{"segmentio/analytics.js-integration":157,"global-queue":188,"convert-dates":194}],117:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var alias=require("alias");var Improvely=module.exports=integration("Improvely").assumesPageview().global("_improvely").global("improvely").option("domain","").option("projectId",null).tag('<script src="//{{ domain }}.iljmp.com/improvely.js">');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)};Improvely.prototype.loaded=function(){return!!(window.improvely&&window.improvely.identify)};Improvely.prototype.identify=function(identify){var id=identify.userId();if(id)window.improvely.label(id)};Improvely.prototype.track=function(track){var props=track.properties({revenue:"amount"});props.type=track.event();window.improvely.goal(props)}},{"segmentio/analytics.js-integration":157,alias:193}],118:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var push=require("global-queue")("__insp");var alias=require("alias");var clone=require("clone");var Inspectlet=module.exports=integration("Inspectlet").assumesPageview().global("__insp").global("__insp_").option("wid","").tag('<script src="//www.inspectlet.com/inspectlet.js">');Inspectlet.prototype.initialize=function(page){push("wid",this.options.wid);this.load(this.ready)};Inspectlet.prototype.loaded=function(){return!!window.__insp_};Inspectlet.prototype.identify=function(identify){var traits=identify.traits({id:"userid"});push("tagSession",traits)};Inspectlet.prototype.track=function(track){push("tagSession",track.event())}},{"segmentio/analytics.js-integration":157,"global-queue":188,alias:193,clone:192}],119:[function(require,module,exports){var integration=require("segmentio/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");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">');Intercom.prototype.initialize=function(page){var self=this;this.load(function(){when(function(){return self.loaded()},self.ready)})};Intercom.prototype.loaded=function(){return is.fn(window.Intercom)};Intercom.prototype.page=function(page){window.Intercom("update")};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;traits.app_id=this.options.appId;if(null!=traits.company&&!is.object(traits.company))delete traits.company;if(traits.company)defaults(traits.company,group.traits());if(name)traits.name=name;if(traits.company&&companyCreated)traits.company.created=companyCreated;if(created)traits.created=created;traits=convertDates(traits,formatDate);traits=alias(traits,{created:"created_at"});if(traits.company)traits.company=alias(traits.company,{created:"created_at"});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;if("#IntercomDefaultWidget"!=activator){traits.widget={activator:activator}}var method=this._id!==id?"boot":"update";this._id=id;window.Intercom(method,traits)};Intercom.prototype.group=function(group){var props=group.properties();var id=group.groupId();if(id)props.id=id;window.Intercom("update",{company:props})};Intercom.prototype.track=function(track){window.Intercom("trackEvent",track.event(),track.properties())};function formatDate(date){return Math.floor(date/1e3)}},{"segmentio/analytics.js-integration":157,"convert-dates":194,defaults:187,"is-email":19,"load-script":166,"is-empty":44,alias:193,each:5,when:182,is:18}],120:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var Keen=module.exports=integration("Keen IO").global("Keen").option("projectId","").option("readKey","").option("writeKey","").option("trackNamedPages",true).option("trackAllPages",false).option("trackCategorizedPages",true).tag('<script src="//dc8na2hxrj29i.cloudfront.net/code/keen-2.1.0-min.js">');Keen.prototype.initialize=function(){var options=this.options;window.Keen=window.Keen||{configure:function(e){this._cf=e},addEvent:function(e,t,n,i){this._eq=this._eq||[],this._eq.push([e,t,n,i])},setGlobalProperties:function(e){this._gp=e},onChartsReady:function(e){this._ocrq=this._ocrq||[],this._ocrq.push(e)}};window.Keen.configure({projectId:options.projectId,writeKey:options.writeKey,readKey:options.readKey});this.load(this.ready)};Keen.prototype.loaded=function(){return!!(window.Keen&&window.Keen.Base64)};Keen.prototype.page=function(page){var category=page.category();var props=page.properties();var name=page.fullName();var opts=this.options;if(opts.trackAllPages){this.track(page.track())}if(name&&opts.trackNamedPages){this.track(page.track(name))}if(category&&opts.trackCategorizedPages){this.track(page.track(category))}};Keen.prototype.identify=function(identify){var traits=identify.traits();var id=identify.userId();var user={};if(id)user.userId=id;if(traits)user.traits=traits;window.Keen.setGlobalProperties(function(){return{user:user}})};Keen.prototype.track=function(track){window.Keen.addEvent(track.event(),track.properties())}},{"segmentio/analytics.js-integration":157}],121:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var indexof=require("indexof");var is=require("is");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 }}">');Kenshoo.prototype.initialize=function(page){this.load(this.ready)};Kenshoo.prototype.loaded=function(){return is.fn(window.k_trackevent)};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(),"GCID=","kw=","product="];window.k_trackevent(params,this.options.subdomain)}},{"segmentio/analytics.js-integration":157,indexof:46,is:18}],122:[function(require,module,exports){var integration=require("segmentio/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");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">');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);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()})};KISSmetrics.prototype.loaded=function(){return is.object(window.KM)};KISSmetrics.prototype.page=function(page){if(!window.KM_SKIP_PAGE_VIEW)window.KM.pageView();this.trackPage(page)};KISSmetrics.prototype.trackPage=function(page){var category=page.category();var name=page.fullName();var opts=this.options;if(name&&opts.trackNamedPages){this.track(page.track(name))}if(category&&opts.trackCategorizedPages){this.track(page.track(category))}};KISSmetrics.prototype.identify=function(identify){var traits=identify.traits();var id=identify.userId();if(id)push("identify",id);if(traits)push("set",traits)};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)};KISSmetrics.prototype.alias=function(alias){push("alias",alias.to(),alias.from())};KISSmetrics.prototype.completedOrder=function(track){var products=track.products();var event=track.event();push("record",event,prefix(event,track.properties()));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)})})};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}},{"segmentio/analytics.js-integration":157,"global-queue":188,facade:27,alias:193,batch:195,each:5,is:18}],195:[function(require,module,exports){try{var EventEmitter=require("events").EventEmitter}catch(err){var Emitter=require("emitter")}function noop(){}module.exports=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])}}if(EventEmitter){Batch.prototype.__proto__=EventEmitter.prototype}else{Emitter(Batch.prototype)}Batch.prototype.concurrency=function(n){this.n=n;return this};Batch.prototype.push=function(fn){this.fns.push(fn);return this};Batch.prototype.throws=function(throws){this.e=!!throws;return this};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;if(!fns.length)return cb(null,results);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)}}for(var i=0;i<fns.length;i++){if(i==max)break;next()}return this}},{emitter:196}],196:[function(require,module,exports){module.exports=Emitter;function Emitter(obj){if(obj)return mixin(obj)}function mixin(obj){for(var key in Emitter.prototype){obj[key]=Emitter.prototype[key]}return obj}Emitter.prototype.on=Emitter.prototype.addEventListener=function(event,fn){this._callbacks=this._callbacks||{};(this._callbacks[event]=this._callbacks[event]||[]).push(fn);return this};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};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(event,fn){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var callbacks=this._callbacks[event];if(!callbacks)return this;if(1==arguments.length){delete this._callbacks[event];return this}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};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};Emitter.prototype.listeners=function(event){this._callbacks=this._callbacks||{};return this._callbacks[event]||[]};Emitter.prototype.hasListeners=function(event){return!!this.listeners(event).length}},{}],123:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var push=require("global-queue")("_learnq");var tick=require("next-tick");var alias=require("alias");var aliases={id:"$id",email:"$email",firstName:"$first_name",lastName:"$last_name",phone:"$phone_number",title:"$title"};var Klaviyo=module.exports=integration("Klaviyo").assumesPageview().global("_learnq").option("apiKey","").tag('<script src="//a.klaviyo.com/media/js/learnmarklet.js">');Klaviyo.prototype.initialize=function(page){var self=this;push("account",this.options.apiKey);this.load(function(){tick(self.ready)})};Klaviyo.prototype.loaded=function(){return!!(window._learnq&&window._learnq.push!==Array.prototype.push)};Klaviyo.prototype.identify=function(identify){var traits=identify.traits(aliases);if(!traits.$id&&!traits.$email)return;push("identify",traits)};Klaviyo.prototype.group=function(group){var props=group.properties();if(!props.name)return;push("identify",{$organization:props.name})};Klaviyo.prototype.track=function(track){push("track",track.event(),track.properties({revenue:"$value"}))}},{"segmentio/analytics.js-integration":157,"global-queue":188,"next-tick":45,alias:193}],124:[function(require,module,exports){var integration=require("segmentio/analytics.js-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">');LeadLander.prototype.initialize=function(page){window.llactid=this.options.accountId;this.load(this.ready)};LeadLander.prototype.loaded=function(){return!!window.trackalyzer}},{"segmentio/analytics.js-integration":157}],125:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var clone=require("clone");var each=require("each");var when=require("when");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">');LiveChat.prototype.initialize=function(page){var self=this;window.__lc=clone(this.options);this.load(function(){when(function(){return self.loaded()},self.ready)})};LiveChat.prototype.loaded=function(){return!!(window.LC_API&&window.LC_Invite)};LiveChat.prototype.identify=function(identify){var traits=identify.traits({userId:"User ID"});window.LC_API.set_custom_variables(convert(traits))};function convert(traits){var arr=[];each(traits,function(key,value){arr.push({name:key,value:value})});return arr}},{"segmentio/analytics.js-integration":157,clone:192,each:5,when:182}],126:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var Identify=require("facade").Identify;var useHttps=require("use-https");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 }}">');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()/6e4);var name=useHttps()?"https":"http";this.load(name,{cache:cache},this.ready)};LuckyOrange.prototype.loaded=function(){return!!window.__wtw_watcher_added};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}},{"segmentio/analytics.js-integration":157,facade:27,"use-https":159}],127:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var alias=require("alias");var Lytics=module.exports=integration("Lytics").global("jstag").option("cid","").option("cookie","seerid").option("delay",2e3).option("sessionTimeout",1800).option("url","//c.lytics.io").tag('<script src="//c.lytics.io/static/io.min.js">');var aliases={sessionTimeout:"sessecs"};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)};Lytics.prototype.loaded=function(){return!!(window.jstag&&window.jstag.bind)};Lytics.prototype.page=function(page){window.jstag.send(page.properties())};Lytics.prototype.identify=function(identify){var traits=identify.traits({userId:"_uid"});window.jstag.send(traits)};Lytics.prototype.track=function(track){var props=track.properties();props._e=track.event();window.jstag.send(props)}},{"segmentio/analytics.js-integration":157,alias:193}],128:[function(require,module,exports){var alias=require("alias");var clone=require("clone");var dates=require("convert-dates");var integration=require("segmentio/analytics.js-integration");var iso=require("to-iso-string");var indexof=require("indexof");var del=require("obj-case").del;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">');var optionsAliases={cookieName:"cookie_name"};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)};Mixpanel.prototype.loaded=function(){return!!(window.mixpanel&&window.mixpanel.config)};Mixpanel.prototype.page=function(page){var category=page.category();var name=page.fullName();var opts=this.options;if(opts.trackAllPages){this.track(page.track())}if(category&&opts.trackCategorizedPages){this.track(page.track(category))}if(name&&opts.trackNamedPages){this.track(page.track(name))}};var traitAliases={created:"$created",email:"$email",firstName:"$first_name",lastName:"$last_name",lastSeen:"$last_seen",name:"$name",username:"$username",phone:"$phone"};Mixpanel.prototype.identify=function(identify){var username=identify.username();var email=identify.email();var id=identify.userId();if(id)window.mixpanel.identify(id);var nametag=email||username||id;if(nametag)window.mixpanel.name_tag(nametag);var traits=identify.traits(traitAliases);if(traits.$created)del(traits,"createdAt");window.mixpanel.register(traits);if(this.options.people)window.mixpanel.people.set(traits)};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 props.distinct_id;delete props.ip;delete props.mp_name_tag;delete props.mp_note;delete props.token;if(people&&~indexof(increments,increment)){window.mixpanel.people.increment(track.event());window.mixpanel.people.set("Last "+track.event(),new Date)}props=dates(props,iso);window.mixpanel.track(track.event(),props);if(revenue&&people){window.mixpanel.people.track_charge(revenue)}};Mixpanel.prototype.alias=function(alias){var mp=window.mixpanel;var to=alias.to();if(mp.get_distinct_id&&mp.get_distinct_id()===to)return;if(mp.get_property&&mp.get_property("$people_distinct_id")===to)return;mp.alias(to,alias.from())};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:193,clone:192,"convert-dates":194,"segmentio/analytics.js-integration":157,"to-iso-string":191,indexof:46,"obj-case":60}],129:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var bind=require("bind");var when=require("when");var is=require("is");var Mojn=module.exports=integration("Mojn").option("customerCode","").global("_mojnTrack").tag('<script src="https://track.idtargeting.com/{{ customerCode }}/track.js">');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)})};Mojn.prototype.loaded=function(){return is.object(window._mojnTrack)};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};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}},{"segmentio/analytics.js-integration":157,bind:33,when:182,is:18}],130:[function(require,module,exports){var push=require("global-queue")("_mfq");var integration=require("segmentio/analytics.js-integration");var each=require("each");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">');Mouseflow.prototype.initialize=function(page){window.mouseflowHtmlDelay=this.options.mouseflowHtmlDelay;this.load(this.ready)};Mouseflow.prototype.loaded=function(){return!!window.mouseflow};Mouseflow.prototype.page=function(page){if(!window.mouseflow)return;if("function"!=typeof mouseflow.newPageView)return;mouseflow.newPageView()};Mouseflow.prototype.identify=function(identify){set(identify.traits())};Mouseflow.prototype.track=function(track){var props=track.properties();props.event=track.event();set(props)};function set(obj){each(obj,function(key,value){push("setVariable",key,value)})}},{"global-queue":188,"segmentio/analytics.js-integration":157,each:5}],131:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var useHttps=require("use-https");var each=require("each");var is=require("is");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 }}">');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()/6e4);var name=useHttps()?"https":"http";this.load(name,{path:path,cache:cache},this.ready)};MouseStats.prototype.loaded=function(){return is.array(window.MouseStatsVisitorPlaybacks)};MouseStats.prototype.identify=function(identify){each(identify.traits(),function(key,value){window.MouseStatsVisitorPlaybacks.customVariable(key,value)})}},{"segmentio/analytics.js-integration":157,"use-https":159,each:5,is:18}],132:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var push=require("global-queue")("__nls");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 }}">');Navilytics.prototype.initialize=function(page){window.__nls=window.__nls||[];this.load(this.ready)};Navilytics.prototype.loaded=function(){return!!(window.__nls&&[].push!=window.__nls.push)};Navilytics.prototype.track=function(track){push("tagRecording",track.event())}},{"segmentio/analytics.js-integration":157,"global-queue":188}],133:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var https=require("use-https");var tick=require("next-tick");var Olark=module.exports=integration("Olark").assumesPageview().global("olark").option("identify",true).option("page",true).option("siteId","").option("groupId","").option("track",false);Olark.prototype.initialize=function(page){var self=this;this.load(function(){tick(self.ready)});var groupId=this.options.groupId;if(groupId){chat("setOperatorGroup",{group:groupId})}var self=this;box("onExpand",function(){self._open=true});box("onShrink",function(){self._open=false})};Olark.prototype.loaded=function(){return!!window.olark};Olark.prototype.load=function(callback){var el=document.getElementById("olark");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()};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})};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});if(name)visitor("updateFullName",{fullName:name});var nickname=name||email||username||id;if(name&&email)nickname+=" ("+email+")";if(nickname)chat("updateVisitorNickname",{snippet:nickname})};Olark.prototype.track=function(track){if(!this.options.track||!this._open)return;chat("sendNotificationToOperator",{body:'visitor triggered "'+track.event()+'"'})};function box(action,value){window.olark("api.box."+action,value)}function visitor(action,value){window.olark("api.visitor."+action,value)}function chat(action,value){window.olark("api.chat."+action,value)}},{"segmentio/analytics.js-integration":157,"use-https":159,"next-tick":45}],134:[function(require,module,exports){var integration=require("segmentio/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");var Optimizely=module.exports=integration("Optimizely").option("variations",true).option("trackNamedPages",true).option("trackCategorizedPages",true);Optimizely.prototype.initialize=function(){if(this.options.variations){var self=this;tick(function(){self.replay()})}this.ready()};Optimizely.prototype.track=function(track){var props=track.properties();if(props.revenue)props.revenue*=100;push("trackEvent",track.event(),props)};Optimizely.prototype.page=function(page){var category=page.category();var name=page.fullName();var opts=this.options;if(category&&opts.trackCategorizedPages){this.track(page.track(category))}if(name&&opts.trackNamedPages){this.track(page.track(name))}};Optimizely.prototype.replay=function(){if(!window.optimizely)return;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)}},{"segmentio/analytics.js-integration":157,"global-queue":188,callback:12,"next-tick":45,bind:33,each:5}],135:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var PerfectAudience=module.exports=integration("Perfect Audience").assumesPageview().global("_pa").option("siteId","").tag('<script src="//tag.perfectaudience.com/serve/{{ siteId }}.js">');PerfectAudience.prototype.initialize=function(page){window._pa=window._pa||{};this.load(this.ready)};PerfectAudience.prototype.loaded=function(){return!!(window._pa&&window._pa.track)};PerfectAudience.prototype.track=function(track){window._pa.track(track.event(),track.properties())}},{"segmentio/analytics.js-integration":157}],136:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var push=require("global-queue")("_prum");var date=require("load-date");var Pingdom=module.exports=integration("Pingdom").assumesPageview().global("_prum").global("PRUM_EPISODES").option("id","").tag('<script src="//rum-static.pingdom.net/prum.min.js">');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)};Pingdom.prototype.loaded=function(){return!!(window._prum&&window._prum.push!==Array.prototype.push)}},{"segmentio/analytics.js-integration":157,"global-queue":188,"load-date":189}],137:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var push=require("global-queue")("_paq");var each=require("each");var Piwik=module.exports=integration("Piwik").global("_paq").option("url",null).option("siteId","").mapping("goals").tag('<script src="{{ url }}/piwik.js">');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)};Piwik.prototype.loaded=function(){return!!(window._paq&&window._paq.push!=[].push)};Piwik.prototype.page=function(page){push("trackPageView")};Piwik.prototype.track=function(track){var goals=this.goals(track.event());var revenue=track.revenue()||0;each(goals,function(goal){push("trackGoal",goal,revenue)})}},{"segmentio/analytics.js-integration":157,"global-queue":188,each:5}],138:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var convertDates=require("convert-dates");var push=require("global-queue")("_lnq");var alias=require("alias");var Preact=module.exports=integration("Preact").assumesPageview().global("_lnq").option("projectCode","").tag('<script src="//d2bbvl6dq48fa6.cloudfront.net/js/ln-2.4.min.js">');Preact.prototype.initialize=function(page){window._lnq=window._lnq||[];push("_setCode",this.options.projectCode);this.load(this.ready)};Preact.prototype.loaded=function(){return!!(window._lnq&&window._lnq.push!==Array.prototype.push)};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})};Preact.prototype.group=function(group){if(!group.groupId())return;push("_setAccount",group.traits())};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)};function convertDate(date){return Math.floor(date/1e3)}},{"segmentio/analytics.js-integration":157,"convert-dates":194,"global-queue":188,alias:193}],139:[function(require,module,exports){var integration=require("segmentio/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");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">');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)})};Qualaroo.prototype.loaded=function(){return!!(window._kiq&&window._kiq.push!==Array.prototype.push)};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)};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}))}},{"segmentio/analytics.js-integration":157,"global-queue":188,facade:27,bind:33,when:182}],140:[function(require,module,exports){var push=require("global-queue")("_qevents",{wrap:false});var integration=require("segmentio/analytics.js-integration");var useHttps=require("use-https");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">');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)};Quantcast.prototype.loaded=function(){return!!window.__qc};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)};Quantcast.prototype.identify=function(identify){var id=identify.userId();if(id){window._qevents[0]=window._qevents[0]||{};window._qevents[0].uid=id}};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+"";if(user.id())settings.uid=user.id();push(settings)};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",labels:labels,revenue:revenue+"",orderid:track.orderId(),qacct:this.options.pCode};push(settings)};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":188,"segmentio/analytics.js-integration":157,"use-https":159}],141:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var extend=require("extend");var is=require("is");var RollbarIntegration=module.exports=integration("Rollbar").global("Rollbar").option("identify",true).option("accessToken","").option("environment","unknown").option("captureUncaught",true);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)};RollbarIntegration.prototype.loaded=function(){return is.object(window.Rollbar)&&null==window.Rollbar.shimId};RollbarIntegration.prototype.load=function(callback){window.Rollbar.loadFull(window,document,true,this.config,callback)};RollbarIntegration.prototype.identify=function(identify){if(!this.options.identify)return;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}})}},{"segmentio/analytics.js-integration":157,extend:40,is:18}],142:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var SaaSquatch=module.exports=integration("SaaSquatch").option("tenantAlias","").global("_sqh").tag('<script src="//d2rcp9ak152ke1.cloudfront.net/assets/javascripts/squatch.min.js">');SaaSquatch.prototype.initialize=function(page){window._sqh=window._sqh||[];this.load(this.ready)};SaaSquatch.prototype.loaded=function(){return window._sqh&&window._sqh.push!=[].push};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()}},{"segmentio/analytics.js-integration":157}],143:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var is=require("is");var Sentry=module.exports=integration("Sentry").global("Raven").option("config","").tag('<script src="//cdn.ravenjs.com/1.1.10/native/raven.min.js">');Sentry.prototype.initialize=function(){var config=this.options.config;var self=this;this.load(function(){window.Raven.config(config).install();self.ready()})};Sentry.prototype.loaded=function(){return is.object(window.Raven)};Sentry.prototype.identify=function(identify){window.Raven.setUser(identify.traits())}},{"segmentio/analytics.js-integration":157,is:18}],144:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var is=require("is");var SnapEngage=module.exports=integration("SnapEngage").assumesPageview().global("SnapABug").option("apiKey","").tag('<script src="//commondatastorage.googleapis.com/code.snapengage.com/js/{{ apiKey }}.js">');SnapEngage.prototype.initialize=function(page){this.load(this.ready)};SnapEngage.prototype.loaded=function(){return is.object(window.SnapABug)};SnapEngage.prototype.identify=function(identify){var email=identify.email();if(!email)return;window.SnapABug.setUserEmail(email)}},{"segmentio/analytics.js-integration":157,is:18}],145:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var bind=require("bind");var when=require("when");var Spinnakr=module.exports=integration("Spinnakr").assumesPageview().global("_spinnakr_site_id").global("_spinnakr").option("siteId","").tag('<script src="//d3ojzyhbolvoi5.cloudfront.net/js/so.js">');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)})};Spinnakr.prototype.loaded=function(){return!!window._spinnakr}},{"segmentio/analytics.js-integration":157,bind:33,when:182}],146:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var slug=require("slug");var push=require("global-queue")("_tsq");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">');Tapstream.prototype.initialize=function(page){window._tsq=window._tsq||[];push("setAccountName",this.options.accountName);this.load(this.ready)};Tapstream.prototype.loaded=function(){return!!(window._tsq&&window._tsq.push!==Array.prototype.push)};Tapstream.prototype.page=function(page){var category=page.category();var opts=this.options;var name=page.fullName();if(opts.trackAllPages){this.track(page.track())}if(name&&opts.trackNamedPages){this.track(page.track(name))}if(category&&opts.trackCategorizedPages){this.track(page.track(category))}};Tapstream.prototype.track=function(track){var props=track.properties();push("fireHit",slug(track.event()),[props.url])}},{"segmentio/analytics.js-integration":157,slug:164,"global-queue":188}],147:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var alias=require("alias");var clone=require("clone");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">');var optionsAliases={initialPageview:"auto_track_page_view"};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)};Trakio.prototype.loaded=function(){return!!(window.trak&&window.trak.loaded)};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);if(name&&this.options.trackNamedPages){this.track(page.track(name))}if(category&&this.options.trackCategorizedPages){this.track(page.track(category))}};var traitAliases={avatar:"avatar_url",firstName:"first_name",lastName:"last_name"};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)}};Trakio.prototype.track=function(track){window.trak.io.track(track.event(),track.properties())};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)}}},{"segmentio/analytics.js-integration":157,alias:193,clone:192}],148:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var has=Object.prototype.hasOwnProperty;var TwitterAds=module.exports=integration("Twitter Ads").option("events",{}).tag("pixel",'<img src="//analytics.twitter.com/i/adsct?txn_id={{ event }}&p_id=Twitter"/>');TwitterAds.prototype.initialize=function(){this.ready()};TwitterAds.prototype.track=function(track){var events=this.options.events;var event=track.event();if(!has.call(events,event))return;return this.load("pixel",{event:events[event]})}},{"segmentio/analytics.js-integration":157}],149:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");
var push=require("global-queue")("_uc");var Usercycle=module.exports=integration("USERcycle").assumesPageview().global("_uc").option("key","").tag('<script src="//api.usercycle.com/javascripts/track.js">');Usercycle.prototype.initialize=function(page){push("_key",this.options.key);this.load(this.ready)};Usercycle.prototype.loaded=function(){return!!(window._uc&&window._uc.push!==Array.prototype.push)};Usercycle.prototype.identify=function(identify){var traits=identify.traits();var id=identify.userId();if(id)push("uid",id);push("action","came_back",traits)};Usercycle.prototype.track=function(track){push("action",track.event(),track.properties({revenue:"revenue_amount"}))}},{"segmentio/analytics.js-integration":157,"global-queue":188}],150:[function(require,module,exports){var alias=require("alias");var callback=require("callback");var convertDates=require("convert-dates");var integration=require("analytics.js-integration");var load=require("load-script");var push=require("global-queue")("_ufq");module.exports=exports=function(analytics){analytics.addIntegration(Userfox)};var Userfox=exports.Integration=integration("userfox").assumesPageview().readyOnLoad().global("_ufq").option("clientId","");Userfox.prototype.initialize=function(page){window._ufq=[];this.load()};Userfox.prototype.loaded=function(){return!!(window._ufq&&window._ufq.push!==Array.prototype.push)};Userfox.prototype.load=function(callback){load("//d2y71mjhnajxcg.cloudfront.net/js/userfox-stable.js",callback)};Userfox.prototype.identify=function(identify){var traits=identify.traits({created:"signup_date"});var email=identify.email();if(!email)return;push("init",{clientId:this.options.clientId,email:email});traits=convertDates(traits,formatDate);push("track",traits)};function formatDate(date){return Math.round(date.getTime()/1e3).toString()}},{alias:193,callback:12,"convert-dates":194,"analytics.js-integration":157,"load-script":166,"global-queue":188}],151:[function(require,module,exports){var integration=require("segmentio/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");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)").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">');UserVoice.on("construct",function(integration){if(!integration.options.classic)return;integration.group=undefined;integration.identify=integration.identifyClassic;integration.initialize=integration.initializeClassic});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)};UserVoice.prototype.loaded=function(){return!!(window.UserVoice&&window.UserVoice.push!==Array.prototype.push)};UserVoice.prototype.identify=function(identify){var traits=identify.traits({created:"created_at"});traits=convertDates(traits,unix);push("identify",traits)};UserVoice.prototype.group=function(group){var traits=group.traits({created:"created_at"});traits=convertDates(traits,unix);push("identify",{account:traits})};UserVoice.prototype.initializeClassic=function(){var options=this.options;window.showClassicWidget=showClassicWidget;if(options.showWidget)showClassicWidget("showTab",formatClassicOptions(options));this.load(this.ready)};UserVoice.prototype.identifyClassic=function(identify){push("setCustomFields",identify.traits())};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"})}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"})}function showClassicWidget(type,options){type=type||"showLightbox";push(type,"classic_widget",options)}},{"segmentio/analytics.js-integration":157,"global-queue":188,"convert-dates":194,"to-unix-timestamp":197,alias:193,clone:192}],197:[function(require,module,exports){module.exports=toUnixTimestamp;function toUnixTimestamp(date){return Math.floor(date.getTime()/1e3)}},{}],152:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var push=require("global-queue")("_veroq");var Vero=module.exports=integration("Vero").global("_veroq").option("apiKey","").tag('<script src="//d3qxef4rp70elm.cloudfront.net/m.js">');Vero.prototype.initialize=function(page){push("init",{api_key:this.options.apiKey});this.load(this.ready)};Vero.prototype.loaded=function(){return!!(window._veroq&&window._veroq.push!==Array.prototype.push)};Vero.prototype.page=function(page){push("trackPageview")};Vero.prototype.identify=function(identify){var traits=identify.traits();var email=identify.email();var id=identify.userId();if(!id||!email)return;push("user",traits)};Vero.prototype.track=function(track){push("track",track.event(),track.properties())}},{"segmentio/analytics.js-integration":157,"global-queue":188}],153:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var tick=require("next-tick");var each=require("each");var VWO=module.exports=integration("Visual Website Optimizer").option("replay",true);VWO.prototype.initialize=function(){if(this.options.replay)this.replay();this.ready()};VWO.prototype.replay=function(){var analytics=this.analytics;tick(function(){experiments(function(err,traits){if(traits)analytics.identify(traits)})})};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)})}function enqueue(fn){window._vis_opt_queue=window._vis_opt_queue||[];window._vis_opt_queue.push(fn)}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}},{"segmentio/analytics.js-integration":157,"next-tick":45,each:5}],154:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var useHttps=require("use-https");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">');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)};WebEngage.prototype.loaded=function(){return!!window.webengage}},{"segmentio/analytics.js-integration":157,"use-https":159}],155:[function(require,module,exports){var integration=require("segmentio/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");var Woopra=module.exports=integration("Woopra").global("woopra").option("domain","").option("cookieName","wooTracker").option("cookieDomain",null).option("cookiePath","/").option("ping",true).option("pingInterval",12e3).option("idleTimeout",3e5).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">');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)})};Woopra.prototype.loaded=function(){return!!(window.woopra&&window.woopra.loaded)};Woopra.prototype.page=function(page){var props=page.properties();var name=page.fullName();if(name)props.title=name;window.woopra.track("pv",props)};Woopra.prototype.identify=function(identify){var traits=identify.traits();if(identify.name())traits.name=identify.name();window.woopra.identify(traits).push()};Woopra.prototype.track=function(track){window.woopra.track(track.event(),track.properties())}},{"segmentio/analytics.js-integration":157,"to-snake-case":158,"is-email":19,extend:40,each:5,type:35}],156:[function(require,module,exports){var integration=require("segmentio/analytics.js-integration");var tick=require("next-tick");var bind=require("bind");var when=require("when");var Yandex=module.exports=integration("Yandex Metrica").assumesPageview().global("yandex_metrika_callbacks").global("Ya").option("counterId",null).tag('<script src="//mc.yandex.ru/metrika/watch.js">');Yandex.prototype.initialize=function(page){var id=this.options.counterId;push(function(){window["yaCounter"+id]=new window.Ya.Metrika({id:id})});var loaded=bind(this,this.loaded);var ready=this.ready;this.load(function(){when(loaded,ready)})};Yandex.prototype.loaded=function(){return!!(window.Ya&&window.Ya.Metrika)};function push(callback){window.yandex_metrika_callbacks=window.yandex_metrika_callbacks||[];window.yandex_metrika_callbacks.push(callback)}},{"segmentio/analytics.js-integration":157,"next-tick":45,bind:33,when:182}]},{},{1:"analytics"});
|
src/ReactBoilerplate/Scripts/containers/Register/Register.js
|
pauldotknopf/react-aspnet-boilerplate
|
import React, { Component } from 'react';
import { RegisterForm } from 'components';
import { connect } from 'react-redux';
import { push } from 'react-router-redux';
class Register extends Component {
componentWillReceiveProps(nextProps) {
if (!this.props.user && nextProps.user) {
this.props.pushState('/');
}
}
render() {
return (
<div>
<h2>Register</h2>
<h4>Create a new account.</h4>
<hr />
<RegisterForm />
</div>
);
}
}
export default connect(
state => ({ user: state.auth.user, externalLogin: state.externalLogin }),
{ pushState: push }
)(Register);
|
ReactNative/Albums/src/components/Button.js
|
makingsensetraining/mobile-pocs
|
import React from 'react';
import { Text, TouchableOpacity } from 'react-native';
const Button = ({ onPress, children }) => {
const { buttonStyle, textStyle } = styles;
return (
<TouchableOpacity onPress={onPress} style={buttonStyle}>
<Text style={textStyle}>
{children}
</Text>
</TouchableOpacity>
);
};
const styles = {
textStyle: {
alignSelf: 'center',
color: '#007aff',
fontSize: 16,
fontWeight: '600',
paddingTop: 10,
paddingBottom: 10
},
buttonStyle: {
flex: 1,
alignSelf: 'stretch',
backgroundColor: '#fff',
borderRadius: 5,
borderWidth: 1,
borderColor: '#007aff',
marginLeft: 5,
marginRight: 5
}
};
export default Button;
|
src/components/root.js
|
roman01la/f-react-kit
|
// Used directly when rendering on server
import React from 'react';
import App from './app/app';
import { connectRoot } from '../lib/state_tools/connect_root';
import { API_ROOT } from '../config/global';
const Root = ({ children }) => <App>{children}</App>;
export default connectRoot(Root, API_ROOT);
|
files/babel/5.4.4/browser-polyfill.js
|
jtblin/jsdelivr
|
(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";
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":78,"regenerator/runtime":79}],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;
};
};
},{"./$":21}],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;
};
};
},{"./$":21,"./$.ctx":11}],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;
},{"./$":21}],5:[function(require,module,exports){
var $ = require('./$')
, enumKeys = require('./$.enum-keys');
// 19.1.2.1 Object.assign(target, source, ...)
/* eslint-disable no-unused-vars */
module.exports = Object.assign || function assign(target, source){
/* eslint-enable no-unused-vars */
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;
};
},{"./$":21,"./$.enum-keys":13}],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;
},{"./$":21,"./$.wks":32}],7:[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
, 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(){
var that = assert.inst(this, C, NAME)
, iterable = arguments[0];
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);
}
$.mix(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[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 forEach(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 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;
// 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,
// 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
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;
// 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 == '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);
}
};
},{"./$":21,"./$.assert":4,"./$.ctx":11,"./$.for-of":14,"./$.iter":20,"./$.iter-define":18,"./$.uid":30}],8:[function(require,module,exports){
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
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":12,"./$.for-of":14}],9:[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
, 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(){
$.set(assert.inst(this, C, NAME), ID, id++);
var iterable = arguments[0];
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 has(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
};
},{"./$":21,"./$.array-methods":3,"./$.assert":4,"./$.for-of":14,"./$.uid":30}],10:[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, 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, 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) || !(IS_WEAK || !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](IS_WEAK ? {} : -0, 1)
, buggyZero;
// wrap for init collections from iterable
if(!require('./$.iter-detect')(function(iter){ new C(iter); })){ // eslint-disable-line no-new
C = function(){
assertInstance(this, C, NAME);
var that = new Base
, iterable = arguments[0];
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
return that;
};
C.prototype = proto;
if($.FW)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, true);
}
require('./$.cof').set(C, NAME);
O[NAME] = C;
$def($def.G + $def.W + $def.F * (C != Base), O);
species(C);
species($.core[NAME]); // for wrapper
if(!IS_WEAK)common.setIter(C, NAME, IS_MAP);
return C;
};
},{"./$":21,"./$.assert":4,"./$.cof":6,"./$.def":12,"./$.for-of":14,"./$.iter":20,"./$.iter-detect":19,"./$.species":27}],11:[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}],12:[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;
},{"./$":21}],13:[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;
};
},{"./$":21}],14:[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":11,"./$.iter":20,"./$.iter-call":17}],15:[function(require,module,exports){
module.exports = function($){
$.FW = true;
$.path = $.g;
return $;
};
},{}],16:[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);
};
},{}],17:[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":4}],18:[function(require,module,exports){
var $def = require('./$.def')
, $ = require('./$')
, cof = require('./$.cof')
, $iter = require('./$.iter')
, SYMBOL_ITERATOR = require('./$.wks')('iterator')
, FF_ITERATOR = '@@iterator'
, VALUES = 'values'
, Iterators = $iter.Iterators;
module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCE){
$iter.create(Constructor, NAME, next);
function createMethod(kind){
return function(){
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 = $.getProto(_default.call(new Base));
// Set @@toStringTag to native iterators
cof.set(IteratorPrototype, TAG, true);
// FF fix
if($.FW && $.has(proto, FF_ITERATOR))$iter.set(IteratorPrototype, $.that);
}
// Define iterator
if($.FW)$iter.set(proto, _default);
// Plug for library
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))$.hide(proto, key, methods[key]);
} else $def($def.P + $def.F * $iter.BUGGY, NAME, methods);
}
};
},{"./$":21,"./$.cof":6,"./$.def":12,"./$.iter":20,"./$.wks":32}],19:[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){ /* 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;
};
},{"./$.wks":32}],20:[function(require,module,exports){
'use strict';
var $ = require('./$')
, cof = require('./$.cof')
, assertObject = require('./$.assert').obj
, SYMBOL_ITERATOR = require('./$.wks')('iterator')
, FF_ITERATOR = '@@iterator'
, Iterators = {}
, IteratorPrototype = {};
// 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);
}
module.exports = {
// Safari has buggy iterators w/o `next`
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
, SYM = Symbol && Symbol.iterator || FF_ITERATOR;
return SYM in O || SYMBOL_ITERATOR in O || $.has(Iterators, cof.classof(O));
},
get: function(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));
},
set: setIterator,
create: function(Constructor, NAME, next, proto){
Constructor.prototype = $.create(proto || IteratorPrototype, {next: $.desc(1, next)});
cof.set(Constructor, NAME + ' Iterator');
}
};
},{"./$":21,"./$.assert":4,"./$.cof":6,"./$.wks":32}],21:[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));
} : 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,
setDescs: Object.defineProperties,
getKeys: Object.keys,
getNames: Object.getOwnPropertyNames,
getSymbols: Object.getOwnPropertySymbols,
assertDefined: assertDefined,
// Dummy, fix for not array-like ES3 string in es5 module
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
});
/* eslint-disable no-undef */
if(typeof __e != 'undefined')__e = core;
if(typeof __g != 'undefined')__g = global;
},{"./$.fw":15}],22:[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;
};
},{"./$":21}],23:[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;
};
},{"./$":21,"./$.assert":4}],24:[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);
};
};
},{"./$":21,"./$.assert":4,"./$.invoke":16}],25:[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);
};
};
},{}],26:[function(require,module,exports){
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
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 {} // 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 setPrototypeOf(O, proto){
check(O, proto);
if(buggy)O.__proto__ = proto;
else set(O, proto);
return O;
};
}()
: undefined),
check: check
};
},{"./$":21,"./$.assert":4,"./$.ctx":11}],27:[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
});
};
},{"./$":21,"./$.wks":32}],28:[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;
};
};
},{"./$":21}],29:[function(require,module,exports){
'use strict';
var $ = require('./$')
, ctx = require('./$.ctx')
, cof = require('./$.cof')
, invoke = require('./$.invoke')
, global = $.g
, isFunction = $.isFunction
, html = $.html
, document = global.document
, process = global.process
, 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(process) == 'process'){
defer = function(id){
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) && !global.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(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
};
},{"./$":21,"./$.cof":6,"./$.ctx":11,"./$.invoke":16}],30:[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;
},{"./$":21}],31:[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;
};
},{"./$":21,"./$.wks":32}],32:[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));
};
},{"./$":21,"./$.uid":30}],33:[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
, has = $.has
, defineProperty = $.setDesc
, getOwnDescriptor = $.getDesc
, defineProperties = $.setDescs
, 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]);
};
$.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', {
// 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
, 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();
};
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()
// 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');
$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;
};
},{"./$":21,"./$.array-includes":2,"./$.array-methods":3,"./$.assert":4,"./$.cof":6,"./$.def":12,"./$.invoke":16,"./$.replacer":25,"./$.uid":30}],34:[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 copyWithin(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');
},{"./$":21,"./$.def":12,"./$.unscope":31}],35:[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 fill(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');
},{"./$":21,"./$.def":12,"./$.unscope":31}],36:[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":12,"./$.unscope":31}],37:[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":12,"./$.unscope":31}],38:[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', {
// 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
from: function from(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 ? call(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;
}
});
},{"./$":21,"./$.ctx":11,"./$.def":12,"./$.iter":20,"./$.iter-call":17,"./$.iter-detect":19}],39:[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]()
require('./$.iter-define')(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 == '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');
},{"./$":21,"./$.iter":20,"./$.iter-define":18,"./$.uid":30,"./$.unscope":31}],40:[function(require,module,exports){
var $def = require('./$.def');
$def($def.S, 'Array', {
// 22.1.2.3 Array.of( ...items)
of: function of(/* ...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":12}],41:[function(require,module,exports){
require('./$.species')(Array);
},{"./$.species":27}],42:[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));
}
});
},{"./$":21}],43:[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 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);
},{"./$.collection":10,"./$.collection-strong":7}],44:[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;
}
// 20.2.2.28 Math.sign(x)
function sign(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 acosh(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 atanh(x){
return (x = +x) == 0 ? x : log((1 + x) / (1 - x)) / 2;
},
// 20.2.2.9 Math.cbrt(x)
cbrt: function cbrt(x){
return sign(x = +x) * pow(abs(x), 1 / 3);
},
// 20.2.2.11 Math.clz32(x)
clz32: function clz32(x){
return (x >>>= 0) ? 31 - floor(log(x + 0.5) * Math.LOG2E) : 32;
},
// 20.2.2.12 Math.cosh(x)
cosh: function cosh(x){
return (exp(x = +x) + exp(-x)) / 2;
},
// 20.2.2.14 Math.expm1(x)
expm1: expm1,
// 20.2.2.16 Math.fround(x)
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;
},
// 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
hypot: function hypot(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 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);
},
// 20.2.2.20 Math.log1p(x)
log1p: function log1p(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 log10(x){
return log(x) / Math.LN10;
},
// 20.2.2.22 Math.log2(x)
log2: function log2(x){
return log(x) / Math.LN2;
},
// 20.2.2.28 Math.sign(x)
sign: sign,
// 20.2.2.30 Math.sinh(x)
sinh: function sinh(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 tanh(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 trunc(it){
return (it > 0 ? floor : ceil)(it);
}
});
},{"./$.def":12}],45:[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);
}
},{"./$":21}],46:[function(require,module,exports){
var $ = require('./$')
, $def = require('./$.def')
, abs = Math.abs
, floor = Math.floor
, _isFinite = $.g.isFinite
, 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 isFinite(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 isNaN(number){
return number != number;
},
// 20.1.2.5 Number.isSafeInteger(number)
isSafeInteger: function isSafeInteger(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
});
},{"./$":21,"./$.def":12}],47:[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":12}],48:[function(require,module,exports){
// 19.1.3.10 Object.is(value1, value2)
var $def = require('./$.def');
$def($def.S, 'Object', {
is: function is(x, y){
return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
}
});
},{"./$.def":12}],49:[function(require,module,exports){
// 19.1.3.19 Object.setPrototypeOf(O, proto)
var $def = require('./$.def');
$def($def.S, 'Object', {setPrototypeOf: require('./$.set-proto').set});
},{"./$.def":12,"./$.set-proto":26}],50:[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 getOwnPropertyDescriptor(it, key){
return fn(toObject(it), key);
} : MODE == 5 ? function getPrototypeOf(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');
},{"./$":21,"./$.def":12}],51:[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 toString(){
return '[object ' + cof.classof(this) + ']';
});
},{"./$":21,"./$.cof":6,"./$.wks":32}],52:[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
, species = require('./$.species')
, SPECIES = require('./$.wks')('species')
, RECORD = require('./$.uid').safe('record')
, PROMISE = 'Promise'
, global = $.g
, process = global.process
, asap = process && process.nextTick || require('./$.task').set
, P = global[PROMISE]
, isFunction = $.isFunction
, isObject = $.isObject
, assertFunction = assert.fn
, assertObject = assert.obj
, test;
var useNative = isFunction(P) && isFunction(P.resolve) &&
P.resolve(test = new P(function(){})) == test;
// actual Firefox has broken subclass support, test that
function P2(x){
var self = new P(x);
setProto(self, P2.prototype);
return self;
}
if(useNative){
try { // protect against bad/buggy Object.setPrototype
setProto(P2, P);
P2.prototype = $.create(P.prototype, {constructor: {value: P2}});
if(!(P2.resolve(5).then(function(){}) instanceof P2)){
useNative = false;
}
} catch(e){ useNative = false; }
}
// helpers
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(function(){
var value = record.v
, ok = record.s == 1
, i = 0;
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 isUnhandled(promise){
var record = promise[RECORD]
, chain = record.a
, 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; // unwrap
record.v = value;
record.s = 2;
asap(function(){
setTimeout(function(){
if(isUnhandled(promise = record.p)){
if(cof(process) == 'process'){
process.emit('unhandledRejection', value, promise);
} else if(global.console && isFunction(console.error)){
console.error('Unhandled promise rejection', value);
}
}
}, 1);
});
notify(record);
}
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
}
}
// constructor polyfill
if(!useNative){
// 25.4.3.1 Promise(executor)
P = function Promise(executor){
assertFunction(executor);
var record = {
p: assert.inst(this, P, PROMISE), // <- promise
c: [], // <- awaiting reactions
a: [], // <- all reactions
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(P.prototype, {
// 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
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.a.push(react);
record.c.push(react);
record.s && notify(record);
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});
cof.set(P, PROMISE);
species(P);
species($.core[PROMISE]); // for wrapper
// statics
$def($def.S + $def.F * !useNative, PROMISE, {
// 25.4.4.5 Promise.reject(r)
reject: function reject(r){
return new (getConstructor(this))(function(res, rej){
rej(r);
});
},
// 25.4.4.6 Promise.resolve(x)
resolve: function resolve(x){
return isObject(x) && RECORD in x && $.getProto(x) === this.prototype
? x : new (getConstructor(this))(function(res){
res(x);
});
}
});
$def($def.S + $def.F * !(useNative && require('./$.iter-detect')(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);
});
});
}
});
},{"./$":21,"./$.assert":4,"./$.cof":6,"./$.ctx":11,"./$.def":12,"./$.for-of":14,"./$.iter-detect":19,"./$.set-proto":26,"./$.species":27,"./$.task":29,"./$.uid":30,"./$.wks":32}],53:[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){
$.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);
});
function wrap(fn){
return function(it){
assertObject(it);
try {
fn.apply(undefined, arguments);
return true;
} catch(e){
return false;
}
};
}
function get(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))
? get(proto, propertyKey, receiver)
: undefined;
}
function set(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 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);
}
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 construct(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 deleteProperty(target, propertyKey){
var desc = getDesc(assertObject(target), propertyKey);
return desc && !desc.configurable ? false : delete target[propertyKey];
},
// 26.1.5 Reflect.enumerate(target)
enumerate: function enumerate(target){
return new Enumerate(assertObject(target));
},
// 26.1.6 Reflect.get(target, propertyKey [, receiver])
get: get,
// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey){
return getDesc(assertObject(target), propertyKey);
},
// 26.1.8 Reflect.getPrototypeOf(target)
getPrototypeOf: function getPrototypeOf(target){
return getProto(assertObject(target));
},
// 26.1.9 Reflect.has(target, propertyKey)
has: function has(target, propertyKey){
return propertyKey in target;
},
// 26.1.10 Reflect.isExtensible(target)
isExtensible: function isExtensible(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: set
};
// 26.1.14 Reflect.setPrototypeOf(target, proto)
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, 'Reflect', reflect);
},{"./$":21,"./$.assert":4,"./$.ctx":11,"./$.def":12,"./$.iter":20,"./$.own-keys":23,"./$.set-proto":26,"./$.uid":30}],54:[function(require,module,exports){
var $ = require('./$')
, cof = require('./$.cof')
, RegExp = $.g.RegExp
, Base = RegExp
, proto = RegExp.prototype;
function regExpBroken() {
try {
var a = /a/g;
// "new" creates a new object
if (a === new RegExp(a)) { return true; }
// RegExp allows a regex with flags as the pattern
return RegExp(/a/g, 'i') != '/a/i';
} catch(e) {
return true;
}
}
if($.FW && $.DESC){
if(regExpBroken()) {
RegExp = function RegExp(pattern, flags){
return new Base(cof(pattern) == 'RegExp' ? pattern.source : pattern,
flags === undefined ? 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;
$.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);
},{"./$":21,"./$.cof":6,"./$.replacer":25,"./$.species":27}],55:[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 add(value){
return strong.def(this, value = value === 0 ? 0 : value, value);
}
}, strong);
},{"./$.collection":10,"./$.collection-strong":7}],56:[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":12,"./$.string-at":28}],57:[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 endsWith(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;
}
});
},{"./$":21,"./$.cof":6,"./$.def":12}],58:[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 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('');
}
});
},{"./$":21,"./$.def":12}],59:[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 includes(searchString /*, position = 0 */){
if(cof(searchString) == 'RegExp')throw TypeError();
return !!~String($.assertDefined(this)).indexOf(searchString, arguments[1]);
}
});
},{"./$":21,"./$.cof":6,"./$.def":12}],60:[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]()
require('./$.iter-define')(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);
});
},{"./$":21,"./$.iter":20,"./$.iter-define":18,"./$.string-at":28,"./$.uid":30}],61:[function(require,module,exports){
var $ = require('./$')
, $def = require('./$.def');
$def($def.S, 'String', {
// 21.1.2.4 String.raw(callSite, ...substitutions)
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('');
}
});
},{"./$":21,"./$.def":12}],62:[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 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;
}
});
},{"./$":21,"./$.def":12}],63:[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 startsWith(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;
}
});
},{"./$":21,"./$.cof":6,"./$.def":12}],64:[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')
, enumKeys = require('./$.enum-keys')
, assertObject = require('./$.assert').obj
, has = $.has
, $create = $.create
, getDesc = $.getDesc
, setDesc = $.setDesc
, desc = $.desc
, getNames = $.getNames
, toObject = $.toObject
, Symbol = $.g.Symbol
, setter = false
, TAG = uid('tag')
, HIDDEN = uid('hidden')
, SymbolRegistry = {}
, AllSymbols = {}
, useNative = $.isFunction(Symbol);
function wrap(tag){
var sym = AllSymbols[tag] = $.set($create(Symbol.prototype), TAG, tag);
$.DESC && setter && setDesc(Object.prototype, tag, {
configurable: true,
set: function(value){
if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
setDesc(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.enumerable = false;
}
} 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 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;
}
// 19.4.1.1 Symbol([description])
if(!useNative){
Symbol = function Symbol(description){
if(this instanceof Symbol)throw TypeError('Symbol is not a constructor');
return wrap(uid(description));
};
$.hide(Symbol.prototype, 'toString', function(){
return this[TAG];
});
$.create = create;
$.setDesc = defineProperty;
$.getDesc = getOwnPropertyDescriptor;
$.setDescs = defineProperties;
$.getNames = getOwnPropertyNames;
$.getSymbols = getOwnPropertySymbols;
}
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 = 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', {
// 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($.g.JSON, 'JSON', true);
},{"./$":21,"./$.assert":4,"./$.cof":6,"./$.def":12,"./$.enum-keys":13,"./$.keyof":22,"./$.uid":30,"./$.wks":32}],65:[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 get(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 set(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);
};
});
}
},{"./$":21,"./$.collection":10,"./$.collection-weak":9}],66:[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 add(value){
return weak.def(this, value, true);
}
}, weak, false, true);
},{"./$.collection":10,"./$.collection-weak":9}],67:[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":12,"./$.unscope":31}],68:[function(require,module,exports){
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
require('./$.collection-to-json')('Map');
},{"./$.collection-to-json":8}],69:[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 getOwnPropertyDescriptors(object){
var O = $.toObject(object)
, result = {};
$.each.call(ownKeys(O), function(key){
$.setDesc(result, key, $.desc(0, $.getDesc(O, key)));
});
return result;
}
});
},{"./$":21,"./$.def":12,"./$.own-keys":23}],70:[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(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)
});
},{"./$":21,"./$.def":12}],71:[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":12,"./$.replacer":25}],72:[function(require,module,exports){
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
require('./$.collection-to-json')('Set');
},{"./$.collection-to-json":8}],73:[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":12,"./$.string-at":28}],74:[function(require,module,exports){
// JavaScript 1.6 / Strawman array statics shim
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);
},{"./$":21,"./$.ctx":11,"./$.def":12}],75:[function(require,module,exports){
require('./es6.array.iterator');
var $ = require('./$')
, Iterators = require('./$.iter').Iterators
, ITERATOR = require('./$.wks')('iterator')
, ArrayValues = Iterators.Array
, NodeList = $.g.NodeList;
if($.FW && NodeList && !(ITERATOR in NodeList.prototype)){
$.hide(NodeList.prototype, ITERATOR, ArrayValues);
}
Iterators.NodeList = ArrayValues;
},{"./$":21,"./$.iter":20,"./$.wks":32,"./es6.array.iterator":39}],76:[function(require,module,exports){
var $def = require('./$.def')
, $task = require('./$.task');
$def($def.G + $def.B, {
setImmediate: $task.set,
clearImmediate: $task.clear
});
},{"./$.def":12,"./$.task":29}],77:[function(require,module,exports){
// ie9- setTimeout & setInterval additional parameters fix
var $ = require('./$')
, $def = require('./$.def')
, invoke = require('./$.invoke')
, partial = require('./$.partial')
, navigator = $.g.navigator
, MSIE = !!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)
});
},{"./$":21,"./$.def":12,"./$.invoke":16,"./$.partial":24}],78:[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.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.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/$":21,"./modules/es5":33,"./modules/es6.array.copy-within":34,"./modules/es6.array.fill":35,"./modules/es6.array.find":37,"./modules/es6.array.find-index":36,"./modules/es6.array.from":38,"./modules/es6.array.iterator":39,"./modules/es6.array.of":40,"./modules/es6.array.species":41,"./modules/es6.function.name":42,"./modules/es6.map":43,"./modules/es6.math":44,"./modules/es6.number.constructor":45,"./modules/es6.number.statics":46,"./modules/es6.object.assign":47,"./modules/es6.object.is":48,"./modules/es6.object.set-prototype-of":49,"./modules/es6.object.statics-accept-primitives":50,"./modules/es6.object.to-string":51,"./modules/es6.promise":52,"./modules/es6.reflect":53,"./modules/es6.regexp":54,"./modules/es6.set":55,"./modules/es6.string.code-point-at":56,"./modules/es6.string.ends-with":57,"./modules/es6.string.from-code-point":58,"./modules/es6.string.includes":59,"./modules/es6.string.iterator":60,"./modules/es6.string.raw":61,"./modules/es6.string.repeat":62,"./modules/es6.string.starts-with":63,"./modules/es6.symbol":64,"./modules/es6.weak-map":65,"./modules/es6.weak-set":66,"./modules/es7.array.includes":67,"./modules/es7.map.to-json":68,"./modules/es7.object.get-own-property-descriptors":69,"./modules/es7.object.to-array":70,"./modules/es7.regexp.escape":71,"./modules/es7.set.to-json":72,"./modules/es7.string.at":73,"./modules/js.array.statics":74,"./modules/web.dom.iterable":75,"./modules/web.immediate":76,"./modules/web.timers":77}],79:[function(require,module,exports){
(function (global){
/**
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* https://raw.github.com/facebook/regenerator/master/LICENSE file. An
* additional grant of patent rights can be found in the PATENTS file in
* the same directory.
*/
!(function(global) {
"use strict";
var hasOwn = Object.prototype.hasOwnProperty;
var undefined; // More compressible than void 0.
var iteratorSymbol =
typeof Symbol === "function" && Symbol.iterator || "@@iterator";
var inModule = typeof module === "object";
var runtime = global.regeneratorRuntime;
if (runtime) {
if (inModule) {
// If regeneratorRuntime is defined globally and we're in a module,
// make the exports object identical to regeneratorRuntime.
module.exports = runtime;
}
// Don't bother evaluating the rest of this file if the runtime was
// already defined globally.
return;
}
// Define the runtime globally (as expected by generated code) as either
// module.exports (if we're in a module) or a new, empty object.
runtime = global.regeneratorRuntime = inModule ? module.exports : {};
function wrap(innerFn, outerFn, self, tryLocsList) {
// If outerFn provided, then outerFn.prototype instanceof Generator.
var generator = Object.create((outerFn || Generator).prototype);
generator._invoke = makeInvokeMethod(
innerFn, self || null,
new Context(tryLocsList || [])
);
return generator;
}
runtime.wrap = wrap;
// Try/catch helper to minimize deoptimizations. Returns a completion
// record like context.tryEntries[i].completion. This interface could
// have been (and was previously) designed to take a closure to be
// invoked without arguments, but in all the cases we care about we
// already have an existing method we want to call, so there's no need
// to create a new function object. We can even get away with assuming
// the method takes exactly one argument, since that happens to be true
// in every case, so we don't have to touch the arguments object. The
// only additional allocation required is the completion record, which
// has a stable shape and so hopefully should be cheap to allocate.
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";
// Returning this object from the innerFn has the same effect as
// breaking out of the dispatch switch statement.
var ContinueSentinel = {};
// Dummy constructor functions that we use as the .constructor and
// .constructor.prototype properties for functions that return Generator
// objects. For full spec compliance, you may wish to configure your
// minifier not to mangle the names of these two functions.
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype;
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
GeneratorFunctionPrototype.constructor = GeneratorFunction;
GeneratorFunction.displayName = "GeneratorFunction";
runtime.isGeneratorFunction = function(genFun) {
var ctor = typeof genFun === "function" && genFun.constructor;
return ctor
? ctor === GeneratorFunction ||
// For the native GeneratorFunction constructor, the best we can
// do is to check its .name property.
(ctor.displayName || ctor.name) === "GeneratorFunction"
: false;
};
runtime.mark = function(genFun) {
genFun.__proto__ = GeneratorFunctionPrototype;
genFun.prototype = Object.create(Gp);
return genFun;
};
runtime.async = function(innerFn, outerFn, self, tryLocsList) {
return new Promise(function(resolve, reject) {
var generator = wrap(innerFn, outerFn, self, tryLocsList);
var callNext = step.bind(generator, "next");
var callThrow = step.bind(generator, "throw");
function step(method, arg) {
var record = tryCatch(generator[method], generator, arg);
if (record.type === "throw") {
reject(record.arg);
return;
}
var info = record.arg;
if (info.done) {
resolve(info.value);
} else {
Promise.resolve(info.value).then(callNext, callThrow);
}
}
callNext();
});
};
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) {
// Be forgiving, per 25.3.3.3.3 of the spec:
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
return doneResult();
}
while (true) {
var delegate = context.delegate;
if (delegate) {
if (method === "return" ||
(method === "throw" && delegate.iterator[method] === undefined)) {
// A return or throw (when the delegate iterator has no throw
// method) always terminates the yield* loop.
context.delegate = null;
// If the delegate iterator has a return method, give it a
// chance to clean up.
var returnMethod = delegate.iterator["return"];
if (returnMethod) {
var record = tryCatch(returnMethod, delegate.iterator, arg);
if (record.type === "throw") {
// If the return method threw an exception, let that
// exception prevail over the original return or throw.
method = "throw";
arg = record.arg;
continue;
}
}
if (method === "return") {
// Continue with the outer return, now that the delegate
// iterator has been terminated.
continue;
}
}
var record = tryCatch(
delegate.iterator[method],
delegate.iterator,
arg
);
if (record.type === "throw") {
context.delegate = null;
// Like returning generator.throw(uncaught), but without the
// overhead of an extra function call.
method = "throw";
arg = record.arg;
continue;
}
// Delegate generator ran and handled its own exceptions so
// regardless of what the method was, we continue as if it is
// "next" with an undefined arg.
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 {
delete context.sent;
}
} else if (method === "throw") {
if (state === GenStateSuspendedStart) {
state = GenStateCompleted;
throw arg;
}
if (context.dispatchException(arg)) {
// If the dispatched exception was caught by a catch block,
// then let that catch block handle the exception normally.
method = "next";
arg = undefined;
}
} else if (method === "return") {
context.abrupt("return", arg);
}
state = GenStateExecuting;
var record = tryCatch(innerFn, self, context);
if (record.type === "normal") {
// If an exception is thrown from innerFn, we leave state ===
// GenStateExecuting and loop back for another invocation.
state = context.done
? GenStateCompleted
: GenStateSuspendedYield;
var info = {
value: record.arg,
done: context.done
};
if (record.arg === ContinueSentinel) {
if (context.delegate && method === "next") {
// Deliberately forget the last sent value so that we don't
// accidentally pass it on to the delegate.
arg = undefined;
}
} else {
return info;
}
} else if (record.type === "throw") {
state = GenStateCompleted;
// Dispatch the exception by looping back around to the
// context.dispatchException(arg) call above.
method = "throw";
arg = record.arg;
}
}
};
}
function defineGeneratorMethod(method) {
Gp[method] = function(arg) {
return this._invoke(method, arg);
};
}
defineGeneratorMethod("next");
defineGeneratorMethod("throw");
defineGeneratorMethod("return");
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) {
// The root entry object (effectively a try statement without a catch
// or a finally block) gives us a place to store values thrown from
// locations where there is no enclosing try statement.
this.tryEntries = [{ tryLoc: "root" }];
tryLocsList.forEach(pushTryEntry, this);
this.reset();
}
runtime.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
keys.reverse();
// Rather than returning an object with a next method, we keep
// things simple and return the next function itself.
return function next() {
while (keys.length) {
var key = keys.pop();
if (key in object) {
next.value = key;
next.done = false;
return next;
}
}
// To avoid creating an additional object, we just hang the .value
// and .done properties off the next function object itself. This
// also ensures that the minifier will not anonymize the function.
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 an iterator with no values.
return { next: doneResult };
}
runtime.values = values;
function doneResult() {
return { value: undefined, done: true };
}
Context.prototype = {
constructor: Context,
reset: function() {
this.prev = 0;
this.next = 0;
this.sent = undefined;
this.done = false;
this.delegate = null;
this.tryEntries.forEach(resetTryEntry);
// Pre-initialize at least 20 temporary variables to enable hidden
// class optimizations for simple generators.
for (var tempIndex = 0, tempName;
hasOwn.call(this, tempName = "t" + tempIndex) || tempIndex < 20;
++tempIndex) {
this[tempName] = null;
}
},
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") {
// Exception thrown outside of any try block that could handle
// it, so set the completion value of the entire function to
// throw the exception.
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) {
// Ignore the finally entry if control is not jumping to a
// location outside the try/catch block.
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;
}
}
// The context.catch method must only be called with a location
// argument that corresponds to a known catch block.
throw new Error("illegal catch attempt");
},
delegateYield: function(iterable, resultName, nextLoc) {
this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
};
return ContinueSentinel;
}
};
})(
// Among the various tricks for obtaining a reference to the global
// object, this seems to be the most reliable technique that does not
// use indirect eval (which violates Content Security Policy).
typeof global === "object" ? global :
typeof window === "object" ? window :
typeof self === "object" ? self : this
);
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}]},{},[1]);
|
examples/basic/src/components/NavBar.js
|
supasate/connected-react-router
|
import React from 'react'
import { Link } from 'react-router-dom'
const NavBar = () => (
<div>
<div><Link to="/">Home</Link> <Link to="/hello">Hello</Link> <Link to="/counter">Counter</Link></div>
</div>
)
export default NavBar
|
packages/material-ui-icons/src/BluetoothDisabled.js
|
kybarg/material-ui
|
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<path d="M13 5.83l1.88 1.88-1.6 1.6 1.41 1.41 3.02-3.02L12 2h-1v5.03l2 2v-3.2zM5.41 4L4 5.41 10.59 12 5 17.59 6.41 19 11 14.41V22h1l4.29-4.29 2.3 2.29L20 18.59 5.41 4zM13 18.17v-3.76l1.88 1.88L13 18.17z" />
, 'BluetoothDisabled');
|
src/components/rolesList/test/index.js
|
codyloyd/teamup
|
import describe from 'tape'
import React from 'react'
import dom from 'cheerio'
import ReactDOMServer from 'react-dom/server'
import RolesList from '../'
const render = ReactDOMServer.renderToStaticMarkup
const createRole = (
{
id = '01',
projectId = '02',
name = 'role name',
status = 'open',
description = 'description of the role',
applications = ['11', '22'],
users = ['33']
} = {}
) => ({
id,
projectId,
name,
status,
description,
applications,
users
})
const createProps = (
{
roles = [createRole(), createRole({id: '02', name: 'role 2 name'})]
} = {}
) => ({
roles
})
describe('Roles List', ({test}) => {
test('creates a Role item for each entry in props', ({equal, end}) => {
let msg, actual, expected, output
msg = 'creates the correct number of roles'
const props = createProps()
const $ = dom.load(render(<RolesList {...props} />))
output = $('.role-details')
actual = output.length
expected = 2
equal(actual, expected, msg)
end()
})
test('creates a Role item for each entry in props', ({equal, end}) => {
let msg, actual, expected, output
msg = 'does not display "no roles" message'
const props = createProps()
const $ = dom.load(render(<RolesList {...props} />))
output = $('.no-roles')
actual = output.length
expected = 0
equal(actual, expected, msg)
end()
})
test('if no roles', ({equal, end}) => {
let msg, actual, expected, output
msg = 'displays message if no roles'
const props = {roles: []}
const $ = dom.load(render(<RolesList {...props} />))
output = $('.no-roles')
actual = output.length
expected = 1
equal(actual, expected, msg)
end()
})
test('if no roles', ({equal, end}) => {
let msg, actual, expected, output
msg = 'does not display roles list'
const props = {roles: []}
const $ = dom.load(render(<RolesList {...props} />))
output = $('.role-details')
actual = output.length
expected = 0
equal(actual, expected, msg)
end()
})
})
|
app/javascript/chitchat/containers/MessageForm/index.js
|
fcbajao/chitchat
|
// @flow
import React from 'react'
import { connect } from 'react-redux'
import { Field, reduxForm } from 'redux-form'
import { actions } from '../../ducks/chat'
import { validateRequired } from '../../utils'
const MessageForm = (props: { handleSubmit: Function, onSubmit: Function }) => {
const handleSubmit = props.handleSubmit(props.onSubmit)
return <form className='message-form' onSubmit={handleSubmit}>
<div className='message-form__input-container'>
<Field name='message' placeholder='Say anything...' className='message-form__input' component='input' type='text' />
</div>
<div className='message-form__action-container'>
<button className='message-form__send-btn' type='submit'>Send</button>
</div>
</form>
}
const mapDispatchToProps = (dispatch: Dispatch) => {
return {
onSubmit (data: { message: string }) {
dispatch(actions.sendMessage(data.message))
}
}
}
const validate = validateRequired(['message'])
const connected = connect(null, mapDispatchToProps)(MessageForm)
export default reduxForm({
form: 'message',
validate
})(connected)
|
inlineStyles/src/components/Example/Example.js
|
wandarkaf/React-Bible
|
import React from 'react';
import styles from './styles';
class Example extends React.Component {
render() {
return (
<p style={styles.announcement}>{this.props.content}</p>
);
}
}
Example.propTypes = {
content: React.PropTypes.string.isRequired
};
export default Example;
|
client/blog/src/components/navmenu/NavLinks.js
|
we-human-space/website
|
import React from 'react';
import PropTypes from 'prop-types';
import config from '../../config';
export default class NavLinks extends React.Component{
isActive(link){
return window.location.search && link.location.search && window.location.search.match(link.location.search);
}
subscribeIsActive() {
return window.__PRELOADED_STATE__.page === 'weeklydose';
}
renderSubscribe() {
if(this.props.class === 'resonateWith'){
return (
<li>
<a href={config.routing['weeklydose']}
className={this.subscribeIsActive() ? 'navSubscribe liActive' : 'navSubscribe'}>
Subscribe
</a>
</li>
);
}
}
render(){
const list = this.props.links.map((link) => {
return (
<li key={link.key}>
<a href={link.url}
onClick={this.props.type !== 'navlinks' ? this.props.onClickWrapper(link) : () => {}}
className={this.isActive(link) ? 'liActive' : undefined}
>{link.text}</a>
</li>
);
});
if(this.props.render_type === 'navigation'){
return (
<div className={this.props.class}>
<div className='sectionTitle'>
<span>{this.props.subtitle}</span>
</div>
<div className='separator blockTwo'></div>
<ul className='ulBlock'>
{ list }
{ this.renderSubscribe() }
</ul>
</div>
);
}else if(this.props.render_type === 'filter'){
return (
<div>
<div className='filtersPlacement'>
<ul className='ulTop1024'>
{ list }
</ul>
</div>
<div><a className='ctaSubscribe' href={config.routing['weeklydose']}>Subscribe</a></div>
</div>
);
}
}
}
NavLinks.propTypes = {
onClickWrapper: PropTypes.func.isRequired,
type: PropTypes.string.isRequired,
render_type: PropTypes.string.isRequired,
class: PropTypes.string.isRequired,
subtitle: PropTypes.string.isRequired,
links: PropTypes.arrayOf(PropTypes.shape({
location: PropTypes.shape({
pathname: PropTypes.string,
search: PropTypes.string
}),
key: PropTypes.string.isRequired,
text: PropTypes.string.isRequired
})).isRequired
};
|
ajax/libs/Sly/1.4.1/sly.js
|
samthor/cdnjs
|
/*!
* sly 1.4.1 - 5th Mar 2015
* https://github.com/darsain/sly
*
* Licensed under the MIT license.
* http://opensource.org/licenses/MIT
*/
;(function ($, w, undefined) {
'use strict';
var pluginName = 'sly';
var className = 'Sly';
var namespace = pluginName;
// Local WindowAnimationTiming interface
var cAF = w.cancelAnimationFrame || w.cancelRequestAnimationFrame;
var rAF = w.requestAnimationFrame;
// Support indicators
var transform, gpuAcceleration;
// Other global values
var $doc = $(document);
var dragInitEvents = 'touchstart.' + namespace + ' mousedown.' + namespace;
var dragMouseEvents = 'mousemove.' + namespace + ' mouseup.' + namespace;
var dragTouchEvents = 'touchmove.' + namespace + ' touchend.' + namespace;
var wheelEvent = (document.implementation.hasFeature('Event.wheel', '3.0') ? 'wheel.' : 'mousewheel.') + namespace;
var clickEvent = 'click.' + namespace;
var mouseDownEvent = 'mousedown.' + namespace;
var interactiveElements = ['INPUT', 'SELECT', 'BUTTON', 'TEXTAREA'];
var tmpArray = [];
var time;
// Math shorthands
var abs = Math.abs;
var sqrt = Math.sqrt;
var pow = Math.pow;
var round = Math.round;
var max = Math.max;
var min = Math.min;
// Keep track of last fired global wheel event
var lastGlobalWheel = 0;
$doc.on(wheelEvent, function () {
lastGlobalWheel = +new Date();
});
/**
* Sly.
*
* @class
*
* @param {Element} frame DOM element of sly container.
* @param {Object} options Object with options.
* @param {Object} callbackMap Callbacks map.
*/
function Sly(frame, options, callbackMap) {
// Extend options
var o = $.extend({}, Sly.defaults, options);
// Private variables
var self = this;
var parallax = isNumber(frame);
// Frame
var $frame = $(frame);
var $slidee = $frame.children().eq(0);
var frameSize = 0;
var slideeSize = 0;
var pos = {
start: 0,
center: 0,
end: 0,
cur: 0,
dest: 0
};
// Scrollbar
var $sb = $(o.scrollBar).eq(0);
var $handle = $sb.children().eq(0);
var sbSize = 0;
var handleSize = 0;
var hPos = {
start: 0,
end: 0,
cur: 0
};
// Pagesbar
var $pb = $(o.pagesBar);
var $pages = 0;
var pages = [];
// Items
var $items = 0;
var items = [];
var rel = {
firstItem: 0,
lastItem: 0,
centerItem: 0,
activeItem: null,
activePage: 0
};
// Styles
var frameStyles = new StyleRestorer($frame[0]);
var slideeStyles = new StyleRestorer($slidee[0]);
var sbStyles = new StyleRestorer($sb[0]);
var handleStyles = new StyleRestorer($handle[0]);
// Navigation type booleans
var basicNav = o.itemNav === 'basic';
var forceCenteredNav = o.itemNav === 'forceCentered';
var centeredNav = o.itemNav === 'centered' || forceCenteredNav;
var itemNav = !parallax && (basicNav || centeredNav || forceCenteredNav);
// Miscellaneous
var $scrollSource = o.scrollSource ? $(o.scrollSource) : $frame;
var $dragSource = o.dragSource ? $(o.dragSource) : $frame;
var $forwardButton = $(o.forward);
var $backwardButton = $(o.backward);
var $prevButton = $(o.prev);
var $nextButton = $(o.next);
var $prevPageButton = $(o.prevPage);
var $nextPageButton = $(o.nextPage);
var callbacks = {};
var last = {};
var animation = {};
var move = {};
var dragging = {
released: 1
};
var scrolling = {
last: 0,
delta: 0,
resetTime: 200
};
var renderID = 0;
var historyID = 0;
var cycleID = 0;
var continuousID = 0;
var i, l;
// Normalizing frame
if (!parallax) {
frame = $frame[0];
}
// Expose properties
self.initialized = 0;
self.frame = frame;
self.slidee = $slidee[0];
self.pos = pos;
self.rel = rel;
self.items = items;
self.pages = pages;
self.isPaused = 0;
self.options = o;
self.dragging = dragging;
/**
* Loading function.
*
* Populate arrays, set sizes, bind events, ...
*
* @param {Boolean} [isInit] Whether load is called from within self.init().
* @return {Void}
*/
function load(isInit) {
// Local variables
var lastItemsCount = 0;
var lastPagesCount = pages.length;
// Save old position
pos.old = $.extend({}, pos);
// Reset global variables
frameSize = parallax ? 0 : $frame[o.horizontal ? 'width' : 'height']();
sbSize = $sb[o.horizontal ? 'width' : 'height']();
slideeSize = parallax ? frame : $slidee[o.horizontal ? 'outerWidth' : 'outerHeight']();
pages.length = 0;
// Set position limits & relatives
pos.start = 0;
pos.end = max(slideeSize - frameSize, 0);
// Sizes & offsets for item based navigations
if (itemNav) {
// Save the number of current items
lastItemsCount = items.length;
// Reset itemNav related variables
$items = $slidee.children(o.itemSelector);
items.length = 0;
// Needed variables
var paddingStart = getPx($slidee, o.horizontal ? 'paddingLeft' : 'paddingTop');
var paddingEnd = getPx($slidee, o.horizontal ? 'paddingRight' : 'paddingBottom');
var borderBox = $($items).css('boxSizing') === 'border-box';
var areFloated = $items.css('float') !== 'none';
var ignoredMargin = 0;
var lastItemIndex = $items.length - 1;
var lastItem;
// Reset slideeSize
slideeSize = 0;
// Iterate through items
$items.each(function (i, element) {
// Item
var $item = $(element);
var rect = element.getBoundingClientRect();
var itemSize = round(o.horizontal ? rect.width || rect.right - rect.left : rect.height || rect.bottom - rect.top);
var itemMarginStart = getPx($item, o.horizontal ? 'marginLeft' : 'marginTop');
var itemMarginEnd = getPx($item, o.horizontal ? 'marginRight' : 'marginBottom');
var itemSizeFull = itemSize + itemMarginStart + itemMarginEnd;
var singleSpaced = !itemMarginStart || !itemMarginEnd;
var item = {};
item.el = element;
item.size = singleSpaced ? itemSize : itemSizeFull;
item.half = item.size / 2;
item.start = slideeSize + (singleSpaced ? itemMarginStart : 0);
item.center = item.start - round(frameSize / 2 - item.size / 2);
item.end = item.start - frameSize + item.size;
// Account for slidee padding
if (!i) {
slideeSize += paddingStart;
}
// Increment slidee size for size of the active element
slideeSize += itemSizeFull;
// Try to account for vertical margin collapsing in vertical mode
// It's not bulletproof, but should work in 99% of cases
if (!o.horizontal && !areFloated) {
// Subtract smaller margin, but only when top margin is not 0, and this is not the first element
if (itemMarginEnd && itemMarginStart && i > 0) {
slideeSize -= min(itemMarginStart, itemMarginEnd);
}
}
// Things to be done on last item
if (i === lastItemIndex) {
item.end += paddingEnd;
slideeSize += paddingEnd;
ignoredMargin = singleSpaced ? itemMarginEnd : 0;
}
// Add item object to items array
items.push(item);
lastItem = item;
});
// Resize SLIDEE to fit all items
$slidee[0].style[o.horizontal ? 'width' : 'height'] = (borderBox ? slideeSize: slideeSize - paddingStart - paddingEnd) + 'px';
// Adjust internal SLIDEE size for last margin
slideeSize -= ignoredMargin;
// Set limits
if (items.length) {
pos.start = items[0][forceCenteredNav ? 'center' : 'start'];
pos.end = forceCenteredNav ? lastItem.center : frameSize < slideeSize ? lastItem.end : pos.start;
} else {
pos.start = pos.end = 0;
}
}
// Calculate SLIDEE center position
pos.center = round(pos.end / 2 + pos.start / 2);
// Update relative positions
updateRelatives();
// Scrollbar
if ($handle.length && sbSize > 0) {
// Stretch scrollbar handle to represent the visible area
if (o.dynamicHandle) {
handleSize = pos.start === pos.end ? sbSize : round(sbSize * frameSize / slideeSize);
handleSize = within(handleSize, o.minHandleSize, sbSize);
$handle[0].style[o.horizontal ? 'width' : 'height'] = handleSize + 'px';
} else {
handleSize = $handle[o.horizontal ? 'outerWidth' : 'outerHeight']();
}
hPos.end = sbSize - handleSize;
if (!renderID) {
syncScrollbar();
}
}
// Pages
if (!parallax && frameSize > 0) {
var tempPagePos = pos.start;
var pagesHtml = '';
// Populate pages array
if (itemNav) {
$.each(items, function (i, item) {
if (forceCenteredNav) {
pages.push(item.center);
} else if (item.start + item.size > tempPagePos && tempPagePos <= pos.end) {
tempPagePos = item.start;
pages.push(tempPagePos);
tempPagePos += frameSize;
if (tempPagePos > pos.end && tempPagePos < pos.end + frameSize) {
pages.push(pos.end);
}
}
});
} else {
while (tempPagePos - frameSize < pos.end) {
pages.push(tempPagePos);
tempPagePos += frameSize;
}
}
// Pages bar
if ($pb[0] && lastPagesCount !== pages.length) {
for (var i = 0; i < pages.length; i++) {
pagesHtml += o.pageBuilder.call(self, i);
}
$pages = $pb.html(pagesHtml).children();
$pages.eq(rel.activePage).addClass(o.activeClass);
}
}
// Extend relative variables object with some useful info
rel.slideeSize = slideeSize;
rel.frameSize = frameSize;
rel.sbSize = sbSize;
rel.handleSize = handleSize;
// Activate requested position
if (itemNav) {
if (isInit && o.startAt != null) {
activate(o.startAt);
self[centeredNav ? 'toCenter' : 'toStart'](o.startAt);
}
// Fix possible overflowing
var activeItem = items[rel.activeItem];
slideTo(centeredNav && activeItem ? activeItem.center : within(pos.dest, pos.start, pos.end));
} else {
if (isInit) {
if (o.startAt != null) slideTo(o.startAt, 1);
} else {
// Fix possible overflowing
slideTo(within(pos.dest, pos.start, pos.end));
}
}
// Trigger load event
trigger('load');
}
self.reload = function () { load(); };
/**
* Animate to a position.
*
* @param {Int} newPos New position.
* @param {Bool} immediate Reposition immediately without an animation.
* @param {Bool} dontAlign Do not align items, use the raw position passed in first argument.
*
* @return {Void}
*/
function slideTo(newPos, immediate, dontAlign) {
// Align items
if (itemNav && dragging.released && !dontAlign) {
var tempRel = getRelatives(newPos);
var isNotBordering = newPos > pos.start && newPos < pos.end;
if (centeredNav) {
if (isNotBordering) {
newPos = items[tempRel.centerItem].center;
}
if (forceCenteredNav && o.activateMiddle) {
activate(tempRel.centerItem);
}
} else if (isNotBordering) {
newPos = items[tempRel.firstItem].start;
}
}
// Handle overflowing position limits
if (dragging.init && dragging.slidee && o.elasticBounds) {
if (newPos > pos.end) {
newPos = pos.end + (newPos - pos.end) / 6;
} else if (newPos < pos.start) {
newPos = pos.start + (newPos - pos.start) / 6;
}
} else {
newPos = within(newPos, pos.start, pos.end);
}
// Update the animation object
animation.start = +new Date();
animation.time = 0;
animation.from = pos.cur;
animation.to = newPos;
animation.delta = newPos - pos.cur;
animation.tweesing = dragging.tweese || dragging.init && !dragging.slidee;
animation.immediate = !animation.tweesing && (immediate || dragging.init && dragging.slidee || !o.speed);
// Reset dragging tweesing request
dragging.tweese = 0;
// Start animation rendering
if (newPos !== pos.dest) {
pos.dest = newPos;
trigger('change');
if (!renderID) {
render();
}
}
// Reset next cycle timeout
resetCycle();
// Synchronize states
updateRelatives();
updateButtonsState();
syncPagesbar();
}
/**
* Render animation frame.
*
* @return {Void}
*/
function render() {
if (!self.initialized) {
return;
}
// If first render call, wait for next animationFrame
if (!renderID) {
renderID = rAF(render);
if (dragging.released) {
trigger('moveStart');
}
return;
}
// If immediate repositioning is requested, don't animate.
if (animation.immediate) {
pos.cur = animation.to;
}
// Use tweesing for animations without known end point
else if (animation.tweesing) {
animation.tweeseDelta = animation.to - pos.cur;
// Fuck Zeno's paradox
if (abs(animation.tweeseDelta) < 0.1) {
pos.cur = animation.to;
} else {
pos.cur += animation.tweeseDelta * (dragging.released ? o.swingSpeed : o.syncSpeed);
}
}
// Use tweening for basic animations with known end point
else {
animation.time = min(+new Date() - animation.start, o.speed);
pos.cur = animation.from + animation.delta * $.easing[o.easing](animation.time/o.speed, animation.time, 0, 1, o.speed);
}
// If there is nothing more to render break the rendering loop, otherwise request new animation frame.
if (animation.to === pos.cur) {
pos.cur = animation.to;
dragging.tweese = renderID = 0;
} else {
renderID = rAF(render);
}
trigger('move');
// Update SLIDEE position
if (!parallax) {
if (transform) {
$slidee[0].style[transform] = gpuAcceleration + (o.horizontal ? 'translateX' : 'translateY') + '(' + (-pos.cur) + 'px)';
} else {
$slidee[0].style[o.horizontal ? 'left' : 'top'] = -round(pos.cur) + 'px';
}
}
// When animation reached the end, and dragging is not active, trigger moveEnd
if (!renderID && dragging.released) {
trigger('moveEnd');
}
syncScrollbar();
}
/**
* Synchronizes scrollbar with the SLIDEE.
*
* @return {Void}
*/
function syncScrollbar() {
if ($handle.length) {
hPos.cur = pos.start === pos.end ? 0 : (((dragging.init && !dragging.slidee) ? pos.dest : pos.cur) - pos.start) / (pos.end - pos.start) * hPos.end;
hPos.cur = within(round(hPos.cur), hPos.start, hPos.end);
if (last.hPos !== hPos.cur) {
last.hPos = hPos.cur;
if (transform) {
$handle[0].style[transform] = gpuAcceleration + (o.horizontal ? 'translateX' : 'translateY') + '(' + hPos.cur + 'px)';
} else {
$handle[0].style[o.horizontal ? 'left' : 'top'] = hPos.cur + 'px';
}
}
}
}
/**
* Synchronizes pagesbar with SLIDEE.
*
* @return {Void}
*/
function syncPagesbar() {
if ($pages[0] && last.page !== rel.activePage) {
last.page = rel.activePage;
$pages.removeClass(o.activeClass).eq(rel.activePage).addClass(o.activeClass);
trigger('activePage', last.page);
}
}
/**
* Returns the position object.
*
* @param {Mixed} item
*
* @return {Object}
*/
self.getPos = function (item) {
if (itemNav) {
var index = getIndex(item);
return index !== -1 ? items[index] : false;
} else {
var $item = $slidee.find(item).eq(0);
if ($item[0]) {
var offset = o.horizontal ? $item.offset().left - $slidee.offset().left : $item.offset().top - $slidee.offset().top;
var size = $item[o.horizontal ? 'outerWidth' : 'outerHeight']();
return {
start: offset,
center: offset - frameSize / 2 + size / 2,
end: offset - frameSize + size,
size: size
};
} else {
return false;
}
}
};
/**
* Continuous move in a specified direction.
*
* @param {Bool} forward True for forward movement, otherwise it'll go backwards.
* @param {Int} speed Movement speed in pixels per frame. Overrides options.moveBy value.
*
* @return {Void}
*/
self.moveBy = function (speed) {
move.speed = speed;
// If already initiated, or there is nowhere to move, abort
if (dragging.init || !move.speed || pos.cur === (move.speed > 0 ? pos.end : pos.start)) {
return;
}
// Initiate move object
move.lastTime = +new Date();
move.startPos = pos.cur;
// Set dragging as initiated
continuousInit('button');
dragging.init = 1;
// Start movement
trigger('moveStart');
cAF(continuousID);
moveLoop();
};
/**
* Continuous movement loop.
*
* @return {Void}
*/
function moveLoop() {
// If there is nowhere to move anymore, stop
if (!move.speed || pos.cur === (move.speed > 0 ? pos.end : pos.start)) {
self.stop();
}
// Request new move loop if it hasn't been stopped
continuousID = dragging.init ? rAF(moveLoop) : 0;
// Update move object
move.now = +new Date();
move.pos = pos.cur + (move.now - move.lastTime) / 1000 * move.speed;
// Slide
slideTo(dragging.init ? move.pos : round(move.pos));
// Normally, this is triggered in render(), but if there
// is nothing to render, we have to do it manually here.
if (!dragging.init && pos.cur === pos.dest) {
trigger('moveEnd');
}
// Update times for future iteration
move.lastTime = move.now;
}
/**
* Stops continuous movement.
*
* @return {Void}
*/
self.stop = function () {
if (dragging.source === 'button') {
dragging.init = 0;
dragging.released = 1;
}
};
/**
* Activate previous item.
*
* @return {Void}
*/
self.prev = function () {
self.activate(rel.activeItem == null ? 0 : rel.activeItem - 1);
};
/**
* Activate next item.
*
* @return {Void}
*/
self.next = function () {
self.activate(rel.activeItem == null ? 0 : rel.activeItem + 1);
};
/**
* Activate previous page.
*
* @return {Void}
*/
self.prevPage = function () {
self.activatePage(rel.activePage - 1);
};
/**
* Activate next page.
*
* @return {Void}
*/
self.nextPage = function () {
self.activatePage(rel.activePage + 1);
};
/**
* Slide SLIDEE by amount of pixels.
*
* @param {Int} delta Pixels/Items. Positive means forward, negative means backward.
* @param {Bool} immediate Reposition immediately without an animation.
*
* @return {Void}
*/
self.slideBy = function (delta, immediate) {
if (!delta) {
return;
}
if (itemNav) {
self[centeredNav ? 'toCenter' : 'toStart'](
within((centeredNav ? rel.centerItem : rel.firstItem) + o.scrollBy * delta, 0, items.length)
);
} else {
slideTo(pos.dest + delta, immediate);
}
};
/**
* Animate SLIDEE to a specific position.
*
* @param {Int} pos New position.
* @param {Bool} immediate Reposition immediately without an animation.
*
* @return {Void}
*/
self.slideTo = function (pos, immediate) {
slideTo(pos, immediate);
};
/**
* Core method for handling `toLocation` methods.
*
* @param {String} location
* @param {Mixed} item
* @param {Bool} immediate
*
* @return {Void}
*/
function to(location, item, immediate) {
// Optional arguments logic
if (type(item) === 'boolean') {
immediate = item;
item = undefined;
}
if (item === undefined) {
slideTo(pos[location], immediate);
} else {
// You can't align items to sides of the frame
// when centered navigation type is enabled
if (centeredNav && location !== 'center') {
return;
}
var itemPos = self.getPos(item);
if (itemPos) {
slideTo(itemPos[location], immediate, !centeredNav);
}
}
}
/**
* Animate element or the whole SLIDEE to the start of the frame.
*
* @param {Mixed} item Item DOM element, or index starting at 0. Omitting will animate SLIDEE.
* @param {Bool} immediate Reposition immediately without an animation.
*
* @return {Void}
*/
self.toStart = function (item, immediate) {
to('start', item, immediate);
};
/**
* Animate element or the whole SLIDEE to the end of the frame.
*
* @param {Mixed} item Item DOM element, or index starting at 0. Omitting will animate SLIDEE.
* @param {Bool} immediate Reposition immediately without an animation.
*
* @return {Void}
*/
self.toEnd = function (item, immediate) {
to('end', item, immediate);
};
/**
* Animate element or the whole SLIDEE to the center of the frame.
*
* @param {Mixed} item Item DOM element, or index starting at 0. Omitting will animate SLIDEE.
* @param {Bool} immediate Reposition immediately without an animation.
*
* @return {Void}
*/
self.toCenter = function (item, immediate) {
to('center', item, immediate);
};
/**
* Get the index of an item in SLIDEE.
*
* @param {Mixed} item Item DOM element.
*
* @return {Int} Item index, or -1 if not found.
*/
function getIndex(item) {
return item != null ?
isNumber(item) ?
item >= 0 && item < items.length ? item : -1 :
$items.index(item) :
-1;
}
// Expose getIndex without lowering the compressibility of it,
// as it is used quite often throughout Sly.
self.getIndex = getIndex;
/**
* Get index of an item in SLIDEE based on a variety of input types.
*
* @param {Mixed} item DOM element, positive or negative integer.
*
* @return {Int} Item index, or -1 if not found.
*/
function getRelativeIndex(item) {
return getIndex(isNumber(item) && item < 0 ? item + items.length : item);
}
/**
* Activates an item.
*
* @param {Mixed} item Item DOM element, or index starting at 0.
*
* @return {Mixed} Activated item index or false on fail.
*/
function activate(item, force) {
var index = getIndex(item);
if (!itemNav || index < 0) {
return false;
}
// Update classes, last active index, and trigger active event only when there
// has been a change. Otherwise just return the current active index.
if (last.active !== index || force) {
// Update classes
$items.eq(rel.activeItem).removeClass(o.activeClass);
$items.eq(index).addClass(o.activeClass);
last.active = rel.activeItem = index;
updateButtonsState();
trigger('active', index);
}
return index;
}
/**
* Activates an item and helps with further navigation when o.smart is enabled.
*
* @param {Mixed} item Item DOM element, or index starting at 0.
* @param {Bool} immediate Whether to reposition immediately in smart navigation.
*
* @return {Void}
*/
self.activate = function (item, immediate) {
var index = activate(item);
// Smart navigation
if (o.smart && index !== false) {
// When centeredNav is enabled, center the element.
// Otherwise, determine where to position the element based on its current position.
// If the element is currently on the far end side of the frame, assume that user is
// moving forward and animate it to the start of the visible frame, and vice versa.
if (centeredNav) {
self.toCenter(index, immediate);
} else if (index >= rel.lastItem) {
self.toStart(index, immediate);
} else if (index <= rel.firstItem) {
self.toEnd(index, immediate);
} else {
resetCycle();
}
}
};
/**
* Activates a page.
*
* @param {Int} index Page index, starting from 0.
* @param {Bool} immediate Whether to reposition immediately without animation.
*
* @return {Void}
*/
self.activatePage = function (index, immediate) {
if (isNumber(index)) {
slideTo(pages[within(index, 0, pages.length - 1)], immediate);
}
};
/**
* Return relative positions of items based on their visibility within FRAME.
*
* @param {Int} slideePos Position of SLIDEE.
*
* @return {Void}
*/
function getRelatives(slideePos) {
slideePos = within(isNumber(slideePos) ? slideePos : pos.dest, pos.start, pos.end);
var relatives = {};
var centerOffset = forceCenteredNav ? 0 : frameSize / 2;
// Determine active page
if (!parallax) {
for (var p = 0, pl = pages.length; p < pl; p++) {
if (slideePos >= pos.end || p === pages.length - 1) {
relatives.activePage = pages.length - 1;
break;
}
if (slideePos <= pages[p] + centerOffset) {
relatives.activePage = p;
break;
}
}
}
// Relative item indexes
if (itemNav) {
var first = false;
var last = false;
var center = false;
// From start
for (var i = 0, il = items.length; i < il; i++) {
// First item
if (first === false && slideePos <= items[i].start + items[i].half) {
first = i;
}
// Center item
if (center === false && slideePos <= items[i].center + items[i].half) {
center = i;
}
// Last item
if (i === il - 1 || slideePos <= items[i].end + items[i].half) {
last = i;
break;
}
}
// Safe assignment, just to be sure the false won't be returned
relatives.firstItem = isNumber(first) ? first : 0;
relatives.centerItem = isNumber(center) ? center : relatives.firstItem;
relatives.lastItem = isNumber(last) ? last : relatives.centerItem;
}
return relatives;
}
/**
* Update object with relative positions.
*
* @param {Int} newPos
*
* @return {Void}
*/
function updateRelatives(newPos) {
$.extend(rel, getRelatives(newPos));
}
/**
* Disable navigation buttons when needed.
*
* Adds disabledClass, and when the button is <button> or <input>, activates :disabled state.
*
* @return {Void}
*/
function updateButtonsState() {
var isStart = pos.dest <= pos.start;
var isEnd = pos.dest >= pos.end;
var slideePosState = (isStart ? 1 : 0) | (isEnd ? 2 : 0);
// Update paging buttons only if there has been a change in SLIDEE position
if (last.slideePosState !== slideePosState) {
last.slideePosState = slideePosState;
if ($prevPageButton.is('button,input')) {
$prevPageButton.prop('disabled', isStart);
}
if ($nextPageButton.is('button,input')) {
$nextPageButton.prop('disabled', isEnd);
}
$prevPageButton.add($backwardButton)[isStart ? 'addClass' : 'removeClass'](o.disabledClass);
$nextPageButton.add($forwardButton)[isEnd ? 'addClass' : 'removeClass'](o.disabledClass);
}
// Forward & Backward buttons need a separate state caching because we cannot "property disable"
// them while they are being used, as disabled buttons stop emitting mouse events.
if (last.fwdbwdState !== slideePosState && dragging.released) {
last.fwdbwdState = slideePosState;
if ($backwardButton.is('button,input')) {
$backwardButton.prop('disabled', isStart);
}
if ($forwardButton.is('button,input')) {
$forwardButton.prop('disabled', isEnd);
}
}
// Item navigation
if (itemNav && rel.activeItem != null) {
var isFirst = rel.activeItem === 0;
var isLast = rel.activeItem >= items.length - 1;
var itemsButtonState = (isFirst ? 1 : 0) | (isLast ? 2 : 0);
if (last.itemsButtonState !== itemsButtonState) {
last.itemsButtonState = itemsButtonState;
if ($prevButton.is('button,input')) {
$prevButton.prop('disabled', isFirst);
}
if ($nextButton.is('button,input')) {
$nextButton.prop('disabled', isLast);
}
$prevButton[isFirst ? 'addClass' : 'removeClass'](o.disabledClass);
$nextButton[isLast ? 'addClass' : 'removeClass'](o.disabledClass);
}
}
}
/**
* Resume cycling.
*
* @param {Int} priority Resume pause with priority lower or equal than this. Used internally for pauseOnHover.
*
* @return {Void}
*/
self.resume = function (priority) {
if (!o.cycleBy || !o.cycleInterval || o.cycleBy === 'items' && (!items[0] || rel.activeItem == null) || priority < self.isPaused) {
return;
}
self.isPaused = 0;
if (cycleID) {
cycleID = clearTimeout(cycleID);
} else {
trigger('resume');
}
cycleID = setTimeout(function () {
trigger('cycle');
switch (o.cycleBy) {
case 'items':
self.activate(rel.activeItem >= items.length - 1 ? 0 : rel.activeItem + 1);
break;
case 'pages':
self.activatePage(rel.activePage >= pages.length - 1 ? 0 : rel.activePage + 1);
break;
}
}, o.cycleInterval);
};
/**
* Pause cycling.
*
* @param {Int} priority Pause priority. 100 is default. Used internally for pauseOnHover.
*
* @return {Void}
*/
self.pause = function (priority) {
if (priority < self.isPaused) {
return;
}
self.isPaused = priority || 100;
if (cycleID) {
cycleID = clearTimeout(cycleID);
trigger('pause');
}
};
/**
* Toggle cycling.
*
* @return {Void}
*/
self.toggle = function () {
self[cycleID ? 'pause' : 'resume']();
};
/**
* Updates a signle or multiple option values.
*
* @param {Mixed} name Name of the option that should be updated, or object that will extend the options.
* @param {Mixed} value New option value.
*
* @return {Void}
*/
self.set = function (name, value) {
if ($.isPlainObject(name)) {
$.extend(o, name);
} else if (o.hasOwnProperty(name)) {
o[name] = value;
}
};
/**
* Add one or multiple items to the SLIDEE end, or a specified position index.
*
* @param {Mixed} element Node element, or HTML string.
* @param {Int} index Index of a new item position. By default item is appended at the end.
*
* @return {Void}
*/
self.add = function (element, index) {
var $element = $(element);
if (itemNav) {
// Insert the element(s)
if (index == null || !items[0] || index >= items.length) {
$element.appendTo($slidee);
} else if (items.length) {
$element.insertBefore(items[index].el);
}
// Adjust the activeItem index
if (rel.activeItem != null && index <= rel.activeItem) {
last.active = rel.activeItem += $element.length;
}
} else {
$slidee.append($element);
}
// Reload
load();
};
/**
* Remove an item from SLIDEE.
*
* @param {Mixed} element Item index, or DOM element.
* @param {Int} index Index of a new item position. By default item is appended at the end.
*
* @return {Void}
*/
self.remove = function (element) {
if (itemNav) {
var index = getRelativeIndex(element);
if (index > -1) {
// Remove the element
$items.eq(index).remove();
// If the current item is being removed, activate new one after reload
var reactivate = index === rel.activeItem;
// Adjust the activeItem index
if (rel.activeItem != null && index < rel.activeItem) {
last.active = --rel.activeItem;
}
// Reload
load();
// Activate new item at the removed position
if (reactivate) {
last.active = null;
self.activate(rel.activeItem);
}
}
} else {
$(element).remove();
load();
}
};
/**
* Helps re-arranging items.
*
* @param {Mixed} item Item DOM element, or index starting at 0. Use negative numbers to select items from the end.
* @param {Mixed} position Item insertion anchor. Accepts same input types as item argument.
* @param {Bool} after Insert after instead of before the anchor.
*
* @return {Void}
*/
function moveItem(item, position, after) {
item = getRelativeIndex(item);
position = getRelativeIndex(position);
// Move only if there is an actual change requested
if (item > -1 && position > -1 && item !== position && (!after || position !== item - 1) && (after || position !== item + 1)) {
$items.eq(item)[after ? 'insertAfter' : 'insertBefore'](items[position].el);
var shiftStart = item < position ? item : (after ? position : position - 1);
var shiftEnd = item > position ? item : (after ? position + 1 : position);
var shiftsUp = item > position;
// Update activeItem index
if (rel.activeItem != null) {
if (item === rel.activeItem) {
last.active = rel.activeItem = after ? (shiftsUp ? position + 1 : position) : (shiftsUp ? position : position - 1);
} else if (rel.activeItem > shiftStart && rel.activeItem < shiftEnd) {
last.active = rel.activeItem += shiftsUp ? 1 : -1;
}
}
// Reload
load();
}
}
/**
* Move item after the target anchor.
*
* @param {Mixed} item Item to be moved. Can be DOM element or item index.
* @param {Mixed} position Target position anchor. Can be DOM element or item index.
*
* @return {Void}
*/
self.moveAfter = function (item, position) {
moveItem(item, position, 1);
};
/**
* Move item before the target anchor.
*
* @param {Mixed} item Item to be moved. Can be DOM element or item index.
* @param {Mixed} position Target position anchor. Can be DOM element or item index.
*
* @return {Void}
*/
self.moveBefore = function (item, position) {
moveItem(item, position);
};
/**
* Registers callbacks.
*
* @param {Mixed} name Event name, or callbacks map.
* @param {Mixed} fn Callback, or an array of callback functions.
*
* @return {Void}
*/
self.on = function (name, fn) {
// Callbacks map
if (type(name) === 'object') {
for (var key in name) {
if (name.hasOwnProperty(key)) {
self.on(key, name[key]);
}
}
// Callback
} else if (type(fn) === 'function') {
var names = name.split(' ');
for (var n = 0, nl = names.length; n < nl; n++) {
callbacks[names[n]] = callbacks[names[n]] || [];
if (callbackIndex(names[n], fn) === -1) {
callbacks[names[n]].push(fn);
}
}
// Callbacks array
} else if (type(fn) === 'array') {
for (var f = 0, fl = fn.length; f < fl; f++) {
self.on(name, fn[f]);
}
}
};
/**
* Registers callbacks to be executed only once.
*
* @param {Mixed} name Event name, or callbacks map.
* @param {Mixed} fn Callback, or an array of callback functions.
*
* @return {Void}
*/
self.one = function (name, fn) {
function proxy() {
fn.apply(self, arguments);
self.off(name, proxy);
}
self.on(name, proxy);
};
/**
* Remove one or all callbacks.
*
* @param {String} name Event name.
* @param {Mixed} fn Callback, or an array of callback functions. Omit to remove all callbacks.
*
* @return {Void}
*/
self.off = function (name, fn) {
if (fn instanceof Array) {
for (var f = 0, fl = fn.length; f < fl; f++) {
self.off(name, fn[f]);
}
} else {
var names = name.split(' ');
for (var n = 0, nl = names.length; n < nl; n++) {
callbacks[names[n]] = callbacks[names[n]] || [];
if (fn == null) {
callbacks[names[n]].length = 0;
} else {
var index = callbackIndex(names[n], fn);
if (index !== -1) {
callbacks[names[n]].splice(index, 1);
}
}
}
}
};
/**
* Returns callback array index.
*
* @param {String} name Event name.
* @param {Function} fn Function
*
* @return {Int} Callback array index, or -1 if isn't registered.
*/
function callbackIndex(name, fn) {
for (var i = 0, l = callbacks[name].length; i < l; i++) {
if (callbacks[name][i] === fn) {
return i;
}
}
return -1;
}
/**
* Reset next cycle timeout.
*
* @return {Void}
*/
function resetCycle() {
if (dragging.released && !self.isPaused) {
self.resume();
}
}
/**
* Calculate SLIDEE representation of handle position.
*
* @param {Int} handlePos
*
* @return {Int}
*/
function handleToSlidee(handlePos) {
return round(within(handlePos, hPos.start, hPos.end) / hPos.end * (pos.end - pos.start)) + pos.start;
}
/**
* Keeps track of a dragging delta history.
*
* @return {Void}
*/
function draggingHistoryTick() {
// Looking at this, I know what you're thinking :) But as we need only 4 history states, doing it this way
// as opposed to a proper loop is ~25 bytes smaller (when minified with GCC), a lot faster, and doesn't
// generate garbage. The loop version would create 2 new variables on every tick. Unexaptable!
dragging.history[0] = dragging.history[1];
dragging.history[1] = dragging.history[2];
dragging.history[2] = dragging.history[3];
dragging.history[3] = dragging.delta;
}
/**
* Initialize continuous movement.
*
* @return {Void}
*/
function continuousInit(source) {
dragging.released = 0;
dragging.source = source;
dragging.slidee = source === 'slidee';
}
/**
* Dragging initiator.
*
* @param {Event} event
*
* @return {Void}
*/
function dragInit(event) {
var isTouch = event.type === 'touchstart';
var source = event.data.source;
var isSlidee = source === 'slidee';
// Ignore when already in progress, or interactive element in non-touch navivagion
if (dragging.init || !isTouch && isInteractive(event.target)) {
return;
}
// Handle dragging conditions
if (source === 'handle' && (!o.dragHandle || hPos.start === hPos.end)) {
return;
}
// SLIDEE dragging conditions
if (isSlidee && !(isTouch ? o.touchDragging : o.mouseDragging && event.which < 2)) {
return;
}
if (!isTouch) {
// prevents native image dragging in Firefox
stopDefault(event);
}
// Reset dragging object
continuousInit(source);
// Properties used in dragHandler
dragging.init = 0;
dragging.$source = $(event.target);
dragging.touch = isTouch;
dragging.pointer = isTouch ? event.originalEvent.touches[0] : event;
dragging.initX = dragging.pointer.pageX;
dragging.initY = dragging.pointer.pageY;
dragging.initPos = isSlidee ? pos.cur : hPos.cur;
dragging.start = +new Date();
dragging.time = 0;
dragging.path = 0;
dragging.delta = 0;
dragging.locked = 0;
dragging.history = [0, 0, 0, 0];
dragging.pathToLock = isSlidee ? isTouch ? 30 : 10 : 0;
// Bind dragging events
$doc.on(isTouch ? dragTouchEvents : dragMouseEvents, dragHandler);
// Pause ongoing cycle
self.pause(1);
// Add dragging class
(isSlidee ? $slidee : $handle).addClass(o.draggedClass);
// Trigger moveStart event
trigger('moveStart');
// Keep track of a dragging path history. This is later used in the
// dragging release swing calculation when dragging SLIDEE.
if (isSlidee) {
historyID = setInterval(draggingHistoryTick, 10);
}
}
/**
* Handler for dragging scrollbar handle or SLIDEE.
*
* @param {Event} event
*
* @return {Void}
*/
function dragHandler(event) {
dragging.released = event.type === 'mouseup' || event.type === 'touchend';
dragging.pointer = dragging.touch ? event.originalEvent[dragging.released ? 'changedTouches' : 'touches'][0] : event;
dragging.pathX = dragging.pointer.pageX - dragging.initX;
dragging.pathY = dragging.pointer.pageY - dragging.initY;
dragging.path = sqrt(pow(dragging.pathX, 2) + pow(dragging.pathY, 2));
dragging.delta = o.horizontal ? dragging.pathX : dragging.pathY;
if (!dragging.released && dragging.path < 1) return;
if (!dragging.init) {
if (o.horizontal ? abs(dragging.pathX) > abs(dragging.pathY) : abs(dragging.pathX) < abs(dragging.pathY)) {
dragging.init = 1;
} else {
return dragEnd();
}
}
stopDefault(event);
// Disable click on a source element, as it is unwelcome when dragging
if (!dragging.locked && dragging.path > dragging.pathToLock && dragging.slidee) {
dragging.locked = 1;
dragging.$source.on(clickEvent, disableOneEvent);
}
// Cancel dragging on release
if (dragging.released) {
dragEnd();
// Adjust path with a swing on mouse release
if (o.releaseSwing && dragging.slidee) {
dragging.swing = (dragging.delta - dragging.history[0]) / 40 * 300;
dragging.delta += dragging.swing;
dragging.tweese = abs(dragging.swing) > 10;
}
}
slideTo(dragging.slidee ? round(dragging.initPos - dragging.delta) : handleToSlidee(dragging.initPos + dragging.delta));
}
/**
* Stops dragging and cleans up after it.
*
* @return {Void}
*/
function dragEnd() {
clearInterval(historyID);
dragging.released = true;
$doc.off(dragging.touch ? dragTouchEvents : dragMouseEvents, dragHandler);
(dragging.slidee ? $slidee : $handle).removeClass(o.draggedClass);
// Make sure that disableOneEvent is not active in next tick.
setTimeout(function () {
dragging.$source.off(clickEvent, disableOneEvent);
});
// Normally, this is triggered in render(), but if there
// is nothing to render, we have to do it manually here.
if (pos.cur === pos.dest && dragging.init) {
trigger('moveEnd');
}
// Resume ongoing cycle
self.resume(1);
dragging.init = 0;
}
/**
* Check whether element is interactive.
*
* @return {Boolean}
*/
function isInteractive(element) {
return ~$.inArray(element.nodeName, interactiveElements) || $(element).is(o.interactive);
}
/**
* Continuous movement cleanup on mouseup.
*
* @return {Void}
*/
function movementReleaseHandler() {
self.stop();
$doc.off('mouseup', movementReleaseHandler);
}
/**
* Buttons navigation handler.
*
* @param {Event} event
*
* @return {Void}
*/
function buttonsHandler(event) {
/*jshint validthis:true */
stopDefault(event);
switch (this) {
case $forwardButton[0]:
case $backwardButton[0]:
self.moveBy($forwardButton.is(this) ? o.moveBy : -o.moveBy);
$doc.on('mouseup', movementReleaseHandler);
break;
case $prevButton[0]:
self.prev();
break;
case $nextButton[0]:
self.next();
break;
case $prevPageButton[0]:
self.prevPage();
break;
case $nextPageButton[0]:
self.nextPage();
break;
}
}
/**
* Mouse wheel delta normalization.
*
* @param {Event} event
*
* @return {Int}
*/
function normalizeWheelDelta(event) {
// wheelDelta needed only for IE8-
scrolling.curDelta = ((o.horizontal ? event.deltaY || event.deltaX : event.deltaY) || -event.wheelDelta);
scrolling.curDelta /= event.deltaMode === 1 ? 3 : 100;
if (!itemNav) {
return scrolling.curDelta;
}
time = +new Date();
if (scrolling.last < time - scrolling.resetTime) {
scrolling.delta = 0;
}
scrolling.last = time;
scrolling.delta += scrolling.curDelta;
if (abs(scrolling.delta) < 1) {
scrolling.finalDelta = 0;
} else {
scrolling.finalDelta = round(scrolling.delta / 1);
scrolling.delta %= 1;
}
return scrolling.finalDelta;
}
/**
* Mouse scrolling handler.
*
* @param {Event} event
*
* @return {Void}
*/
function scrollHandler(event) {
// Don't hijack global scrolling
var time = +new Date();
if (lastGlobalWheel + 300 > time) {
lastGlobalWheel = time;
return;
}
// Ignore if there is no scrolling to be done
if (!o.scrollBy || pos.start === pos.end) {
return;
}
var delta = normalizeWheelDelta(event.originalEvent);
// Trap scrolling only when necessary and/or requested
if (o.scrollTrap || delta > 0 && pos.dest < pos.end || delta < 0 && pos.dest > pos.start) {
stopDefault(event, 1);
}
self.slideBy(o.scrollBy * delta);
}
/**
* Scrollbar click handler.
*
* @param {Event} event
*
* @return {Void}
*/
function scrollbarHandler(event) {
// Only clicks on scroll bar. Ignore the handle.
if (o.clickBar && event.target === $sb[0]) {
stopDefault(event);
// Calculate new handle position and sync SLIDEE to it
slideTo(handleToSlidee((o.horizontal ? event.pageX - $sb.offset().left : event.pageY - $sb.offset().top) - handleSize / 2));
}
}
/**
* Keyboard input handler.
*
* @param {Event} event
*
* @return {Void}
*/
function keyboardHandler(event) {
if (!o.keyboardNavBy) {
return;
}
switch (event.which) {
// Left or Up
case o.horizontal ? 37 : 38:
stopDefault(event);
self[o.keyboardNavBy === 'pages' ? 'prevPage' : 'prev']();
break;
// Right or Down
case o.horizontal ? 39 : 40:
stopDefault(event);
self[o.keyboardNavBy === 'pages' ? 'nextPage' : 'next']();
break;
}
}
/**
* Click on item activation handler.
*
* @param {Event} event
*
* @return {Void}
*/
function activateHandler(event) {
/*jshint validthis:true */
// Ignore clicks on interactive elements.
if (isInteractive(this)) {
event.stopPropagation();
return;
}
// Accept only events from direct SLIDEE children.
if (this.parentNode === $slidee[0]) {
self.activate(this);
}
}
/**
* Click on page button handler.
*
* @param {Event} event
*
* @return {Void}
*/
function activatePageHandler() {
/*jshint validthis:true */
// Accept only events from direct pages bar children.
if (this.parentNode === $pb[0]) {
self.activatePage($pages.index(this));
}
}
/**
* Pause on hover handler.
*
* @param {Event} event
*
* @return {Void}
*/
function pauseOnHoverHandler(event) {
if (o.pauseOnHover) {
self[event.type === 'mouseenter' ? 'pause' : 'resume'](2);
}
}
/**
* Trigger callbacks for event.
*
* @param {String} name Event name.
* @param {Mixed} argX Arguments passed to callbacks.
*
* @return {Void}
*/
function trigger(name, arg1) {
if (callbacks[name]) {
l = callbacks[name].length;
// Callbacks will be stored and executed from a temporary array to not
// break the execution queue when one of the callbacks unbinds itself.
tmpArray.length = 0;
for (i = 0; i < l; i++) {
tmpArray.push(callbacks[name][i]);
}
// Execute the callbacks
for (i = 0; i < l; i++) {
tmpArray[i].call(self, name, arg1);
}
}
}
/**
* Destroys instance and everything it created.
*
* @return {Void}
*/
self.destroy = function () {
// Unbind all events
$scrollSource
.add($handle)
.add($sb)
.add($pb)
.add($forwardButton)
.add($backwardButton)
.add($prevButton)
.add($nextButton)
.add($prevPageButton)
.add($nextPageButton)
.off('.' + namespace);
// Unbinding specifically as to not nuke out other instances
$doc.off('keydown', keyboardHandler);
// Remove classes
$prevButton
.add($nextButton)
.add($prevPageButton)
.add($nextPageButton)
.removeClass(o.disabledClass);
if ($items && rel.activeItem != null) {
$items.eq(rel.activeItem).removeClass(o.activeClass);
}
// Remove page items
$pb.empty();
if (!parallax) {
// Unbind events from frame
$frame.off('.' + namespace);
// Restore original styles
frameStyles.restore();
slideeStyles.restore();
sbStyles.restore();
handleStyles.restore();
// Remove the instance from element data storage
$.removeData(frame, namespace);
}
// Clean up collections
items.length = pages.length = 0;
last = {};
// Reset initialized status and return the instance
self.initialized = 0;
return self;
};
/**
* Initialize.
*
* @return {Object}
*/
self.init = function () {
if (self.initialized) {
return;
}
// Register callbacks map
self.on(callbackMap);
// Save styles
var holderProps = ['overflow', 'position'];
var movableProps = ['position', 'webkitTransform', 'msTransform', 'transform', 'left', 'top', 'width', 'height'];
frameStyles.save.apply(frameStyles, holderProps);
sbStyles.save.apply(sbStyles, holderProps);
slideeStyles.save.apply(slideeStyles, movableProps);
handleStyles.save.apply(handleStyles, movableProps);
// Set required styles
var $movables = $handle;
if (!parallax) {
$movables = $movables.add($slidee);
$frame.css('overflow', 'hidden');
if (!transform && $frame.css('position') === 'static') {
$frame.css('position', 'relative');
}
}
if (transform) {
if (gpuAcceleration) {
$movables.css(transform, gpuAcceleration);
}
} else {
if ($sb.css('position') === 'static') {
$sb.css('position', 'relative');
}
$movables.css({ position: 'absolute' });
}
// Navigation buttons
if (o.forward) {
$forwardButton.on(mouseDownEvent, buttonsHandler);
}
if (o.backward) {
$backwardButton.on(mouseDownEvent, buttonsHandler);
}
if (o.prev) {
$prevButton.on(clickEvent, buttonsHandler);
}
if (o.next) {
$nextButton.on(clickEvent, buttonsHandler);
}
if (o.prevPage) {
$prevPageButton.on(clickEvent, buttonsHandler);
}
if (o.nextPage) {
$nextPageButton.on(clickEvent, buttonsHandler);
}
// Scrolling navigation
$scrollSource.on(wheelEvent, scrollHandler);
// Clicking on scrollbar navigation
if ($sb[0]) {
$sb.on(clickEvent, scrollbarHandler);
}
// Click on items navigation
if (itemNav && o.activateOn) {
$frame.on(o.activateOn + '.' + namespace, '*', activateHandler);
}
// Pages navigation
if ($pb[0] && o.activatePageOn) {
$pb.on(o.activatePageOn + '.' + namespace, '*', activatePageHandler);
}
// Dragging navigation
$dragSource.on(dragInitEvents, { source: 'slidee' }, dragInit);
// Scrollbar dragging navigation
if ($handle) {
$handle.on(dragInitEvents, { source: 'handle' }, dragInit);
}
// Keyboard navigation
$doc.on('keydown', keyboardHandler);
if (!parallax) {
// Pause on hover
$frame.on('mouseenter.' + namespace + ' mouseleave.' + namespace, pauseOnHoverHandler);
// Reset native FRAME element scroll
$frame.on('scroll.' + namespace, resetScroll);
}
// Mark instance as initialized
self.initialized = 1;
// Load
load(true);
// Initiate automatic cycling
if (o.cycleBy && !parallax) {
self[o.startPaused ? 'pause' : 'resume']();
}
// Return instance
return self;
};
}
/**
* Return type of the value.
*
* @param {Mixed} value
*
* @return {String}
*/
function type(value) {
if (value == null) {
return String(value);
}
if (typeof value === 'object' || typeof value === 'function') {
return Object.prototype.toString.call(value).match(/\s([a-z]+)/i)[1].toLowerCase() || 'object';
}
return typeof value;
}
/**
* Event preventDefault & stopPropagation helper.
*
* @param {Event} event Event object.
* @param {Bool} noBubbles Cancel event bubbling.
*
* @return {Void}
*/
function stopDefault(event, noBubbles) {
event.preventDefault();
if (noBubbles) {
event.stopPropagation();
}
}
/**
* Disables an event it was triggered on and unbinds itself.
*
* @param {Event} event
*
* @return {Void}
*/
function disableOneEvent(event) {
/*jshint validthis:true */
stopDefault(event, 1);
$(this).off(event.type, disableOneEvent);
}
/**
* Resets native element scroll values to 0.
*
* @return {Void}
*/
function resetScroll() {
/*jshint validthis:true */
this.scrollLeft = 0;
this.scrollTop = 0;
}
/**
* Check if variable is a number.
*
* @param {Mixed} value
*
* @return {Boolean}
*/
function isNumber(value) {
return !isNaN(parseFloat(value)) && isFinite(value);
}
/**
* Parse style to pixels.
*
* @param {Object} $item jQuery object with element.
* @param {Property} property CSS property to get the pixels from.
*
* @return {Int}
*/
function getPx($item, property) {
return 0 | round(String($item.css(property)).replace(/[^\-0-9.]/g, ''));
}
/**
* Make sure that number is within the limits.
*
* @param {Number} number
* @param {Number} min
* @param {Number} max
*
* @return {Number}
*/
function within(number, min, max) {
return number < min ? min : number > max ? max : number;
}
/**
* Saves element styles for later restoration.
*
* Example:
* var styles = new StyleRestorer(frame);
* styles.save('position');
* element.style.position = 'absolute';
* styles.restore(); // restores to state before the assignment above
*
* @param {Element} element
*/
function StyleRestorer(element) {
var self = {};
self.style = {};
self.save = function () {
if (!element) return;
for (var i = 0; i < arguments.length; i++) {
self.style[arguments[i]] = element.style[arguments[i]];
}
return self;
};
self.restore = function () {
if (!element) return;
for (var prop in self.style) {
if (self.style.hasOwnProperty(prop)) element.style[prop] = self.style[prop];
}
return self;
};
return self;
}
// Local WindowAnimationTiming interface polyfill
(function (w) {
rAF = w.requestAnimationFrame
|| w.webkitRequestAnimationFrame
|| fallback;
/**
* Fallback implementation.
*/
var prev = new Date().getTime();
function fallback(fn) {
var curr = new Date().getTime();
var ms = Math.max(0, 16 - (curr - prev));
var req = setTimeout(fn, ms);
prev = curr;
return req;
}
/**
* Cancel.
*/
var cancel = w.cancelAnimationFrame
|| w.webkitCancelAnimationFrame
|| w.clearTimeout;
cAF = function(id){
cancel.call(w, id);
};
}(window));
// Feature detects
(function () {
var prefixes = ['', 'webkit', 'moz', 'ms', 'o'];
var el = document.createElement('div');
function testProp(prop) {
for (var p = 0, pl = prefixes.length; p < pl; p++) {
var prefixedProp = prefixes[p] ? prefixes[p] + prop.charAt(0).toUpperCase() + prop.slice(1) : prop;
if (el.style[prefixedProp] != null) {
return prefixedProp;
}
}
}
// Global support indicators
transform = testProp('transform');
gpuAcceleration = testProp('perspective') ? 'translateZ(0) ' : '';
}());
// Expose class globally
w[className] = Sly;
// jQuery proxy
$.fn[pluginName] = function (options, callbackMap) {
var method, methodArgs;
// Attributes logic
if (!$.isPlainObject(options)) {
if (type(options) === 'string' || options === false) {
method = options === false ? 'destroy' : options;
methodArgs = Array.prototype.slice.call(arguments, 1);
}
options = {};
}
// Apply to all elements
return this.each(function (i, element) {
// Call with prevention against multiple instantiations
var plugin = $.data(element, namespace);
if (!plugin && !method) {
// Create a new object if it doesn't exist yet
plugin = $.data(element, namespace, new Sly(element, options, callbackMap).init());
} else if (plugin && method) {
// Call method
if (plugin[method]) {
plugin[method].apply(plugin, methodArgs);
}
}
});
};
// Default options
Sly.defaults = {
horizontal: false, // Switch to horizontal mode.
// Item based navigation
itemNav: null, // Item navigation type. Can be: 'basic', 'centered', 'forceCentered'.
itemSelector: null, // Select only items that match this selector.
smart: false, // Repositions the activated item to help with further navigation.
activateOn: null, // Activate an item on this event. Can be: 'click', 'mouseenter', ...
activateMiddle: false, // Always activate the item in the middle of the FRAME. forceCentered only.
// Scrolling
scrollSource: null, // Element for catching the mouse wheel scrolling. Default is FRAME.
scrollBy: 0, // Pixels or items to move per one mouse scroll. 0 to disable scrolling.
scrollHijack: 300, // Milliseconds since last wheel event after which it is acceptable to hijack global scroll.
scrollTrap: false, // Don't bubble scrolling when hitting scrolling limits.
// Dragging
dragSource: null, // Selector or DOM element for catching dragging events. Default is FRAME.
mouseDragging: false, // Enable navigation by dragging the SLIDEE with mouse cursor.
touchDragging: false, // Enable navigation by dragging the SLIDEE with touch events.
releaseSwing: false, // Ease out on dragging swing release.
swingSpeed: 0.2, // Swing synchronization speed, where: 1 = instant, 0 = infinite.
elasticBounds: false, // Stretch SLIDEE position limits when dragging past FRAME boundaries.
interactive: null, // Selector for special interactive elements.
// Scrollbar
scrollBar: null, // Selector or DOM element for scrollbar container.
dragHandle: false, // Whether the scrollbar handle should be draggable.
dynamicHandle: false, // Scrollbar handle represents the ratio between hidden and visible content.
minHandleSize: 50, // Minimal height or width (depends on sly direction) of a handle in pixels.
clickBar: false, // Enable navigation by clicking on scrollbar.
syncSpeed: 0.5, // Handle => SLIDEE synchronization speed, where: 1 = instant, 0 = infinite.
// Pagesbar
pagesBar: null, // Selector or DOM element for pages bar container.
activatePageOn: null, // Event used to activate page. Can be: click, mouseenter, ...
pageBuilder: // Page item generator.
function (index) {
return '<li>' + (index + 1) + '</li>';
},
// Navigation buttons
forward: null, // Selector or DOM element for "forward movement" button.
backward: null, // Selector or DOM element for "backward movement" button.
prev: null, // Selector or DOM element for "previous item" button.
next: null, // Selector or DOM element for "next item" button.
prevPage: null, // Selector or DOM element for "previous page" button.
nextPage: null, // Selector or DOM element for "next page" button.
// Automated cycling
cycleBy: null, // Enable automatic cycling by 'items' or 'pages'.
cycleInterval: 5000, // Delay between cycles in milliseconds.
pauseOnHover: false, // Pause cycling when mouse hovers over the FRAME.
startPaused: false, // Whether to start in paused sate.
// Mixed options
moveBy: 300, // Speed in pixels per second used by forward and backward buttons.
speed: 0, // Animations speed in milliseconds. 0 to disable animations.
easing: 'swing', // Easing for duration based (tweening) animations.
startAt: null, // Starting offset in pixels or items.
keyboardNavBy: null, // Enable keyboard navigation by 'items' or 'pages'.
// Classes
draggedClass: 'dragged', // Class for dragged elements (like SLIDEE or scrollbar handle).
activeClass: 'active', // Class for active items and pages.
disabledClass: 'disabled' // Class for disabled navigation elements.
};
}(jQuery, window));
|
node_modules/material-ui/svg-icons/av/library-music.js
|
firdiansyah/crud-req
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _pure = require('recompose/pure');
var _pure2 = _interopRequireDefault(_pure);
var _SvgIcon = require('../../SvgIcon');
var _SvgIcon2 = _interopRequireDefault(_SvgIcon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var AvLibraryMusic = function AvLibraryMusic(props) {
return _react2.default.createElement(
_SvgIcon2.default,
props,
_react2.default.createElement('path', { d: 'M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 5h-3v5.5c0 1.38-1.12 2.5-2.5 2.5S10 13.88 10 12.5s1.12-2.5 2.5-2.5c.57 0 1.08.19 1.5.51V5h4v2zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6z' })
);
};
AvLibraryMusic = (0, _pure2.default)(AvLibraryMusic);
AvLibraryMusic.displayName = 'AvLibraryMusic';
AvLibraryMusic.muiName = 'SvgIcon';
exports.default = AvLibraryMusic;
|
src/components/Display/Display.js
|
wavicles/fossasia-pslab-apps
|
import React from 'react';
import { ValueWrapper } from './Display.styles';
const Display = ({ fontSize, value, unit }) => (
<ValueWrapper fontSize={fontSize}>
{value} {unit}
</ValueWrapper>
);
export default Display;
|
docs/src/app/components/pages/components/SvgIcon/ExampleSimple.js
|
ichiohta/material-ui
|
import React from 'react';
import {blue500, red500, greenA200} from 'material-ui/styles/colors';
import SvgIcon from 'material-ui/SvgIcon';
const iconStyles = {
marginRight: 24,
};
const HomeIcon = (props) => (
<SvgIcon {...props}>
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" />
</SvgIcon>
);
const SvgIconExampleSimple = () => (
<div>
<HomeIcon style={iconStyles} />
<HomeIcon style={iconStyles} color={blue500} />
<HomeIcon style={iconStyles} color={red500} hoverColor={greenA200} />
</div>
);
export default SvgIconExampleSimple;
|
demo-buzz-feed/lib/react-dom.min.js
|
catavolt-oss/catreact-examples
|
/**
* ReactDOM v0.14.5
*
* 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.
*
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e(require("react"));else if("function"==typeof define&&define.amd)define(["react"],e);else{var f;f="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,f.ReactDOM=e(f.React)}}(function(e){return e.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED});
|
public/js/app/components/pages/NewEvent.js
|
joaoahmad/minha-lista
|
import React from 'react';
import ReactMixin from 'react-mixin';
import { Route, RouteHandler, Link, History, Lifecycle } from 'react-router';
import EventActions from '../../actions/EventActions';
import Form from '../Form';
import PageWithNavbar from '../PageWithNavbar';
import Container from '../Container';
import Section from '../Section';
import Input from '../Input';
import Textarea from '../Input';
class NewEvent extends React.Component {
constructor() {
super();
this.handleChange = this.handleChange.bind(this);
this.state = { event: {} };
}
render() {
return (
<PageWithNavbar>
<Container>
<Section>
<div className="section-title">
<span className="title">Novo evento</span>
<Link to="/events" className="u-pull-right" >Voltar</Link>
</div>
<form role="form">
<fieldset>
<Input name="name" type="text" label="Nome do evento" value={this.state.form.name} onChange={this.handleChange} errorMsg="Nome incorreto" />
<Input name="location" type="text" label="Local" value={this.state.form.email} onChange={this.handleChange} errorMsg="Email incorreto" />
</fieldset>
<button type="button" onClick={this.handleSave.bind(this)}>Save</button>
</form>
</Section>
</Container>
</PageWithNavbar>
);
}
handleChange(event){
var state = this.state;
state.form[event.target.name] = event.target.value;
this.setState(state);
}
handleSave(){
EventActions.create(this.state.form);
this.props.history.pushState(null, '/')
}
}
module.exports = NewEvent;
|
src/widgets/input-filter-with-criteria/components/input-filter-with-criteria.spec.js
|
InseeFr/Pogues
|
import React from 'react';
import { shallow } from 'enzyme';
import InputFilterWithCriteria from './input-filter-with-criteria';
import { WIDGET_INPUT_FILTER_WITH_CRITERIA } from 'constants/dom-constants';
import { fakeEvent, noop } from 'utils/test/test-utils';
const {
SEARCH_INPUT_CLASS,
BUTTON_SEARCH_CLASS,
} = WIDGET_INPUT_FILTER_WITH_CRITERIA;
describe('<InputFilterWithCriteria />', () => {
let props;
beforeEach(() => {
props = {
label: 'This is a fake label',
typeItem: 'FAKE_TYPE_ITEM',
loadSearchResult: noop,
criteriaValues: {},
loadOnInit: true,
};
});
test('Should render the search input', () => {
const wrapper = shallow(<InputFilterWithCriteria {...props} />);
expect(wrapper.find(`input.${SEARCH_INPUT_CLASS}`)).toHaveLength(1);
});
test('Should render the search action button', () => {
const wrapper = shallow(<InputFilterWithCriteria {...props} />);
expect(wrapper.find(`button.${BUTTON_SEARCH_CLASS}`)).toHaveLength(1);
});
test('Should call "search" at the beggining only if the prop "loadOnInit" is true', () => {
const spySearchFirst = jest.fn();
const spySearchSecond = jest.fn();
props.loadSearchResult = spySearchFirst;
shallow(<InputFilterWithCriteria {...props} />);
expect(spySearchFirst).not.toHaveBeenCalled();
props = { ...props, loadOnInit: false, loadSearchResult: spySearchSecond };
shallow(<InputFilterWithCriteria {...props} />);
expect(spySearchSecond).not.toHaveBeenCalled();
});
test.skip('Should call "search" with the text existing in the "input" action when the "button" is clicked', () => {
// @TODO: Find a way to test refs
const spySearch = jest.fn();
const text = 'This is a fake test';
props.loadSearchResult = spySearch;
const wrapper = shallow(<InputFilterWithCriteria {...props} />);
wrapper
.find(`input.${SEARCH_INPUT_CLASS}`)
.get(0)
.ref(<input value={text} />);
wrapper.find(`button.${BUTTON_SEARCH_CLASS}`).simulate('click', fakeEvent);
expect(spySearch).toHaveBeenCalledWith(
props.typeItem,
props.criteriaValues,
text,
);
});
});
|
frontend/src/routes/Detail.js
|
OwenRay/Remote-MediaServer
|
/* eslint-disable no-underscore-dangle */
/**
* Created by owenray on 6/30/2017.
*/
import React, { Component } from 'react';
import { Button, Icon, Tabs, Tab, Modal } from 'react-materialize';
import ReactTooltip from 'react-tooltip';
import BodyClassName from 'react-body-classname';
import { apiActions, deserialize } from 'redux-jsonapi';
import { Flipped } from 'react-flip-toolkit';
import TopBar from '../components/TopBar';
import store from '../helpers/stores/store';
import ReadableDuration from '../components/ReadableDuration';
import MediaItemRow from '../components/mediaItem/MediaItemRow';
import MediaInfo from '../components/mediaItem/MediaInfo';
import DownloadButton from '../components/localStorage/DownloadButton';
import LocalStorageProgressForItem from '../components/localStorage/LocalStorageProgressForItem';
import { connect } from 'react-redux';
import { playQueueActions } from '../helpers/stores/playQueue';
class Detail extends Component {
constructor(props) {
super(props);
this.state = { item: null, id: props.match.params.id };
this.toggleWatched = this.toggleWatched.bind(this);
this.play = this.play.bind(this);
this.loadMeta = this.loadMeta.bind(this);
}
componentWillMount() {
this.componentWillReceiveProps(this.props);
}
async componentWillReceiveProps(nextProps) {
if (this.id === nextProps.match.params.id) {
return;
}
this.id = nextProps.match.params.id;
let item;
if (store.getState().api.mediaItem) { item = store.getState().api.mediaItem[this.id]; }
if (!item) {
item = await store.dispatch(apiActions.read({
id: nextProps.match.params.id,
_type: 'media-items',
}));
item = item.resources[0];
}
const i = deserialize(item, store);
this.itemModel = i;
this.setState(
{
item: i,
watched: i.playPosition && (await i.playPosition()).watched,
},
() => {
if (this.animationComplete) this.loadMeta();
},
);
// onAppear is not always triggered, so call loadmeta on timeout as well
setTimeout(this.loadMeta, 1000);
}
backDrop() {
return { backgroundImage: `url(/img/${this.props.match.params.id}_backdrop.jpg)` };
}
poster() {
return { backgroundImage: `url(/img/${this.props.match.params.id}_poster.jpg)` };
}
posterLarge() {
return { backgroundImage: `url(/img/${this.props.match.params.id}_posterlarge.jpg)` };
}
seasonTabs() {
const s = this.state;
if (!s.item) return null;
let title = 'Movie info';
let tabs;
if (s.item.type !== 'tv') {
tabs = (
<Tab title="Versions">
<div className="scrollable">
<h1>{s.item.title}</h1>
<div className="collection">
{s.episodes[0].map(item => (
<MediaItemRow key={item.id} ref={item.id} mediaItem={item} />
))}
</div>
</div>
</Tab>
);
} else {
title = 'Episode info';
tabs = s.seasons.map(season => (
<Tab key={season} title={!season || season === '0' ? 'Extras' : `Season ${season}`}>
<div className="scrollable">
<h1>{s.item.title}</h1>
<div className="collection">
{s.episodes[season].map(episode => (
<MediaItemRow key={episode.id} ref={episode.id} mediaItem={episode} />
))}
</div>
</div>
</Tab>));
}
return (
<div id="tabs">
<Tabs defaultValue="0">
<Tab key={-1} active title={title}>
{this.mediaInfo()}
</Tab>
{tabs}
</Tabs>
</div>
);
}
mediaInfo() {
const s = this.state;
if (!s.item) return null;
return (
<div className="scrollable">
<h1>{s.item.title}</h1>
<div className="description">
{s.item.type === 'tv' ?
<h3>Episode {s.item.episode} - {s.item.episodeTitle}</h3> :
''
}
<div className="header">
<div className="stars">
<img src="/assets/img/stars.png" alt="stars" />
<div className="full" style={{ width: `${s.item.rating}%` }}>
<img src="/assets/img/stars-full.png" alt="full_stars" />
</div>
</div>
<Icon>fiber_manual_record</Icon>
<ReadableDuration>{this.state.item.fileduration}</ReadableDuration>
<Icon>fiber_manual_record</Icon>
{s.item.year}
</div>
<p>{s.item.overview}</p>
</div>
</div>
);
}
async toggleWatched() {
let pos = {};
if (this.itemModel.playPosition) {
pos = await this.itemModel.playPosition();
}
pos._type = 'play-positions';
pos.position = this.state.watched ? 0 : this.state.item.fileduration;
if (!pos.position) pos.position = 0;
pos.watched = !this.state.watched;
this.setState({ watched: !this.state.watched });
const posResult = await store.dispatch(apiActions.write(pos));
if (!pos.id) {
this.itemModel._type = 'media-items';
this.itemModel.playPosition = () => {
const p = deserialize(posResult.resources[0], store);
p._type = 'play-positions';
return p;
};
store.dispatch(apiActions.write(this.itemModel));
}
}
play() {
this.props.insertAtCurrentOffset(this.itemModel);
}
async loadMeta(ell) {
if (ell) ell.style.opacity = 1;
// make sure metadata only gets loaded after the animation has completed
// and the item has been loaded
this.animationComplete = true;
const i = this.state.item;
if (!i || this.gotMeta || !i.externalId) return;
this.gotMeta = true;
const readAction = apiActions.read(
{ _type: 'media-items' },
{
params:
{
'external-id': i.externalId,
sort: 'season,episode',
join: 'play-position',
extra: 'false',
},
},
);
let episodes = await store.dispatch(readAction);
episodes = episodes.resources.map(o => deserialize(o, store));
episodes = episodes.filter(o => o._type === 'media-item');
const seasons = [];
episodes.forEach((e) => {
const s = e.season || 0;
if (!seasons[s]) {
seasons[s] = [];
}
seasons[s].push(e);
});
this.setState({
showTabs: episodes.length > 1,
episodes: seasons,
seasons: Object.keys(seasons),
});
}
render() {
const s = this.state;
const id = this.props.match.params.id;
return (
<div>
<Flipped flipId={`media-item${id}`} onAppear={this.loadMeta} onComplete={this.loadMeta}>
<div className="movie-detail-backdrop-wrapper">
<div style={this.backDrop()} className="movie-detail-backdrop" />
<div style={this.posterLarge()} className="movie-detail-backdrop poster" />
</div>
</Flipped>
<div>
<BodyClassName className="hideNav" />
<TopBar showBackButton>
{s.item && s.item.externalId ? (
<a
rel="noopener noreferrer"
href={`/api/redirectToIMDB/${id}`}
target="_blank"
>
<img alt="IMDB" src="/assets/img/imdb.svg" />
</a>) :
''
}
<DownloadButton item={this.state.item || { id }} />
{s.watched ?
<Button onClick={this.toggleWatched} data-tip="Mark unwatched" className="marked"><Icon>done</Icon></Button> :
<Button onClick={this.toggleWatched} data-tip="Mark watched"><Icon>done</Icon></Button>
}
<Modal
header={s.item ? s.item.title : ''}
fixedFooter
trigger={<Button onClick={this.toggleDetails} data-tip="Info" icon="info_outline" />}
>
<MediaInfo item={this.state.item} />
</Modal>
<ReactTooltip place="bottom" effect="solid" />
<LocalStorageProgressForItem item={s.item} />
</TopBar>
<div>
<main>
<Flipped flipId="page">
<div className="container detail">
<div className="blurred">
<div className="movie-detail-backdrop-wrapper">
<div style={this.backDrop()} className="movie-detail-backdrop" />
<div style={this.posterLarge()} className="movie-detail-backdrop poster" />
</div>
</div>
{s.showTabs ? this.seasonTabs() : this.mediaInfo()}
<div className="poster" style={this.poster()} />
<Button large floating id="play" icon="play_arrow" onClick={this.play} />
</div>
</Flipped>
</main>
</div>
</div>
</div>
);
}
}
export default connect(null, playQueueActions)(Detail);
|
ajax/libs/video.js/5.11.2/video.js
|
sreym/cdnjs
|
/**
* @license
* Video.js 5.11.2 <http://videojs.com/>
* Copyright Brightcove, Inc. <https://www.brightcove.com/>
* Available under Apache License Version 2.0
* <https://github.com/videojs/video.js/blob/master/LICENSE>
*
* Includes vtt.js <https://github.com/mozilla/vtt.js>
* Available under Apache License Version 2.0
* <https://github.com/mozilla/vtt.js/blob/master/LICENSE>
*/
(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){
var getNative = _dereq_('../internal/getNative');
/* Native method references for those with the same name as other `lodash` methods. */
var nativeNow = getNative(Date, 'now');
/**
* Gets the number of milliseconds that have elapsed since the Unix epoch
* (1 January 1970 00:00:00 UTC).
*
* @static
* @memberOf _
* @category Date
* @example
*
* _.defer(function(stamp) {
* console.log(_.now() - stamp);
* }, _.now());
* // => logs the number of milliseconds it took for the deferred function to be invoked
*/
var now = nativeNow || function() {
return new Date().getTime();
};
module.exports = now;
},{"../internal/getNative":20}],5:[function(_dereq_,module,exports){
var isObject = _dereq_('../lang/isObject'),
now = _dereq_('../date/now');
/** 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 debounced function that delays invoking `func` until after `wait`
* milliseconds have elapsed since the last time the debounced function was
* invoked. The debounced function comes with a `cancel` method to cancel
* delayed invocations. Provide an options object to indicate that `func`
* should be invoked on the leading and/or trailing edge of the `wait` timeout.
* Subsequent calls to the debounced function return the result of the last
* `func` invocation.
*
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
* on the trailing edge of the timeout only if the the debounced function is
* invoked more than once during the `wait` timeout.
*
* See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
* for details over the differences between `_.debounce` and `_.throttle`.
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to debounce.
* @param {number} [wait=0] The number of milliseconds to delay.
* @param {Object} [options] The options object.
* @param {boolean} [options.leading=false] Specify invoking on the leading
* edge of the timeout.
* @param {number} [options.maxWait] The maximum time `func` is allowed to be
* delayed before it's invoked.
* @param {boolean} [options.trailing=true] Specify invoking on the trailing
* edge of the timeout.
* @returns {Function} Returns the new debounced function.
* @example
*
* // avoid costly calculations while the window size is in flux
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
*
* // invoke `sendMail` when the click event is fired, debouncing subsequent calls
* jQuery('#postbox').on('click', _.debounce(sendMail, 300, {
* 'leading': true,
* 'trailing': false
* }));
*
* // ensure `batchLog` is invoked once after 1 second of debounced calls
* var source = new EventSource('/stream');
* jQuery(source).on('message', _.debounce(batchLog, 250, {
* 'maxWait': 1000
* }));
*
* // cancel a debounced call
* var todoChanges = _.debounce(batchLog, 1000);
* Object.observe(models.todo, todoChanges);
*
* Object.observe(models, function(changes) {
* if (_.find(changes, { 'user': 'todo', 'type': 'delete'})) {
* todoChanges.cancel();
* }
* }, ['delete']);
*
* // ...at some point `models.todo` is changed
* models.todo.completed = true;
*
* // ...before 1 second has passed `models.todo` is deleted
* // which cancels the debounced `todoChanges` call
* delete models.todo;
*/
function debounce(func, wait, options) {
var args,
maxTimeoutId,
result,
stamp,
thisArg,
timeoutId,
trailingCall,
lastCalled = 0,
maxWait = false,
trailing = true;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
wait = wait < 0 ? 0 : (+wait || 0);
if (options === true) {
var leading = true;
trailing = false;
} else if (isObject(options)) {
leading = !!options.leading;
maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait);
trailing = 'trailing' in options ? !!options.trailing : trailing;
}
function cancel() {
if (timeoutId) {
clearTimeout(timeoutId);
}
if (maxTimeoutId) {
clearTimeout(maxTimeoutId);
}
lastCalled = 0;
maxTimeoutId = timeoutId = trailingCall = undefined;
}
function complete(isCalled, id) {
if (id) {
clearTimeout(id);
}
maxTimeoutId = timeoutId = trailingCall = undefined;
if (isCalled) {
lastCalled = now();
result = func.apply(thisArg, args);
if (!timeoutId && !maxTimeoutId) {
args = thisArg = undefined;
}
}
}
function delayed() {
var remaining = wait - (now() - stamp);
if (remaining <= 0 || remaining > wait) {
complete(trailingCall, maxTimeoutId);
} else {
timeoutId = setTimeout(delayed, remaining);
}
}
function maxDelayed() {
complete(trailing, timeoutId);
}
function debounced() {
args = arguments;
stamp = now();
thisArg = this;
trailingCall = trailing && (timeoutId || !leading);
if (maxWait === false) {
var leadingCall = leading && !timeoutId;
} else {
if (!maxTimeoutId && !leading) {
lastCalled = stamp;
}
var remaining = maxWait - (stamp - lastCalled),
isCalled = remaining <= 0 || remaining > maxWait;
if (isCalled) {
if (maxTimeoutId) {
maxTimeoutId = clearTimeout(maxTimeoutId);
}
lastCalled = stamp;
result = func.apply(thisArg, args);
}
else if (!maxTimeoutId) {
maxTimeoutId = setTimeout(maxDelayed, remaining);
}
}
if (isCalled && timeoutId) {
timeoutId = clearTimeout(timeoutId);
}
else if (!timeoutId && wait !== maxWait) {
timeoutId = setTimeout(delayed, wait);
}
if (leadingCall) {
isCalled = true;
result = func.apply(thisArg, args);
}
if (isCalled && !timeoutId && !maxTimeoutId) {
args = thisArg = undefined;
}
return result;
}
debounced.cancel = cancel;
return debounced;
}
module.exports = debounce;
},{"../date/now":4,"../lang/isObject":33}],6:[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;
},{}],7:[function(_dereq_,module,exports){
var debounce = _dereq_('./debounce'),
isObject = _dereq_('../lang/isObject');
/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
/**
* Creates a throttled function that only invokes `func` at most once per
* every `wait` milliseconds. The throttled function comes with a `cancel`
* method to cancel delayed invocations. Provide an options object to indicate
* that `func` should be invoked on the leading and/or trailing edge of the
* `wait` timeout. Subsequent calls to the throttled function return the
* result of the last `func` call.
*
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
* on the trailing edge of the timeout only if the the throttled function is
* invoked more than once during the `wait` timeout.
*
* See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
* for details over the differences between `_.throttle` and `_.debounce`.
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to throttle.
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
* @param {Object} [options] The options object.
* @param {boolean} [options.leading=true] Specify invoking on the leading
* edge of the timeout.
* @param {boolean} [options.trailing=true] Specify invoking on the trailing
* edge of the timeout.
* @returns {Function} Returns the new throttled function.
* @example
*
* // avoid excessively updating the position while scrolling
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
*
* // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes
* jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {
* 'trailing': false
* }));
*
* // cancel a trailing throttled call
* jQuery(window).on('popstate', throttled.cancel);
*/
function throttle(func, wait, options) {
var leading = true,
trailing = true;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
if (options === false) {
leading = false;
} else if (isObject(options)) {
leading = 'leading' in options ? !!options.leading : leading;
trailing = 'trailing' in options ? !!options.trailing : trailing;
}
return debounce(func, wait, { 'leading': leading, 'maxWait': +wait, 'trailing': trailing });
}
module.exports = throttle;
},{"../lang/isObject":33,"./debounce":5}],8:[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;
},{}],9:[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;
},{}],10:[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;
},{}],11:[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":18}],12:[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":39,"./baseFor":11}],13:[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":30,"../lang/isObject":33,"../lang/isTypedArray":36,"../object/keys":38,"./arrayEach":9,"./baseMergeDeep":14,"./isArrayLike":21,"./isObjectLike":26}],14:[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":29,"../lang/isArray":30,"../lang/isPlainObject":34,"../lang/isTypedArray":36,"../lang/toPlainObject":37,"./arrayCopy":8,"./isArrayLike":21}],15:[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":28}],16:[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":42}],17:[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":6,"./bindCallback":16,"./isIterateeCall":24}],18:[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":28}],19:[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":15}],20:[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":32}],21:[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":19,"./isLength":25}],22:[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;
},{}],23:[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;
},{}],24:[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":33,"./isArrayLike":21,"./isIndex":23}],25:[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;
},{}],26:[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;
},{}],27:[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":29,"../lang/isArray":30,"../lang/isString":35,"../object/keysIn":39,"./isIndex":23,"./isLength":25}],28:[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":33,"../lang/isString":35,"../support":41}],29:[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":21,"../internal/isObjectLike":26}],30:[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":20,"../internal/isLength":25,"../internal/isObjectLike":26}],31:[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":33}],32:[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":22,"../internal/isObjectLike":26,"./isFunction":31}],33:[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;
},{}],34:[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":12,"../internal/isHostObject":22,"../internal/isObjectLike":26,"../support":41,"./isArguments":29}],35:[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":26}],36:[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":25,"../internal/isObjectLike":26}],37:[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":10,"../object/keysIn":39}],38:[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":20,"../internal/isArrayLike":21,"../internal/shimKeys":27,"../lang/isObject":33,"../support":41}],39:[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":9,"../internal/isIndex":23,"../internal/isLength":25,"../lang/isArguments":29,"../lang/isArray":30,"../lang/isFunction":31,"../lang/isObject":33,"../lang/isString":35,"../support":41}],40:[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":13,"../internal/createAssigner":17}],41:[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;
},{}],42:[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;
},{}],43:[function(_dereq_,module,exports){
'use strict';
var keys = _dereq_('object-keys');
module.exports = function hasSymbols() {
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
if (typeof Symbol.iterator === 'symbol') { return true; }
var obj = {};
var sym = Symbol('test');
if (typeof sym === 'string') { return false; }
// temp disabled per https://github.com/ljharb/object.assign/issues/17
// if (sym instanceof Symbol) { return false; }
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
// if (!(Object(sym) instanceof Symbol)) { return false; }
var symVal = 42;
obj[sym] = symVal;
for (sym in obj) { return false; }
if (keys(obj).length !== 0) { return false; }
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
var syms = Object.getOwnPropertySymbols(obj);
if (syms.length !== 1 || syms[0] !== sym) { return false; }
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
if (typeof Object.getOwnPropertyDescriptor === 'function') {
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
}
return true;
};
},{"object-keys":50}],44:[function(_dereq_,module,exports){
'use strict';
// modified from https://github.com/es-shims/es6-shim
var keys = _dereq_('object-keys');
var bind = _dereq_('function-bind');
var canBeObject = function (obj) {
return typeof obj !== 'undefined' && obj !== null;
};
var hasSymbols = _dereq_('./hasSymbols')();
var toObject = Object;
var push = bind.call(Function.call, Array.prototype.push);
var propIsEnumerable = bind.call(Function.call, Object.prototype.propertyIsEnumerable);
module.exports = 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, value, key;
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) {
key = syms[i];
if (propIsEnumerable(source, key)) {
push(props, key);
}
}
}
for (i = 0; i < props.length; ++i) {
key = props[i];
value = source[key];
if (propIsEnumerable(source, key)) {
objTarget[key] = value;
}
}
}
return objTarget;
};
},{"./hasSymbols":43,"function-bind":49,"object-keys":50}],45:[function(_dereq_,module,exports){
'use strict';
var defineProperties = _dereq_('define-properties');
var implementation = _dereq_('./implementation');
var getPolyfill = _dereq_('./polyfill');
var shim = _dereq_('./shim');
defineProperties(implementation, {
implementation: implementation,
getPolyfill: getPolyfill,
shim: shim
});
module.exports = implementation;
},{"./implementation":44,"./polyfill":52,"./shim":53,"define-properties":46}],46:[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', { enumerable: false, value: obj });
/* eslint-disable no-unused-vars, no-restricted-syntax */
for (var _ in obj) { return false; }
/* eslint-enable no-unused-vars, no-restricted-syntax */
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,
value: value,
writable: true
});
} 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":47,"object-keys":50}],47:[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);
}
}
}
};
},{}],48:[function(_dereq_,module,exports){
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
var slice = Array.prototype.slice;
var toStr = Object.prototype.toString;
var funcType = '[object Function]';
module.exports = function bind(that) {
var target = this;
if (typeof target !== 'function' || toStr.call(target) !== funcType) {
throw new TypeError(ERROR_MESSAGE + target);
}
var args = slice.call(arguments, 1);
var bound;
var binder = function () {
if (this instanceof bound) {
var result = target.apply(
this,
args.concat(slice.call(arguments))
);
if (Object(result) === result) {
return result;
}
return this;
} else {
return target.apply(
that,
args.concat(slice.call(arguments))
);
}
};
var boundLength = Math.max(0, target.length - args.length);
var boundArgs = [];
for (var i = 0; i < boundLength; i++) {
boundArgs.push('$' + i);
}
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
if (target.prototype) {
var Empty = function Empty() {};
Empty.prototype = target.prototype;
bound.prototype = new Empty();
Empty.prototype = null;
}
return bound;
};
},{}],49:[function(_dereq_,module,exports){
var implementation = _dereq_('./implementation');
module.exports = Function.prototype.bind || implementation;
},{"./implementation":48}],50:[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 isEnumerable = Object.prototype.propertyIsEnumerable;
var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
var dontEnums = [
'toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'constructor'
];
var equalsConstructorPrototype = function (o) {
var ctor = o.constructor;
return ctor && ctor.prototype === o;
};
var excludedKeys = {
$console: true,
$external: true,
$frame: true,
$frameElement: true,
$frames: true,
$innerHeight: true,
$innerWidth: true,
$outerHeight: true,
$outerWidth: true,
$pageXOffset: true,
$pageYOffset: true,
$parent: true,
$scrollLeft: true,
$scrollTop: true,
$scrollX: true,
$scrollY: true,
$self: true,
$webkitIndexedDB: true,
$webkitStorageInfo: true,
$window: true
};
var hasAutomationEqualityBug = (function () {
/* global window */
if (typeof window === 'undefined') { return false; }
for (var k in window) {
try {
if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
try {
equalsConstructorPrototype(window[k]);
} catch (e) {
return true;
}
}
} 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) {
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);
}
};
}
} else {
Object.keys = keysShim;
}
return Object.keys || keysShim;
};
module.exports = keysShim;
},{"./isArguments":51}],51:[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;
};
},{}],52:[function(_dereq_,module,exports){
'use strict';
var implementation = _dereq_('./implementation');
var lacksProperEnumerationOrder = function () {
if (!Object.assign) {
return false;
}
// v8, specifically in node 4.x, has a bug with incorrect property enumeration order
// note: this does not detect the bug unless there's 20 characters
var str = 'abcdefghijklmnopqrst';
var letters = str.split('');
var map = {};
for (var i = 0; i < letters.length; ++i) {
map[letters[i]] = letters[i];
}
var obj = Object.assign({}, map);
var actual = '';
for (var k in obj) {
actual += k;
}
return str !== actual;
};
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';
}
};
module.exports = function getPolyfill() {
if (!Object.assign) {
return implementation;
}
if (lacksProperEnumerationOrder()) {
return implementation;
}
if (assignHasPendingExceptions()) {
return implementation;
}
return Object.assign;
};
},{"./implementation":44}],53:[function(_dereq_,module,exports){
'use strict';
var define = _dereq_('define-properties');
var getPolyfill = _dereq_('./polyfill');
module.exports = function shimAssign() {
var polyfill = getPolyfill();
define(
Object,
{ assign: polyfill },
{ assign: function () { return Object.assign !== polyfill; } }
);
return polyfill;
};
},{"./polyfill":52,"define-properties":46}],54:[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]
}
},{}],55:[function(_dereq_,module,exports){
function clean (s) {
return s.replace(/\n\r?\s*/g, '')
}
module.exports = function tsml (sa) {
var s = ''
, i = 0
for (; i < arguments.length; i++)
s += clean(sa[i]) + (arguments[i + 1] || '')
return s
}
},{}],56:[function(_dereq_,module,exports){
"use strict";
var window = _dereq_("global/window")
var once = _dereq_("once")
var isFunction = _dereq_("is-function")
var parseHeaders = _dereq_("parse-headers")
var xtend = _dereq_("xtend")
module.exports = createXHR
createXHR.XMLHttpRequest = window.XMLHttpRequest || noop
createXHR.XDomainRequest = "withCredentials" in (new createXHR.XMLHttpRequest()) ? createXHR.XMLHttpRequest : window.XDomainRequest
forEachArray(["get", "put", "post", "patch", "head", "delete"], function(method) {
createXHR[method === "delete" ? "del" : method] = function(uri, options, callback) {
options = initParams(uri, options, callback)
options.method = method.toUpperCase()
return _createXHR(options)
}
})
function forEachArray(array, iterator) {
for (var i = 0; i < array.length; i++) {
iterator(array[i])
}
}
function isEmpty(obj){
for(var i in obj){
if(obj.hasOwnProperty(i)) return false
}
return true
}
function initParams(uri, options, callback) {
var params = uri
if (isFunction(options)) {
callback = options
if (typeof uri === "string") {
params = {uri:uri}
}
} else {
params = xtend(options, {uri: uri})
}
params.callback = callback
return params
}
function createXHR(uri, options, callback) {
options = initParams(uri, options, callback)
return _createXHR(options)
}
function _createXHR(options) {
var callback = options.callback
if(typeof callback === "undefined"){
throw new Error("callback argument missing")
}
callback = once(callback)
function readystatechange() {
if (xhr.readyState === 4) {
loadFunc()
}
}
function getBody() {
// Chrome with requestType=blob throws errors arround when even testing access to responseText
var body = undefined
if (xhr.response) {
body = xhr.response
} else if (xhr.responseType === "text" || !xhr.responseType) {
body = xhr.responseText || xhr.responseXML
}
if (isJson) {
try {
body = JSON.parse(body)
} catch (e) {}
}
return body
}
var failureResponse = {
body: undefined,
headers: {},
statusCode: 0,
method: method,
url: uri,
rawRequest: xhr
}
function errorFunc(evt) {
clearTimeout(timeoutTimer)
if(!(evt instanceof Error)){
evt = new Error("" + (evt || "Unknown XMLHttpRequest Error") )
}
evt.statusCode = 0
callback(evt, failureResponse)
}
// will load the data & process the response in a special response object
function loadFunc() {
if (aborted) return
var status
clearTimeout(timeoutTimer)
if(options.useXDR && xhr.status===undefined) {
//IE8 CORS GET successful response doesn't have a status field, but body is fine
status = 200
} else {
status = (xhr.status === 1223 ? 204 : xhr.status)
}
var response = failureResponse
var err = null
if (status !== 0){
response = {
body: getBody(),
statusCode: status,
method: method,
headers: {},
url: uri,
rawRequest: xhr
}
if(xhr.getAllResponseHeaders){ //remember xhr can in fact be XDR for CORS in IE
response.headers = parseHeaders(xhr.getAllResponseHeaders())
}
} else {
err = new Error("Internal XMLHttpRequest Error")
}
callback(err, response, response.body)
}
var xhr = options.xhr || null
if (!xhr) {
if (options.cors || options.useXDR) {
xhr = new createXHR.XDomainRequest()
}else{
xhr = new createXHR.XMLHttpRequest()
}
}
var key
var aborted
var uri = xhr.url = options.uri || options.url
var method = xhr.method = options.method || "GET"
var body = options.body || options.data || null
var headers = xhr.headers = options.headers || {}
var sync = !!options.sync
var isJson = false
var timeoutTimer
if ("json" in options) {
isJson = true
headers["accept"] || headers["Accept"] || (headers["Accept"] = "application/json") //Don't override existing accept header declared by user
if (method !== "GET" && method !== "HEAD") {
headers["content-type"] || headers["Content-Type"] || (headers["Content-Type"] = "application/json") //Don't override existing accept header declared by user
body = JSON.stringify(options.json)
}
}
xhr.onreadystatechange = readystatechange
xhr.onload = loadFunc
xhr.onerror = errorFunc
// IE9 must have onprogress be set to a unique function.
xhr.onprogress = function () {
// IE must die
}
xhr.ontimeout = errorFunc
xhr.open(method, uri, !sync, options.username, options.password)
//has to be after open
if(!sync) {
xhr.withCredentials = !!options.withCredentials
}
// Cannot set timeout with sync request
// not setting timeout on the xhr object, because of old webkits etc. not handling that correctly
// both npm's request and jquery 1.x use this kind of timeout, so this is being consistent
if (!sync && options.timeout > 0 ) {
timeoutTimer = setTimeout(function(){
aborted=true//IE9 may still call readystatechange
xhr.abort("timeout")
var e = new Error("XMLHttpRequest timeout")
e.code = "ETIMEDOUT"
errorFunc(e)
}, options.timeout )
}
if (xhr.setRequestHeader) {
for(key in headers){
if(headers.hasOwnProperty(key)){
xhr.setRequestHeader(key, headers[key])
}
}
} else if (options.headers && !isEmpty(options.headers)) {
throw new Error("Headers cannot be set on an XDomainRequest object")
}
if ("responseType" in options) {
xhr.responseType = options.responseType
}
if ("beforeSend" in options &&
typeof options.beforeSend === "function"
) {
options.beforeSend(xhr)
}
xhr.send(body)
return xhr
}
function noop() {}
},{"global/window":2,"is-function":57,"once":58,"parse-headers":61,"xtend":62}],57:[function(_dereq_,module,exports){
module.exports = isFunction
var toString = Object.prototype.toString
function isFunction (fn) {
var string = toString.call(fn)
return string === '[object Function]' ||
(typeof fn === 'function' && string !== '[object RegExp]') ||
(typeof window !== 'undefined' &&
// IE8 and below
(fn === window.setTimeout ||
fn === window.alert ||
fn === window.confirm ||
fn === window.prompt))
};
},{}],58:[function(_dereq_,module,exports){
module.exports = once
once.proto = once(function () {
Object.defineProperty(Function.prototype, 'once', {
value: function () {
return once(this)
},
configurable: true
})
})
function once (fn) {
var called = false
return function () {
if (called) return
called = true
return fn.apply(this, arguments)
}
}
},{}],59:[function(_dereq_,module,exports){
var isFunction = _dereq_('is-function')
module.exports = forEach
var toString = Object.prototype.toString
var hasOwnProperty = Object.prototype.hasOwnProperty
function forEach(list, iterator, context) {
if (!isFunction(iterator)) {
throw new TypeError('iterator must be a function')
}
if (arguments.length < 3) {
context = this
}
if (toString.call(list) === '[object Array]')
forEachArray(list, iterator, context)
else if (typeof list === 'string')
forEachString(list, iterator, context)
else
forEachObject(list, iterator, context)
}
function forEachArray(array, iterator, context) {
for (var i = 0, len = array.length; i < len; i++) {
if (hasOwnProperty.call(array, i)) {
iterator.call(context, array[i], i, array)
}
}
}
function forEachString(string, iterator, context) {
for (var i = 0, len = string.length; i < len; i++) {
// no such thing as a sparse string.
iterator.call(context, string.charAt(i), i, string)
}
}
function forEachObject(object, iterator, context) {
for (var k in object) {
if (hasOwnProperty.call(object, k)) {
iterator.call(context, object[k], k, object)
}
}
}
},{"is-function":57}],60:[function(_dereq_,module,exports){
exports = module.exports = trim;
function trim(str){
return str.replace(/^\s*|\s*$/g, '');
}
exports.left = function(str){
return str.replace(/^\s*/, '');
};
exports.right = function(str){
return str.replace(/\s*$/, '');
};
},{}],61:[function(_dereq_,module,exports){
var trim = _dereq_('trim')
, forEach = _dereq_('for-each')
, isArray = function(arg) {
return Object.prototype.toString.call(arg) === '[object Array]';
}
module.exports = function (headers) {
if (!headers)
return {}
var result = {}
forEach(
trim(headers).split('\n')
, function (row) {
var index = row.indexOf(':')
, key = trim(row.slice(0, index)).toLowerCase()
, value = trim(row.slice(index + 1))
if (typeof(result[key]) === 'undefined') {
result[key] = value
} else if (isArray(result[key])) {
result[key].push(value)
} else {
result[key] = [ result[key], value ]
}
}
)
return result
}
},{"for-each":59,"trim":60}],62:[function(_dereq_,module,exports){
module.exports = extend
var hasOwnProperty = Object.prototype.hasOwnProperty;
function extend() {
var target = {}
for (var i = 0; i < arguments.length; i++) {
var source = arguments[i]
for (var key in source) {
if (hasOwnProperty.call(source, key)) {
target[key] = source[key]
}
}
}
return target
}
},{}],63:[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":64,"./component.js":67}],64:[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 _clickableComponentJs = _dereq_('./clickable-component.js');
var _clickableComponentJs2 = _interopRequireDefault(_clickableComponentJs);
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 _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 ClickableComponent
* @class Button
*/
var Button = (function (_ClickableComponent) {
_inherits(Button, _ClickableComponent);
function Button(player, options) {
_classCallCheck(this, Button);
_ClickableComponent.call(this, player, options);
}
/**
* Create the component's DOM element
*
* @param {String=} type Element's node type. e.g. 'div'
* @param {Object=} props An object of properties that should be set on the element
* @param {Object=} attributes An object of attributes that should be set on the element
* @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];
var attributes = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
props = _objectAssign2['default']({
className: this.buildCSSClass()
}, props);
if (tag !== 'button') {
_utilsLogJs2['default'].warn('Creating a Button with an HTML element of ' + tag + ' is deprecated; use ClickableComponent instead.');
// Add properties for clickable element which is not a native HTML button
props = _objectAssign2['default']({
tabIndex: 0
}, props);
// Add ARIA attributes for clickable element which is not a native HTML button
attributes = _objectAssign2['default']({
role: 'button'
}, attributes);
}
// Add attributes for button element
attributes = _objectAssign2['default']({
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
}, attributes);
var el = _component2['default'].prototype.createEl.call(this, tag, props, attributes);
this.createControlTextEl(el);
return el;
};
/**
* Adds a child component inside this button
*
* @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)
* @deprecated
* @method addChild
*/
Button.prototype.addChild = function addChild(child) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var className = this.constructor.name;
_utilsLogJs2['default'].warn('Adding an actionable (user controllable) child to a Button (' + className + ') is not supported; use a ClickableComponent instead.');
// Avoid the error message generated by ClickableComponent's addChild method
return _component2['default'].prototype.addChild.call(this, child, options);
};
/**
* Handle KeyPress (document level) - Extend with specific functionality for button
*
* @method handleKeyPress
*/
Button.prototype.handleKeyPress = function handleKeyPress(event) {
// Ignore Space (32) or Enter (13) key operation, which is handled by the browser for a button.
if (event.which === 32 || event.which === 13) {} else {
_ClickableComponent.prototype.handleKeyPress.call(this, event); // Pass keypress handling up for unsupported keys
}
};
return Button;
})(_clickableComponentJs2['default']);
_component2['default'].registerComponent('Button', Button);
exports['default'] = Button;
module.exports = exports['default'];
},{"./clickable-component.js":65,"./component":67,"./utils/events.js":143,"./utils/fn.js":144,"./utils/log.js":147,"global/document":1,"object.assign":45}],65:[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 _utilsLogJs = _dereq_('./utils/log.js');
var _utilsLogJs2 = _interopRequireDefault(_utilsLogJs);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
var _objectAssign = _dereq_('object.assign');
var _objectAssign2 = _interopRequireDefault(_objectAssign);
/**
* Clickable Component which is clickable or keyboard actionable, but is not a native HTML button
*
* @param {Object} player Main Player
* @param {Object=} options Object of option names and values
* @extends Component
* @class ClickableComponent
*/
var ClickableComponent = (function (_Component) {
_inherits(ClickableComponent, _Component);
function ClickableComponent(player, options) {
_classCallCheck(this, ClickableComponent);
_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 properties that should be set on the element
* @param {Object=} attributes An object of attributes that should be set on the element
* @return {Element}
* @method createEl
*/
ClickableComponent.prototype.createEl = function createEl() {
var tag = arguments.length <= 0 || arguments[0] === undefined ? 'div' : arguments[0];
var props = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var attributes = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
props = _objectAssign2['default']({
className: this.buildCSSClass(),
tabIndex: 0
}, props);
if (tag === 'button') {
_utilsLogJs2['default'].error('Creating a ClickableComponent with an HTML element of ' + tag + ' is not supported; use a Button instead.');
}
// Add ARIA attributes for clickable element which is not a native HTML button
attributes = _objectAssign2['default']({
role: 'button',
'aria-live': 'polite' // let the screen reader user know that the text of the element may change
}, attributes);
var el = _Component.prototype.createEl.call(this, tag, props, attributes);
this.createControlTextEl(el);
return el;
};
/**
* create control text
*
* @param {Element} el Parent element for the control text
* @return {Element}
* @method controlText
*/
ClickableComponent.prototype.createControlTextEl = function createControlTextEl(el) {
this.controlTextEl_ = Dom.createEl('span', {
className: 'vjs-control-text'
});
if (el) {
el.appendChild(this.controlTextEl_);
}
this.controlText(this.controlText_, el);
return this.controlTextEl_;
};
/**
* Controls text - both request and localize
*
* @param {String} text Text for element
* @param {Element=} el Element to set the title on
* @return {String}
* @method controlText
*/
ClickableComponent.prototype.controlText = function controlText(text) {
var el = arguments.length <= 1 || arguments[1] === undefined ? this.el() : arguments[1];
if (!text) return this.controlText_ || 'Need Text';
var localizedText = this.localize(text);
this.controlText_ = text;
this.controlTextEl_.innerHTML = localizedText;
el.setAttribute('title', localizedText);
return this;
};
/**
* Allows sub components to stack CSS class names
*
* @return {String}
* @method buildCSSClass
*/
ClickableComponent.prototype.buildCSSClass = function buildCSSClass() {
return 'vjs-control vjs-button ' + _Component.prototype.buildCSSClass.call(this);
};
/**
* Adds a child component inside this clickable-component
*
* @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
*/
ClickableComponent.prototype.addChild = function addChild(child) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
// TODO: Fix adding an actionable child to a ClickableComponent; currently
// it will cause issues with assistive technology (e.g. screen readers)
// which support ARIA, since an element with role="button" cannot have
// actionable child elements.
//let className = this.constructor.name;
//log.warn(`Adding a child to a ClickableComponent (${className}) can cause issues with assistive technology which supports ARIA, since an element with role="button" cannot have actionable child elements.`);
return _Component.prototype.addChild.call(this, child, options);
};
/**
* Enable the component element
*
* @return {Component}
* @method enable
*/
ClickableComponent.prototype.enable = function enable() {
this.removeClass('vjs-disabled');
this.el_.setAttribute('aria-disabled', 'false');
return this;
};
/**
* Disable the component element
*
* @return {Component}
* @method disable
*/
ClickableComponent.prototype.disable = function disable() {
this.addClass('vjs-disabled');
this.el_.setAttribute('aria-disabled', 'true');
return this;
};
/**
* Handle Click - Override with specific functionality for component
*
* @method handleClick
*/
ClickableComponent.prototype.handleClick = function handleClick() {};
/**
* Handle Focus - Add keyboard functionality to element
*
* @method handleFocus
*/
ClickableComponent.prototype.handleFocus = function handleFocus() {
Events.on(_globalDocument2['default'], 'keydown', Fn.bind(this, this.handleKeyPress));
};
/**
* Handle KeyPress (document level) - Trigger click when Space or Enter key is pressed
*
* @method handleKeyPress
*/
ClickableComponent.prototype.handleKeyPress = function handleKeyPress(event) {
// Support Space (32) or Enter (13) key operation to fire a click event
if (event.which === 32 || event.which === 13) {
event.preventDefault();
this.handleClick(event);
} else if (_Component.prototype.handleKeyPress) {
_Component.prototype.handleKeyPress.call(this, event); // Pass keypress handling up for unsupported keys
}
};
/**
* Handle Blur - Remove keyboard triggers
*
* @method handleBlur
*/
ClickableComponent.prototype.handleBlur = function handleBlur() {
Events.off(_globalDocument2['default'], 'keydown', Fn.bind(this, this.handleKeyPress));
};
return ClickableComponent;
})(_component2['default']);
_component2['default'].registerComponent('ClickableComponent', ClickableComponent);
exports['default'] = ClickableComponent;
module.exports = exports['default'];
},{"./component":67,"./utils/dom.js":142,"./utils/events.js":143,"./utils/fn.js":144,"./utils/log.js":147,"global/document":1,"object.assign":45}],66:[function(_dereq_,module,exports){
'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 _button = _dereq_('./button');
var _button2 = _interopRequireDefault(_button);
var _component = _dereq_('./component');
var _component2 = _interopRequireDefault(_component);
/**
* The `CloseButton` component is a button which fires a "close" event
* when it is activated.
*
* @extends Button
* @class CloseButton
*/
var CloseButton = (function (_Button) {
_inherits(CloseButton, _Button);
function CloseButton(player, options) {
_classCallCheck(this, CloseButton);
_Button.call(this, player, options);
this.controlText(options && options.controlText || this.localize('Close'));
}
CloseButton.prototype.buildCSSClass = function buildCSSClass() {
return 'vjs-close-button ' + _Button.prototype.buildCSSClass.call(this);
};
CloseButton.prototype.handleClick = function handleClick() {
this.trigger({ type: 'close', bubbles: false });
};
return CloseButton;
})(_button2['default']);
_component2['default'].registerComponent('CloseButton', CloseButton);
exports['default'] = CloseButton;
module.exports = exports['default'];
},{"./button":64,"./component":67}],67:[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.
*
* ```js
* Parent.prototype.options_ = {
* optionSet: {
* 'childOne': { 'foo': 'bar', 'asdf': 'fdsa' },
* 'childTwo': {},
* 'childThree': {}
* }
* }
* newOptions = {
* optionSet: {
* 'childOne': { 'foo': 'baz', 'abc': '123' }
* 'childTwo': null,
* 'childFour': {}
* }
* }
*
* this.options(newOptions);
* ```
* RESULT
* ```js
* {
* optionSet: {
* '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=} properties An object of properties that should be set
* @param {Object=} attributes An object of attributes that should be set
* @return {Element}
* @method createEl
*/
Component.prototype.createEl = function createEl(tagName, properties, attributes) {
return Dom.createEl(tagName, properties, 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 === myComponent.children()[0];
* ```
* Pass in options for child constructors and options for children of the child
* ```js
* var myButton = myComponent.addChild('MyButton', {
* text: 'Press Me',
* 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.
* @param {Number} index into our children array to attempt to add 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 index = arguments.length <= 2 || arguments[2] === undefined ? this.children_.length : arguments[2];
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);
if (!ComponentClass) {
throw new Error('Component ' + componentClassName + ' does not exist');
}
// data stored directly on the videojs object may be
// misidentified as a component to retain
// backwards-compatibility with 4.x. check to make sure the
// component class can be instantiated.
if (typeof ComponentClass !== 'function') {
return null;
}
component = new ComponentClass(this.player_ || this, options);
// child is a component instance
} else {
component = child;
}
this.children_.splice(index, 0, 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()) {
var childNodes = this.contentEl().children;
var refNode = childNodes[index] || null;
this.contentEl().insertBefore(component.el(), refNode);
}
// 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'
* ],
* myChildComponent: {
* myChildOption: true
* }
* };
*
* // Or when creating the component
* var myComp = new MyComponent(player, {
* children: [
* 'myChildComponent'
* ],
* myChildComponent: {
* myChildOption: true
* }
* });
* ```
* The children option can also be an array of
* child options objects (that also include a 'name' key).
* This can be used if you have two child components of the
* same type that need different options.
* ```js
* var myComp = new MyComponent(player, {
* children: [
* 'button',
* {
* name: 'button',
* someOtherOption: true
* },
* {
* name: 'button',
* someOtherOption: false
* }
* ]
* });
* ```
*
* @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(child) {
var name = child.name;
var opts = child.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
var newChild = _this.addChild(name, opts);
if (newChild) {
_this[name] = newChild;
}
};
// Allow for an array of children details to passed in the options
var workingChildren = undefined;
var Tech = Component.getComponent('Tech');
if (Array.isArray(children)) {
workingChildren = children;
} else {
workingChildren = Object.keys(children);
}
workingChildren
// children that are in this.options_ but also in workingChildren would
// give us extra children we do not want. So, we want to filter them out.
.concat(Object.keys(_this.options_).filter(function (child) {
return !workingChildren.some(function (wchild) {
if (typeof wchild === 'string') {
return child === wchild;
} else {
return child === wchild.name;
}
});
})).map(function (child) {
var name = undefined,
opts = undefined;
if (typeof child === 'string') {
name = child;
opts = children[name] || _this.options_[name] || {};
} else {
name = child.name;
opts = child;
}
return { name: name, opts: opts };
}).filter(function (child) {
// we have to make sure that child.name isn't in the techOrder since
// techs are registerd as Components but can't aren't compatible
// See https://github.com/videojs/video.js/issues/2772
var c = Component.getComponent(child.opts.componentClass || _utilsToTitleCaseJs2['default'](child.name));
return c && !Tech.isTech(c);
}).forEach(handleAdd);
})();
}
};
/**
* 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_;
// Reset Ready Queue
this.readyQueue_ = [];
if (readyQueue && readyQueue.length > 0) {
readyQueue.forEach(function (fn) {
fn.call(this);
}, this);
}
// Allow for using event listeners also
this.trigger('ready');
}, 1);
};
/**
* Finds a single DOM element matching `selector` within the component's
* `contentEl` or another custom context.
*
* @method $
* @param {String} selector
* A valid CSS selector, which will be passed to `querySelector`.
*
* @param {Element|String} [context=document]
* A DOM element within which to query. Can also be a selector
* string in which case the first matching element will be used
* as context. If missing (or no element matches selector), falls
* back to `document`.
*
* @return {Element|null}
*/
Component.prototype.$ = function $(selector, context) {
return Dom.$(selector, context || this.contentEl());
};
/**
* Finds a all DOM elements matching `selector` within the component's
* `contentEl` or another custom context.
*
* @method $$
* @param {String} selector
* A valid CSS selector, which will be passed to `querySelectorAll`.
*
* @param {Element|String} [context=document]
* A DOM element within which to query. Can also be a selector
* string in which case the first matching element will be used
* as context. If missing (or no element matches selector), falls
* back to `document`.
*
* @return {NodeList}
*/
Component.prototype.$$ = function $$(selector, context) {
return Dom.$$(selector, context || this.contentEl());
};
/**
* 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 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;
};
/**
* Add or remove a CSS class name from the component's element
*
* @param {String} classToToggle
* @param {Boolean|Function} [predicate]
* Can be a function that returns a Boolean. If `true`, the class
* will be added; if `false`, the class will be removed. If not
* given, the class will be added if not present and vice versa.
*
* @return {Component}
* @method toggleClass
*/
Component.prototype.toggleClass = function toggleClass(classToToggle, predicate) {
Dom.toggleElClass(this.el_, classToToggle, predicate);
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);
};
/**
* Get width or height of computed style
* @param {String} widthOrHeight 'width' or 'height'
* @return {Number|Boolean} The bolean false if nothing was set
* @method currentDimension
*/
Component.prototype.currentDimension = function currentDimension(widthOrHeight) {
var computedWidthOrHeight = 0;
if (widthOrHeight !== 'width' && widthOrHeight !== 'height') {
throw new Error('currentDimension only accepts width or height value');
}
if (typeof _globalWindow2['default'].getComputedStyle === 'function') {
var computedStyle = _globalWindow2['default'].getComputedStyle(this.el_);
computedWidthOrHeight = computedStyle.getPropertyValue(widthOrHeight) || computedStyle[widthOrHeight];
} else if (this.el_.currentStyle) {
// ie 8 doesn't support computed style, shim it
// return clientWidth or clientHeight instead for better accuracy
var rule = 'offset' + _utilsToTitleCaseJs2['default'](widthOrHeight);
computedWidthOrHeight = this.el_[rule];
}
// remove 'px' from variable and parse as integer
computedWidthOrHeight = parseFloat(computedWidthOrHeight);
return computedWidthOrHeight;
};
/**
* Get an object which contains width and height values of computed style
* @return {Object} The dimensions of element
* @method currentDimensions
*/
Component.prototype.currentDimensions = function currentDimensions() {
return {
width: this.currentDimension('width'),
height: this.currentDimension('height')
};
};
/**
* Get width of computed style
* @return {Integer}
* @method currentWidth
*/
Component.prototype.currentWidth = function currentWidth() {
return this.currentDimension('width');
};
/**
* Get height of computed style
* @return {Integer}
* @method currentHeight
*/
Component.prototype.currentHeight = function currentHeight() {
return this.currentDimension('height');
};
/**
* 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.extend(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 _name in props) {
if (props.hasOwnProperty(_name)) {
subObj.prototype[_name] = props[_name];
}
}
return subObj;
};
return Component;
})();
Component.registerComponent('Component', Component);
exports['default'] = Component;
module.exports = exports['default'];
},{"./utils/dom.js":142,"./utils/events.js":143,"./utils/fn.js":144,"./utils/guid.js":146,"./utils/log.js":147,"./utils/merge-options.js":148,"./utils/to-title-case.js":151,"global/window":2,"object.assign":45}],68:[function(_dereq_,module,exports){
/**
* @file audio-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 _trackButtonJs = _dereq_('../track-button.js');
var _trackButtonJs2 = _interopRequireDefault(_trackButtonJs);
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _utilsFnJs = _dereq_('../../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _audioTrackMenuItemJs = _dereq_('./audio-track-menu-item.js');
var _audioTrackMenuItemJs2 = _interopRequireDefault(_audioTrackMenuItemJs);
/**
* The base class for buttons that toggle specific text track types (e.g. subtitles)
*
* @param {Player|Object} player
* @param {Object=} options
* @extends TrackButton
* @class AudioTrackButton
*/
var AudioTrackButton = (function (_TrackButton) {
_inherits(AudioTrackButton, _TrackButton);
function AudioTrackButton(player) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, AudioTrackButton);
options.tracks = player.audioTracks && player.audioTracks();
_TrackButton.call(this, player, options);
this.el_.setAttribute('aria-label', 'Audio Menu');
}
/**
* Allow sub components to stack CSS class names
*
* @return {String} The constructed class name
* @method buildCSSClass
*/
AudioTrackButton.prototype.buildCSSClass = function buildCSSClass() {
return 'vjs-audio-button ' + _TrackButton.prototype.buildCSSClass.call(this);
};
/**
* Create a menu item for each audio track
*
* @return {Array} Array of menu items
* @method createItems
*/
AudioTrackButton.prototype.createItems = function createItems() {
var items = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
var tracks = this.player_.audioTracks && this.player_.audioTracks();
if (!tracks) {
return items;
}
for (var i = 0; i < tracks.length; i++) {
var track = tracks[i];
items.push(new _audioTrackMenuItemJs2['default'](this.player_, {
// MenuItem is selectable
'selectable': true,
'track': track
}));
}
return items;
};
return AudioTrackButton;
})(_trackButtonJs2['default']);
_componentJs2['default'].registerComponent('AudioTrackButton', AudioTrackButton);
exports['default'] = AudioTrackButton;
module.exports = exports['default'];
},{"../../component.js":67,"../../utils/fn.js":144,"../track-button.js":98,"./audio-track-menu-item.js":69}],69:[function(_dereq_,module,exports){
/**
* @file audio-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 audio track menu item
*
* @param {Player|Object} player
* @param {Object=} options
* @extends MenuItem
* @class AudioTrackMenuItem
*/
var AudioTrackMenuItem = (function (_MenuItem) {
_inherits(AudioTrackMenuItem, _MenuItem);
function AudioTrackMenuItem(player, options) {
var _this = this;
_classCallCheck(this, AudioTrackMenuItem);
var track = options.track;
var tracks = player.audioTracks();
// Modify options for parent MenuItem class's init.
options.label = track.label || track.language || 'Unknown';
options.selected = track.enabled;
_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);
});
})();
}
}
/**
* Handle click on audio track
*
* @method handleClick
*/
AudioTrackMenuItem.prototype.handleClick = function handleClick(event) {
var tracks = this.player_.audioTracks();
_MenuItem.prototype.handleClick.call(this, event);
if (!tracks) return;
for (var i = 0; i < tracks.length; i++) {
var track = tracks[i];
if (track === this.track) {
track.enabled = true;
}
}
};
/**
* Handle audio track change
*
* @method handleTracksChange
*/
AudioTrackMenuItem.prototype.handleTracksChange = function handleTracksChange(event) {
this.selected(this.track.enabled);
};
return AudioTrackMenuItem;
})(_menuMenuItemJs2['default']);
_componentJs2['default'].registerComponent('AudioTrackMenuItem', AudioTrackMenuItem);
exports['default'] = AudioTrackMenuItem;
module.exports = exports['default'];
},{"../../component.js":67,"../../menu/menu-item.js":110,"../../utils/fn.js":144}],70:[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 _textTrackControlsDescriptionsButtonJs = _dereq_('./text-track-controls/descriptions-button.js');
var _textTrackControlsDescriptionsButtonJs2 = _interopRequireDefault(_textTrackControlsDescriptionsButtonJs);
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 _audioTrackControlsAudioTrackButtonJs = _dereq_('./audio-track-controls/audio-track-button.js');
var _audioTrackControlsAudioTrackButtonJs2 = _interopRequireDefault(_audioTrackControlsAudioTrackButtonJs);
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',
dir: 'ltr'
}, {
'role': 'group' // The control bar is a group, so it can contain menuitems
});
};
return ControlBar;
})(_componentJs2['default']);
ControlBar.prototype.options_ = {
children: ['playToggle', 'volumeMenuButton', 'currentTimeDisplay', 'timeDivider', 'durationDisplay', 'progressControl', 'liveDisplay', 'remainingTimeDisplay', 'customControlSpacer', 'playbackRateMenuButton', 'chaptersButton', 'descriptionsButton', 'subtitlesButton', 'captionsButton', 'audioTrackButton', 'fullscreenToggle']
};
_componentJs2['default'].registerComponent('ControlBar', ControlBar);
exports['default'] = ControlBar;
module.exports = exports['default'];
},{"../component.js":67,"./audio-track-controls/audio-track-button.js":68,"./fullscreen-toggle.js":71,"./live-display.js":72,"./mute-toggle.js":73,"./play-toggle.js":74,"./playback-rate-menu/playback-rate-menu-button.js":75,"./progress-control/progress-control.js":80,"./spacer-controls/custom-control-spacer.js":83,"./text-track-controls/captions-button.js":86,"./text-track-controls/chapters-button.js":87,"./text-track-controls/descriptions-button.js":89,"./text-track-controls/subtitles-button.js":91,"./time-controls/current-time-display.js":94,"./time-controls/duration-display.js":95,"./time-controls/remaining-time-display.js":96,"./time-controls/time-divider.js":97,"./volume-control/volume-control.js":100,"./volume-menu-button.js":102}],71:[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":64,"../component.js":67}],72:[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(player, options) {
_classCallCheck(this, LiveDisplay);
_Component.call(this, player, options);
this.updateShowing();
this.on(this.player(), 'durationchange', this.updateShowing);
}
/**
* 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;
};
LiveDisplay.prototype.updateShowing = function updateShowing() {
if (this.player().duration() === Infinity) {
this.show();
} else {
this.hide();
}
};
return LiveDisplay;
})(_component2['default']);
_component2['default'].registerComponent('LiveDisplay', LiveDisplay);
exports['default'] = LiveDisplay;
module.exports = exports['default'];
},{"../component":67,"../utils/dom.js":142}],73:[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';
if (this.controlText() !== toMute) {
this.controlText(toMute);
}
/* 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":64,"../component":67,"../utils/dom.js":142}],74:[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":64,"../component.js":67}],75:[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 whether playback rates is supported by the tech
* and an array of playback rates exists
*
* @return {Boolean} Whether changing playback rate is supported
* @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":67,"../../menu/menu-button.js":109,"../../menu/menu.js":111,"../../utils/dom.js":142,"./playback-rate-menu-item.js":76}],76:[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":67,"../../menu/menu-item.js":110}],77:[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":67,"../../utils/dom.js":142}],78:[function(_dereq_,module,exports){
/**
* @file mouse-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 _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
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 _utilsFormatTimeJs = _dereq_('../../utils/format-time.js');
var _utilsFormatTimeJs2 = _interopRequireDefault(_utilsFormatTimeJs);
var _lodashCompatFunctionThrottle = _dereq_('lodash-compat/function/throttle');
var _lodashCompatFunctionThrottle2 = _interopRequireDefault(_lodashCompatFunctionThrottle);
/**
* The Mouse Time Display component shows the time you will seek to
* when hovering over the progress bar
*
* @param {Player|Object} player
* @param {Object=} options
* @extends Component
* @class MouseTimeDisplay
*/
var MouseTimeDisplay = (function (_Component) {
_inherits(MouseTimeDisplay, _Component);
function MouseTimeDisplay(player, options) {
var _this = this;
_classCallCheck(this, MouseTimeDisplay);
_Component.call(this, player, options);
if (options.playerOptions && options.playerOptions.controlBar && options.playerOptions.controlBar.progressControl && options.playerOptions.controlBar.progressControl.keepTooltipsInside) {
this.keepTooltipsInside = options.playerOptions.controlBar.progressControl.keepTooltipsInside;
}
if (this.keepTooltipsInside) {
this.tooltip = Dom.createEl('div', { className: 'vjs-time-tooltip' });
this.el().appendChild(this.tooltip);
this.addClass('vjs-keep-tooltips-inside');
}
this.update(0, 0);
player.on('ready', function () {
_this.on(player.controlBar.progressControl.el(), 'mousemove', _lodashCompatFunctionThrottle2['default'](Fn.bind(_this, _this.handleMouseMove), 25));
});
}
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
MouseTimeDisplay.prototype.createEl = function createEl() {
return _Component.prototype.createEl.call(this, 'div', {
className: 'vjs-mouse-display'
});
};
MouseTimeDisplay.prototype.handleMouseMove = function handleMouseMove(event) {
var duration = this.player_.duration();
var newTime = this.calculateDistance(event) * duration;
var position = event.pageX - Dom.findElPosition(this.el().parentNode).left;
this.update(newTime, position);
};
MouseTimeDisplay.prototype.update = function update(newTime, position) {
var time = _utilsFormatTimeJs2['default'](newTime, this.player_.duration());
this.el().style.left = position + 'px';
this.el().setAttribute('data-current-time', time);
if (this.keepTooltipsInside) {
var clampedPosition = this.clampPosition_(position);
var difference = position - clampedPosition + 1;
var tooltipWidth = parseFloat(_globalWindow2['default'].getComputedStyle(this.tooltip).width);
var tooltipWidthHalf = tooltipWidth / 2;
this.tooltip.innerHTML = time;
this.tooltip.style.right = '-' + (tooltipWidthHalf - difference) + 'px';
}
};
MouseTimeDisplay.prototype.calculateDistance = function calculateDistance(event) {
return Dom.getPointerPosition(this.el().parentNode, event).x;
};
/**
* This takes in a horizontal position for the bar and returns a clamped position.
* Clamped position means that it will keep the position greater than half the width
* of the tooltip and smaller than the player width minus half the width o the tooltip.
* It will only clamp the position if `keepTooltipsInside` option is set.
*
* @param {Number} position the position the bar wants to be
* @return {Number} newPosition the (potentially) clamped position
* @method clampPosition_
*/
MouseTimeDisplay.prototype.clampPosition_ = function clampPosition_(position) {
if (!this.keepTooltipsInside) {
return position;
}
var playerWidth = parseFloat(_globalWindow2['default'].getComputedStyle(this.player().el()).width);
var tooltipWidth = parseFloat(_globalWindow2['default'].getComputedStyle(this.tooltip).width);
var tooltipWidthHalf = tooltipWidth / 2;
var actualPosition = position;
if (position < tooltipWidthHalf) {
actualPosition = Math.ceil(tooltipWidthHalf);
} else if (position > playerWidth - tooltipWidthHalf) {
actualPosition = Math.floor(playerWidth - tooltipWidthHalf);
}
return actualPosition;
};
return MouseTimeDisplay;
})(_componentJs2['default']);
_componentJs2['default'].registerComponent('MouseTimeDisplay', MouseTimeDisplay);
exports['default'] = MouseTimeDisplay;
module.exports = exports['default'];
},{"../../component.js":67,"../../utils/dom.js":142,"../../utils/fn.js":144,"../../utils/format-time.js":145,"global/window":2,"lodash-compat/function/throttle":7}],79:[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 _utilsDomJs = _dereq_('../../utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
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));
if (options.playerOptions && options.playerOptions.controlBar && options.playerOptions.controlBar.progressControl && options.playerOptions.controlBar.progressControl.keepTooltipsInside) {
this.keepTooltipsInside = options.playerOptions.controlBar.progressControl.keepTooltipsInside;
}
if (this.keepTooltipsInside) {
this.addClass('vjs-keep-tooltips-inside');
}
}
/**
* 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 vjs-slider-bar',
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":67,"../../utils/dom.js":142,"../../utils/fn.js":144,"../../utils/format-time.js":145}],80:[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);
var _mouseTimeDisplayJs = _dereq_('./mouse-time-display.js');
var _mouseTimeDisplayJs2 = _interopRequireDefault(_mouseTimeDisplayJs);
/**
* 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":67,"./mouse-time-display.js":78,"./seek-bar.js":81}],81:[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 _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
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 _tooltipProgressBarJs = _dereq_('./tooltip-progress-bar.js');
var _tooltipProgressBarJs2 = _interopRequireDefault(_tooltipProgressBarJs);
var _utilsFnJs = _dereq_('../../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _utilsFormatTimeJs = _dereq_('../../utils/format-time.js');
var _utilsFormatTimeJs2 = _interopRequireDefault(_utilsFormatTimeJs);
var _objectAssign = _dereq_('object.assign');
var _objectAssign2 = _interopRequireDefault(_objectAssign);
/**
* 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.updateProgress);
this.on(player, 'ended', this.updateProgress);
player.ready(Fn.bind(this, this.updateProgress));
if (options.playerOptions && options.playerOptions.controlBar && options.playerOptions.controlBar.progressControl && options.playerOptions.controlBar.progressControl.keepTooltipsInside) {
this.keepTooltipsInside = options.playerOptions.controlBar.progressControl.keepTooltipsInside;
}
if (this.keepTooltipsInside) {
this.tooltipProgressBar = this.addChild('TooltipProgressBar');
}
}
/**
* 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': 'progress bar'
});
};
/**
* Update ARIA accessibility attributes
*
* @method updateARIAAttributes
*/
SeekBar.prototype.updateProgress = function updateProgress() {
this.updateAriaAttributes(this.el_);
if (this.keepTooltipsInside) {
this.updateAriaAttributes(this.tooltipProgressBar.el_);
this.tooltipProgressBar.el_.style.width = this.bar.el_.style.width;
var playerWidth = parseFloat(_globalWindow2['default'].getComputedStyle(this.player().el()).width);
var tooltipWidth = parseFloat(_globalWindow2['default'].getComputedStyle(this.tooltipProgressBar.tooltip).width);
var tooltipStyle = this.tooltipProgressBar.el().style;
tooltipStyle.maxWidth = Math.floor(playerWidth - tooltipWidth / 2) + 'px';
tooltipStyle.minWidth = Math.ceil(tooltipWidth / 2) + 'px';
tooltipStyle.right = '-' + tooltipWidth / 2 + 'px';
}
};
SeekBar.prototype.updateAriaAttributes = function updateAriaAttributes(el) {
// Allows for smooth scrubbing, when player can't keep up.
var time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
el.setAttribute('aria-valuenow', (this.getPercent() * 100).toFixed(2)); // machine readable value of progress bar (percentage complete)
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', 'mouseTimeDisplay', 'playProgressBar'],
'barName': 'playProgressBar'
};
SeekBar.prototype.playerEvent = 'timeupdate';
_componentJs2['default'].registerComponent('SeekBar', SeekBar);
exports['default'] = SeekBar;
module.exports = exports['default'];
},{"../../component.js":67,"../../slider/slider.js":119,"../../utils/fn.js":144,"../../utils/format-time.js":145,"./load-progress-bar.js":77,"./play-progress-bar.js":79,"./tooltip-progress-bar.js":82,"global/window":2,"object.assign":45}],82:[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 _utilsDomJs = _dereq_('../../utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
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 TooltipProgressBar = (function (_Component) {
_inherits(TooltipProgressBar, _Component);
function TooltipProgressBar(player, options) {
_classCallCheck(this, TooltipProgressBar);
_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
*/
TooltipProgressBar.prototype.createEl = function createEl() {
var el = _Component.prototype.createEl.call(this, 'div', {
className: 'vjs-tooltip-progress-bar vjs-slider-bar',
innerHTML: '<div class="vjs-time-tooltip"></div>\n <span class="vjs-control-text"><span>' + this.localize('Progress') + '</span>: 0%</span>'
});
this.tooltip = el.querySelector('.vjs-time-tooltip');
return el;
};
TooltipProgressBar.prototype.updateDataAttr = function updateDataAttr() {
var time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
var formattedTime = _utilsFormatTimeJs2['default'](time, this.player_.duration());
this.el_.setAttribute('data-current-time', formattedTime);
this.tooltip.innerHTML = formattedTime;
};
return TooltipProgressBar;
})(_componentJs2['default']);
_componentJs2['default'].registerComponent('TooltipProgressBar', TooltipProgressBar);
exports['default'] = TooltipProgressBar;
module.exports = exports['default'];
},{"../../component.js":67,"../../utils/dom.js":142,"../../utils/fn.js":144,"../../utils/format-time.js":145}],83:[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() {
var el = _Spacer.prototype.createEl.call(this, {
className: this.buildCSSClass()
});
// No-flex/table-cell mode requires there be some content
// in the cell to fill the remaining space of the table.
el.innerHTML = ' ';
return el;
};
return CustomControlSpacer;
})(_spacerJs2['default']);
_componentJs2['default'].registerComponent('CustomControlSpacer', CustomControlSpacer);
exports['default'] = CustomControlSpacer;
module.exports = exports['default'];
},{"../../component.js":67,"./spacer.js":84}],84:[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
*
* @return {Element}
* @method createEl
*/
Spacer.prototype.createEl = function createEl() {
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":67}],85:[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',
'selectable': false,
'default': false,
mode: 'disabled'
};
// CaptionSettingsMenuItem has no concept of 'selected'
options['selectable'] = false;
_TextTrackMenuItem.call(this, player, options);
this.addClass('vjs-texttrack-settings');
this.controlText(', opens ' + options['kind'] + ' settings dialog');
}
/**
* Handle click on menu item
*
* @method handleClick
*/
CaptionSettingsMenuItem.prototype.handleClick = function handleClick() {
this.player().getChild('textTrackSettings').show();
this.player().getChild('textTrackSettings').el_.focus();
};
return CaptionSettingsMenuItem;
})(_textTrackMenuItemJs2['default']);
_componentJs2['default'].registerComponent('CaptionSettingsMenuItem', CaptionSettingsMenuItem);
exports['default'] = CaptionSettingsMenuItem;
module.exports = exports['default'];
},{"../../component.js":67,"./text-track-menu-item.js":93}],86:[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":67,"./caption-settings-menu-item.js":85,"./text-track-button.js":92}],87:[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 _this = this;
var tracks = this.player_.textTracks() || [];
var chaptersTrack = undefined;
var items = this.items || [];
for (var i = tracks.length - 1; i >= 0; i--) {
// We will always choose the last track as our chaptersTrack
var track = tracks[i];
if (track['kind'] === this.kind_) {
chaptersTrack = track;
break;
}
}
var menu = this.menu;
if (menu === undefined) {
menu = new _menuMenuJs2['default'](this.player_);
var title = Dom.createEl('li', {
className: 'vjs-menu-title',
innerHTML: _utilsToTitleCaseJs2['default'](this.kind_),
tabIndex: -1
});
menu.children_.unshift(title);
Dom.insertElFirst(title, menu.contentEl());
} else {
// We will empty out the menu children each time because we want a
// fresh new menu child list each time
items.forEach(function (item) {
return menu.removeChild(item);
});
// Empty out the ChaptersButton menu items because we no longer need them
items = [];
}
if (chaptersTrack && chaptersTrack.cues == null) {
chaptersTrack['mode'] = 'hidden';
var remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(chaptersTrack);
if (remoteTextTrackEl) {
remoteTextTrackEl.addEventListener('load', function (event) {
return _this.update();
});
}
}
if (chaptersTrack && chaptersTrack.cues && chaptersTrack.cues.length > 0) {
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);
}
}
if (items.length > 0) {
this.show();
}
// Assigning the value of items back to this.items for next iteration
this.items = items;
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":67,"../../menu/menu.js":111,"../../utils/dom.js":142,"../../utils/fn.js":144,"../../utils/to-title-case.js":151,"./chapters-track-menu-item.js":88,"./text-track-button.js":92,"./text-track-menu-item.js":93,"global/window":2}],88:[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":67,"../../menu/menu-item.js":110,"../../utils/fn.js":144}],89:[function(_dereq_,module,exports){
/**
* @file descriptions-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 _utilsFnJs = _dereq_('../../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
/**
* The button component for toggling and selecting descriptions
*
* @param {Object} player Player object
* @param {Object=} options Object of option names and values
* @param {Function=} ready Ready callback function
* @extends TextTrackButton
* @class DescriptionsButton
*/
var DescriptionsButton = (function (_TextTrackButton) {
_inherits(DescriptionsButton, _TextTrackButton);
function DescriptionsButton(player, options, ready) {
var _this = this;
_classCallCheck(this, DescriptionsButton);
_TextTrackButton.call(this, player, options, ready);
this.el_.setAttribute('aria-label', 'Descriptions Menu');
var tracks = player.textTracks();
if (tracks) {
(function () {
var changeHandler = Fn.bind(_this, _this.handleTracksChange);
tracks.addEventListener('change', changeHandler);
_this.on('dispose', function () {
tracks.removeEventListener('change', changeHandler);
});
})();
}
}
/**
* Handle text track change
*
* @method handleTracksChange
*/
DescriptionsButton.prototype.handleTracksChange = function handleTracksChange(event) {
var tracks = this.player().textTracks();
var disabled = false;
// Check whether a track of a different kind is showing
for (var i = 0, l = tracks.length; i < l; i++) {
var track = tracks[i];
if (track['kind'] !== this.kind_ && track['mode'] === 'showing') {
disabled = true;
break;
}
}
// If another track is showing, disable this menu button
if (disabled) {
this.disable();
} else {
this.enable();
}
};
/**
* Allow sub components to stack CSS class names
*
* @return {String} The constructed class name
* @method buildCSSClass
*/
DescriptionsButton.prototype.buildCSSClass = function buildCSSClass() {
return 'vjs-descriptions-button ' + _TextTrackButton.prototype.buildCSSClass.call(this);
};
return DescriptionsButton;
})(_textTrackButtonJs2['default']);
DescriptionsButton.prototype.kind_ = 'descriptions';
DescriptionsButton.prototype.controlText_ = 'Descriptions';
_componentJs2['default'].registerComponent('DescriptionsButton', DescriptionsButton);
exports['default'] = DescriptionsButton;
module.exports = exports['default'];
},{"../../component.js":67,"../../utils/fn.js":144,"./text-track-button.js":92}],90:[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'
};
// MenuItem is selectable
options['selectable'] = true;
_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":67,"./text-track-menu-item.js":93}],91:[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":67,"./text-track-button.js":92}],92:[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 _trackButtonJs = _dereq_('../track-button.js');
var _trackButtonJs2 = _interopRequireDefault(_trackButtonJs);
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 (_TrackButton) {
_inherits(TextTrackButton, _TrackButton);
function TextTrackButton(player) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, TextTrackButton);
options.tracks = player.textTracks();
_TrackButton.call(this, player, options);
}
/**
* Create a menu item for each text track
*
* @return {Array} Array of menu items
* @method createItems
*/
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_, {
// MenuItem is selectable
'selectable': true,
'track': track
}));
}
}
return items;
};
return TextTrackButton;
})(_trackButtonJs2['default']);
_componentJs2['default'].registerComponent('TextTrackButton', TextTrackButton);
exports['default'] = TextTrackButton;
module.exports = exports['default'];
},{"../../component.js":67,"../../utils/fn.js":144,"../track-button.js":98,"./off-text-track-menu-item.js":90,"./text-track-menu-item.js":93}],93:[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":67,"../../menu/menu-item.js":110,"../../utils/fn.js":144,"global/document":1,"global/window":2}],94:[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',
// label the current time for screen reader users
innerHTML: '<span class="vjs-control-text">Current Time </span>' + '0:00'
}, {
// tell screen readers not to automatically read the time as it changes
'aria-live': 'off'
});
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());
if (formattedTime !== this.formattedTime_) {
this.formattedTime_ = formattedTime;
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":67,"../../utils/dom.js":142,"../../utils/format-time.js":145}],95:[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.on(player, 'durationchange', 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',
// label the duration time for screen reader users
innerHTML: '<span class="vjs-control-text">' + this.localize('Duration Time') + '</span> 0:00'
}, {
// tell screen readers not to automatically read the time as it changes
'aria-live': 'off'
});
el.appendChild(this.contentEl_);
return el;
};
/**
* Update duration time display
*
* @method updateContent
*/
DurationDisplay.prototype.updateContent = function updateContent() {
var duration = this.player_.duration();
if (duration && this.duration_ !== duration) {
this.duration_ = 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":67,"../../utils/dom.js":142,"../../utils/format-time.js":145}],96:[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);
this.on(player, 'durationchange', 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',
// label the remaining time for screen reader users
innerHTML: '<span class="vjs-control-text">' + this.localize('Remaining Time') + '</span> -0:00'
}, {
// tell screen readers not to automatically read the time as it changes
'aria-live': 'off'
});
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());
if (formattedTime !== this.formattedTime_) {
this.formattedTime_ = formattedTime;
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":67,"../../utils/dom.js":142,"../../utils/format-time.js":145}],97:[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":67}],98:[function(_dereq_,module,exports){
/**
* @file 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);
/**
* The base class for buttons that toggle specific text track types (e.g. subtitles)
*
* @param {Player|Object} player
* @param {Object=} options
* @extends MenuButton
* @class TrackButton
*/
var TrackButton = (function (_MenuButton) {
_inherits(TrackButton, _MenuButton);
function TrackButton(player, options) {
_classCallCheck(this, TrackButton);
var tracks = options.tracks;
_MenuButton.call(this, player, options);
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);
});
}
return TrackButton;
})(_menuMenuButtonJs2['default']);
_componentJs2['default'].registerComponent('TrackButton', TrackButton);
exports['default'] = TrackButton;
module.exports = exports['default'];
},{"../component.js":67,"../menu/menu-button.js":109,"../utils/fn.js":144}],99:[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 vjs-slider-bar'
}, {
'aria-label': 'volume level'
});
};
/**
* Handle mouse move on volume bar
*
* @method handleMouseMove
*/
VolumeBar.prototype.handleMouseMove = function handleMouseMove(event) {
this.checkMuted();
this.player_.volume(this.calculateDistance(event));
};
VolumeBar.prototype.checkMuted = function checkMuted() {
if (this.player_.muted()) {
this.player_.muted(false);
}
};
/**
* 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.checkMuted();
this.player_.volume(this.player_.volume() + 0.1);
};
/**
* Decrease volume level for keyboard users
*
* @method stepBack
*/
VolumeBar.prototype.stepBack = function stepBack() {
this.checkMuted();
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":67,"../../slider/slider.js":119,"../../utils/fn.js":144,"./volume-level.js":101}],100:[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":67,"./volume-bar.js":99}],101:[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":67}],102:[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 _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 _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 _utilsFnJs = _dereq_('../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _componentJs = _dereq_('../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _popupPopupJs = _dereq_('../popup/popup.js');
var _popupPopupJs2 = _interopRequireDefault(_popupPopupJs);
var _popupPopupButtonJs = _dereq_('../popup/popup-button.js');
var _popupPopupButtonJs2 = _interopRequireDefault(_popupPopupButtonJs);
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 popup
*
* @param {Player|Object} player
* @param {Object=} options
* @extends PopupButton
* @class VolumeMenuButton
*/
var VolumeMenuButton = (function (_PopupButton) {
_inherits(VolumeMenuButton, _PopupButton);
function VolumeMenuButton(player) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, VolumeMenuButton);
// Default to inline
if (options.inline === undefined) {
options.inline = true;
}
// 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;
_PopupButton.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
function updateVisibility() {
if (player.tech_ && player.tech_['featuresVolumeControl'] === false) {
this.addClass('vjs-hidden');
} else {
this.removeClass('vjs-hidden');
}
}
updateVisibility.call(this);
this.on(player, 'loadstart', updateVisibility);
this.on(this.volumeBar, ['slideractive', 'focus'], function () {
this.addClass('vjs-slider-active');
});
this.on(this.volumeBar, ['sliderinactive', 'blur'], function () {
this.removeClass('vjs-slider-active');
});
this.on(this.volumeBar, ['focus'], function () {
this.addClass('vjs-lock-showing');
});
this.on(this.volumeBar, ['blur'], function () {
this.removeClass('vjs-lock-showing');
});
}
/**
* 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 ' + _PopupButton.prototype.buildCSSClass.call(this) + ' ' + orientationClass;
};
/**
* Allow sub components to stack CSS class names
*
* @return {Popup} The volume popup button
* @method createPopup
*/
VolumeMenuButton.prototype.createPopup = function createPopup() {
var popup = new _popupPopupJs2['default'](this.player_, {
contentElType: 'div'
});
var vb = new _volumeControlVolumeBarJs2['default'](this.player_, this.options_.volumeBar);
popup.addChild(vb);
this.menuContent = popup;
this.volumeBar = vb;
this.attachVolumeBarEvents();
return popup;
};
/**
* Handle click on volume popup and calls super
*
* @method handleClick
*/
VolumeMenuButton.prototype.handleClick = function handleClick() {
_muteToggleJs2['default'].prototype.handleClick.call(this);
_PopupButton.prototype.handleClick.call(this);
};
VolumeMenuButton.prototype.attachVolumeBarEvents = function attachVolumeBarEvents() {
this.menuContent.on(['mousedown', 'touchdown'], Fn.bind(this, this.handleMouseDown));
};
VolumeMenuButton.prototype.handleMouseDown = function handleMouseDown(event) {
this.on(['mousemove', 'touchmove'], Fn.bind(this.volumeBar, this.volumeBar.handleMouseMove));
this.on(this.el_.ownerDocument, ['mouseup', 'touchend'], this.handleMouseUp);
};
VolumeMenuButton.prototype.handleMouseUp = function handleMouseUp(event) {
this.off(['mousemove', 'touchmove'], Fn.bind(this.volumeBar, this.volumeBar.handleMouseMove));
};
return VolumeMenuButton;
})(_popupPopupButtonJs2['default']);
VolumeMenuButton.prototype.volumeUpdate = _muteToggleJs2['default'].prototype.update;
VolumeMenuButton.prototype.controlText_ = 'Mute';
_componentJs2['default'].registerComponent('VolumeMenuButton', VolumeMenuButton);
exports['default'] = VolumeMenuButton;
module.exports = exports['default'];
},{"../component.js":67,"../popup/popup-button.js":115,"../popup/popup.js":116,"../utils/fn.js":144,"./mute-toggle.js":73,"./volume-control/volume-bar.js":99}],103:[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 _modalDialog = _dereq_('./modal-dialog');
var _modalDialog2 = _interopRequireDefault(_modalDialog);
var _utilsDom = _dereq_('./utils/dom');
var Dom = _interopRequireWildcard(_utilsDom);
var _utilsMergeOptions = _dereq_('./utils/merge-options');
var _utilsMergeOptions2 = _interopRequireDefault(_utilsMergeOptions);
/**
* Display that an error has occurred making the video unplayable.
*
* @extends ModalDialog
* @class ErrorDisplay
*/
var ErrorDisplay = (function (_ModalDialog) {
_inherits(ErrorDisplay, _ModalDialog);
/**
* Constructor for error display modal.
*
* @param {Player} player
* @param {Object} [options]
*/
function ErrorDisplay(player, options) {
_classCallCheck(this, ErrorDisplay);
_ModalDialog.call(this, player, options);
this.on(player, 'error', this.open);
}
/**
* Include the old class for backward-compatibility.
*
* This can be removed in 6.0.
*
* @method buildCSSClass
* @deprecated
* @return {String}
*/
ErrorDisplay.prototype.buildCSSClass = function buildCSSClass() {
return 'vjs-error-display ' + _ModalDialog.prototype.buildCSSClass.call(this);
};
/**
* Generates the modal content based on the player error.
*
* @return {String|Null}
*/
ErrorDisplay.prototype.content = function content() {
var error = this.player().error();
return error ? this.localize(error.message) : '';
};
return ErrorDisplay;
})(_modalDialog2['default']);
ErrorDisplay.prototype.options_ = _utilsMergeOptions2['default'](_modalDialog2['default'].prototype.options_, {
fillAlways: true,
temporary: false,
uncloseable: true
});
_component2['default'].registerComponent('ErrorDisplay', ErrorDisplay);
exports['default'] = ErrorDisplay;
module.exports = exports['default'];
},{"./component":67,"./modal-dialog":112,"./utils/dom":142,"./utils/merge-options":148}],104:[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 () {};
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) {
// 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 () {};
Events.one(this, type, fn);
this.addEventListener = ael;
};
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":143}],105:[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 extend.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.extend(Button, {
* constructor: function(player, options) {
* Button.call(this, player, options);
* },
* onClick: function() {
* // doSomething
* }
* });
* ```
*/
var extendFn = function extendFn(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'] = extendFn;
module.exports = exports['default'];
},{"./utils/log":147}],106:[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}],107:[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',
dir: 'ltr'
});
};
return LoadingSpinner;
})(_component2['default']);
_component2['default'].registerComponent('LoadingSpinner', LoadingSpinner);
exports['default'] = LoadingSpinner;
module.exports = exports['default'];
},{"./component":67}],108:[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":45}],109:[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 _clickableComponentJs = _dereq_('../clickable-component.js');
var _clickableComponentJs2 = _interopRequireDefault(_clickableComponentJs);
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 (_ClickableComponent) {
_inherits(MenuButton, _ClickableComponent);
function MenuButton(player) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, MenuButton);
_ClickableComponent.call(this, player, options);
this.update();
this.enabled_ = true;
this.el_.setAttribute('aria-haspopup', 'true');
this.el_.setAttribute('role', 'menuitem');
this.on('keydown', this.handleSubmenuKeyPress);
}
/**
* 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;
this.el_.setAttribute('aria-expanded', '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) {
var title = Dom.createEl('li', {
className: 'vjs-menu-title',
innerHTML: _utilsToTitleCaseJs2['default'](this.options_.title),
tabIndex: -1
});
menu.children_.unshift(title);
Dom.insertElFirst(title, menu.contentEl());
}
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 _ClickableComponent.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 + ' ' + _ClickableComponent.prototype.buildCSSClass.call(this);
};
/**
* 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(this.menu.contentEl(), 'mouseleave', Fn.bind(this, function (e) {
this.unpressButton();
this.el_.blur();
}));
if (this.buttonPressed_) {
this.unpressButton();
} else {
this.pressButton();
}
};
/**
* Handle key press on menu
*
* @param {Object} event Key press event
* @method handleKeyPress
*/
MenuButton.prototype.handleKeyPress = function handleKeyPress(event) {
// Escape (27) key or Tab (9) key unpress the 'button'
if (event.which === 27 || event.which === 9) {
if (this.buttonPressed_) {
this.unpressButton();
}
// Don't preventDefault for Tab key - we still want to lose focus
if (event.which !== 9) {
event.preventDefault();
}
// Up (38) key or Down (40) key press the 'button'
} else if (event.which === 38 || event.which === 40) {
if (!this.buttonPressed_) {
this.pressButton();
event.preventDefault();
}
} else {
_ClickableComponent.prototype.handleKeyPress.call(this, event);
}
};
/**
* Handle key press on submenu
*
* @param {Object} event Key press event
* @method handleSubmenuKeyPress
*/
MenuButton.prototype.handleSubmenuKeyPress = function handleSubmenuKeyPress(event) {
// Escape (27) key or Tab (9) key unpress the 'button'
if (event.which === 27 || event.which === 9) {
if (this.buttonPressed_) {
this.unpressButton();
}
// Don't preventDefault for Tab key - we still want to lose focus
if (event.which !== 9) {
event.preventDefault();
}
}
};
/**
* Makes changes based on button pressed
*
* @method pressButton
*/
MenuButton.prototype.pressButton = function pressButton() {
if (this.enabled_) {
this.buttonPressed_ = true;
this.menu.lockShowing();
this.el_.setAttribute('aria-expanded', 'true');
this.menu.focus(); // set the focus into the submenu
}
};
/**
* Makes changes based on button unpressed
*
* @method unpressButton
*/
MenuButton.prototype.unpressButton = function unpressButton() {
if (this.enabled_) {
this.buttonPressed_ = false;
this.menu.unlockShowing();
this.el_.setAttribute('aria-expanded', 'false');
this.el_.focus(); // Set focus back to this menu button
}
};
/**
* Disable the menu button
*
* @return {Component}
* @method disable
*/
MenuButton.prototype.disable = function disable() {
// Unpress, but don't force focus on this button
this.buttonPressed_ = false;
this.menu.unlockShowing();
this.el_.setAttribute('aria-expanded', 'false');
this.enabled_ = false;
return _ClickableComponent.prototype.disable.call(this);
};
/**
* Enable the menu button
*
* @return {Component}
* @method disable
*/
MenuButton.prototype.enable = function enable() {
this.enabled_ = true;
return _ClickableComponent.prototype.enable.call(this);
};
return MenuButton;
})(_clickableComponentJs2['default']);
_componentJs2['default'].registerComponent('MenuButton', MenuButton);
exports['default'] = MenuButton;
module.exports = exports['default'];
},{"../clickable-component.js":65,"../component.js":67,"../utils/dom.js":142,"../utils/fn.js":144,"../utils/to-title-case.js":151,"./menu.js":111}],110:[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 _clickableComponentJs = _dereq_('../clickable-component.js');
var _clickableComponentJs2 = _interopRequireDefault(_clickableComponentJs);
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 (_ClickableComponent) {
_inherits(MenuItem, _ClickableComponent);
function MenuItem(player, options) {
_classCallCheck(this, MenuItem);
_ClickableComponent.call(this, player, options);
this.selectable = options['selectable'];
this.selected(options['selected']);
if (this.selectable) {
// TODO: May need to be either menuitemcheckbox or menuitemradio,
// and may need logical grouping of menu items.
this.el_.setAttribute('role', 'menuitemcheckbox');
} else {
this.el_.setAttribute('role', 'menuitem');
}
}
/**
* 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, attrs) {
return _ClickableComponent.prototype.createEl.call(this, 'li', _objectAssign2['default']({
className: 'vjs-menu-item',
innerHTML: this.localize(this.options_['label']),
tabIndex: -1
}, props), attrs);
};
/**
* 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 (this.selectable) {
if (_selected) {
this.addClass('vjs-selected');
this.el_.setAttribute('aria-checked', 'true');
// aria-checked isn't fully supported by browsers/screen readers,
// so indicate selected state to screen reader in the control text.
this.controlText(', selected');
} else {
this.removeClass('vjs-selected');
this.el_.setAttribute('aria-checked', 'false');
// Indicate un-selected state to screen reader
// Note that a space clears out the selected state text
this.controlText(' ');
}
}
};
return MenuItem;
})(_clickableComponentJs2['default']);
_componentJs2['default'].registerComponent('MenuItem', MenuItem);
exports['default'] = MenuItem;
module.exports = exports['default'];
},{"../clickable-component.js":65,"../component.js":67,"object.assign":45}],111:[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(player, options) {
_classCallCheck(this, Menu);
_Component.call(this, player, options);
this.focusedChild_ = -1;
this.on('keydown', this.handleKeyPress);
}
/**
* 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();
//TODO: Need to set keyboard focus back to the menuButton
}));
};
/**
* 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'
});
this.contentEl_.setAttribute('role', 'menu');
var el = _Component.prototype.createEl.call(this, 'div', {
append: this.contentEl_,
className: 'vjs-menu'
});
el.setAttribute('role', 'presentation');
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;
};
/**
* Handle key press for menu
*
* @param {Object} event Event object
* @method handleKeyPress
*/
Menu.prototype.handleKeyPress = function handleKeyPress(event) {
if (event.which === 37 || event.which === 40) {
// Left and Down Arrows
event.preventDefault();
this.stepForward();
} else if (event.which === 38 || event.which === 39) {
// Up and Right Arrows
event.preventDefault();
this.stepBack();
}
};
/**
* Move to next (lower) menu item for keyboard users
*
* @method stepForward
*/
Menu.prototype.stepForward = function stepForward() {
var stepChild = 0;
if (this.focusedChild_ !== undefined) {
stepChild = this.focusedChild_ + 1;
}
this.focus(stepChild);
};
/**
* Move to previous (higher) menu item for keyboard users
*
* @method stepBack
*/
Menu.prototype.stepBack = function stepBack() {
var stepChild = 0;
if (this.focusedChild_ !== undefined) {
stepChild = this.focusedChild_ - 1;
}
this.focus(stepChild);
};
/**
* Set focus on a menu item in the menu
*
* @param {Object|String} item Index of child item set focus on
* @method focus
*/
Menu.prototype.focus = function focus() {
var item = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0];
var children = this.children().slice();
var haveTitle = children.length && children[0].className && /vjs-menu-title/.test(children[0].className);
if (haveTitle) {
children.shift();
}
if (children.length > 0) {
if (item < 0) {
item = 0;
} else if (item >= children.length) {
item = children.length - 1;
}
this.focusedChild_ = item;
children[item].el_.focus();
}
};
return Menu;
})(_componentJs2['default']);
_componentJs2['default'].registerComponent('Menu', Menu);
exports['default'] = Menu;
module.exports = exports['default'];
},{"../component.js":67,"../utils/dom.js":142,"../utils/events.js":143,"../utils/fn.js":144}],112:[function(_dereq_,module,exports){
/**
* @file modal-dialog.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; } }
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 _utilsDom = _dereq_('./utils/dom');
var Dom = _interopRequireWildcard(_utilsDom);
var _utilsFn = _dereq_('./utils/fn');
var Fn = _interopRequireWildcard(_utilsFn);
var _utilsLog = _dereq_('./utils/log');
var _utilsLog2 = _interopRequireDefault(_utilsLog);
var _component = _dereq_('./component');
var _component2 = _interopRequireDefault(_component);
var _closeButton = _dereq_('./close-button');
var _closeButton2 = _interopRequireDefault(_closeButton);
var MODAL_CLASS_NAME = 'vjs-modal-dialog';
var ESC = 27;
/**
* The `ModalDialog` displays over the video and its controls, which blocks
* interaction with the player until it is closed.
*
* Modal dialogs include a "Close" button and will close when that button
* is activated - or when ESC is pressed anywhere.
*
* @extends Component
* @class ModalDialog
*/
var ModalDialog = (function (_Component) {
_inherits(ModalDialog, _Component);
/**
* Constructor for modals.
*
* @param {Player} player
* @param {Object} [options]
* @param {Mixed} [options.content=undefined]
* Provide customized content for this modal.
*
* @param {String} [options.description]
* A text description for the modal, primarily for accessibility.
*
* @param {Boolean} [options.fillAlways=false]
* Normally, modals are automatically filled only the first time
* they open. This tells the modal to refresh its content
* every time it opens.
*
* @param {String} [options.label]
* A text label for the modal, primarily for accessibility.
*
* @param {Boolean} [options.temporary=true]
* If `true`, the modal can only be opened once; it will be
* disposed as soon as it's closed.
*
* @param {Boolean} [options.uncloseable=false]
* If `true`, the user will not be able to close the modal
* through the UI in the normal ways. Programmatic closing is
* still possible.
*
*/
function ModalDialog(player, options) {
_classCallCheck(this, ModalDialog);
_Component.call(this, player, options);
this.opened_ = this.hasBeenOpened_ = this.hasBeenFilled_ = false;
this.closeable(!this.options_.uncloseable);
this.content(this.options_.content);
// Make sure the contentEl is defined AFTER any children are initialized
// because we only want the contents of the modal in the contentEl
// (not the UI elements like the close button).
this.contentEl_ = Dom.createEl('div', {
className: MODAL_CLASS_NAME + '-content'
}, {
role: 'document'
});
this.descEl_ = Dom.createEl('p', {
className: MODAL_CLASS_NAME + '-description vjs-offscreen',
id: this.el().getAttribute('aria-describedby')
});
Dom.textContent(this.descEl_, this.description());
this.el_.appendChild(this.descEl_);
this.el_.appendChild(this.contentEl_);
}
/*
* Modal dialog default options.
*
* @type {Object}
* @private
*/
/**
* Create the modal's DOM element
*
* @method createEl
* @return {Element}
*/
ModalDialog.prototype.createEl = function createEl() {
return _Component.prototype.createEl.call(this, 'div', {
className: this.buildCSSClass(),
tabIndex: -1
}, {
'aria-describedby': this.id() + '_description',
'aria-hidden': 'true',
'aria-label': this.label(),
role: 'dialog'
});
};
/**
* Build the modal's CSS class.
*
* @method buildCSSClass
* @return {String}
*/
ModalDialog.prototype.buildCSSClass = function buildCSSClass() {
return MODAL_CLASS_NAME + ' vjs-hidden ' + _Component.prototype.buildCSSClass.call(this);
};
/**
* Handles key presses on the document, looking for ESC, which closes
* the modal.
*
* @method handleKeyPress
* @param {Event} e
*/
ModalDialog.prototype.handleKeyPress = function handleKeyPress(e) {
if (e.which === ESC && this.closeable()) {
this.close();
}
};
/**
* Returns the label string for this modal. Primarily used for accessibility.
*
* @return {String}
*/
ModalDialog.prototype.label = function label() {
return this.options_.label || this.localize('Modal Window');
};
/**
* Returns the description string for this modal. Primarily used for
* accessibility.
*
* @return {String}
*/
ModalDialog.prototype.description = function description() {
var desc = this.options_.description || this.localize('This is a modal window.');
// Append a universal closeability message if the modal is closeable.
if (this.closeable()) {
desc += ' ' + this.localize('This modal can be closed by pressing the Escape key or activating the close button.');
}
return desc;
};
/**
* Opens the modal.
*
* @method open
* @return {ModalDialog}
*/
ModalDialog.prototype.open = function open() {
if (!this.opened_) {
var player = this.player();
this.trigger('beforemodalopen');
this.opened_ = true;
// Fill content if the modal has never opened before and
// never been filled.
if (this.options_.fillAlways || !this.hasBeenOpened_ && !this.hasBeenFilled_) {
this.fill();
}
// If the player was playing, pause it and take note of its previously
// playing state.
this.wasPlaying_ = !player.paused();
if (this.wasPlaying_) {
player.pause();
}
if (this.closeable()) {
this.on(this.el_.ownerDocument, 'keydown', Fn.bind(this, this.handleKeyPress));
}
player.controls(false);
this.show();
this.el().setAttribute('aria-hidden', 'false');
this.trigger('modalopen');
this.hasBeenOpened_ = true;
}
return this;
};
/**
* Whether or not the modal is opened currently.
*
* @method opened
* @param {Boolean} [value]
* If given, it will open (`true`) or close (`false`) the modal.
*
* @return {Boolean}
*/
ModalDialog.prototype.opened = function opened(value) {
if (typeof value === 'boolean') {
this[value ? 'open' : 'close']();
}
return this.opened_;
};
/**
* Closes the modal.
*
* @method close
* @return {ModalDialog}
*/
ModalDialog.prototype.close = function close() {
if (this.opened_) {
var player = this.player();
this.trigger('beforemodalclose');
this.opened_ = false;
if (this.wasPlaying_) {
player.play();
}
if (this.closeable()) {
this.off(this.el_.ownerDocument, 'keydown', Fn.bind(this, this.handleKeyPress));
}
player.controls(true);
this.hide();
this.el().setAttribute('aria-hidden', 'true');
this.trigger('modalclose');
if (this.options_.temporary) {
this.dispose();
}
}
return this;
};
/**
* Whether or not the modal is closeable via the UI.
*
* @method closeable
* @param {Boolean} [value]
* If given as a Boolean, it will set the `closeable` option.
*
* @return {Boolean}
*/
ModalDialog.prototype.closeable = function closeable(value) {
if (typeof value === 'boolean') {
var closeable = this.closeable_ = !!value;
var _close = this.getChild('closeButton');
// If this is being made closeable and has no close button, add one.
if (closeable && !_close) {
// The close button should be a child of the modal - not its
// content element, so temporarily change the content element.
var temp = this.contentEl_;
this.contentEl_ = this.el_;
_close = this.addChild('closeButton', { controlText: 'Close Modal Dialog' });
this.contentEl_ = temp;
this.on(_close, 'close', this.close);
}
// If this is being made uncloseable and has a close button, remove it.
if (!closeable && _close) {
this.off(_close, 'close', this.close);
this.removeChild(_close);
_close.dispose();
}
}
return this.closeable_;
};
/**
* Fill the modal's content element with the modal's "content" option.
*
* The content element will be emptied before this change takes place.
*
* @method fill
* @return {ModalDialog}
*/
ModalDialog.prototype.fill = function fill() {
return this.fillWith(this.content());
};
/**
* Fill the modal's content element with arbitrary content.
*
* The content element will be emptied before this change takes place.
*
* @method fillWith
* @param {Mixed} [content]
* The same rules apply to this as apply to the `content` option.
*
* @return {ModalDialog}
*/
ModalDialog.prototype.fillWith = function fillWith(content) {
var contentEl = this.contentEl();
var parentEl = contentEl.parentNode;
var nextSiblingEl = contentEl.nextSibling;
this.trigger('beforemodalfill');
this.hasBeenFilled_ = true;
// Detach the content element from the DOM before performing
// manipulation to avoid modifying the live DOM multiple times.
parentEl.removeChild(contentEl);
this.empty();
Dom.insertContent(contentEl, content);
this.trigger('modalfill');
// Re-inject the re-filled content element.
if (nextSiblingEl) {
parentEl.insertBefore(contentEl, nextSiblingEl);
} else {
parentEl.appendChild(contentEl);
}
return this;
};
/**
* Empties the content element.
*
* This happens automatically anytime the modal is filled.
*
* @method empty
* @return {ModalDialog}
*/
ModalDialog.prototype.empty = function empty() {
this.trigger('beforemodalempty');
Dom.emptyEl(this.contentEl());
this.trigger('modalempty');
return this;
};
/**
* Gets or sets the modal content, which gets normalized before being
* rendered into the DOM.
*
* This does not update the DOM or fill the modal, but it is called during
* that process.
*
* @method content
* @param {Mixed} [value]
* If defined, sets the internal content value to be used on the
* next call(s) to `fill`. This value is normalized before being
* inserted. To "clear" the internal content value, pass `null`.
*
* @return {Mixed}
*/
ModalDialog.prototype.content = function content(value) {
if (typeof value !== 'undefined') {
this.content_ = value;
}
return this.content_;
};
return ModalDialog;
})(_component2['default']);
ModalDialog.prototype.options_ = {
temporary: true
};
_component2['default'].registerComponent('ModalDialog', ModalDialog);
exports['default'] = ModalDialog;
module.exports = exports['default'];
},{"./close-button":66,"./component":67,"./utils/dom":142,"./utils/fn":144,"./utils/log":147}],113:[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);
var _tracksAudioTrackListJs = _dereq_('./tracks/audio-track-list.js');
var _tracksAudioTrackListJs2 = _interopRequireDefault(_tracksAudioTrackListJs);
var _tracksVideoTrackListJs = _dereq_('./tracks/video-track-list.js');
var _tracksVideoTrackListJs2 = _interopRequireDefault(_tracksVideoTrackListJs);
// 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);
var _modalDialog = _dereq_('./modal-dialog');
var _modalDialog2 = _interopRequireDefault(_modalDialog);
// Require html5 tech, at least for disposing the original video tag
var _techTechJs = _dereq_('./tech/tech.js');
var _techTechJs2 = _interopRequireDefault(_techTechJs);
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;
// If language is not set, get the closest lang attribute
if (!options.language) {
if (typeof tag.closest === 'function') {
var closest = tag.closest('[lang]');
if (closest) {
options.language = closest.getAttribute('lang');
}
} else {
var element = tag;
while (element && element.nodeType === 1) {
if (Dom.getElAttributes(element).hasOwnProperty('lang')) {
options.language = element.getAttribute('lang');
break;
}
element = element.parentNode;
}
}
}
// 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');
}
// Set ARIA label and region role depending on player type
this.el_.setAttribute('role', 'region');
if (this.isAudio()) {
this.el_.setAttribute('aria-label', 'audio player');
} else {
this.el_.setAttribute('aria-label', 'video player');
}
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');
// }
// iOS Safari has broken hover handling
if (!browser.IS_IOS) {
this.addClass('vjs-workinghover');
}
// 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) {
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.playerId = tag.id;
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
if (_globalWindow2['default'].VIDEOJS_NO_DYNAMIC_STYLE !== true) {
this.styleEl_ = stylesheet.createStyleElement('vjs-styles-dimensions');
var defaultsStyleEl = Dom.$('.vjs-styles-defaults');
var head = Dom.$('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);
// Hide any links within the video/audio tag, because IE doesn't hide them completely.
var links = tag.getElementsByTagName('a');
for (var i = 0; i < links.length; i++) {
var linkEl = links.item(i);
Dom.addElClass(linkEl, 'vjs-hidden');
linkEl.setAttribute('hidden', 'hidden');
}
// 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);
}
// insert the tag as the first child of the player element
// then manually add it to the children array so that this.addChild
// will work properly for other components
Dom.insertElFirst(tag, el); // Breaks iPhone, fixed in HTML5 setup.
this.children_.unshift(tag);
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_() {
if (_globalWindow2['default'].VIDEOJS_NO_DYNAMIC_STYLE === true) {
var _width = typeof this.width_ === 'number' ? this.width_ : this.options_.width;
var _height = typeof this.height_ === 'number' ? this.height_ : this.options_.height;
var techEl = this.tech_ && this.tech_.el();
if (techEl) {
if (_width >= 0) {
techEl.width = _width;
}
if (_height >= 0) {
techEl.height = _height;
}
}
return;
}
var width = undefined;
var height = undefined;
var aspectRatio = undefined;
var idClass = 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;
}
// Ensure the CSS class is valid by starting with an alpha character
if (/^[^a-zA-Z]/.test(this.id())) {
idClass = 'dimensions-' + this.id();
} else {
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_
* @private
*/
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) {
_techTechJs2['default'].getTech('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;
// 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',
'videoTracks': this.videoTracks_,
'textTracks': this.textTracks_,
'audioTracks': this.audioTracks_,
'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 = _techTechJs2['default'].getTech(techName);
// Support old behavior of techs being registered as components.
// Remove once that deprecated behavior is removed.
if (!techComponent) {
techComponent = _componentJs2['default'].getComponent(techName);
}
this.tech_ = new techComponent(techOptions);
// player.triggerReady is always async, so don't need this to be async
this.tech_.ready(Fn.bind(this, this.handleTechReady_), true);
_tracksTextTrackListConverterJs2['default'].jsonToTextTracks(this.textTracksJson_ || [], this.tech_);
// Listen to all HTML5-defined events and trigger them on the player
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.handleTechTextTrackChange_);
this.on(this.tech_, 'loadedmetadata', this.updateStyleEl_);
this.on(this.tech_, 'posterchange', this.handleTechPosterChange_);
this.on(this.tech_, 'textdata', this.handleTechTextData_);
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;
}
};
/**
* Unload playback technology
*
* @method unloadTech_
* @private
*/
Player.prototype.unloadTech_ = function unloadTech_() {
// Save the current text tracks so that we can reuse the same text tracks with the next tech
this.videoTracks_ = this.videoTracks();
this.textTracks_ = this.textTracks();
this.audioTracks_ = this.audioTracks();
this.textTracksJson_ = _tracksTextTrackListConverterJs2['default'].textTracksToJson(this.tech_);
this.isReady_ = false;
this.tech_.dispose();
this.tech_ = false;
};
/**
* Return a reference to the current tech.
* It will only return a reference to the tech if given an object with the
* `IWillNotUseThisInPlugins` property on it. This is try and prevent misuse
* of techs by plugins.
*
* @param {Object}
* @return {Object} The Tech
* @method tech
*/
Player.prototype.tech = function tech(safety) {
if (safety && safety.IWillNotUseThisInPlugins) {
return this.tech_;
}
var errorText = '\n Please make sure that you are not using this inside of a plugin.\n To disable this alert and error, please pass in an object with\n `IWillNotUseThisInPlugins` to the `tech` method. See\n https://github.com/videojs/video.js/issues/2617 for more info.\n ';
_globalWindow2['default'].alert(errorText);
throw new Error(errorText);
};
/**
* 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
*
* @private
* @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_
* @private
*/
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
*
* @method handleTechReady_
* @private
*/
Player.prototype.handleTechReady_ = function handleTechReady_() {
this.triggerReady();
// Keep the same volume as before
if (this.cache_.volume) {
this.techCall_('setVolume', this.cache_.volume);
}
// Look if the tech found a higher resolution poster while loading
this.handleTechPosterChange_();
// Update the duration if available
this.handleTechDurationChange_();
// 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.src() || this.currentSrc()) && this.tag && this.options_.autoplay && this.paused()) {
try {
delete this.tag.poster; // Chrome Fix. Fixed in Chrome v16.
} catch (e) {
_utilsLogJs2['default']('deleting tag.poster throws in some browsers', e);
}
this.play();
}
};
/**
* Fired when the user agent begins looking for media data
*
* @private
* @method handleTechLoadStart_
*/
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
* @private
* @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
*
* @private
* @method handleTechPlay_
*/
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
*
* @private
* @method handleTechWaiting_
*/
Player.prototype.handleTechWaiting_ = function handleTechWaiting_() {
var _this2 = this;
this.addClass('vjs-waiting');
this.trigger('waiting');
this.one('timeupdate', function () {
return _this2.removeClass('vjs-waiting');
});
};
/**
* A handler for events that signal that waiting has ended
* which is not consistent between browsers. See #1351
*
* @private
* @method handleTechCanPlay_
*/
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
*
* @private
* @method handleTechCanPlayThrough_
*/
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
*
* @private
* @method handleTechPlaying_
*/
Player.prototype.handleTechPlaying_ = function handleTechPlaying_() {
this.removeClass('vjs-waiting');
this.trigger('playing');
};
/**
* Fired whenever the player is jumping to a new time
*
* @private
* @method handleTechSeeking_
*/
Player.prototype.handleTechSeeking_ = function handleTechSeeking_() {
this.addClass('vjs-seeking');
this.trigger('seeking');
};
/**
* Fired when the player has finished jumping to a new time
*
* @private
* @method handleTechSeeked_
*/
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.
*
* @private
* @method handleTechFirstPlay_
*/
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
*
* @private
* @method handleTechPause_
*/
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
*
* @private
* @method handleTechProgress_
*/
Player.prototype.handleTechProgress_ = function handleTechProgress_() {
this.trigger('progress');
};
/**
* Fired when the end of the media resource is reached (currentTime == duration)
*
* @private
* @method handleTechEnded_
*/
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
*
* @private
* @method handleTechDurationChange_
*/
Player.prototype.handleTechDurationChange_ = function handleTechDurationChange_() {
this.duration(this.techGet_('duration'));
};
/**
* Handle a click on the media element to play/pause
*
* @param {Object=} event Event object
* @private
* @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.
*
* @private
* @method handleTechTap_
*/
Player.prototype.handleTechTap_ = function handleTechTap_() {
this.userActive(!this.userActive());
};
/**
* Handle touch to start
*
* @private
* @method handleTechTouchStart_
*/
Player.prototype.handleTechTouchStart_ = function handleTechTouchStart_() {
this.userWasActive = this.userActive();
};
/**
* Handle touch to move
*
* @private
* @method handleTechTouchMove_
*/
Player.prototype.handleTechTouchMove_ = function handleTechTouchMove_() {
if (this.userWasActive) {
this.reportUserActivity();
}
};
/**
* Handle touch to end
*
* @private
* @method handleTechTouchEnd_
*/
Player.prototype.handleTechTouchEnd_ = function handleTechTouchEnd_(event) {
// Stop the mouse events from also happening
event.preventDefault();
};
/**
* Fired when the player switches in or out of fullscreen mode
*
* @private
* @method handleFullscreenChange_
*/
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
*
* @private
* @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
*
* @private
* @method handleTechError_
*/
Player.prototype.handleTechError_ = function handleTechError_() {
var error = this.tech_.error();
this.error(error);
};
/**
* Fires when the browser is intentionally not getting media data
*
* @private
* @method handleTechSuspend_
*/
Player.prototype.handleTechSuspend_ = function handleTechSuspend_() {
this.trigger('suspend');
};
/**
* Fires when the loading of an audio/video is aborted
*
* @private
* @method handleTechAbort_
*/
Player.prototype.handleTechAbort_ = function handleTechAbort_() {
this.trigger('abort');
};
/**
* Fires when the current playlist is empty
*
* @private
* @method handleTechEmptied_
*/
Player.prototype.handleTechEmptied_ = function handleTechEmptied_() {
this.trigger('emptied');
};
/**
* Fires when the browser is trying to get media data, but data is not available
*
* @private
* @method handleTechStalled_
*/
Player.prototype.handleTechStalled_ = function handleTechStalled_() {
this.trigger('stalled');
};
/**
* Fires when the browser has loaded meta data for the audio/video
*
* @private
* @method handleTechLoadedMetaData_
*/
Player.prototype.handleTechLoadedMetaData_ = function handleTechLoadedMetaData_() {
this.trigger('loadedmetadata');
};
Player.prototype.handleTechTextData_ = function handleTechTextData_() {
var data = null;
if (arguments.length > 1) {
data = arguments[1];
}
this.trigger('textdata', data);
};
/**
* Fires when the browser has loaded the current frame of the audio/video
*
* @private
* @method handleTechLoadedData_
*/
Player.prototype.handleTechLoadedData_ = function handleTechLoadedData_() {
this.trigger('loadeddata');
};
/**
* Fires when the current playback position has changed
*
* @private
* @method handleTechTimeUpdate_
*/
Player.prototype.handleTechTimeUpdate_ = function handleTechTimeUpdate_() {
this.trigger('timeupdate');
};
/**
* Fires when the playing speed of the audio/video is changed
*
* @private
* @method handleTechRateChange_
*/
Player.prototype.handleTechRateChange_ = function handleTechRateChange_() {
this.trigger('ratechange');
};
/**
* Fires when the volume has been changed
*
* @private
* @method handleTechVolumeChange_
*/
Player.prototype.handleTechVolumeChange_ = function handleTechVolumeChange_() {
this.trigger('volumechange');
};
/**
* Fires when the text track has been changed
*
* @private
* @method handleTechTextTrackChange_
*/
Player.prototype.handleTechTextTrackChange_ = function handleTechTextTrackChange_() {
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
* @private
* @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_ && 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}
* @private
* @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() {
// Only calls the tech's play if we already have a src loaded
if (this.src() || this.currentSrc()) {
this.techCall_('play');
} else {
this.tech_.one('loadstart', function () {
this.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) {
return this.cache_.duration || 0;
}
seconds = parseFloat(seconds) || 0;
// Standardize on Inifity for signaling video is live
if (seconds < 0) {
seconds = Infinity;
}
if (seconds !== this.cache_.duration) {
// Cache the last set value for optimized scrubbing (esp. Flash)
this.cache_.duration = seconds;
if (seconds === Infinity) {
this.addClass('vjs-live');
} else {
this.removeClass('vjs-live');
}
this.trigger('durationchange');
}
return this;
};
/**
* 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');
};
/**
* Check whether the player can play a given mimetype
*
* @param {String} type The mimetype to check
* @return {String} 'probably', 'maybe', or '' (empty string)
* @method canPlayType
*/
Player.prototype.canPlayType = function canPlayType(type) {
var can = undefined;
// 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 = _techTechJs2['default'].getTech(techName);
// Support old behavior of techs being registered as components.
// Remove once that deprecated behavior is removed.
if (!tech) {
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()) {
can = tech.canPlayType(type);
if (can) {
return can;
}
}
}
return '';
};
/**
* Select source based on tech-order or source-order
* Uses source-order selection if `options.sourceOrder` is truthy. Otherwise,
* defaults to tech-order selection
*
* @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) {
var _this3 = this;
// Get only the techs specified in `techOrder` that exist and are supported by the
// current platform
var techs = this.options_.techOrder.map(_utilsToTitleCaseJs2['default']).map(function (techName) {
// `Component.getComponent(...)` is for support of old behavior of techs
// being registered as components.
// Remove once that deprecated behavior is removed.
return [techName, _techTechJs2['default'].getTech(techName) || _componentJs2['default'].getComponent(techName)];
}).filter(function (_ref) {
var techName = _ref[0];
var tech = _ref[1];
// Check if the current tech is defined before continuing
if (tech) {
// Check if the browser supports this technology
return tech.isSupported();
}
_utilsLogJs2['default'].error('The "' + techName + '" tech is undefined. Skipped browser support check for that tech.');
return false;
});
// Iterate over each `innerArray` element once per `outerArray` element and execute
// `tester` with both. If `tester` returns a non-falsy value, exit early and return
// that value.
var findFirstPassingTechSourcePair = function findFirstPassingTechSourcePair(outerArray, innerArray, tester) {
var found = undefined;
outerArray.some(function (outerChoice) {
return innerArray.some(function (innerChoice) {
found = tester(outerChoice, innerChoice);
if (found) {
return true;
}
});
});
return found;
};
var foundSourceAndTech = undefined;
var flip = function flip(fn) {
return function (a, b) {
return fn(b, a);
};
};
var finder = function finder(_ref2, source) {
var techName = _ref2[0];
var tech = _ref2[1];
if (tech.canPlaySource(source, _this3.options_[techName.toLowerCase()])) {
return { source: source, tech: techName };
}
};
// Depending on the truthiness of `options.sourceOrder`, we swap the order of techs and sources
// to select from them based on their priority.
if (this.options_.sourceOrder) {
// Source-first ordering
foundSourceAndTech = findFirstPassingTechSourcePair(sources, techs, flip(finder));
} else {
// Tech-first ordering
foundSourceAndTech = findFirstPassingTechSourcePair(techs, sources, finder);
}
return foundSourceAndTech || 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 = _techTechJs2['default'].getTech(this.techName_);
// Support old behavior of techs being registered as components.
// Remove once that deprecated behavior is removed.
if (!currentTech) {
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, this.options_[this.techName_.toLowerCase()])) {
// 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;
};
/**
* Reset the player. Loads the first tech in the techOrder,
* and calls `reset` on the tech`.
*
* @return {Player} Returns the player
* @method reset
*/
Player.prototype.reset = function reset() {
this.loadTech_(_utilsToTitleCaseJs2['default'](this.options_.techOrder[0]), null);
this.techCall_('reset');
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 video should autoplay
* @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 video should loop
* @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;
};
/**
* Some techs (e.g. YouTube) can provide a poster source in an
* asynchronous way. We want the poster component to use this
* poster source so that it covers up the tech's controls.
* (YouTube's play button). However we only want to use this
* soruce if the player user hasn't set a poster through
* the normal APIs.
*
* @private
* @method handleTechPosterChange_
*/
Player.prototype.handleTechPosterChange_ = function handleTechPosterChange_() {
if (!this.poster_ && this.tech_ && this.tech_.poster) {
this.poster_ = this.tech_.poster() || '';
// Let components know the poster has changed
this.trigger('posterchange');
}
};
/**
* 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');
if (this.errorDisplay) {
this.errorDisplay.close();
}
return this;
}
// error instance
if (err instanceof _mediaErrorJs2['default']) {
this.error_ = err;
} else {
this.error_ = new _mediaErrorJs2['default'](err);
}
// 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_);
// fire an error event on the player
this.trigger('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
*
* @private
* @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');
};
/**
* Get a video track list
* @link https://html.spec.whatwg.org/multipage/embedded-content.html#videotracklist
*
* @return {VideoTrackList} thes current video track list
* @method videoTracks
*/
Player.prototype.videoTracks = function videoTracks() {
// if we have not yet loadTech_, we create videoTracks_
// these will be passed to the tech during loading
if (!this.tech_) {
this.videoTracks_ = this.videoTracks_ || new _tracksVideoTrackListJs2['default']();
return this.videoTracks_;
}
return this.tech_.videoTracks();
};
/**
* Get an audio track list
* @link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotracklist
*
* @return {AudioTrackList} thes current audio track list
* @method audioTracks
*/
Player.prototype.audioTracks = function audioTracks() {
// if we have not yet loadTech_, we create videoTracks_
// these will be passed to the tech during loading
if (!this.tech_) {
this.audioTracks_ = this.audioTracks_ || new _tracksAudioTrackListJs2['default']();
return this.audioTracks_;
}
return this.tech_.audioTracks();
};
/*
* 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']();
};
/**
* Get an array of remote html track elements
*
* @return {HTMLTrackElement[]}
* @method remoteTextTrackEls
*/
Player.prototype.remoteTextTrackEls = function remoteTextTrackEls() {
return this.tech_ && this.tech_['remoteTextTrackEls']();
};
/**
* 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
*/
// destructure the input into an object with a track argument, defaulting to arguments[0]
// default the whole argument to an empty object if nothing was passed in
Player.prototype.removeRemoteTextTrack = function removeRemoteTextTrack() {
var _ref3 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var _ref3$track = _ref3.track;
var track = _ref3$track === undefined ? arguments[0] : _ref3$track;
// jshint ignore:line
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'); },
// defaultPlaybackRate: function(){ return this.techCall_('defaultPlaybackRate'); },
// defaultMuted: function(){ return this.techCall_('defaultMuted'); }
/**
* 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;
};
/**
* Creates a simple modal dialog (an instance of the `ModalDialog`
* component) that immediately overlays the player with arbitrary
* content and removes itself when closed.
*
* @param {String|Function|Element|Array|Null} content
* Same as `ModalDialog#content`'s param of the same name.
*
* The most straight-forward usage is to provide a string or DOM
* element.
*
* @param {Object} [options]
* Extra options which will be passed on to the `ModalDialog`.
*
* @return {ModalDialog}
*/
Player.prototype.createModal = function createModal(content, options) {
var player = this;
options = options || {};
options.content = content || '';
var modal = new _modalDialog2['default'](player, options);
player.addChild(modal);
modal.on('dispose', function () {
player.removeChild(modal);
});
return modal.open();
};
/**
* 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: 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 media.'
};
/**
* Fired when the user agent begins looking for media data
*
* @event loadstart
*/
Player.prototype.handleTechLoadStart_;
/**
* Fired when the player has initial duration and dimension information
*
* @event loadedmetadata
*/
Player.prototype.handleLoadedMetaData_;
/**
* Fired when the player receives text data
*
* @event textdata
*/
Player.prototype.handleTextData_;
/**
* Fired when the player has downloaded data at the current playback position
*
* @event loadeddata
*/
Player.prototype.handleLoadedData_;
/**
* 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 video playback ends
*
* @event ended
*/
Player.prototype.handleTechEnded_;
/**
* 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":63,"./component.js":67,"./control-bar/control-bar.js":70,"./error-display.js":103,"./fullscreen-api.js":106,"./loading-spinner.js":107,"./media-error.js":108,"./modal-dialog":112,"./poster-image.js":117,"./tech/html5.js":122,"./tech/loader.js":123,"./tech/tech.js":124,"./tracks/audio-track-list.js":125,"./tracks/text-track-display.js":130,"./tracks/text-track-list-converter.js":131,"./tracks/text-track-settings.js":133,"./tracks/video-track-list.js":138,"./utils/browser.js":140,"./utils/buffer.js":141,"./utils/dom.js":142,"./utils/events.js":143,"./utils/fn.js":144,"./utils/guid.js":146,"./utils/log.js":147,"./utils/merge-options.js":148,"./utils/stylesheet.js":149,"./utils/time-ranges.js":150,"./utils/to-title-case.js":151,"global/document":1,"global/window":2,"object.assign":45,"safe-json-parse/tuple":54}],114:[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":113}],115:[function(_dereq_,module,exports){
/**
* @file popup-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 _clickableComponentJs = _dereq_('../clickable-component.js');
var _clickableComponentJs2 = _interopRequireDefault(_clickableComponentJs);
var _componentJs = _dereq_('../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _popupJs = _dereq_('./popup.js');
var _popupJs2 = _interopRequireDefault(_popupJs);
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 control
*
* @param {Player|Object} player
* @param {Object=} options
* @extends ClickableComponent
* @class PopupButton
*/
var PopupButton = (function (_ClickableComponent) {
_inherits(PopupButton, _ClickableComponent);
function PopupButton(player) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, PopupButton);
_ClickableComponent.call(this, player, options);
this.update();
}
/**
* Update popup
*
* @method update
*/
PopupButton.prototype.update = function update() {
var popup = this.createPopup();
if (this.popup) {
this.removeChild(this.popup);
}
this.popup = popup;
this.addChild(popup);
if (this.items && this.items.length === 0) {
this.hide();
} else if (this.items && this.items.length > 1) {
this.show();
}
};
/**
* Create popup - Override with specific functionality for component
*
* @return {Popup} The constructed popup
* @method createPopup
*/
PopupButton.prototype.createPopup = function createPopup() {};
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
PopupButton.prototype.createEl = function createEl() {
return _ClickableComponent.prototype.createEl.call(this, 'div', {
className: this.buildCSSClass()
});
};
/**
* Allow sub components to stack CSS class names
*
* @return {String} The constructed class name
* @method buildCSSClass
*/
PopupButton.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 + ' ' + _ClickableComponent.prototype.buildCSSClass.call(this);
};
return PopupButton;
})(_clickableComponentJs2['default']);
_componentJs2['default'].registerComponent('PopupButton', PopupButton);
exports['default'] = PopupButton;
module.exports = exports['default'];
},{"../clickable-component.js":65,"../component.js":67,"../utils/dom.js":142,"../utils/fn.js":144,"../utils/to-title-case.js":151,"./popup.js":116}],116:[function(_dereq_,module,exports){
/**
* @file popup.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 Popup component is used to build pop up controls.
*
* @extends Component
* @class Popup
*/
var Popup = (function (_Component) {
_inherits(Popup, _Component);
function Popup() {
_classCallCheck(this, Popup);
_Component.apply(this, arguments);
}
/**
* Add a popup item to the popup
*
* @param {Object|String} component Component or component type to add
* @method addItem
*/
Popup.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
*/
Popup.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 Popup Buttons,
// where a click on the parent is significant
Events.on(el, 'click', function (event) {
event.preventDefault();
event.stopImmediatePropagation();
});
return el;
};
return Popup;
})(_componentJs2['default']);
_componentJs2['default'].registerComponent('Popup', Popup);
exports['default'] = Popup;
module.exports = exports['default'];
},{"../component.js":67,"../utils/dom.js":142,"../utils/events.js":143,"../utils/fn.js":144}],117:[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 _clickableComponentJs = _dereq_('./clickable-component.js');
var _clickableComponentJs2 = _interopRequireDefault(_clickableComponentJs);
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 (_ClickableComponent) {
_inherits(PosterImage, _ClickableComponent);
function PosterImage(player, options) {
_classCallCheck(this, PosterImage);
_ClickableComponent.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);
_ClickableComponent.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;
})(_clickableComponentJs2['default']);
_componentJs2['default'].registerComponent('PosterImage', PosterImage);
exports['default'] = PosterImage;
module.exports = exports['default'];
},{"./clickable-component.js":65,"./component.js":67,"./utils/browser.js":140,"./utils/dom.js":142,"./utils/fn.js":144}],118:[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) {
if (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":143,"global/document":1,"global/window":2}],119:[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 _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];
var attributes = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
// Add the slider element class to all sub classes
props.className = props.className + ' vjs-slider';
props = _objectAssign2['default']({
tabIndex: 0
}, props);
attributes = _objectAssign2['default']({
'role': 'slider',
'aria-valuenow': 0,
'aria-valuemin': 0,
'aria-valuemax': 100,
tabIndex: 0
}, attributes);
return _Component.prototype.createEl.call(this, type, props, attributes);
};
/**
* Handle mouse down on slider
*
* @param {Object} event Mouse down event object
* @method handleMouseDown
*/
Slider.prototype.handleMouseDown = function handleMouseDown(event) {
var doc = this.bar.el_.ownerDocument;
event.preventDefault();
Dom.blockTextSelection();
this.addClass('vjs-sliding');
this.trigger('slideractive');
this.on(doc, 'mousemove', this.handleMouseMove);
this.on(doc, 'mouseup', this.handleMouseUp);
this.on(doc, 'touchmove', this.handleMouseMove);
this.on(doc, '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() {
var doc = this.bar.el_.ownerDocument;
Dom.unblockTextSelection();
this.removeClass('vjs-sliding');
this.trigger('sliderinactive');
this.off(doc, 'mousemove', this.handleMouseMove);
this.off(doc, 'mouseup', this.handleMouseUp);
this.off(doc, 'touchmove', this.handleMouseMove);
this.off(doc, '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 position = Dom.getPointerPosition(this.el_, event);
if (this.vertical()) {
return position.y;
}
return position.x;
};
/**
* Handle on focus for slider
*
* @method handleFocus
*/
Slider.prototype.handleFocus = function handleFocus() {
this.on(this.bar.el_.ownerDocument, '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(this.bar.el_.ownerDocument, '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":67,"../utils/dom.js":142,"object.assign":45}],120:[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.search(/&(?!\w+=)/);
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 if Flash can play the given videotype
* @param {String} type The mimetype to check
* @return {String} 'probably', 'maybe', or '' (empty string)
*/
Flash.rtmpSourceHandler.canPlayType = function (type) {
if (Flash.isStreamingType(type)) {
return 'maybe';
}
return '';
};
/**
* Check if Flash can handle the source natively
* @param {Object} source The source object
* @param {Object} options The options passed to the tech
* @return {String} 'probably', 'maybe', or '' (empty string)
*/
Flash.rtmpSourceHandler.canHandleSource = function (source, options) {
var can = Flash.rtmpSourceHandler.canPlayType(source.type);
if (can) {
return can;
}
if (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
* @param {Object} options The options to pass to the source
*/
Flash.rtmpSourceHandler.handleSource = function (source, tech, options) {
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'];
},{}],121:[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.1.0/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');
}
};
/**
* Get media duration
*
* @returns {Number} Media duration
*/
Flash.prototype.duration = function duration() {
if (this.readyState() === 0) {
return NaN;
} else {
var duration = this.el_.vjs_getProperty('duration');
return duration >= 0 ? duration : Infinity;
}
};
/**
* 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,startOffsetTime,paused,ended,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 if Flash can play the given videotype
* @param {String} type The mimetype to check
* @return {String} 'probably', 'maybe', or '' (empty string)
*/
Flash.nativeSourceHandler.canPlayType = function (type) {
if (type in Flash.formats) {
return 'maybe';
}
return '';
};
/*
* Check Flash can handle the source natively
*
* @param {Object} source The source object
* @param {Object} options The options passed to the tech
* @return {String} 'probably', 'maybe', or '' (empty string)
*/
Flash.nativeSourceHandler.canHandleSource = function (source, options) {
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();
}
return Flash.nativeSourceHandler.canPlayType(type);
};
/*
* 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
* @param {Object} options The options to pass to the source
*/
Flash.nativeSourceHandler.handleSource = function (source, tech, options) {
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, Array.prototype.slice.call(arguments, 2));
};
// 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);
_tech2['default'].registerTech('Flash', Flash);
exports['default'] = Flash;
module.exports = exports['default'];
},{"../component":67,"../utils/dom.js":142,"../utils/time-ranges.js":150,"../utils/url.js":152,"./flash-rtmp":120,"./tech":124,"global/window":2,"object.assign":45}],122:[function(_dereq_,module,exports){
/**
* @file html5.js
* HTML5 Media Controller - Wrapper for HTML5 Media API
*/
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['Text Tracks are being loaded from another origin but the crossorigin attribute isn\'t used. \n This may prevent text tracks from loading.'], ['Text Tracks are being loaded from another origin but the crossorigin attribute isn\'t used. \n This may prevent text tracks from loading.']);
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; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
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 _tsml = _dereq_('tsml');
var _tsml2 = _interopRequireDefault(_tsml);
var _srcJsTracksTextTrackJs = _dereq_('../../../src/js/tracks/text-track.js');
var _srcJsTracksTextTrackJs2 = _interopRequireDefault(_srcJsTracksTextTrackJs);
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);
var _utilsToTitleCaseJs = _dereq_('../utils/to-title-case.js');
var _utilsToTitleCaseJs2 = _interopRequireDefault(_utilsToTitleCaseJs);
/**
* 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) {
var _this = this;
_classCallCheck(this, Html5);
_Tech.call(this, options, ready);
var source = options.source;
var crossoriginTracks = false;
// 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);
} else {
this.handleLateInit_(this.el_);
}
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 {
// store HTMLTrackElement and TextTrack to remote list
this.remoteTextTrackEls().addTrackElement_(node);
this.remoteTextTracks().addTrack_(node.track);
if (!crossoriginTracks && !this.el_.hasAttribute('crossorigin') && Url.isCrossOrigin(node.src)) {
crossoriginTracks = true;
}
}
}
}
for (var i = 0; i < removeNodes.length; i++) {
this.el_.removeChild(removeNodes[i]);
}
}
var trackTypes = ['audio', 'video'];
// ProxyNativeTextTracks
trackTypes.forEach(function (type) {
var capitalType = _utilsToTitleCaseJs2['default'](type);
if (!_this['featuresNative' + capitalType + 'Tracks']) {
return;
}
var tl = _this.el()[type + 'Tracks'];
if (tl && tl.addEventListener) {
tl.addEventListener('change', Fn.bind(_this, _this['handle' + capitalType + 'TrackChange_']));
tl.addEventListener('addtrack', Fn.bind(_this, _this['handle' + capitalType + 'TrackAdd_']));
tl.addEventListener('removetrack', Fn.bind(_this, _this['handle' + capitalType + 'TrackRemove_']));
// Remove (native) trackts that are not used anymore
_this.on('loadstart', _this['removeOld' + capitalType + 'Tracks_']);
}
});
if (this.featuresNativeTextTracks) {
if (crossoriginTracks) {
_utilsLogJs2['default'].warn(_tsml2['default'](_templateObject));
}
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 || browser.IS_IPHONE || browser.IS_NATIVE_ANDROID) && options.nativeControlsForTouch === true) {
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 _this2 = this;
// Un-ProxyNativeTracks
['audio', 'video', 'text'].forEach(function (type) {
var capitalType = _utilsToTitleCaseJs2['default'](type);
var tl = _this2.el_[type + 'Tracks'];
if (tl && tl.removeEventListener) {
tl.removeEventListener('change', _this2['handle' + capitalType + 'TrackChange_']);
tl.removeEventListener('addtrack', _this2['handle' + capitalType + 'TrackAdd_']);
tl.removeEventListener('removetrack', _this2['handle' + capitalType + 'TrackRemove_']);
}
// Stop removing old text tracks
if (tl) {
_this2.off('loadstart', _this2['removeOld' + capitalType + 'Tracks_']);
}
});
Html5.disposeMediaElement(this.el_);
// tech will handle clearing of the emulated track list
_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;
};
// 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.
Html5.prototype.handleLateInit_ = function handleLateInit_(el) {
var _this3 = this;
if (el.networkState === 0 || el.networkState === 3) {
// The video element hasn't started loading the source yet
// or didn't find a source
return;
}
if (el.readyState === 0) {
var _ret = (function () {
// NetworkState is set synchronously BUT loadstart is fired at the
// end of the current stack, usually before setInterval(fn, 0).
// So at this point we know loadstart may have already fired or is
// about to fire, and either way the player hasn't seen it yet.
// We don't want to fire loadstart prematurely here and cause a
// double loadstart so we'll wait and see if it happens between now
// and the next loop, and fire it if not.
// HOWEVER, we also want to make sure it fires before loadedmetadata
// which could also happen between now and the next loop, so we'll
// watch for that also.
var loadstartFired = false;
var setLoadstartFired = function setLoadstartFired() {
loadstartFired = true;
};
_this3.on('loadstart', setLoadstartFired);
var triggerLoadstart = function triggerLoadstart() {
// We did miss the original loadstart. Make sure the player
// sees loadstart before loadedmetadata
if (!loadstartFired) {
this.trigger('loadstart');
}
};
_this3.on('loadedmetadata', triggerLoadstart);
_this3.ready(function () {
this.off('loadstart', setLoadstartFired);
this.off('loadedmetadata', triggerLoadstart);
if (!loadstartFired) {
// We did miss the original native loadstart. Fire it now.
this.trigger('loadstart');
}
});
return {
v: undefined
};
})();
if (typeof _ret === 'object') return _ret.v;
}
// From here on we know that loadstart already fired and we missed it.
// The other readyState events aren't as much of a problem if we double
// them, so not going to go to as much trouble as loadstart to prevent
// that unless we find reason to.
var eventsToTrigger = ['loadstart'];
// loadedmetadata: newly equal to HAVE_METADATA (1) or greater
eventsToTrigger.push('loadedmetadata');
// loadeddata: newly increased to HAVE_CURRENT_DATA (2) or greater
if (el.readyState >= 2) {
eventsToTrigger.push('loadeddata');
}
// canplay: newly increased to HAVE_FUTURE_DATA (3) or greater
if (el.readyState >= 3) {
eventsToTrigger.push('canplay');
}
// canplaythrough: newly equal to HAVE_ENOUGH_DATA (4)
if (el.readyState >= 4) {
eventsToTrigger.push('canplaythrough');
}
// We still need to give the player time to add event listeners
this.ready(function () {
eventsToTrigger.forEach(function (type) {
this.trigger(type);
}, this);
});
};
Html5.prototype.proxyNativeTextTracks_ = function proxyNativeTextTracks_() {
var tt = this.el().textTracks;
if (tt) {
// Add tracks - if player is initialised after DOM loaded, textTracks
// will not trigger addtrack
for (var i = 0; i < tt.length; i++) {
this.textTracks().addTrack_(tt[i]);
}
if (tt.addEventListener) {
tt.addEventListener('change', this.handleTextTrackChange_);
tt.addEventListener('addtrack', this.handleTextTrackAdd_);
tt.addEventListener('removetrack', this.handleTextTrackRemove_);
}
// Remove (native) texttracks that are not used anymore
this.on('loadstart', this.removeOldTextTracks_);
}
};
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);
};
Html5.prototype.handleVideoTrackChange_ = function handleVideoTrackChange_(e) {
var vt = this.videoTracks();
this.videoTracks().trigger({
type: 'change',
target: vt,
currentTarget: vt,
srcElement: vt
});
};
Html5.prototype.handleVideoTrackAdd_ = function handleVideoTrackAdd_(e) {
this.videoTracks().addTrack_(e.track);
};
Html5.prototype.handleVideoTrackRemove_ = function handleVideoTrackRemove_(e) {
this.videoTracks().removeTrack_(e.track);
};
Html5.prototype.handleAudioTrackChange_ = function handleAudioTrackChange_(e) {
var audioTrackList = this.audioTracks();
this.audioTracks().trigger({
type: 'change',
target: audioTrackList,
currentTarget: audioTrackList,
srcElement: audioTrackList
});
};
Html5.prototype.handleAudioTrackAdd_ = function handleAudioTrackAdd_(e) {
this.audioTracks().addTrack_(e.track);
};
Html5.prototype.handleAudioTrackRemove_ = function handleAudioTrackRemove_(e) {
this.audioTracks().removeTrack_(e.track);
};
/**
* This is a helper function that is used in removeOldTextTracks_, removeOldAudioTracks_ and
* removeOldVideoTracks_
* @param {Track[]} techTracks Tracks for this tech
* @param {Track[]} elTracks Tracks for the HTML5 video element
* @private
*/
Html5.prototype.removeOldTracks_ = function removeOldTracks_(techTracks, elTracks) {
// This will loop over the techTracks and check if they are still used by the HTML5 video element
// If not, they will be removed from the emulated list
var removeTracks = [];
if (!elTracks) {
return;
}
for (var i = 0; i < techTracks.length; i++) {
var techTrack = techTracks[i];
var found = false;
for (var j = 0; j < elTracks.length; j++) {
if (elTracks[j] === techTrack) {
found = true;
break;
}
}
if (!found) {
removeTracks.push(techTrack);
}
}
for (var i = 0; i < removeTracks.length; i++) {
var _track = removeTracks[i];
techTracks.removeTrack_(_track);
}
};
Html5.prototype.removeOldTextTracks_ = function removeOldTextTracks_() {
var techTracks = this.textTracks();
var elTracks = this.el().textTracks;
this.removeOldTracks_(techTracks, elTracks);
};
Html5.prototype.removeOldAudioTracks_ = function removeOldAudioTracks_() {
var techTracks = this.audioTracks();
var elTracks = this.el().audioTracks;
this.removeOldTracks_(techTracks, elTracks);
};
Html5.prototype.removeOldVideoTracks_ = function removeOldVideoTracks_() {
var techTracks = this.videoTracks();
var elTracks = this.el().videoTracks;
this.removeOldTracks_(techTracks, elTracks);
};
/**
* 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();
};
/**
* Reset the tech. Removes all sources and calls `load`.
*
* @method reset
*/
Html5.prototype.reset = function reset() {
Html5.resetMediaElement(this.el_);
};
/**
* Get current source
*
* @return {Object}
* @method currentSrc
*/
Html5.prototype.currentSrc = function currentSrc() {
if (this.currentSource_) {
return this.currentSource_.src;
} else {
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 a remote text track object and returns a html track element
*
* @param {Object} options The object should contain values for
* kind, language, label and src (location of the WebVTT file)
* @return {HTMLTrackElement}
* @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 htmlTrackElement = _globalDocument2['default'].createElement('track');
if (options.kind) {
htmlTrackElement.kind = options.kind;
}
if (options.label) {
htmlTrackElement.label = options.label;
}
if (options.language || options.srclang) {
htmlTrackElement.srclang = options.language || options.srclang;
}
if (options['default']) {
htmlTrackElement['default'] = options['default'];
}
if (options.id) {
htmlTrackElement.id = options.id;
}
if (options.src) {
htmlTrackElement.src = options.src;
}
this.el().appendChild(htmlTrackElement);
// store HTMLTrackElement and TextTrack to remote list
this.remoteTextTrackEls().addTrackElement_(htmlTrackElement);
this.remoteTextTracks().addTrack_(htmlTrackElement.track);
return htmlTrackElement;
};
/**
* 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 = undefined,
i = undefined;
var trackElement = this.remoteTextTrackEls().getTrackElementByTrack_(track);
// remove HTMLTrackElement and TextTrack from remote list
this.remoteTextTrackEls().removeTrackElement_(trackElement);
this.remoteTextTracks().removeTrack_(track);
tracks = this.$$('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 play the given videotype
*
* @param {String} type The mimetype to check
* @return {String} 'probably', 'maybe', or '' (empty string)
*/
Html5.nativeSourceHandler.canPlayType = function (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 '';
}
};
/*
* Check if the video element can handle the source natively
*
* @param {Object} source The source object
* @param {Object} options The options passed to the tech
* @return {String} 'probably', 'maybe', or '' (empty string)
*/
Html5.nativeSourceHandler.canHandleSource = function (source, options) {
var match, ext;
// If a type was provided we should rely on that
if (source.type) {
return Html5.nativeSourceHandler.canPlayType(source.type);
} else if (source.src) {
// If no type, fall back to checking 'video/[EXTENSION]'
ext = Url.getFileExtension(source.src);
return Html5.nativeSourceHandler.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
* @param {Object} options The options to pass to the source
*/
Html5.nativeSourceHandler.handleSource = function (source, tech, options) {
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 () {
// IE will error if Windows Media Player not installed #3315
try {
var volume = Html5.TEST_VID.volume;
Html5.TEST_VID.volume = volume / 2 + 0.1;
return volume !== Html5.TEST_VID.volume;
} catch (e) {
return false;
}
};
/*
* Check if playbackRate is supported in this browser/device.
*
* @return {Boolean}
*/
Html5.canControlPlaybackRate = function () {
// Playback rate API is implemented in Android Chrome, but doesn't do anything
// https://github.com/videojs/video.js/issues/3180
if (browser.IS_ANDROID && browser.IS_CHROME) {
return false;
}
// IE will error if Windows Media Player not installed #3315
try {
var playbackRate = Html5.TEST_VID.playbackRate;
Html5.TEST_VID.playbackRate = playbackRate / 2 + 0.1;
return playbackRate !== Html5.TEST_VID.playbackRate;
} catch (e) {
return false;
}
};
/*
* 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;
};
/*
* Check to see if native video tracks are supported by this browser/device
*
* @return {Boolean}
*/
Html5.supportsNativeVideoTracks = function () {
var supportsVideoTracks = !!Html5.TEST_VID.videoTracks;
return supportsVideoTracks;
};
/*
* Check to see if native audio tracks are supported by this browser/device
*
* @return {Boolean}
*/
Html5.supportsNativeAudioTracks = function () {
var supportsAudioTracks = !!Html5.TEST_VID.audioTracks;
return supportsAudioTracks;
};
/**
* 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();
/**
* Sets the tech's status on native text track support
*
* @type {Boolean}
*/
Html5.prototype['featuresNativeVideoTracks'] = Html5.supportsNativeVideoTracks();
/**
* Sets the tech's status on native audio track support
*
* @type {Boolean}
*/
Html5.prototype['featuresNativeAudioTracks'] = Html5.supportsNativeAudioTracks();
// 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
}
})();
}
};
Html5.resetMediaElement = function (el) {
if (!el) {
return;
}
var sources = el.querySelectorAll('source');
var i = sources.length;
while (i--) {
el.removeChild(sources[i]);
}
// remove any src reference.
// not setting `src=''` because that throws an error
el.removeAttribute('src');
if (typeof el.load === 'function') {
// wrapping in an iife so it's not deoptimized (#1060#discussion_r10324473)
(function () {
try {
el.load();
} catch (e) {}
})();
}
};
_component2['default'].registerComponent('Html5', Html5);
_techJs2['default'].registerTech('Html5', Html5);
exports['default'] = Html5;
module.exports = exports['default'];
},{"../../../src/js/tracks/text-track.js":134,"../component":67,"../utils/browser.js":140,"../utils/dom.js":142,"../utils/fn.js":144,"../utils/log.js":147,"../utils/merge-options.js":148,"../utils/to-title-case.js":151,"../utils/url.js":152,"./tech.js":124,"global/document":1,"global/window":2,"object.assign":45,"tsml":55}],123:[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 _componentJs = _dereq_('../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _techJs = _dereq_('./tech.js');
var _techJs2 = _interopRequireDefault(_techJs);
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 = _techJs2['default'].getTech(techName);
// Support old behavior of techs being registered as components.
// Remove once that deprecated behavior is removed.
if (!techName) {
tech = _componentJs2['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;
})(_componentJs2['default']);
_componentJs2['default'].registerComponent('MediaLoader', MediaLoader);
exports['default'] = MediaLoader;
module.exports = exports['default'];
},{"../component.js":67,"../utils/to-title-case.js":151,"./tech.js":124,"global/window":2}],124:[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 _tracksHtmlTrackElement = _dereq_('../tracks/html-track-element');
var _tracksHtmlTrackElement2 = _interopRequireDefault(_tracksHtmlTrackElement);
var _tracksHtmlTrackElementList = _dereq_('../tracks/html-track-element-list');
var _tracksHtmlTrackElementList2 = _interopRequireDefault(_tracksHtmlTrackElementList);
var _utilsMergeOptionsJs = _dereq_('../utils/merge-options.js');
var _utilsMergeOptionsJs2 = _interopRequireDefault(_utilsMergeOptionsJs);
var _tracksTextTrack = _dereq_('../tracks/text-track');
var _tracksTextTrack2 = _interopRequireDefault(_tracksTextTrack);
var _tracksTextTrackList = _dereq_('../tracks/text-track-list');
var _tracksTextTrackList2 = _interopRequireDefault(_tracksTextTrackList);
var _tracksVideoTrack = _dereq_('../tracks/video-track');
var _tracksVideoTrack2 = _interopRequireDefault(_tracksVideoTrack);
var _tracksVideoTrackList = _dereq_('../tracks/video-track-list');
var _tracksVideoTrackList2 = _interopRequireDefault(_tracksVideoTrackList);
var _tracksAudioTrackList = _dereq_('../tracks/audio-track-list');
var _tracksAudioTrackList2 = _interopRequireDefault(_tracksAudioTrackList);
var _tracksAudioTrack = _dereq_('../tracks/audio-track');
var _tracksAudioTrack2 = _interopRequireDefault(_tracksAudioTrack);
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;
this.videoTracks_ = options.videoTracks;
this.audioTracks_ = options.audioTracks;
// 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();
}
if (options.nativeCaptions === false || options.nativeTextTracks === false) {
this.featuresNativeTextTracks = false;
}
if (!this.featuresNativeTextTracks) {
this.on('ready', this.emulateTextTracks);
}
this.initTextTrackListeners();
this.initTrackListeners();
// Turn on component tap events
this.emitTapEvents();
}
/**
* List of associated text tracks
*
* @type {TextTrackList}
* @private
*/
/* 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 all tracks because we can't reuse them between techs
this.clearTracks(['audio', 'video', 'text']);
// Turn off any manual progress or timeupdate tracking
if (this.manualProgress) {
this.manualProgressOff();
}
if (this.manualTimeUpdates) {
this.manualTimeUpdatesOff();
}
_Component.prototype.dispose.call(this);
};
/**
* clear out a track list, or multiple track lists
*
* Note: Techs without source handlers should call this between
* sources for video & audio tracks, as usually you don't want
* to use them between tracks and we have no automatic way to do
* it for you
*
* @method clearTracks
* @param {Array|String} types type(s) of track lists to empty
*/
Tech.prototype.clearTracks = function clearTracks(types) {
var _this = this;
types = [].concat(types);
// clear out all tracks because we can't reuse them between techs
types.forEach(function (type) {
var list = _this[type + 'Tracks']() || [];
var i = list.length;
while (i--) {
var track = list[i];
if (type === 'text') {
_this.removeRemoteTextTrack(track);
}
list.removeTrack_(track);
}
});
};
/**
* Reset the tech. Removes all sources and resets readyState.
*
* @method reset
*/
Tech.prototype.reset = function reset() {};
/**
* 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);
}));
};
/**
* Initialize audio and video track listeners
*
* @method initTrackListeners
*/
Tech.prototype.initTrackListeners = function initTrackListeners() {
var _this2 = this;
var trackTypes = ['video', 'audio'];
trackTypes.forEach(function (type) {
var trackListChanges = function trackListChanges() {
_this2.trigger(type + 'trackchange');
};
var tracks = _this2[type + 'Tracks']();
tracks.addEventListener('removetrack', trackListChanges);
tracks.addEventListener('addtrack', trackListChanges);
_this2.on('dispose', function () {
tracks.removeEventListener('removetrack', trackListChanges);
tracks.removeEventListener('addtrack', trackListChanges);
});
});
};
/**
* Emulate texttracks
*
* @method emulateTextTracks
*/
Tech.prototype.emulateTextTracks = function emulateTextTracks() {
var _this3 = this;
var tracks = this.textTracks();
if (!tracks) {
return;
}
if (!_globalWindow2['default']['WebVTT'] && this.el().parentNode != null) {
(function () {
var script = _globalDocument2['default'].createElement('script');
script.src = _this3.options_['vtt.js'] || 'https://cdn.rawgit.com/gkatsev/vtt.js/vjs-v0.12.1/dist/vtt.min.js';
script.onload = function () {
_this3.trigger('vttjsloaded');
};
script.onerror = function () {
_this3.trigger('vttjserror');
};
_this3.on('dispose', function () {
script.onload = null;
script.onerror = null;
});
// but have not loaded yet and we set it to true before the inject so that
// we don't overwrite the injected window.WebVTT if it loads right away
_globalWindow2['default']['WebVTT'] = true;
_this3.el().parentNode.appendChild(script);
})();
}
var updateDisplay = function updateDisplay() {
return _this3.trigger('texttrackchange');
};
var textTracksChanges = function textTracksChanges() {
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);
}
}
};
textTracksChanges();
tracks.addEventListener('change', textTracksChanges);
this.on('dispose', function () {
tracks.removeEventListener('change', textTracksChanges);
});
};
/**
* Get videotracks
*
* @returns {VideoTrackList}
* @method videoTracks
*/
Tech.prototype.videoTracks = function videoTracks() {
this.videoTracks_ = this.videoTracks_ || new _tracksVideoTrackList2['default']();
return this.videoTracks_;
};
/**
* Get audiotracklist
*
* @returns {AudioTrackList}
* @method audioTracks
*/
Tech.prototype.audioTracks = function audioTracks() {
this.audioTracks_ = this.audioTracks_ || new _tracksAudioTrackList2['default']();
return this.audioTracks_;
};
/*
* 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_;
};
/**
* Get remote htmltrackelements
*
* @returns {HTMLTrackElementList}
* @method remoteTextTrackEls
*/
Tech.prototype.remoteTextTrackEls = function remoteTextTrackEls() {
this.remoteTextTrackEls_ = this.remoteTextTrackEls_ || new _tracksHtmlTrackElementList2['default']();
return this.remoteTextTrackEls_;
};
/**
* 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 a remote text track object and returns a emulated html track element
*
* @param {Object} options The object should contain values for
* kind, language, label and src (location of the WebVTT file)
* @return {HTMLTrackElement}
* @method addRemoteTextTrack
*/
Tech.prototype.addRemoteTextTrack = function addRemoteTextTrack(options) {
var track = _utilsMergeOptionsJs2['default'](options, {
tech: this
});
var htmlTrackElement = new _tracksHtmlTrackElement2['default'](track);
// store HTMLTrackElement and TextTrack to remote list
this.remoteTextTrackEls().addTrackElement_(htmlTrackElement);
this.remoteTextTracks().addTrack_(htmlTrackElement.track);
// must come after remoteTextTracks()
this.textTracks().addTrack_(htmlTrackElement.track);
return htmlTrackElement;
};
/**
* Remove remote texttrack
*
* @param {TextTrackObject} track Texttrack to remove
* @method removeRemoteTextTrack
*/
Tech.prototype.removeRemoteTextTrack = function removeRemoteTextTrack(track) {
this.textTracks().removeTrack_(track);
var trackElement = this.remoteTextTrackEls().getTrackElementByTrack_(track);
// remove HTMLTrackElement and TextTrack from remote list
this.remoteTextTrackEls().removeTrackElement_(trackElement);
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() {};
/*
* Check if the tech can support the given type
*
* The base tech does not support any type, but source handlers might
* overwrite this.
*
* @param {String} type The mimetype to check
* @return {String} 'probably', 'maybe', or '' (empty string)
*/
Tech.prototype.canPlayType = function canPlayType() {
return '';
};
/*
* Return whether the argument is a Tech or not.
* Can be passed either a Class like `Html5` or a instance like `player.tech_`
*
* @param {Object} component An item to check
* @return {Boolean} Whether it is a tech or not
*/
Tech.isTech = function isTech(component) {
return component.prototype instanceof Tech || component instanceof Tech || component === Tech;
};
/**
* Registers a Tech
*
* @param {String} name Name of the Tech to register
* @param {Object} tech The tech to register
* @static
* @method registerComponent
*/
Tech.registerTech = function registerTech(name, tech) {
if (!Tech.techs_) {
Tech.techs_ = {};
}
if (!Tech.isTech(tech)) {
throw new Error('Tech ' + name + ' must be a Tech');
}
Tech.techs_[name] = tech;
return tech;
};
/**
* Gets a component by name
*
* @param {String} name Name of the component to get
* @return {Component}
* @static
* @method getComponent
*/
Tech.getTech = function getTech(name) {
if (Tech.techs_ && Tech.techs_[name]) {
return Tech.techs_[name];
}
if (_globalWindow2['default'] && _globalWindow2['default'].videojs && _globalWindow2['default'].videojs[name]) {
_utilsLogJs2['default'].warn('The ' + name + ' tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)');
return _globalWindow2['default'].videojs[name];
}
};
return Tech;
})(_component2['default']);
Tech.prototype.textTracks_;
/**
* List of associated audio tracks
*
* @type {AudioTrackList}
* @private
*/
Tech.prototype.audioTracks_;
/**
* List of associated video tracks
*
* @type {VideoTrackList}
* @private
*/
Tech.prototype.videoTracks_;
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);
};
/*
* Check if the tech can support the given type
* @param {String} type The mimetype to check
* @return {String} 'probably', 'maybe', or '' (empty string)
*/
_Tech.canPlayType = function (type) {
var handlers = _Tech.sourceHandlers || [];
var can = undefined;
for (var i = 0; i < handlers.length; i++) {
can = handlers[i].canPlayType(type);
if (can) {
return can;
}
}
return '';
};
/*
* Return the first source handler that supports the source
* TODO: Answer question: should 'probably' be prioritized over 'maybe'
* @param {Object} source The source object
* @param {Object} options The options passed to the tech
* @returns {Object} The first source handler that supports the source
* @returns {null} Null if no source handler is found
*/
_Tech.selectSourceHandler = function (source, options) {
var handlers = _Tech.sourceHandlers || [];
var can = undefined;
for (var i = 0; i < handlers.length; i++) {
can = handlers[i].canHandleSource(source, options);
if (can) {
return handlers[i];
}
}
return null;
};
/*
* Check if the tech can support the given source
* @param {Object} srcObj The source object
* @param {Object} options The options passed to the tech
* @return {String} 'probably', 'maybe', or '' (empty string)
*/
_Tech.canPlaySource = function (srcObj, options) {
var sh = _Tech.selectSourceHandler(srcObj, options);
if (sh) {
return sh.canHandleSource(srcObj, options);
}
return '';
};
/*
* When using a source handler, prefer its implementation of
* any function normally provided by the tech.
*/
var deferrable = ['seekable', 'duration'];
deferrable.forEach(function (fnName) {
var originalFn = this[fnName];
if (typeof originalFn !== 'function') {
return;
}
this[fnName] = function () {
if (this.sourceHandler_ && this.sourceHandler_[fnName]) {
return this.sourceHandler_[fnName].apply(this.sourceHandler_, arguments);
}
return originalFn.apply(this, arguments);
};
}, _Tech.prototype);
/*
* 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, this.options_);
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);
// if we have a source and get another one
// then we are loading something new
// than clear all of our current tracks
if (this.currentSource_) {
this.clearTracks(['audio', 'video']);
this.currentSource_ = null;
}
if (sh !== _Tech.nativeSourceHandler) {
this.currentSource_ = source;
// Catch if someone replaced the src without calling setSource.
// If they do, set currentSource_ to null and dispose our source handler.
this.off(this.el_, 'loadstart', _Tech.prototype.firstLoadStartListener_);
this.off(this.el_, 'loadstart', _Tech.prototype.successiveLoadStartListener_);
this.one(this.el_, 'loadstart', _Tech.prototype.firstLoadStartListener_);
}
this.sourceHandler_ = sh.handleSource(source, this, this.options_);
this.on('dispose', this.disposeSourceHandler);
return this;
};
// On the first loadstart after setSource
_Tech.prototype.firstLoadStartListener_ = function () {
this.one(this.el_, 'loadstart', _Tech.prototype.successiveLoadStartListener_);
};
// On successive loadstarts when setSource has not been called again
_Tech.prototype.successiveLoadStartListener_ = function () {
this.currentSource_ = null;
this.disposeSourceHandler();
this.one(this.el_, 'loadstart', _Tech.prototype.successiveLoadStartListener_);
};
/*
* Clean up any existing source handler
*/
_Tech.prototype.disposeSourceHandler = function () {
if (this.sourceHandler_ && this.sourceHandler_.dispose) {
this.off(this.el_, 'loadstart', _Tech.prototype.firstLoadStartListener_);
this.off(this.el_, 'loadstart', _Tech.prototype.successiveLoadStartListener_);
this.sourceHandler_.dispose();
this.sourceHandler_ = null;
}
};
};
_component2['default'].registerComponent('Tech', Tech);
// Old name for Tech
_component2['default'].registerComponent('MediaTechController', Tech);
Tech.registerTech('Tech', Tech);
exports['default'] = Tech;
module.exports = exports['default'];
},{"../component":67,"../media-error.js":108,"../tracks/audio-track":126,"../tracks/audio-track-list":125,"../tracks/html-track-element":128,"../tracks/html-track-element-list":127,"../tracks/text-track":134,"../tracks/text-track-list":132,"../tracks/video-track":139,"../tracks/video-track-list":138,"../utils/buffer.js":141,"../utils/fn.js":144,"../utils/log.js":147,"../utils/merge-options.js":148,"../utils/time-ranges.js":150,"global/document":1,"global/window":2}],125:[function(_dereq_,module,exports){
/**
* @file audio-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 }; }
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 _trackList = _dereq_('./track-list');
var _trackList2 = _interopRequireDefault(_trackList);
var _utilsBrowserJs = _dereq_('../utils/browser.js');
var browser = _interopRequireWildcard(_utilsBrowserJs);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
/**
* anywhere we call this function we diverge from the spec
* as we only support one enabled audiotrack at a time
*
* @param {Array|AudioTrackList} list list to work on
* @param {AudioTrack} track the track to skip
*/
var disableOthers = function disableOthers(list, track) {
for (var i = 0; i < list.length; i++) {
if (track.id === list[i].id) {
continue;
}
// another audio track is enabled, disable it
list[i].enabled = false;
}
};
/**
* A list of possible audio tracks. All functionality is in the
* base class Tracklist and the spec for AudioTrackList is located at:
* @link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotracklist
*
* interface AudioTrackList : EventTarget {
* readonly attribute unsigned long length;
* getter AudioTrack (unsigned long index);
* AudioTrack? getTrackById(DOMString id);
*
* attribute EventHandler onchange;
* attribute EventHandler onaddtrack;
* attribute EventHandler onremovetrack;
* };
*
* @param {AudioTrack[]} tracks a list of audio tracks to instantiate the list with
* @extends TrackList
* @class AudioTrackList
*/
var AudioTrackList = (function (_TrackList) {
_inherits(AudioTrackList, _TrackList);
function AudioTrackList() {
var tracks = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
_classCallCheck(this, AudioTrackList);
var list = undefined;
// make sure only 1 track is enabled
// sorted from last index to first index
for (var i = tracks.length - 1; i >= 0; i--) {
if (tracks[i].enabled) {
disableOthers(tracks, tracks[i]);
break;
}
}
// IE8 forces us to implement inheritance ourselves
// as it does not support Object.defineProperty properly
if (browser.IS_IE8) {
list = _globalDocument2['default'].createElement('custom');
for (var prop in _trackList2['default'].prototype) {
if (prop !== 'constructor') {
list[prop] = _trackList2['default'].prototype[prop];
}
}
for (var prop in AudioTrackList.prototype) {
if (prop !== 'constructor') {
list[prop] = AudioTrackList.prototype[prop];
}
}
}
list = _TrackList.call(this, tracks, list);
list.changing_ = false;
return list;
}
AudioTrackList.prototype.addTrack_ = function addTrack_(track) {
var _this = this;
if (track.enabled) {
disableOthers(this, track);
}
_TrackList.prototype.addTrack_.call(this, track);
// native tracks don't have this
if (!track.addEventListener) {
return;
}
track.addEventListener('enabledchange', function () {
// when we are disabling other tracks (since we don't support
// more than one track at a time) we will set changing_
// to true so that we don't trigger additional change events
if (_this.changing_) {
return;
}
_this.changing_ = true;
disableOthers(_this, track);
_this.changing_ = false;
_this.trigger('change');
});
};
AudioTrackList.prototype.addTrack = function addTrack(track) {
this.addTrack_(track);
};
AudioTrackList.prototype.removeTrack = function removeTrack(track) {
_TrackList.prototype.removeTrack_.call(this, track);
};
return AudioTrackList;
})(_trackList2['default']);
exports['default'] = AudioTrackList;
module.exports = exports['default'];
},{"../utils/browser.js":140,"./track-list":136,"global/document":1}],126:[function(_dereq_,module,exports){
'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 _trackEnums = _dereq_('./track-enums');
var _track = _dereq_('./track');
var _track2 = _interopRequireDefault(_track);
var _utilsMergeOptions = _dereq_('../utils/merge-options');
var _utilsMergeOptions2 = _interopRequireDefault(_utilsMergeOptions);
var _utilsBrowserJs = _dereq_('../utils/browser.js');
var browser = _interopRequireWildcard(_utilsBrowserJs);
/**
* A single audio text track as defined in:
* @link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotrack
*
* interface AudioTrack {
* readonly attribute DOMString id;
* readonly attribute DOMString kind;
* readonly attribute DOMString label;
* readonly attribute DOMString language;
* attribute boolean enabled;
* };
*
* @param {Object=} options Object of option names and values
* @class AudioTrack
*/
var AudioTrack = (function (_Track) {
_inherits(AudioTrack, _Track);
function AudioTrack() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
_classCallCheck(this, AudioTrack);
var settings = _utilsMergeOptions2['default'](options, {
kind: _trackEnums.AudioTrackKind[options.kind] || ''
});
// on IE8 this will be a document element
// for every other browser this will be a normal object
var track = _Track.call(this, settings);
var enabled = false;
if (browser.IS_IE8) {
for (var prop in AudioTrack.prototype) {
if (prop !== 'constructor') {
track[prop] = AudioTrack.prototype[prop];
}
}
}
Object.defineProperty(track, 'enabled', {
get: function get() {
return enabled;
},
set: function set(newEnabled) {
// an invalid or unchanged value
if (typeof newEnabled !== 'boolean' || newEnabled === enabled) {
return;
}
enabled = newEnabled;
this.trigger('enabledchange');
}
});
// if the user sets this track to selected then
// set selected to that true value otherwise
// we keep it false
if (settings.enabled) {
track.enabled = settings.enabled;
}
track.loaded_ = true;
return track;
}
return AudioTrack;
})(_track2['default']);
exports['default'] = AudioTrack;
module.exports = exports['default'];
},{"../utils/browser.js":140,"../utils/merge-options":148,"./track":137,"./track-enums":135}],127:[function(_dereq_,module,exports){
/**
* @file html-track-element-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; } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var _utilsBrowserJs = _dereq_('../utils/browser.js');
var browser = _interopRequireWildcard(_utilsBrowserJs);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
var HtmlTrackElementList = (function () {
function HtmlTrackElementList() {
var trackElements = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
_classCallCheck(this, HtmlTrackElementList);
var list = this;
if (browser.IS_IE8) {
list = _globalDocument2['default'].createElement('custom');
for (var prop in HtmlTrackElementList.prototype) {
if (prop !== 'constructor') {
list[prop] = HtmlTrackElementList.prototype[prop];
}
}
}
list.trackElements_ = [];
Object.defineProperty(list, 'length', {
get: function get() {
return this.trackElements_.length;
}
});
for (var i = 0, _length = trackElements.length; i < _length; i++) {
list.addTrackElement_(trackElements[i]);
}
if (browser.IS_IE8) {
return list;
}
}
HtmlTrackElementList.prototype.addTrackElement_ = function addTrackElement_(trackElement) {
this.trackElements_.push(trackElement);
};
HtmlTrackElementList.prototype.getTrackElementByTrack_ = function getTrackElementByTrack_(track) {
var trackElement_ = undefined;
for (var i = 0, _length2 = this.trackElements_.length; i < _length2; i++) {
if (track === this.trackElements_[i].track) {
trackElement_ = this.trackElements_[i];
break;
}
}
return trackElement_;
};
HtmlTrackElementList.prototype.removeTrackElement_ = function removeTrackElement_(trackElement) {
for (var i = 0, _length3 = this.trackElements_.length; i < _length3; i++) {
if (trackElement === this.trackElements_[i]) {
this.trackElements_.splice(i, 1);
break;
}
}
};
return HtmlTrackElementList;
})();
exports['default'] = HtmlTrackElementList;
module.exports = exports['default'];
},{"../utils/browser.js":140,"global/document":1}],128:[function(_dereq_,module,exports){
/**
* @file html-track-element.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; } }
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 _utilsBrowserJs = _dereq_('../utils/browser.js');
var browser = _interopRequireWildcard(_utilsBrowserJs);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
var _eventTarget = _dereq_('../event-target');
var _eventTarget2 = _interopRequireDefault(_eventTarget);
var _tracksTextTrack = _dereq_('../tracks/text-track');
var _tracksTextTrack2 = _interopRequireDefault(_tracksTextTrack);
var NONE = 0;
var LOADING = 1;
var LOADED = 2;
var ERROR = 3;
/**
* https://html.spec.whatwg.org/multipage/embedded-content.html#htmltrackelement
*
* interface HTMLTrackElement : HTMLElement {
* attribute DOMString kind;
* attribute DOMString src;
* attribute DOMString srclang;
* attribute DOMString label;
* attribute boolean default;
*
* const unsigned short NONE = 0;
* const unsigned short LOADING = 1;
* const unsigned short LOADED = 2;
* const unsigned short ERROR = 3;
* readonly attribute unsigned short readyState;
*
* readonly attribute TextTrack track;
* };
*
* @param {Object} options TextTrack configuration
* @class HTMLTrackElement
*/
var HTMLTrackElement = (function (_EventTarget) {
_inherits(HTMLTrackElement, _EventTarget);
function HTMLTrackElement() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
_classCallCheck(this, HTMLTrackElement);
_EventTarget.call(this);
var readyState = undefined,
trackElement = this;
if (browser.IS_IE8) {
trackElement = _globalDocument2['default'].createElement('custom');
for (var prop in HTMLTrackElement.prototype) {
if (prop !== 'constructor') {
trackElement[prop] = HTMLTrackElement.prototype[prop];
}
}
}
var track = new _tracksTextTrack2['default'](options);
trackElement.kind = track.kind;
trackElement.src = track.src;
trackElement.srclang = track.language;
trackElement.label = track.label;
trackElement['default'] = track['default'];
Object.defineProperty(trackElement, 'readyState', {
get: function get() {
return readyState;
}
});
Object.defineProperty(trackElement, 'track', {
get: function get() {
return track;
}
});
readyState = NONE;
track.addEventListener('loadeddata', function () {
readyState = LOADED;
trackElement.trigger({
type: 'load',
target: trackElement
});
});
if (browser.IS_IE8) {
return trackElement;
}
}
return HTMLTrackElement;
})(_eventTarget2['default']);
HTMLTrackElement.prototype.allowedEvents_ = {
load: 'load'
};
HTMLTrackElement.NONE = NONE;
HTMLTrackElement.LOADING = LOADING;
HTMLTrackElement.LOADED = LOADED;
HTMLTrackElement.ERROR = ERROR;
exports['default'] = HTMLTrackElement;
module.exports = exports['default'];
},{"../event-target":104,"../tracks/text-track":134,"../utils/browser.js":140,"global/document":1}],129:[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; } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var _utilsBrowserJs = _dereq_('../utils/browser.js');
var browser = _interopRequireWildcard(_utilsBrowserJs);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
/**
* A List of text track cues as defined in:
* 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);
* };
*
* @param {Array} cues A list of cues to be initialized with
* @class TextTrackCueList
*/
var TextTrackCueList = (function () {
function TextTrackCueList(cues) {
_classCallCheck(this, TextTrackCueList);
var list = this;
if (browser.IS_IE8) {
list = _globalDocument2['default'].createElement('custom');
for (var prop in TextTrackCueList.prototype) {
if (prop !== 'constructor') {
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;
}
}
/**
* A setter for cues in this list
*
* @param {Array} cues an array of cues
* @method setCues_
* @private
*/
TextTrackCueList.prototype.setCues_ = function setCues_(cues) {
var oldLength = this.length || 0;
var i = 0;
var l = cues.length;
this.cues_ = cues;
this.length_ = cues.length;
var defineProp = function defineProp(index) {
if (!('' + index in this)) {
Object.defineProperty(this, '' + index, {
get: function get() {
return this.cues_[index];
}
});
}
};
if (oldLength < l) {
i = oldLength;
for (; i < l; i++) {
defineProp.call(this, i);
}
}
};
/**
* Get a cue that is currently in the Cue list by id
*
* @param {String} id
* @method getCueById
* @return {Object} a single cue
*/
TextTrackCueList.prototype.getCueById = function getCueById(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;
};
return TextTrackCueList;
})();
exports['default'] = TextTrackCueList;
module.exports = exports['default'];
},{"../utils/browser.js":140,"global/document":1}],130:[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);
}
var modes = { 'captions': 1, 'subtitles': 1 };
var trackList = this.player_.textTracks();
var firstDesc = undefined;
var firstCaptions = undefined;
if (trackList) {
for (var i = 0; i < trackList.length; i++) {
var track = trackList[i];
if (track['default']) {
if (track.kind === 'descriptions' && !firstDesc) {
firstDesc = track;
} else if (track.kind in modes && !firstCaptions) {
firstCaptions = track;
}
}
}
// We want to show the first default track but captions and subtitles
// take precedence over descriptions.
// So, display the first default captions or subtitles track
// and otherwise the first default descriptions track.
if (firstCaptions) {
firstCaptions.mode = 'showing';
} else if (firstDesc) {
firstDesc.mode = 'showing';
}
}
}));
}
/**
* 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'
}, {
'aria-live': 'assertive',
'aria-atomic': 'true'
});
};
/**
* 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;
}
// Track display prioritization model: if multiple tracks are 'showing',
// display the first 'subtitles' or 'captions' track which is 'showing',
// otherwise display the first 'descriptions' track which is 'showing'
var descriptionsTrack = null;
var captionsSubtitlesTrack = null;
var i = tracks.length;
while (i--) {
var track = tracks[i];
if (track['mode'] === 'showing') {
if (track['kind'] === 'descriptions') {
descriptionsTrack = track;
} else {
captionsSubtitlesTrack = track;
}
}
}
if (captionsSubtitlesTrack) {
this.updateForTrack(captionsSubtitlesTrack);
} else if (descriptionsTrack) {
this.updateForTrack(descriptionsTrack);
}
};
/**
* 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'], cues, this.el_);
var i = cues.length;
while (i--) {
var cue = cues[i];
if (!cue) {
continue;
}
var cueDiv = cue.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":67,"../menu/menu-button.js":109,"../menu/menu-item.js":110,"../menu/menu.js":111,"../utils/fn.js":144,"global/document":1,"global/window":2}],131:[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) {
var ret = ['kind', 'label', 'language', 'id', 'inBandMetadataTrackDispatchType', 'mode', 'src'].reduce(function (acc, prop, i) {
if (track[prop]) {
acc[prop] = track[prop];
}
return acc;
}, {
cues: track.cues && Array.prototype.map.call(track.cues, function (cue) {
return {
startTime: cue.startTime,
endTime: cue.endTime,
text: cue.text,
id: cue.id
};
})
});
return ret;
};
/**
* 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.$$('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);
if (trackEl.src) {
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'];
},{}],132:[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 }; }
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 _trackList = _dereq_('./track-list');
var _trackList2 = _interopRequireDefault(_trackList);
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);
/**
* A list of possible text tracks. All functionality is in the
* base class TrackList. The spec for TextTrackList is located at:
* @link 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;
* };
*
* @param {TextTrack[]} tracks A list of tracks to initialize the list with
* @extends TrackList
* @class TextTrackList
*/
var TextTrackList = (function (_TrackList) {
_inherits(TextTrackList, _TrackList);
function TextTrackList() {
var tracks = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
_classCallCheck(this, TextTrackList);
var list = undefined;
// IE8 forces us to implement inheritance ourselves
// as it does not support Object.defineProperty properly
if (browser.IS_IE8) {
list = _globalDocument2['default'].createElement('custom');
for (var prop in _trackList2['default'].prototype) {
if (prop !== 'constructor') {
list[prop] = _trackList2['default'].prototype[prop];
}
}
for (var prop in TextTrackList.prototype) {
if (prop !== 'constructor') {
list[prop] = TextTrackList.prototype[prop];
}
}
}
list = _TrackList.call(this, tracks, list);
return list;
}
TextTrackList.prototype.addTrack_ = function addTrack_(track) {
_TrackList.prototype.addTrack_.call(this, track);
track.addEventListener('modechange', Fn.bind(this, function () {
this.trigger('change');
}));
};
/**
* Remove TextTrack from TextTrackList
* NOTE: Be mindful of what is passed in as it may be a HTMLTrackElement
*
* @param {TextTrack} rtrack
* @method removeTrack_
* @private
*/
TextTrackList.prototype.removeTrack_ = function removeTrack_(rtrack) {
var track = undefined;
for (var i = 0, l = this.length; i < l; i++) {
if (this[i] === rtrack) {
track = this[i];
if (track.off) {
track.off();
}
this.tracks_.splice(i, 1);
break;
}
}
if (!track) {
return;
}
this.trigger({
track: track,
type: 'removetrack'
});
};
/**
* Get a TextTrack from TextTrackList by a tracks id
*
* @param {String} id - the id of the track to get
* @method getTrackById
* @return {TextTrack}
* @private
*/
TextTrackList.prototype.getTrackById = function getTrackById(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;
};
return TextTrackList;
})(_trackList2['default']);
exports['default'] = TextTrackList;
module.exports = exports['default'];
},{"../utils/browser.js":140,"../utils/fn.js":144,"./track-list":136,"global/document":1}],133:[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.$('.vjs-done-button'), 'click', Fn.bind(this, function () {
this.saveSettings();
this.hide();
}));
Events.on(this.$('.vjs-default-button'), 'click', Fn.bind(this, function () {
this.$('.vjs-fg-color > select').selectedIndex = 0;
this.$('.vjs-bg-color > select').selectedIndex = 0;
this.$('.window-color > select').selectedIndex = 0;
this.$('.vjs-text-opacity > select').selectedIndex = 0;
this.$('.vjs-bg-opacity > select').selectedIndex = 0;
this.$('.vjs-window-opacity > select').selectedIndex = 0;
this.$('.vjs-edge-style select').selectedIndex = 0;
this.$('.vjs-font-family select').selectedIndex = 0;
this.$('.vjs-font-percent select').selectedIndex = 2;
this.updateDisplay();
}));
Events.on(this.$('.vjs-fg-color > select'), 'change', Fn.bind(this, this.updateDisplay));
Events.on(this.$('.vjs-bg-color > select'), 'change', Fn.bind(this, this.updateDisplay));
Events.on(this.$('.window-color > select'), 'change', Fn.bind(this, this.updateDisplay));
Events.on(this.$('.vjs-text-opacity > select'), 'change', Fn.bind(this, this.updateDisplay));
Events.on(this.$('.vjs-bg-opacity > select'), 'change', Fn.bind(this, this.updateDisplay));
Events.on(this.$('.vjs-window-opacity > select'), 'change', Fn.bind(this, this.updateDisplay));
Events.on(this.$('.vjs-font-percent select'), 'change', Fn.bind(this, this.updateDisplay));
Events.on(this.$('.vjs-edge-style select'), 'change', Fn.bind(this, this.updateDisplay));
Events.on(this.$('.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() {
var uniqueId = this.id_;
var dialogLabelId = 'TTsettingsDialogLabel-' + uniqueId;
var dialogDescriptionId = 'TTsettingsDialogDescription-' + uniqueId;
return _Component.prototype.createEl.call(this, 'div', {
className: 'vjs-caption-settings vjs-modal-overlay',
innerHTML: captionOptionsMenuTemplate(uniqueId, dialogLabelId, dialogDescriptionId),
tabIndex: -1
}, {
role: 'dialog',
'aria-labelledby': dialogLabelId,
'aria-describedby': dialogDescriptionId
});
};
/**
* 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 textEdge = getSelectedOptionValue(this.$('.vjs-edge-style select'));
var fontFamily = getSelectedOptionValue(this.$('.vjs-font-family select'));
var fgColor = getSelectedOptionValue(this.$('.vjs-fg-color > select'));
var textOpacity = getSelectedOptionValue(this.$('.vjs-text-opacity > select'));
var bgColor = getSelectedOptionValue(this.$('.vjs-bg-color > select'));
var bgOpacity = getSelectedOptionValue(this.$('.vjs-bg-opacity > select'));
var windowColor = getSelectedOptionValue(this.$('.window-color > select'));
var windowOpacity = getSelectedOptionValue(this.$('.vjs-window-opacity > select'));
var fontPercent = _globalWindow2['default']['parseFloat'](getSelectedOptionValue(this.$('.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) {
setSelectedOption(this.$('.vjs-edge-style select'), values.edgeStyle);
setSelectedOption(this.$('.vjs-font-family select'), values.fontFamily);
setSelectedOption(this.$('.vjs-fg-color > select'), values.color);
setSelectedOption(this.$('.vjs-text-opacity > select'), values.textOpacity);
setSelectedOption(this.$('.vjs-bg-color > select'), values.backgroundColor);
setSelectedOption(this.$('.vjs-bg-opacity > select'), values.backgroundOpacity);
setSelectedOption(this.$('.window-color > select'), values.windowColor);
setSelectedOption(this.$('.vjs-window-opacity > select'), values.windowOpacity);
var fontPercent = values.fontPercent;
if (fontPercent) {
fontPercent = fontPercent.toFixed(2);
}
setSelectedOption(this.$('.vjs-font-percent > select'), fontPercent);
};
/**
* Restore texttrack settings
*
* @method restoreSettings
*/
TextTrackSettings.prototype.restoreSettings = function restoreSettings() {
var err = undefined,
values = undefined;
try {
var _safeParseTuple = _safeJsonParseTuple2['default'](_globalWindow2['default'].localStorage.getItem('vjs-text-track-settings'));
err = _safeParseTuple[0];
values = _safeParseTuple[1];
if (err) {
_utilsLogJs2['default'].error(err);
}
} catch (e) {
_utilsLogJs2['default'].warn(e);
}
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) {
_utilsLogJs2['default'].warn(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(uniqueId, dialogLabelId, dialogDescriptionId) {
var template = '\n <div role="document">\n <div role="heading" aria-level="1" id="' + dialogLabelId + '" class="vjs-control-text">Captions Settings Dialog</div>\n <div id="' + dialogDescriptionId + '" class="vjs-control-text">Beginning of dialog window. Escape will cancel and close the window.</div>\n <div class="vjs-tracksettings">\n <div class="vjs-tracksettings-colors">\n <fieldset class="vjs-fg-color vjs-tracksetting">\n <legend>Text</legend>\n <label class="vjs-label" for="captions-foreground-color-' + uniqueId + '">Color</label>\n <select id="captions-foreground-color-' + uniqueId + '">\n <option value="#FFF" selected>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 <label class="vjs-label" for="captions-foreground-opacity-' + uniqueId + '">Transparency</label>\n <select id="captions-foreground-opacity-' + uniqueId + '">\n <option value="1" selected>Opaque</option>\n <option value="0.5">Semi-Opaque</option>\n </select>\n </span>\n </fieldset>\n <fieldset class="vjs-bg-color vjs-tracksetting">\n <legend>Background</legend>\n <label class="vjs-label" for="captions-background-color-' + uniqueId + '">Color</label>\n <select id="captions-background-color-' + uniqueId + '">\n <option value="#000" selected>Black</option>\n <option value="#FFF">White</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 <label class="vjs-label" for="captions-background-opacity-' + uniqueId + '">Transparency</label>\n <select id="captions-background-opacity-' + uniqueId + '">\n <option value="1" selected>Opaque</option>\n <option value="0.5">Semi-Transparent</option>\n <option value="0">Transparent</option>\n </select>\n </span>\n </fieldset>\n <fieldset class="window-color vjs-tracksetting">\n <legend>Window</legend>\n <label class="vjs-label" for="captions-window-color-' + uniqueId + '">Color</label>\n <select id="captions-window-color-' + uniqueId + '">\n <option value="#000" selected>Black</option>\n <option value="#FFF">White</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 <label class="vjs-label" for="captions-window-opacity-' + uniqueId + '">Transparency</label>\n <select id="captions-window-opacity-' + uniqueId + '">\n <option value="0" selected>Transparent</option>\n <option value="0.5">Semi-Transparent</option>\n <option value="1">Opaque</option>\n </select>\n </span>\n </fieldset>\n </div> <!-- vjs-tracksettings-colors -->\n <div class="vjs-tracksettings-font">\n <div class="vjs-font-percent vjs-tracksetting">\n <label class="vjs-label" for="captions-font-size-' + uniqueId + '">Font Size</label>\n <select id="captions-font-size-' + uniqueId + '">\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>\n <div class="vjs-edge-style vjs-tracksetting">\n <label class="vjs-label" for="captions-edge-style-' + uniqueId + '">Text Edge Style</label>\n <select id="captions-edge-style-' + uniqueId + '">\n <option value="none" selected>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>\n <div class="vjs-font-family vjs-tracksetting">\n <label class="vjs-label" for="captions-font-family-' + uniqueId + '">Font Family</label>\n <select id="captions-font-family-' + uniqueId + '">\n <option value="proportionalSansSerif" selected>Proportional Sans-Serif</option>\n <option value="monospaceSansSerif">Monospace Sans-Serif</option>\n <option value="proportionalSerif">Proportional Serif</option>\n <option value="monospaceSerif">Monospace 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>\n </div> <!-- vjs-tracksettings-font -->\n <div class="vjs-tracksettings-controls">\n <button class="vjs-default-button">Defaults</button>\n <button class="vjs-done-button">Done</button>\n </div>\n </div> <!-- vjs-tracksettings -->\n </div> <!-- role="document" -->';
return template;
}
exports['default'] = TextTrackSettings;
module.exports = exports['default'];
},{"../component":67,"../utils/events.js":143,"../utils/fn.js":144,"../utils/log.js":147,"global/window":2,"safe-json-parse/tuple":54}],134:[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 }; }
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 _textTrackCueList = _dereq_('./text-track-cue-list');
var _textTrackCueList2 = _interopRequireDefault(_textTrackCueList);
var _utilsFnJs = _dereq_('../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _trackEnums = _dereq_('./track-enums');
var _utilsLogJs = _dereq_('../utils/log.js');
var _utilsLogJs2 = _interopRequireDefault(_utilsLogJs);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
var _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
var _trackJs = _dereq_('./track.js');
var _trackJs2 = _interopRequireDefault(_trackJs);
var _utilsUrlJs = _dereq_('../utils/url.js');
var _xhr = _dereq_('xhr');
var _xhr2 = _interopRequireDefault(_xhr);
var _utilsMergeOptions = _dereq_('../utils/merge-options');
var _utilsMergeOptions2 = _interopRequireDefault(_utilsMergeOptions);
var _utilsBrowserJs = _dereq_('../utils/browser.js');
var browser = _interopRequireWildcard(_utilsBrowserJs);
/**
* takes a webvtt file contents and parses it into cues
*
* @param {String} srcContent webVTT file contents
* @param {Track} track track to addcues to
*/
var parseCues = function parseCues(srcContent, track) {
var parser = new _globalWindow2['default'].WebVTT.Parser(_globalWindow2['default'], _globalWindow2['default'].vttjs, _globalWindow2['default'].WebVTT.StringDecoder());
var errors = [];
parser.oncue = function (cue) {
track.addCue(cue);
};
parser.onparsingerror = function (error) {
errors.push(error);
};
parser.onflush = function () {
track.trigger({
type: 'loadeddata',
target: track
});
};
parser.parse(srcContent);
if (errors.length > 0) {
if (console.groupCollapsed) {
console.groupCollapsed('Text Track parsing errors for ' + track.src);
}
errors.forEach(function (error) {
return _utilsLogJs2['default'].error(error);
});
if (console.groupEnd) {
console.groupEnd();
}
}
parser.flush();
};
/**
* load a track from a specifed url
*
* @param {String} src url to load track from
* @param {Track} track track to addcues to
*/
var loadTrack = function loadTrack(src, track) {
var opts = {
uri: src
};
var crossOrigin = _utilsUrlJs.isCrossOrigin(src);
if (crossOrigin) {
opts.cors = crossOrigin;
}
_xhr2['default'](opts, Fn.bind(this, function (err, response, responseBody) {
if (err) {
return _utilsLogJs2['default'].error(err, response);
}
track.loaded_ = true;
// Make sure that vttjs has loaded, otherwise, wait till it finished loading
// NOTE: this is only used for the alt/video.novtt.js build
if (typeof _globalWindow2['default'].WebVTT !== 'function') {
if (track.tech_) {
(function () {
var loadHandler = function loadHandler() {
return parseCues(responseBody, track);
};
track.tech_.on('vttjsloaded', loadHandler);
track.tech_.on('vttjserror', function () {
_utilsLogJs2['default'].error('vttjs failed to load, stopping trying to process ' + track.src);
track.tech_.off('vttjsloaded', loadHandler);
});
})();
}
} else {
parseCues(responseBody, track);
}
}));
};
/**
* A single text track as defined in:
* @link 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;
* };
*
* @param {Object=} options Object of option names and values
* @extends Track
* @class TextTrack
*/
var TextTrack = (function (_Track) {
_inherits(TextTrack, _Track);
function TextTrack() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
_classCallCheck(this, TextTrack);
if (!options.tech) {
throw new Error('A tech was not provided.');
}
var settings = _utilsMergeOptions2['default'](options, {
kind: _trackEnums.TextTrackKind[options.kind] || 'subtitles',
language: options.language || options.srclang || ''
});
var mode = _trackEnums.TextTrackMode[settings.mode] || 'disabled';
var default_ = settings['default'];
if (settings.kind === 'metadata' || settings.kind === 'chapters') {
mode = 'hidden';
}
// on IE8 this will be a document element
// for every other browser this will be a normal object
var tt = _Track.call(this, settings);
tt.tech_ = settings.tech;
if (browser.IS_IE8) {
for (var prop in TextTrack.prototype) {
if (prop !== 'constructor') {
tt[prop] = TextTrack.prototype[prop];
}
}
}
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, 'default', {
get: function get() {
return default_;
},
set: function set() {}
});
Object.defineProperty(tt, 'mode', {
get: function get() {
return mode;
},
set: function set(newMode) {
if (!_trackEnums.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 set() {}
});
Object.defineProperty(tt, 'activeCues', {
get: function get() {
if (!this.loaded_) {
return null;
}
// nothing to do
if (this.cues.length === 0) {
return activeCues;
}
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 (this.activeCues_.indexOf(active[i]) === -1) {
changed = true;
}
}
}
this.activeCues_ = active;
activeCues.setCues_(this.activeCues_);
return activeCues;
},
set: function set() {}
});
if (settings.src) {
tt.src = settings.src;
loadTrack(settings.src, tt);
} else {
tt.loaded_ = true;
}
return tt;
}
/**
* cuechange - One or more cues in the track have become active or stopped being active.
*/
/**
* add a cue to the internal list of cues
*
* @param {Object} cue the cue to add to our internal list
* @method addCue
*/
TextTrack.prototype.addCue = function addCue(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_);
};
/**
* remvoe a cue from our internal list
*
* @param {Object} removeCue the cue to remove from our internal list
* @method removeCue
*/
TextTrack.prototype.removeCue = function removeCue(_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_);
}
};
return TextTrack;
})(_trackJs2['default']);
TextTrack.prototype.allowedEvents_ = {
cuechange: 'cuechange'
};
exports['default'] = TextTrack;
module.exports = exports['default'];
},{"../utils/browser.js":140,"../utils/fn.js":144,"../utils/log.js":147,"../utils/merge-options":148,"../utils/url.js":152,"./text-track-cue-list":129,"./track-enums":135,"./track.js":137,"global/document":1,"global/window":2,"xhr":56}],135:[function(_dereq_,module,exports){
/**
* @file track-kinds.js
*/
/**
* https://html.spec.whatwg.org/multipage/embedded-content.html#dom-videotrack-kind
*
* enum VideoTrackKind {
* "alternative",
* "captions",
* "main",
* "sign",
* "subtitles",
* "commentary",
* "",
* };
*/
'use strict';
exports.__esModule = true;
var VideoTrackKind = {
alternative: 'alternative',
captions: 'captions',
main: 'main',
sign: 'sign',
subtitles: 'subtitles',
commentary: 'commentary'
};
/**
* https://html.spec.whatwg.org/multipage/embedded-content.html#dom-audiotrack-kind
*
* enum AudioTrackKind {
* "alternative",
* "descriptions",
* "main",
* "main-desc",
* "translation",
* "commentary",
* "",
* };
*/
var AudioTrackKind = {
alternative: 'alternative',
descriptions: 'descriptions',
main: 'main',
'main-desc': 'main-desc',
translation: 'translation',
commentary: 'commentary'
};
/**
* 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'
};
/**
* https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackmode
*
* enum TextTrackMode { "disabled", "hidden", "showing" };
*/
var TextTrackMode = {
disabled: 'disabled',
hidden: 'hidden',
showing: 'showing'
};
/* jshint ignore:start */
// we ignore jshint here because it does not see
// AudioTrackKind as defined here
exports['default'] = { VideoTrackKind: VideoTrackKind, AudioTrackKind: AudioTrackKind, TextTrackKind: TextTrackKind, TextTrackMode: TextTrackMode };
/* jshint ignore:end */
module.exports = exports['default'];
},{}],136:[function(_dereq_,module,exports){
/**
* @file 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 }; }
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 _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);
/**
* Common functionaliy between Text, Audio, and Video TrackLists
* Interfaces defined in the following spec:
* @link https://html.spec.whatwg.org/multipage/embedded-content.html
*
* @param {Track[]} tracks A list of tracks to initialize the list with
* @param {Object} list the child object with inheritance done manually for ie8
* @extends EventTarget
* @class TrackList
*/
var TrackList = (function (_EventTarget) {
_inherits(TrackList, _EventTarget);
function TrackList() {
var tracks = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
var list = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
_classCallCheck(this, TrackList);
_EventTarget.call(this);
if (!list) {
list = this;
if (browser.IS_IE8) {
list = _globalDocument2['default'].createElement('custom');
for (var prop in TrackList.prototype) {
if (prop !== 'constructor') {
list[prop] = TrackList.prototype[prop];
}
}
}
}
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]);
}
return list;
}
/**
* 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.
*/
/**
* Add a Track from TrackList
*
* @param {Mixed} track
* @method addTrack_
* @private
*/
TrackList.prototype.addTrack_ = function addTrack_(track) {
var index = this.tracks_.length;
if (!('' + index in this)) {
Object.defineProperty(this, index, {
get: function get() {
return this.tracks_[index];
}
});
}
// Do not add duplicate tracks
if (this.tracks_.indexOf(track) === -1) {
this.tracks_.push(track);
this.trigger({
track: track,
type: 'addtrack'
});
}
};
/**
* Remove a Track from TrackList
*
* @param {Track} rtrack track to be removed
* @method removeTrack_
* @private
*/
TrackList.prototype.removeTrack_ = function removeTrack_(rtrack) {
var track = undefined;
for (var i = 0, l = this.length; i < l; i++) {
if (this[i] === rtrack) {
track = this[i];
if (track.off) {
track.off();
}
this.tracks_.splice(i, 1);
break;
}
}
if (!track) {
return;
}
this.trigger({
track: track,
type: 'removetrack'
});
};
/**
* Get a Track from the TrackList by a tracks id
*
* @param {String} id - the id of the track to get
* @method getTrackById
* @return {Track}
* @private
*/
TrackList.prototype.getTrackById = function getTrackById(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;
};
return TrackList;
})(_eventTarget2['default']);
TrackList.prototype.allowedEvents_ = {
change: 'change',
addtrack: 'addtrack',
removetrack: 'removetrack'
};
// emulate attribute EventHandler support to allow for feature detection
for (var _event in TrackList.prototype.allowedEvents_) {
TrackList.prototype['on' + _event] = null;
}
exports['default'] = TrackList;
module.exports = exports['default'];
},{"../event-target":104,"../utils/browser.js":140,"../utils/fn.js":144,"global/document":1}],137:[function(_dereq_,module,exports){
/**
* @file track.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; } }
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 _utilsBrowserJs = _dereq_('../utils/browser.js');
var browser = _interopRequireWildcard(_utilsBrowserJs);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
var _utilsGuidJs = _dereq_('../utils/guid.js');
var Guid = _interopRequireWildcard(_utilsGuidJs);
var _eventTarget = _dereq_('../event-target');
var _eventTarget2 = _interopRequireDefault(_eventTarget);
/**
* setup the common parts of an audio, video, or text track
* @link https://html.spec.whatwg.org/multipage/embedded-content.html
*
* @param {String} type The type of track we are dealing with audio|video|text
* @param {Object=} options Object of option names and values
* @extends EventTarget
* @class Track
*/
var Track = (function (_EventTarget) {
_inherits(Track, _EventTarget);
function Track() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
_classCallCheck(this, Track);
_EventTarget.call(this);
var track = this;
if (browser.IS_IE8) {
track = _globalDocument2['default'].createElement('custom');
for (var prop in Track.prototype) {
if (prop !== 'constructor') {
track[prop] = Track.prototype[prop];
}
}
}
var trackProps = {
id: options.id || 'vjs_track_' + Guid.newGUID(),
kind: options.kind || '',
label: options.label || '',
language: options.language || ''
};
var _loop = function (key) {
Object.defineProperty(track, key, {
get: function get() {
return trackProps[key];
},
set: function set() {}
});
};
for (var key in trackProps) {
_loop(key);
}
return track;
}
return Track;
})(_eventTarget2['default']);
exports['default'] = Track;
module.exports = exports['default'];
},{"../event-target":104,"../utils/browser.js":140,"../utils/guid.js":146,"global/document":1}],138:[function(_dereq_,module,exports){
/**
* @file video-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 }; }
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 _trackList = _dereq_('./track-list');
var _trackList2 = _interopRequireDefault(_trackList);
var _utilsBrowserJs = _dereq_('../utils/browser.js');
var browser = _interopRequireWildcard(_utilsBrowserJs);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
/**
* disable other video tracks before selecting the new one
*
* @param {Array|VideoTrackList} list list to work on
* @param {VideoTrack} track the track to skip
*/
var disableOthers = function disableOthers(list, track) {
for (var i = 0; i < list.length; i++) {
if (track.id === list[i].id) {
continue;
}
// another audio track is enabled, disable it
list[i].selected = false;
}
};
/**
* A list of possiblee video tracks. Most functionality is in the
* base class Tracklist and the spec for VideoTrackList is located at:
* @link https://html.spec.whatwg.org/multipage/embedded-content.html#videotracklist
*
* interface VideoTrackList : EventTarget {
* readonly attribute unsigned long length;
* getter VideoTrack (unsigned long index);
* VideoTrack? getTrackById(DOMString id);
* readonly attribute long selectedIndex;
*
* attribute EventHandler onchange;
* attribute EventHandler onaddtrack;
* attribute EventHandler onremovetrack;
* };
*
* @param {VideoTrack[]} tracks a list of video tracks to instantiate the list with
# @extends TrackList
* @class VideoTrackList
*/
var VideoTrackList = (function (_TrackList) {
_inherits(VideoTrackList, _TrackList);
function VideoTrackList() {
var tracks = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
_classCallCheck(this, VideoTrackList);
var list = undefined;
// make sure only 1 track is enabled
// sorted from last index to first index
for (var i = tracks.length - 1; i >= 0; i--) {
if (tracks[i].selected) {
disableOthers(tracks, tracks[i]);
break;
}
}
// IE8 forces us to implement inheritance ourselves
// as it does not support Object.defineProperty properly
if (browser.IS_IE8) {
list = _globalDocument2['default'].createElement('custom');
for (var prop in _trackList2['default'].prototype) {
if (prop !== 'constructor') {
list[prop] = _trackList2['default'].prototype[prop];
}
}
for (var prop in VideoTrackList.prototype) {
if (prop !== 'constructor') {
list[prop] = VideoTrackList.prototype[prop];
}
}
}
list = _TrackList.call(this, tracks, list);
list.changing_ = false;
Object.defineProperty(list, 'selectedIndex', {
get: function get() {
for (var i = 0; i < this.length; i++) {
if (this[i].selected) {
return i;
}
}
return -1;
},
set: function set() {}
});
return list;
}
VideoTrackList.prototype.addTrack_ = function addTrack_(track) {
var _this = this;
if (track.selected) {
disableOthers(this, track);
}
_TrackList.prototype.addTrack_.call(this, track);
// native tracks don't have this
if (!track.addEventListener) {
return;
}
track.addEventListener('selectedchange', function () {
if (_this.changing_) {
return;
}
_this.changing_ = true;
disableOthers(_this, track);
_this.changing_ = false;
_this.trigger('change');
});
};
VideoTrackList.prototype.addTrack = function addTrack(track) {
this.addTrack_(track);
};
VideoTrackList.prototype.removeTrack = function removeTrack(track) {
_TrackList.prototype.removeTrack_.call(this, track);
};
return VideoTrackList;
})(_trackList2['default']);
exports['default'] = VideoTrackList;
module.exports = exports['default'];
},{"../utils/browser.js":140,"./track-list":136,"global/document":1}],139:[function(_dereq_,module,exports){
'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 _trackEnums = _dereq_('./track-enums');
var _track = _dereq_('./track');
var _track2 = _interopRequireDefault(_track);
var _utilsMergeOptions = _dereq_('../utils/merge-options');
var _utilsMergeOptions2 = _interopRequireDefault(_utilsMergeOptions);
var _utilsBrowserJs = _dereq_('../utils/browser.js');
var browser = _interopRequireWildcard(_utilsBrowserJs);
/**
* A single video text track as defined in:
* @link https://html.spec.whatwg.org/multipage/embedded-content.html#videotrack
*
* interface VideoTrack {
* readonly attribute DOMString id;
* readonly attribute DOMString kind;
* readonly attribute DOMString label;
* readonly attribute DOMString language;
* attribute boolean selected;
* };
*
* @param {Object=} options Object of option names and values
* @class VideoTrack
*/
var VideoTrack = (function (_Track) {
_inherits(VideoTrack, _Track);
function VideoTrack() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
_classCallCheck(this, VideoTrack);
var settings = _utilsMergeOptions2['default'](options, {
kind: _trackEnums.VideoTrackKind[options.kind] || ''
});
// on IE8 this will be a document element
// for every other browser this will be a normal object
var track = _Track.call(this, settings);
var selected = false;
if (browser.IS_IE8) {
for (var prop in VideoTrack.prototype) {
if (prop !== 'constructor') {
track[prop] = VideoTrack.prototype[prop];
}
}
}
Object.defineProperty(track, 'selected', {
get: function get() {
return selected;
},
set: function set(newSelected) {
// an invalid or unchanged value
if (typeof newSelected !== 'boolean' || newSelected === selected) {
return;
}
selected = newSelected;
this.trigger('selectedchange');
}
});
// if the user sets this track to selected then
// set selected to that true value otherwise
// we keep it false
if (settings.selected) {
track.selected = settings.selected;
}
return track;
}
return VideoTrack;
})(_track2['default']);
exports['default'] = VideoTrack;
module.exports = exports['default'];
},{"../utils/browser.js":140,"../utils/merge-options":148,"./track":137,"./track-enums":135}],140:[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_IPAD = /iPad/i.test(USER_AGENT);
exports.IS_IPAD = IS_IPAD;
// The Facebook app's UIWebView identifies as both an iPhone and iPad, so
// to identify iPhones, we need to exclude iPads.
// http://artsy.github.io/blog/2012/10/18/the-perils-of-ios-user-agent-sniffing/
var IS_IPHONE = /iPhone/i.test(USER_AGENT) && !IS_IPAD;
exports.IS_IPHONE = IS_IPHONE;
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_EDGE = /Edge/i.test(USER_AGENT);
exports.IS_EDGE = IS_EDGE;
var IS_CHROME = !IS_EDGE && /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 IE_VERSION = (function (result) {
return result && parseFloat(result[1]);
})(/MSIE\s(\d+)\.\d/.exec(USER_AGENT));
exports.IE_VERSION = IE_VERSION;
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}],141:[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":150}],142:[function(_dereq_,module,exports){
/**
* @file dom.js
*/
'use strict';
exports.__esModule = true;
exports.getEl = getEl;
exports.createEl = createEl;
exports.textContent = textContent;
exports.insertElFirst = insertElFirst;
exports.getElData = getElData;
exports.hasElData = hasElData;
exports.removeElData = removeElData;
exports.hasElClass = hasElClass;
exports.addElClass = addElClass;
exports.removeElClass = removeElClass;
exports.toggleElClass = toggleElClass;
exports.setElAttributes = setElAttributes;
exports.getElAttributes = getElAttributes;
exports.blockTextSelection = blockTextSelection;
exports.unblockTextSelection = unblockTextSelection;
exports.findElPosition = findElPosition;
exports.getPointerPosition = getPointerPosition;
exports.isEl = isEl;
exports.isTextNode = isTextNode;
exports.emptyEl = emptyEl;
exports.normalizeContent = normalizeContent;
exports.appendContent = appendContent;
exports.insertContent = insertContent;
var _templateObject = _taggedTemplateLiteralLoose(['Setting attributes in the second argument of createEl()\n has been deprecated. Use the third argument instead.\n createEl(type, properties, attributes). Attempting to set ', ' to ', '.'], ['Setting attributes in the second argument of createEl()\n has been deprecated. Use the third argument instead.\n createEl(type, properties, attributes). Attempting to set ', ' to ', '.']);
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 _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
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);
var _logJs = _dereq_('./log.js');
var _logJs2 = _interopRequireDefault(_logJs);
var _tsml = _dereq_('tsml');
var _tsml2 = _interopRequireDefault(_tsml);
/**
* Detect if a value is a string with any non-whitespace characters.
*
* @param {String} str
* @return {Boolean}
*/
function isNonBlankString(str) {
return typeof str === 'string' && /\S/.test(str);
}
/**
* Throws an error if the passed string has whitespace. This is used by
* class methods to be relatively consistent with the classList API.
*
* @param {String} str
* @return {Boolean}
*/
function throwIfWhitespace(str) {
if (/\s/.test(str)) {
throw new Error('class has illegal whitespace characters');
}
}
/**
* Produce a regular expression for matching a class name.
*
* @param {String} className
* @return {RegExp}
*/
function classRegExp(className) {
return new RegExp('(^|\\s)' + className + '($|\\s)');
}
/**
* Creates functions to query the DOM using a given method.
*
* @function createQuerier
* @private
* @param {String} method
* @return {Function}
*/
function createQuerier(method) {
return function (selector, context) {
if (!isNonBlankString(selector)) {
return _globalDocument2['default'][method](null);
}
if (isNonBlankString(context)) {
context = _globalDocument2['default'].querySelector(context);
}
return (isEl(context) ? context : _globalDocument2['default'])[method](selector);
};
}
/**
* 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='div'] Name of tag to be created.
* @param {Object} [properties={}] Element properties to be applied.
* @param {Object} [attributes={}] Element attributes 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 attributes = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
var el = _globalDocument2['default'].createElement(tagName);
Object.getOwnPropertyNames(properties).forEach(function (propName) {
var val = properties[propName];
// See #2176
// We originally were accepting both properties and attributes in the
// same object, but that doesn't work so well.
if (propName.indexOf('aria-') !== -1 || propName === 'role' || propName === 'type') {
_logJs2['default'].warn(_tsml2['default'](_templateObject, propName, val));
el.setAttribute(propName, val);
} else {
el[propName] = val;
}
});
Object.getOwnPropertyNames(attributes).forEach(function (attrName) {
var val = attributes[attrName];
el.setAttribute(attrName, attributes[attrName]);
});
return el;
}
/**
* Injects text into an element, replacing any existing contents entirely.
*
* @param {Element} el
* @param {String} text
* @return {Element}
* @function textContent
*/
function textContent(el, text) {
if (typeof el.textContent === 'undefined') {
el.innerText = text;
} else {
el.textContent = text;
}
}
/**
* 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
*
* @function hasElClass
* @param {Element} element Element to check
* @param {String} classToCheck Classname to check
*/
function hasElClass(element, classToCheck) {
if (element.classList) {
return element.classList.contains(classToCheck);
} else {
throwIfWhitespace(classToCheck);
return classRegExp(classToCheck).test(element.className);
}
}
/**
* Add a CSS class name to an element
*
* @function addElClass
* @param {Element} element Element to add class name to
* @param {String} classToAdd Classname to add
*/
function addElClass(element, classToAdd) {
if (element.classList) {
element.classList.add(classToAdd);
// Don't need to `throwIfWhitespace` here because `hasElClass` will do it
// in the case of classList not being supported.
} else if (!hasElClass(element, classToAdd)) {
element.className = (element.className + ' ' + classToAdd).trim();
}
return element;
}
/**
* Remove a CSS class name from an element
*
* @function removeElClass
* @param {Element} element Element to remove from class name
* @param {String} classToRemove Classname to remove
*/
function removeElClass(element, classToRemove) {
if (element.classList) {
element.classList.remove(classToRemove);
} else {
throwIfWhitespace(classToRemove);
element.className = element.className.split(/\s+/).filter(function (c) {
return c !== classToRemove;
}).join(' ');
}
return element;
}
/**
* Adds or removes a CSS class name on an element depending on an optional
* condition or the presence/absence of the class name.
*
* @function toggleElClass
* @param {Element} element
* @param {String} classToToggle
* @param {Boolean|Function} [predicate]
* Can be a function that returns a Boolean. If `true`, the class
* will be added; if `false`, the class will be removed. If not
* given, the class will be added if not present and vice versa.
*/
function toggleElClass(element, classToToggle, predicate) {
// This CANNOT use `classList` internally because IE does not support the
// second parameter to the `classList.toggle()` method! Which is fine because
// `classList` will be used by the add/remove functions.
var has = hasElClass(element, classToToggle);
if (typeof predicate === 'function') {
predicate = predicate(element, classToToggle);
}
if (typeof predicate !== 'boolean') {
predicate = !has;
}
// If the necessary class operation matches the current state of the
// element, no action is required.
if (predicate === has) {
return;
}
if (predicate) {
addElClass(element, classToToggle);
} else {
removeElClass(element, classToToggle);
}
return element;
}
/**
* 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}
* @function blockTextSelection
*/
function blockTextSelection() {
_globalDocument2['default'].body.focus();
_globalDocument2['default'].onselectstart = function () {
return false;
};
}
/**
* Turn off text selection blocking
*
* @return {Boolean}
* @function unblockTextSelection
*/
function unblockTextSelection() {
_globalDocument2['default'].onselectstart = function () {
return true;
};
}
/**
* Offset Left
* getBoundingClientRect technique from
* John Resig http://ejohn.org/blog/getboundingclientrect-is-awesome/
*
* @function findElPosition
* @param {Element} el Element from which to get offset
* @return {Object}
*/
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)
};
}
/**
* Get pointer position in element
* Returns an object with x and y coordinates.
* The base on the coordinates are the bottom left of the element.
*
* @function getPointerPosition
* @param {Element} el Element on which to get the pointer position on
* @param {Event} event Event object
* @return {Object} This object will have x and y coordinates corresponding to the mouse position
*/
function getPointerPosition(el, event) {
var position = {};
var box = findElPosition(el);
var boxW = el.offsetWidth;
var boxH = el.offsetHeight;
var boxY = box.top;
var boxX = box.left;
var pageY = event.pageY;
var pageX = event.pageX;
if (event.changedTouches) {
pageX = event.changedTouches[0].pageX;
pageY = event.changedTouches[0].pageY;
}
position.y = Math.max(0, Math.min(1, (boxY - pageY + boxH) / boxH));
position.x = Math.max(0, Math.min(1, (pageX - boxX) / boxW));
return position;
}
/**
* Determines, via duck typing, whether or not a value is a DOM element.
*
* @function isEl
* @param {Mixed} value
* @return {Boolean}
*/
function isEl(value) {
return !!value && typeof value === 'object' && value.nodeType === 1;
}
/**
* Determines, via duck typing, whether or not a value is a text node.
*
* @param {Mixed} value
* @return {Boolean}
*/
function isTextNode(value) {
return !!value && typeof value === 'object' && value.nodeType === 3;
}
/**
* Empties the contents of an element.
*
* @function emptyEl
* @param {Element} el
* @return {Element}
*/
function emptyEl(el) {
while (el.firstChild) {
el.removeChild(el.firstChild);
}
return el;
}
/**
* Normalizes content for eventual insertion into the DOM.
*
* This allows a wide range of content definition methods, but protects
* from falling into the trap of simply writing to `innerHTML`, which is
* an XSS concern.
*
* The content for an element can be passed in multiple types and
* combinations, whose behavior is as follows:
*
* - String
* Normalized into a text node.
*
* - Element, TextNode
* Passed through.
*
* - Array
* A one-dimensional array of strings, elements, nodes, or functions (which
* return single strings, elements, or nodes).
*
* - Function
* If the sole argument, is expected to produce a string, element,
* node, or array.
*
* @function normalizeContent
* @param {String|Element|TextNode|Array|Function} content
* @return {Array}
*/
function normalizeContent(content) {
// First, invoke content if it is a function. If it produces an array,
// that needs to happen before normalization.
if (typeof content === 'function') {
content = content();
}
// Next up, normalize to an array, so one or many items can be normalized,
// filtered, and returned.
return (Array.isArray(content) ? content : [content]).map(function (value) {
// First, invoke value if it is a function to produce a new value,
// which will be subsequently normalized to a Node of some kind.
if (typeof value === 'function') {
value = value();
}
if (isEl(value) || isTextNode(value)) {
return value;
}
if (typeof value === 'string' && /\S/.test(value)) {
return _globalDocument2['default'].createTextNode(value);
}
}).filter(function (value) {
return value;
});
}
/**
* Normalizes and appends content to an element.
*
* @function appendContent
* @param {Element} el
* @param {String|Element|TextNode|Array|Function} content
* See: `normalizeContent`
* @return {Element}
*/
function appendContent(el, content) {
normalizeContent(content).forEach(function (node) {
return el.appendChild(node);
});
return el;
}
/**
* Normalizes and inserts content into an element; this is identical to
* `appendContent()`, except it empties the element first.
*
* @function insertContent
* @param {Element} el
* @param {String|Element|TextNode|Array|Function} content
* See: `normalizeContent`
* @return {Element}
*/
function insertContent(el, content) {
return appendContent(emptyEl(el), content);
}
/**
* Finds a single DOM element matching `selector` within the optional
* `context` of another DOM element (defaulting to `document`).
*
* @function $
* @param {String} selector
* A valid CSS selector, which will be passed to `querySelector`.
*
* @param {Element|String} [context=document]
* A DOM element within which to query. Can also be a selector
* string in which case the first matching element will be used
* as context. If missing (or no element matches selector), falls
* back to `document`.
*
* @return {Element|null}
*/
var $ = createQuerier('querySelector');
exports.$ = $;
/**
* Finds a all DOM elements matching `selector` within the optional
* `context` of another DOM element (defaulting to `document`).
*
* @function $$
* @param {String} selector
* A valid CSS selector, which will be passed to `querySelectorAll`.
*
* @param {Element|String} [context=document]
* A DOM element within which to query. Can also be a selector
* string in which case the first matching element will be used
* as context. If missing (or no element matches selector), falls
* back to `document`.
*
* @return {NodeList}
*/
var $$ = createQuerier('querySelectorAll');
exports.$$ = $$;
},{"./guid.js":146,"./log.js":147,"global/document":1,"global/window":2,"tsml":55}],143:[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
// and webkitMovementX/Y
if (key !== 'layerX' && key !== 'layerY' && key !== 'keyLocation' && key !== 'webkitMovementX' && key !== 'webkitMovementY') {
// 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":142,"./guid.js":146,"global/document":1,"global/window":2}],144:[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":146}],145:[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 () {
seconds = seconds < 0 ? 0 : seconds;
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'];
},{}],146:[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++;
}
},{}],147:[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);
var _browser = _dereq_('./browser');
/**
* Log messages to the console and history based on the type of message
*
* @param {String} type
* The name of the console method to use.
* @param {Array} args
* The arguments to be passed to the matching console method.
* @param {Boolean} [stringify]
* By default, only old IEs should get console argument stringification,
* but this is exposed as a parameter to facilitate testing.
*/
var logByType = function logByType(type, args) {
var stringify = arguments.length <= 2 || arguments[2] === undefined ? !!_browser.IE_VERSION && _browser.IE_VERSION < 11 : arguments[2];
var console = _globalWindow2['default'].console;
// If there's no console then don't try to output messages, but 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
// when the module is executed.
var fn = console && console[type] || function () {};
if (type !== 'log') {
// add the type to the front of the message when it's not "log"
args.unshift(type.toUpperCase() + ':');
}
// add to history
log.history.push(args);
// add console prefix after adding to history
args.unshift('VIDEOJS:');
// IEs previous to 11 log objects uselessly as "[object Object]"; so, JSONify
// objects and arrays for those less-capable browsers.
if (stringify) {
args = args.map(function (a) {
if (a && typeof a === 'object' || Array.isArray(a)) {
try {
return JSON.stringify(a);
} catch (x) {}
}
// Cast to string before joining, so we get null and undefined explicitly
// included in output (as we would in a modern console).
return String(a);
}).join(' ');
}
// Old IE versions do not allow .apply() for console methods (they are
// reported as objects rather than functions).
if (!fn.apply) {
fn(args);
} else {
fn[Array.isArray(args) ? 'apply' : 'call'](console, args);
}
};
exports.logByType = logByType;
/**
* Log plain debug messages
*
* @function log
*/
function log() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
logByType('log', args);
}
/**
* Keep a history of log messages
*
* @type {Array}
*/
log.history = [];
/**
* Log error messages
*
* @method error
*/
log.error = function () {
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return logByType('error', args);
};
/**
* Log warning messages
*
* @method warn
*/
log.warn = function () {
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
return logByType('warn', args);
};
exports['default'] = log;
},{"./browser":140,"global/window":2}],148:[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":40}],149:[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}],150:[function(_dereq_,module,exports){
'use strict';
exports.__esModule = true;
exports.createTimeRanges = createTimeRanges;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _logJs = _dereq_('./log.js');
var _logJs2 = _interopRequireDefault(_logJs);
/**
* @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|Array)} Start of a single range or an array of ranges
* @param {Number} End of a single range
* @private
* @method createTimeRanges
*/
function createTimeRanges(start, end) {
if (Array.isArray(start)) {
return createTimeRangesObj(start);
} else if (start === undefined || end === undefined) {
return createTimeRangesObj();
}
return createTimeRangesObj([[start, end]]);
}
exports.createTimeRange = createTimeRanges;
function createTimeRangesObj(ranges) {
if (ranges === undefined || ranges.length === 0) {
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: ranges.length,
start: getRange.bind(null, 'start', 0, ranges),
end: getRange.bind(null, 'end', 1, ranges)
};
}
function getRange(fnName, valueIndex, ranges, rangeIndex) {
if (rangeIndex === undefined) {
_logJs2['default'].warn('DEPRECATED: Function \'' + fnName + '\' on \'TimeRanges\' called without an index argument.');
rangeIndex = 0;
}
rangeCheck(fnName, rangeIndex, ranges.length - 1);
return ranges[rangeIndex][valueIndex];
}
function rangeCheck(fnName, index, maxIndex) {
if (index < 0 || index > maxIndex) {
throw new Error('Failed to execute \'' + fnName + '\' on \'TimeRanges\': The index provided (' + index + ') is greater than or equal to the maximum bound (' + maxIndex + ').');
}
}
},{"./log.js":147}],151:[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"];
},{}],152:[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);
var _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
/**
* 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;
/**
* Returns whether the url passed is a cross domain request or not.
*
* @param {String} url The url to check
* @return {Boolean} Whether it is a cross domain request or not
* @method isCrossOrigin
*/
var isCrossOrigin = function isCrossOrigin(url) {
var winLoc = _globalWindow2['default'].location;
var urlInfo = parseUrl(url);
// IE8 protocol relative urls will return ':' for protocol
var srcProtocol = urlInfo.protocol === ':' ? winLoc.protocol : urlInfo.protocol;
// Check if url is for another domain/origin
// IE8 doesn't know location.origin, so we won't rely on it here
var crossOrigin = srcProtocol + urlInfo.host !== winLoc.protocol + winLoc.host;
return crossOrigin;
};
exports.isCrossOrigin = isCrossOrigin;
},{"global/document":1,"global/window":2}],153:[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 _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
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 _tracksTextTrackJs = _dereq_('./tracks/text-track.js');
var _tracksTextTrackJs2 = _interopRequireDefault(_tracksTextTrackJs);
var _tracksAudioTrackJs = _dereq_('./tracks/audio-track.js');
var _tracksAudioTrackJs2 = _interopRequireDefault(_tracksAudioTrackJs);
var _tracksVideoTrackJs = _dereq_('./tracks/video-track.js');
var _tracksVideoTrackJs2 = _interopRequireDefault(_tracksVideoTrackJs);
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 _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 _extendJs = _dereq_('./extend.js');
var _extendJs2 = _interopRequireDefault(_extendJs);
var _lodashCompatObjectMerge = _dereq_('lodash-compat/object/merge');
var _lodashCompatObjectMerge2 = _interopRequireDefault(_lodashCompatObjectMerge);
var _xhr = _dereq_('xhr');
var _xhr2 = _interopRequireDefault(_xhr);
// Include the built-in techs
var _techTechJs = _dereq_('./tech/tech.js');
var _techTechJs2 = _interopRequireDefault(_techTechJs);
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
*/
function videojs(id, options, ready) {
var tag = undefined; // 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'] || _player2['default'].players[tag.playerId] || new _player2['default'](tag, options, ready);
}
// Add default styles
if (_globalWindow2['default'].VIDEOJS_NO_DYNAMIC_STYLE !== true) {
var style = Dom.$('.vjs-styles-defaults');
if (!style) {
style = stylesheet.createStyleElement('vjs-styles-defaults');
var head = Dom.$('head');
head.insertBefore(style, head.firstChild);
stylesheet.setTextContent(style, '\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\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.11.2';
/**
* 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;
};
/**
* Expose players object.
*
* @memberOf videojs
* @property {Object} players
*/
videojs.players = _player2['default'].players;
/**
* 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 'extend' doc for more info)
* var MySpecialButton = videojs.extend(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 = function (name, comp) {
if (_techTechJs2['default'].isTech(comp)) {
_utilsLogJs2['default'].warn('The ' + name + ' tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)');
}
_component2['default'].registerComponent.call(_component2['default'], name, comp);
};
/**
* Get a Tech class object by name
* ```js
* var Html5 = videojs.getTech('Html5');
* // Create a new instance of the component
* var html5 = new Html5(options);
* ```
*
* @return {Tech} Tech identified by name
* @mixes videojs
* @method getComponent
*/
videojs.getTech = _techTechJs2['default'].getTech;
/**
* Register a Tech so it can referred to by name.
* This is used in the tech order for the player.
*
* ```js
* // get the Html5 Tech
* var Html5 = videojs.getTech('Html5');
* var MyTech = videojs.extend(Html5, {});
* // Register the new Tech
* VjsButton.registerTech('Tech', MyTech);
* var player = videojs('myplayer', {
* techOrder: ['myTech', 'html5']
* });
* ```
*
* @param {String} The class name of the tech
* @param {Tech} The tech class
* @return {Tech} The newly registered Tech
* @mixes videojs
* @method registerTech
*/
videojs.registerTech = _techTechJs2['default'].registerTech;
/**
* 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 `extend` 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.extend(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 extend
*/
videojs.extend = _extendJs2['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} defaults The options object whose values will be overriden
* @param {Object} overrides The options object with values to override the first
* @param {Object} etc 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} name The plugin name
* @param {Function} fn 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|Array} start Start time in seconds or an array of ranges
* @param {Number} end End time in seconds
* @return {Object} Fake TimeRange object
* @method createTimeRange
*/
videojs.createTimeRange = videojs.createTimeRanges = _utilsTimeRangesJs.createTimeRanges;
/**
* 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'];
/**
* 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;
/**
* Returns whether the url passed is a cross domain request or not.
*
* @param {String} url The url to check
* @return {Boolean} Whether it is a cross domain request or not
* @method isCrossOrigin
*/
videojs.isCrossOrigin = Url.isCrossOrigin;
/**
* 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;
/**
* A cross-browser XMLHttpRequest wrapper. Here's a simple example:
*
* videojs.xhr({
* body: someJSONString,
* uri: "/foo",
* headers: {
* "Content-Type": "application/json"
* }
* }, function (err, resp, body) {
* // check resp.statusCode
* });
*
* Check out the [full
* documentation](https://github.com/Raynos/xhr/blob/v2.1.0/README.md)
* for more options.
*
* @param {Object} options settings for the request.
* @return {XMLHttpRequest|XDomainRequest} the request object.
* @see https://github.com/Raynos/xhr
*/
videojs.xhr = _xhr2['default'];
/**
* TextTrack class
*
* @type {Function}
*/
videojs.TextTrack = _tracksTextTrackJs2['default'];
/**
* export the AudioTrack class so that source handlers can create
* AudioTracks and then add them to the players AudioTrackList
*
* @type {Function}
*/
videojs.AudioTrack = _tracksAudioTrackJs2['default'];
/**
* export the VideoTrack class so that source handlers can create
* VideoTracks and then add them to the players VideoTrackList
*
* @type {Function}
*/
videojs.VideoTrack = _tracksVideoTrackJs2['default'];
/**
* Determines, via duck typing, whether or not a value is a DOM element.
*
* @method isEl
* @param {Mixed} value
* @return {Boolean}
*/
videojs.isEl = Dom.isEl;
/**
* Determines, via duck typing, whether or not a value is a text node.
*
* @method isTextNode
* @param {Mixed} value
* @return {Boolean}
*/
videojs.isTextNode = Dom.isTextNode;
/**
* Creates an element and applies properties.
*
* @method createEl
* @param {String} [tagName='div'] Name of tag to be created.
* @param {Object} [properties={}] Element properties to be applied.
* @param {Object} [attributes={}] Element attributes to be applied.
* @return {Element}
*/
videojs.createEl = Dom.createEl;
/**
* Check if an element has a CSS class
*
* @method hasClass
* @param {Element} element Element to check
* @param {String} classToCheck Classname to check
*/
videojs.hasClass = Dom.hasElClass;
/**
* Add a CSS class name to an element
*
* @method addClass
* @param {Element} element Element to add class name to
* @param {String} classToAdd Classname to add
*/
videojs.addClass = Dom.addElClass;
/**
* Remove a CSS class name from an element
*
* @method removeClass
* @param {Element} element Element to remove from class name
* @param {String} classToRemove Classname to remove
*/
videojs.removeClass = Dom.removeElClass;
/**
* Adds or removes a CSS class name on an element depending on an optional
* condition or the presence/absence of the class name.
*
* @method toggleElClass
* @param {Element} element
* @param {String} classToToggle
* @param {Boolean|Function} [predicate]
* Can be a function that returns a Boolean. If `true`, the class
* will be added; if `false`, the class will be removed. If not
* given, the class will be added if not present and vice versa.
*/
videojs.toggleClass = Dom.toggleElClass;
/**
* Apply attributes to an HTML element.
*
* @method setAttributes
* @param {Element} el Target element.
* @param {Object=} attributes Element attributes to be applied.
*/
videojs.setAttributes = Dom.setElAttributes;
/**
* 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.
*
* @method getAttributes
* @param {Element} tag Element from which to get tag attributes
* @return {Object}
*/
videojs.getAttributes = Dom.getElAttributes;
/**
* Empties the contents of an element.
*
* @method emptyEl
* @param {Element} el
* @return {Element}
*/
videojs.emptyEl = Dom.emptyEl;
/**
* Normalizes and appends content to an element.
*
* The content for an element can be passed in multiple types and
* combinations, whose behavior is as follows:
*
* - String
* Normalized into a text node.
*
* - Element, TextNode
* Passed through.
*
* - Array
* A one-dimensional array of strings, elements, nodes, or functions (which
* return single strings, elements, or nodes).
*
* - Function
* If the sole argument, is expected to produce a string, element,
* node, or array.
*
* @method appendContent
* @param {Element} el
* @param {String|Element|TextNode|Array|Function} content
* @return {Element}
*/
videojs.appendContent = Dom.appendContent;
/**
* Normalizes and inserts content into an element; this is identical to
* `appendContent()`, except it empties the element first.
*
* The content for an element can be passed in multiple types and
* combinations, whose behavior is as follows:
*
* - String
* Normalized into a text node.
*
* - Element, TextNode
* Passed through.
*
* - Array
* A one-dimensional array of strings, elements, nodes, or functions (which
* return single strings, elements, or nodes).
*
* - Function
* If the sole argument, is expected to produce a string, element,
* node, or array.
*
* @method insertContent
* @param {Element} el
* @param {String|Element|TextNode|Array|Function} content
* @return {Element}
*/
videojs.insertContent = Dom.insertContent;
/*
* 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":148,"./component":67,"./event-target":104,"./extend.js":105,"./player":113,"./plugins.js":114,"./setup":118,"./tech/flash.js":121,"./tech/html5.js":122,"./tech/tech.js":124,"./tracks/audio-track.js":126,"./tracks/text-track.js":134,"./tracks/video-track.js":139,"./utils/browser.js":140,"./utils/dom.js":142,"./utils/events.js":143,"./utils/fn.js":144,"./utils/format-time.js":145,"./utils/log.js":147,"./utils/stylesheet.js":149,"./utils/time-ranges.js":150,"./utils/url.js":152,"global/document":1,"global/window":2,"lodash-compat/object/merge":40,"xhr":56}]},{},[153])(153)
});
//# sourceMappingURL=video.js.map
/* vtt.js - v0.12.1 (https://github.com/mozilla/vtt.js) built on 08-07-2015 */
(function(root) {
var vttjs = root.vttjs = {};
var cueShim = vttjs.VTTCue;
var regionShim = vttjs.VTTRegion;
var oldVTTCue = root.VTTCue;
var oldVTTRegion = root.VTTRegion;
vttjs.shim = function() {
vttjs.VTTCue = cueShim;
vttjs.VTTRegion = regionShim;
};
vttjs.restore = function() {
vttjs.VTTCue = oldVTTCue;
vttjs.VTTRegion = oldVTTRegion;
};
}(this));
/**
* Copyright 2013 vtt.js Contributors
*
* 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(root, vttjs) {
var autoKeyword = "auto";
var directionSetting = {
"": true,
"lr": true,
"rl": true
};
var alignSetting = {
"start": true,
"middle": true,
"end": true,
"left": true,
"right": true
};
function findDirectionSetting(value) {
if (typeof value !== "string") {
return false;
}
var dir = directionSetting[value.toLowerCase()];
return dir ? value.toLowerCase() : false;
}
function findAlignSetting(value) {
if (typeof value !== "string") {
return false;
}
var align = alignSetting[value.toLowerCase()];
return align ? value.toLowerCase() : false;
}
function extend(obj) {
var i = 1;
for (; i < arguments.length; i++) {
var cobj = arguments[i];
for (var p in cobj) {
obj[p] = cobj[p];
}
}
return obj;
}
function VTTCue(startTime, endTime, text) {
var cue = this;
var isIE8 = (/MSIE\s8\.0/).test(navigator.userAgent);
var baseObj = {};
if (isIE8) {
cue = document.createElement('custom');
} else {
baseObj.enumerable = true;
}
/**
* Shim implementation specific properties. These properties are not in
* the spec.
*/
// Lets us know when the VTTCue's data has changed in such a way that we need
// to recompute its display state. This lets us compute its display state
// lazily.
cue.hasBeenReset = false;
/**
* VTTCue and TextTrackCue properties
* http://dev.w3.org/html5/webvtt/#vttcue-interface
*/
var _id = "";
var _pauseOnExit = false;
var _startTime = startTime;
var _endTime = endTime;
var _text = text;
var _region = null;
var _vertical = "";
var _snapToLines = true;
var _line = "auto";
var _lineAlign = "start";
var _position = 50;
var _positionAlign = "middle";
var _size = 50;
var _align = "middle";
Object.defineProperty(cue,
"id", extend({}, baseObj, {
get: function() {
return _id;
},
set: function(value) {
_id = "" + value;
}
}));
Object.defineProperty(cue,
"pauseOnExit", extend({}, baseObj, {
get: function() {
return _pauseOnExit;
},
set: function(value) {
_pauseOnExit = !!value;
}
}));
Object.defineProperty(cue,
"startTime", extend({}, baseObj, {
get: function() {
return _startTime;
},
set: function(value) {
if (typeof value !== "number") {
throw new TypeError("Start time must be set to a number.");
}
_startTime = value;
this.hasBeenReset = true;
}
}));
Object.defineProperty(cue,
"endTime", extend({}, baseObj, {
get: function() {
return _endTime;
},
set: function(value) {
if (typeof value !== "number") {
throw new TypeError("End time must be set to a number.");
}
_endTime = value;
this.hasBeenReset = true;
}
}));
Object.defineProperty(cue,
"text", extend({}, baseObj, {
get: function() {
return _text;
},
set: function(value) {
_text = "" + value;
this.hasBeenReset = true;
}
}));
Object.defineProperty(cue,
"region", extend({}, baseObj, {
get: function() {
return _region;
},
set: function(value) {
_region = value;
this.hasBeenReset = true;
}
}));
Object.defineProperty(cue,
"vertical", extend({}, baseObj, {
get: function() {
return _vertical;
},
set: function(value) {
var setting = findDirectionSetting(value);
// Have to check for false because the setting an be an empty string.
if (setting === false) {
throw new SyntaxError("An invalid or illegal string was specified.");
}
_vertical = setting;
this.hasBeenReset = true;
}
}));
Object.defineProperty(cue,
"snapToLines", extend({}, baseObj, {
get: function() {
return _snapToLines;
},
set: function(value) {
_snapToLines = !!value;
this.hasBeenReset = true;
}
}));
Object.defineProperty(cue,
"line", extend({}, baseObj, {
get: function() {
return _line;
},
set: function(value) {
if (typeof value !== "number" && value !== autoKeyword) {
throw new SyntaxError("An invalid number or illegal string was specified.");
}
_line = value;
this.hasBeenReset = true;
}
}));
Object.defineProperty(cue,
"lineAlign", extend({}, baseObj, {
get: function() {
return _lineAlign;
},
set: function(value) {
var setting = findAlignSetting(value);
if (!setting) {
throw new SyntaxError("An invalid or illegal string was specified.");
}
_lineAlign = setting;
this.hasBeenReset = true;
}
}));
Object.defineProperty(cue,
"position", extend({}, baseObj, {
get: function() {
return _position;
},
set: function(value) {
if (value < 0 || value > 100) {
throw new Error("Position must be between 0 and 100.");
}
_position = value;
this.hasBeenReset = true;
}
}));
Object.defineProperty(cue,
"positionAlign", extend({}, baseObj, {
get: function() {
return _positionAlign;
},
set: function(value) {
var setting = findAlignSetting(value);
if (!setting) {
throw new SyntaxError("An invalid or illegal string was specified.");
}
_positionAlign = setting;
this.hasBeenReset = true;
}
}));
Object.defineProperty(cue,
"size", extend({}, baseObj, {
get: function() {
return _size;
},
set: function(value) {
if (value < 0 || value > 100) {
throw new Error("Size must be between 0 and 100.");
}
_size = value;
this.hasBeenReset = true;
}
}));
Object.defineProperty(cue,
"align", extend({}, baseObj, {
get: function() {
return _align;
},
set: function(value) {
var setting = findAlignSetting(value);
if (!setting) {
throw new SyntaxError("An invalid or illegal string was specified.");
}
_align = setting;
this.hasBeenReset = true;
}
}));
/**
* Other <track> spec defined properties
*/
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#text-track-cue-display-state
cue.displayState = undefined;
if (isIE8) {
return cue;
}
}
/**
* VTTCue methods
*/
VTTCue.prototype.getCueAsHTML = function() {
// Assume WebVTT.convertCueToDOMTree is on the global.
return WebVTT.convertCueToDOMTree(window, this.text);
};
root.VTTCue = root.VTTCue || VTTCue;
vttjs.VTTCue = VTTCue;
}(this, (this.vttjs || {})));
/**
* Copyright 2013 vtt.js Contributors
*
* 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(root, vttjs) {
var scrollSetting = {
"": true,
"up": true
};
function findScrollSetting(value) {
if (typeof value !== "string") {
return false;
}
var scroll = scrollSetting[value.toLowerCase()];
return scroll ? value.toLowerCase() : false;
}
function isValidPercentValue(value) {
return typeof value === "number" && (value >= 0 && value <= 100);
}
// VTTRegion shim http://dev.w3.org/html5/webvtt/#vttregion-interface
function VTTRegion() {
var _width = 100;
var _lines = 3;
var _regionAnchorX = 0;
var _regionAnchorY = 100;
var _viewportAnchorX = 0;
var _viewportAnchorY = 100;
var _scroll = "";
Object.defineProperties(this, {
"width": {
enumerable: true,
get: function() {
return _width;
},
set: function(value) {
if (!isValidPercentValue(value)) {
throw new Error("Width must be between 0 and 100.");
}
_width = value;
}
},
"lines": {
enumerable: true,
get: function() {
return _lines;
},
set: function(value) {
if (typeof value !== "number") {
throw new TypeError("Lines must be set to a number.");
}
_lines = value;
}
},
"regionAnchorY": {
enumerable: true,
get: function() {
return _regionAnchorY;
},
set: function(value) {
if (!isValidPercentValue(value)) {
throw new Error("RegionAnchorX must be between 0 and 100.");
}
_regionAnchorY = value;
}
},
"regionAnchorX": {
enumerable: true,
get: function() {
return _regionAnchorX;
},
set: function(value) {
if(!isValidPercentValue(value)) {
throw new Error("RegionAnchorY must be between 0 and 100.");
}
_regionAnchorX = value;
}
},
"viewportAnchorY": {
enumerable: true,
get: function() {
return _viewportAnchorY;
},
set: function(value) {
if (!isValidPercentValue(value)) {
throw new Error("ViewportAnchorY must be between 0 and 100.");
}
_viewportAnchorY = value;
}
},
"viewportAnchorX": {
enumerable: true,
get: function() {
return _viewportAnchorX;
},
set: function(value) {
if (!isValidPercentValue(value)) {
throw new Error("ViewportAnchorX must be between 0 and 100.");
}
_viewportAnchorX = value;
}
},
"scroll": {
enumerable: true,
get: function() {
return _scroll;
},
set: function(value) {
var setting = findScrollSetting(value);
// Have to check for false as an empty string is a legal value.
if (setting === false) {
throw new SyntaxError("An invalid or illegal string was specified.");
}
_scroll = setting;
}
}
});
}
root.VTTRegion = root.VTTRegion || VTTRegion;
vttjs.VTTRegion = VTTRegion;
}(this, (this.vttjs || {})));
/**
* Copyright 2013 vtt.js Contributors
*
* 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.
*/
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
(function(global) {
var _objCreate = Object.create || (function() {
function F() {}
return function(o) {
if (arguments.length !== 1) {
throw new Error('Object.create shim only accepts one parameter.');
}
F.prototype = o;
return new F();
};
})();
// Creates a new ParserError object from an errorData object. The errorData
// object should have default code and message properties. The default message
// property can be overriden by passing in a message parameter.
// See ParsingError.Errors below for acceptable errors.
function ParsingError(errorData, message) {
this.name = "ParsingError";
this.code = errorData.code;
this.message = message || errorData.message;
}
ParsingError.prototype = _objCreate(Error.prototype);
ParsingError.prototype.constructor = ParsingError;
// ParsingError metadata for acceptable ParsingErrors.
ParsingError.Errors = {
BadSignature: {
code: 0,
message: "Malformed WebVTT signature."
},
BadTimeStamp: {
code: 1,
message: "Malformed time stamp."
}
};
// Try to parse input as a time stamp.
function parseTimeStamp(input) {
function computeSeconds(h, m, s, f) {
return (h | 0) * 3600 + (m | 0) * 60 + (s | 0) + (f | 0) / 1000;
}
var m = input.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);
if (!m) {
return null;
}
if (m[3]) {
// Timestamp takes the form of [hours]:[minutes]:[seconds].[milliseconds]
return computeSeconds(m[1], m[2], m[3].replace(":", ""), m[4]);
} else if (m[1] > 59) {
// Timestamp takes the form of [hours]:[minutes].[milliseconds]
// First position is hours as it's over 59.
return computeSeconds(m[1], m[2], 0, m[4]);
} else {
// Timestamp takes the form of [minutes]:[seconds].[milliseconds]
return computeSeconds(0, m[1], m[2], m[4]);
}
}
// A settings object holds key/value pairs and will ignore anything but the first
// assignment to a specific key.
function Settings() {
this.values = _objCreate(null);
}
Settings.prototype = {
// Only accept the first assignment to any key.
set: function(k, v) {
if (!this.get(k) && v !== "") {
this.values[k] = v;
}
},
// Return the value for a key, or a default value.
// If 'defaultKey' is passed then 'dflt' is assumed to be an object with
// a number of possible default values as properties where 'defaultKey' is
// the key of the property that will be chosen; otherwise it's assumed to be
// a single value.
get: function(k, dflt, defaultKey) {
if (defaultKey) {
return this.has(k) ? this.values[k] : dflt[defaultKey];
}
return this.has(k) ? this.values[k] : dflt;
},
// Check whether we have a value for a key.
has: function(k) {
return k in this.values;
},
// Accept a setting if its one of the given alternatives.
alt: function(k, v, a) {
for (var n = 0; n < a.length; ++n) {
if (v === a[n]) {
this.set(k, v);
break;
}
}
},
// Accept a setting if its a valid (signed) integer.
integer: function(k, v) {
if (/^-?\d+$/.test(v)) { // integer
this.set(k, parseInt(v, 10));
}
},
// Accept a setting if its a valid percentage.
percent: function(k, v) {
var m;
if ((m = v.match(/^([\d]{1,3})(\.[\d]*)?%$/))) {
v = parseFloat(v);
if (v >= 0 && v <= 100) {
this.set(k, v);
return true;
}
}
return false;
}
};
// Helper function to parse input into groups separated by 'groupDelim', and
// interprete each group as a key/value pair separated by 'keyValueDelim'.
function parseOptions(input, callback, keyValueDelim, groupDelim) {
var groups = groupDelim ? input.split(groupDelim) : [input];
for (var i in groups) {
if (typeof groups[i] !== "string") {
continue;
}
var kv = groups[i].split(keyValueDelim);
if (kv.length !== 2) {
continue;
}
var k = kv[0];
var v = kv[1];
callback(k, v);
}
}
function parseCue(input, cue, regionList) {
// Remember the original input if we need to throw an error.
var oInput = input;
// 4.1 WebVTT timestamp
function consumeTimeStamp() {
var ts = parseTimeStamp(input);
if (ts === null) {
throw new ParsingError(ParsingError.Errors.BadTimeStamp,
"Malformed timestamp: " + oInput);
}
// Remove time stamp from input.
input = input.replace(/^[^\sa-zA-Z-]+/, "");
return ts;
}
// 4.4.2 WebVTT cue settings
function consumeCueSettings(input, cue) {
var settings = new Settings();
parseOptions(input, function (k, v) {
switch (k) {
case "region":
// Find the last region we parsed with the same region id.
for (var i = regionList.length - 1; i >= 0; i--) {
if (regionList[i].id === v) {
settings.set(k, regionList[i].region);
break;
}
}
break;
case "vertical":
settings.alt(k, v, ["rl", "lr"]);
break;
case "line":
var vals = v.split(","),
vals0 = vals[0];
settings.integer(k, vals0);
settings.percent(k, vals0) ? settings.set("snapToLines", false) : null;
settings.alt(k, vals0, ["auto"]);
if (vals.length === 2) {
settings.alt("lineAlign", vals[1], ["start", "middle", "end"]);
}
break;
case "position":
vals = v.split(",");
settings.percent(k, vals[0]);
if (vals.length === 2) {
settings.alt("positionAlign", vals[1], ["start", "middle", "end"]);
}
break;
case "size":
settings.percent(k, v);
break;
case "align":
settings.alt(k, v, ["start", "middle", "end", "left", "right"]);
break;
}
}, /:/, /\s/);
// Apply default values for any missing fields.
cue.region = settings.get("region", null);
cue.vertical = settings.get("vertical", "");
cue.line = settings.get("line", "auto");
cue.lineAlign = settings.get("lineAlign", "start");
cue.snapToLines = settings.get("snapToLines", true);
cue.size = settings.get("size", 100);
cue.align = settings.get("align", "middle");
cue.position = settings.get("position", {
start: 0,
left: 0,
middle: 50,
end: 100,
right: 100
}, cue.align);
cue.positionAlign = settings.get("positionAlign", {
start: "start",
left: "start",
middle: "middle",
end: "end",
right: "end"
}, cue.align);
}
function skipWhitespace() {
input = input.replace(/^\s+/, "");
}
// 4.1 WebVTT cue timings.
skipWhitespace();
cue.startTime = consumeTimeStamp(); // (1) collect cue start time
skipWhitespace();
if (input.substr(0, 3) !== "-->") { // (3) next characters must match "-->"
throw new ParsingError(ParsingError.Errors.BadTimeStamp,
"Malformed time stamp (time stamps must be separated by '-->'): " +
oInput);
}
input = input.substr(3);
skipWhitespace();
cue.endTime = consumeTimeStamp(); // (5) collect cue end time
// 4.1 WebVTT cue settings list.
skipWhitespace();
consumeCueSettings(input, cue);
}
var ESCAPE = {
"&": "&",
"<": "<",
">": ">",
"‎": "\u200e",
"‏": "\u200f",
" ": "\u00a0"
};
var TAG_NAME = {
c: "span",
i: "i",
b: "b",
u: "u",
ruby: "ruby",
rt: "rt",
v: "span",
lang: "span"
};
var TAG_ANNOTATION = {
v: "title",
lang: "lang"
};
var NEEDS_PARENT = {
rt: "ruby"
};
// Parse content into a document fragment.
function parseContent(window, input) {
function nextToken() {
// Check for end-of-string.
if (!input) {
return null;
}
// Consume 'n' characters from the input.
function consume(result) {
input = input.substr(result.length);
return result;
}
var m = input.match(/^([^<]*)(<[^>]+>?)?/);
// If there is some text before the next tag, return it, otherwise return
// the tag.
return consume(m[1] ? m[1] : m[2]);
}
// Unescape a string 's'.
function unescape1(e) {
return ESCAPE[e];
}
function unescape(s) {
while ((m = s.match(/&(amp|lt|gt|lrm|rlm|nbsp);/))) {
s = s.replace(m[0], unescape1);
}
return s;
}
function shouldAdd(current, element) {
return !NEEDS_PARENT[element.localName] ||
NEEDS_PARENT[element.localName] === current.localName;
}
// Create an element for this tag.
function createElement(type, annotation) {
var tagName = TAG_NAME[type];
if (!tagName) {
return null;
}
var element = window.document.createElement(tagName);
element.localName = tagName;
var name = TAG_ANNOTATION[type];
if (name && annotation) {
element[name] = annotation.trim();
}
return element;
}
var rootDiv = window.document.createElement("div"),
current = rootDiv,
t,
tagStack = [];
while ((t = nextToken()) !== null) {
if (t[0] === '<') {
if (t[1] === "/") {
// If the closing tag matches, move back up to the parent node.
if (tagStack.length &&
tagStack[tagStack.length - 1] === t.substr(2).replace(">", "")) {
tagStack.pop();
current = current.parentNode;
}
// Otherwise just ignore the end tag.
continue;
}
var ts = parseTimeStamp(t.substr(1, t.length - 2));
var node;
if (ts) {
// Timestamps are lead nodes as well.
node = window.document.createProcessingInstruction("timestamp", ts);
current.appendChild(node);
continue;
}
var m = t.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);
// If we can't parse the tag, skip to the next tag.
if (!m) {
continue;
}
// Try to construct an element, and ignore the tag if we couldn't.
node = createElement(m[1], m[3]);
if (!node) {
continue;
}
// Determine if the tag should be added based on the context of where it
// is placed in the cuetext.
if (!shouldAdd(current, node)) {
continue;
}
// Set the class list (as a list of classes, separated by space).
if (m[2]) {
node.className = m[2].substr(1).replace('.', ' ');
}
// Append the node to the current node, and enter the scope of the new
// node.
tagStack.push(m[1]);
current.appendChild(node);
current = node;
continue;
}
// Text nodes are leaf nodes.
current.appendChild(window.document.createTextNode(unescape(t)));
}
return rootDiv;
}
// This is a list of all the Unicode characters that have a strong
// right-to-left category. What this means is that these characters are
// written right-to-left for sure. It was generated by pulling all the strong
// right-to-left characters out of the Unicode data table. That table can
// found at: http://www.unicode.org/Public/UNIDATA/UnicodeData.txt
var strongRTLChars = [0x05BE, 0x05C0, 0x05C3, 0x05C6, 0x05D0, 0x05D1,
0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, 0x05D9, 0x05DA,
0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, 0x05E0, 0x05E1, 0x05E2, 0x05E3,
0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA, 0x05F0, 0x05F1,
0x05F2, 0x05F3, 0x05F4, 0x0608, 0x060B, 0x060D, 0x061B, 0x061E, 0x061F,
0x0620, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628,
0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, 0x0630, 0x0631,
0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, 0x0638, 0x0639, 0x063A,
0x063B, 0x063C, 0x063D, 0x063E, 0x063F, 0x0640, 0x0641, 0x0642, 0x0643,
0x0644, 0x0645, 0x0646, 0x0647, 0x0648, 0x0649, 0x064A, 0x066D, 0x066E,
0x066F, 0x0671, 0x0672, 0x0673, 0x0674, 0x0675, 0x0676, 0x0677, 0x0678,
0x0679, 0x067A, 0x067B, 0x067C, 0x067D, 0x067E, 0x067F, 0x0680, 0x0681,
0x0682, 0x0683, 0x0684, 0x0685, 0x0686, 0x0687, 0x0688, 0x0689, 0x068A,
0x068B, 0x068C, 0x068D, 0x068E, 0x068F, 0x0690, 0x0691, 0x0692, 0x0693,
0x0694, 0x0695, 0x0696, 0x0697, 0x0698, 0x0699, 0x069A, 0x069B, 0x069C,
0x069D, 0x069E, 0x069F, 0x06A0, 0x06A1, 0x06A2, 0x06A3, 0x06A4, 0x06A5,
0x06A6, 0x06A7, 0x06A8, 0x06A9, 0x06AA, 0x06AB, 0x06AC, 0x06AD, 0x06AE,
0x06AF, 0x06B0, 0x06B1, 0x06B2, 0x06B3, 0x06B4, 0x06B5, 0x06B6, 0x06B7,
0x06B8, 0x06B9, 0x06BA, 0x06BB, 0x06BC, 0x06BD, 0x06BE, 0x06BF, 0x06C0,
0x06C1, 0x06C2, 0x06C3, 0x06C4, 0x06C5, 0x06C6, 0x06C7, 0x06C8, 0x06C9,
0x06CA, 0x06CB, 0x06CC, 0x06CD, 0x06CE, 0x06CF, 0x06D0, 0x06D1, 0x06D2,
0x06D3, 0x06D4, 0x06D5, 0x06E5, 0x06E6, 0x06EE, 0x06EF, 0x06FA, 0x06FB,
0x06FC, 0x06FD, 0x06FE, 0x06FF, 0x0700, 0x0701, 0x0702, 0x0703, 0x0704,
0x0705, 0x0706, 0x0707, 0x0708, 0x0709, 0x070A, 0x070B, 0x070C, 0x070D,
0x070F, 0x0710, 0x0712, 0x0713, 0x0714, 0x0715, 0x0716, 0x0717, 0x0718,
0x0719, 0x071A, 0x071B, 0x071C, 0x071D, 0x071E, 0x071F, 0x0720, 0x0721,
0x0722, 0x0723, 0x0724, 0x0725, 0x0726, 0x0727, 0x0728, 0x0729, 0x072A,
0x072B, 0x072C, 0x072D, 0x072E, 0x072F, 0x074D, 0x074E, 0x074F, 0x0750,
0x0751, 0x0752, 0x0753, 0x0754, 0x0755, 0x0756, 0x0757, 0x0758, 0x0759,
0x075A, 0x075B, 0x075C, 0x075D, 0x075E, 0x075F, 0x0760, 0x0761, 0x0762,
0x0763, 0x0764, 0x0765, 0x0766, 0x0767, 0x0768, 0x0769, 0x076A, 0x076B,
0x076C, 0x076D, 0x076E, 0x076F, 0x0770, 0x0771, 0x0772, 0x0773, 0x0774,
0x0775, 0x0776, 0x0777, 0x0778, 0x0779, 0x077A, 0x077B, 0x077C, 0x077D,
0x077E, 0x077F, 0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0786,
0x0787, 0x0788, 0x0789, 0x078A, 0x078B, 0x078C, 0x078D, 0x078E, 0x078F,
0x0790, 0x0791, 0x0792, 0x0793, 0x0794, 0x0795, 0x0796, 0x0797, 0x0798,
0x0799, 0x079A, 0x079B, 0x079C, 0x079D, 0x079E, 0x079F, 0x07A0, 0x07A1,
0x07A2, 0x07A3, 0x07A4, 0x07A5, 0x07B1, 0x07C0, 0x07C1, 0x07C2, 0x07C3,
0x07C4, 0x07C5, 0x07C6, 0x07C7, 0x07C8, 0x07C9, 0x07CA, 0x07CB, 0x07CC,
0x07CD, 0x07CE, 0x07CF, 0x07D0, 0x07D1, 0x07D2, 0x07D3, 0x07D4, 0x07D5,
0x07D6, 0x07D7, 0x07D8, 0x07D9, 0x07DA, 0x07DB, 0x07DC, 0x07DD, 0x07DE,
0x07DF, 0x07E0, 0x07E1, 0x07E2, 0x07E3, 0x07E4, 0x07E5, 0x07E6, 0x07E7,
0x07E8, 0x07E9, 0x07EA, 0x07F4, 0x07F5, 0x07FA, 0x0800, 0x0801, 0x0802,
0x0803, 0x0804, 0x0805, 0x0806, 0x0807, 0x0808, 0x0809, 0x080A, 0x080B,
0x080C, 0x080D, 0x080E, 0x080F, 0x0810, 0x0811, 0x0812, 0x0813, 0x0814,
0x0815, 0x081A, 0x0824, 0x0828, 0x0830, 0x0831, 0x0832, 0x0833, 0x0834,
0x0835, 0x0836, 0x0837, 0x0838, 0x0839, 0x083A, 0x083B, 0x083C, 0x083D,
0x083E, 0x0840, 0x0841, 0x0842, 0x0843, 0x0844, 0x0845, 0x0846, 0x0847,
0x0848, 0x0849, 0x084A, 0x084B, 0x084C, 0x084D, 0x084E, 0x084F, 0x0850,
0x0851, 0x0852, 0x0853, 0x0854, 0x0855, 0x0856, 0x0857, 0x0858, 0x085E,
0x08A0, 0x08A2, 0x08A3, 0x08A4, 0x08A5, 0x08A6, 0x08A7, 0x08A8, 0x08A9,
0x08AA, 0x08AB, 0x08AC, 0x200F, 0xFB1D, 0xFB1F, 0xFB20, 0xFB21, 0xFB22,
0xFB23, 0xFB24, 0xFB25, 0xFB26, 0xFB27, 0xFB28, 0xFB2A, 0xFB2B, 0xFB2C,
0xFB2D, 0xFB2E, 0xFB2F, 0xFB30, 0xFB31, 0xFB32, 0xFB33, 0xFB34, 0xFB35,
0xFB36, 0xFB38, 0xFB39, 0xFB3A, 0xFB3B, 0xFB3C, 0xFB3E, 0xFB40, 0xFB41,
0xFB43, 0xFB44, 0xFB46, 0xFB47, 0xFB48, 0xFB49, 0xFB4A, 0xFB4B, 0xFB4C,
0xFB4D, 0xFB4E, 0xFB4F, 0xFB50, 0xFB51, 0xFB52, 0xFB53, 0xFB54, 0xFB55,
0xFB56, 0xFB57, 0xFB58, 0xFB59, 0xFB5A, 0xFB5B, 0xFB5C, 0xFB5D, 0xFB5E,
0xFB5F, 0xFB60, 0xFB61, 0xFB62, 0xFB63, 0xFB64, 0xFB65, 0xFB66, 0xFB67,
0xFB68, 0xFB69, 0xFB6A, 0xFB6B, 0xFB6C, 0xFB6D, 0xFB6E, 0xFB6F, 0xFB70,
0xFB71, 0xFB72, 0xFB73, 0xFB74, 0xFB75, 0xFB76, 0xFB77, 0xFB78, 0xFB79,
0xFB7A, 0xFB7B, 0xFB7C, 0xFB7D, 0xFB7E, 0xFB7F, 0xFB80, 0xFB81, 0xFB82,
0xFB83, 0xFB84, 0xFB85, 0xFB86, 0xFB87, 0xFB88, 0xFB89, 0xFB8A, 0xFB8B,
0xFB8C, 0xFB8D, 0xFB8E, 0xFB8F, 0xFB90, 0xFB91, 0xFB92, 0xFB93, 0xFB94,
0xFB95, 0xFB96, 0xFB97, 0xFB98, 0xFB99, 0xFB9A, 0xFB9B, 0xFB9C, 0xFB9D,
0xFB9E, 0xFB9F, 0xFBA0, 0xFBA1, 0xFBA2, 0xFBA3, 0xFBA4, 0xFBA5, 0xFBA6,
0xFBA7, 0xFBA8, 0xFBA9, 0xFBAA, 0xFBAB, 0xFBAC, 0xFBAD, 0xFBAE, 0xFBAF,
0xFBB0, 0xFBB1, 0xFBB2, 0xFBB3, 0xFBB4, 0xFBB5, 0xFBB6, 0xFBB7, 0xFBB8,
0xFBB9, 0xFBBA, 0xFBBB, 0xFBBC, 0xFBBD, 0xFBBE, 0xFBBF, 0xFBC0, 0xFBC1,
0xFBD3, 0xFBD4, 0xFBD5, 0xFBD6, 0xFBD7, 0xFBD8, 0xFBD9, 0xFBDA, 0xFBDB,
0xFBDC, 0xFBDD, 0xFBDE, 0xFBDF, 0xFBE0, 0xFBE1, 0xFBE2, 0xFBE3, 0xFBE4,
0xFBE5, 0xFBE6, 0xFBE7, 0xFBE8, 0xFBE9, 0xFBEA, 0xFBEB, 0xFBEC, 0xFBED,
0xFBEE, 0xFBEF, 0xFBF0, 0xFBF1, 0xFBF2, 0xFBF3, 0xFBF4, 0xFBF5, 0xFBF6,
0xFBF7, 0xFBF8, 0xFBF9, 0xFBFA, 0xFBFB, 0xFBFC, 0xFBFD, 0xFBFE, 0xFBFF,
0xFC00, 0xFC01, 0xFC02, 0xFC03, 0xFC04, 0xFC05, 0xFC06, 0xFC07, 0xFC08,
0xFC09, 0xFC0A, 0xFC0B, 0xFC0C, 0xFC0D, 0xFC0E, 0xFC0F, 0xFC10, 0xFC11,
0xFC12, 0xFC13, 0xFC14, 0xFC15, 0xFC16, 0xFC17, 0xFC18, 0xFC19, 0xFC1A,
0xFC1B, 0xFC1C, 0xFC1D, 0xFC1E, 0xFC1F, 0xFC20, 0xFC21, 0xFC22, 0xFC23,
0xFC24, 0xFC25, 0xFC26, 0xFC27, 0xFC28, 0xFC29, 0xFC2A, 0xFC2B, 0xFC2C,
0xFC2D, 0xFC2E, 0xFC2F, 0xFC30, 0xFC31, 0xFC32, 0xFC33, 0xFC34, 0xFC35,
0xFC36, 0xFC37, 0xFC38, 0xFC39, 0xFC3A, 0xFC3B, 0xFC3C, 0xFC3D, 0xFC3E,
0xFC3F, 0xFC40, 0xFC41, 0xFC42, 0xFC43, 0xFC44, 0xFC45, 0xFC46, 0xFC47,
0xFC48, 0xFC49, 0xFC4A, 0xFC4B, 0xFC4C, 0xFC4D, 0xFC4E, 0xFC4F, 0xFC50,
0xFC51, 0xFC52, 0xFC53, 0xFC54, 0xFC55, 0xFC56, 0xFC57, 0xFC58, 0xFC59,
0xFC5A, 0xFC5B, 0xFC5C, 0xFC5D, 0xFC5E, 0xFC5F, 0xFC60, 0xFC61, 0xFC62,
0xFC63, 0xFC64, 0xFC65, 0xFC66, 0xFC67, 0xFC68, 0xFC69, 0xFC6A, 0xFC6B,
0xFC6C, 0xFC6D, 0xFC6E, 0xFC6F, 0xFC70, 0xFC71, 0xFC72, 0xFC73, 0xFC74,
0xFC75, 0xFC76, 0xFC77, 0xFC78, 0xFC79, 0xFC7A, 0xFC7B, 0xFC7C, 0xFC7D,
0xFC7E, 0xFC7F, 0xFC80, 0xFC81, 0xFC82, 0xFC83, 0xFC84, 0xFC85, 0xFC86,
0xFC87, 0xFC88, 0xFC89, 0xFC8A, 0xFC8B, 0xFC8C, 0xFC8D, 0xFC8E, 0xFC8F,
0xFC90, 0xFC91, 0xFC92, 0xFC93, 0xFC94, 0xFC95, 0xFC96, 0xFC97, 0xFC98,
0xFC99, 0xFC9A, 0xFC9B, 0xFC9C, 0xFC9D, 0xFC9E, 0xFC9F, 0xFCA0, 0xFCA1,
0xFCA2, 0xFCA3, 0xFCA4, 0xFCA5, 0xFCA6, 0xFCA7, 0xFCA8, 0xFCA9, 0xFCAA,
0xFCAB, 0xFCAC, 0xFCAD, 0xFCAE, 0xFCAF, 0xFCB0, 0xFCB1, 0xFCB2, 0xFCB3,
0xFCB4, 0xFCB5, 0xFCB6, 0xFCB7, 0xFCB8, 0xFCB9, 0xFCBA, 0xFCBB, 0xFCBC,
0xFCBD, 0xFCBE, 0xFCBF, 0xFCC0, 0xFCC1, 0xFCC2, 0xFCC3, 0xFCC4, 0xFCC5,
0xFCC6, 0xFCC7, 0xFCC8, 0xFCC9, 0xFCCA, 0xFCCB, 0xFCCC, 0xFCCD, 0xFCCE,
0xFCCF, 0xFCD0, 0xFCD1, 0xFCD2, 0xFCD3, 0xFCD4, 0xFCD5, 0xFCD6, 0xFCD7,
0xFCD8, 0xFCD9, 0xFCDA, 0xFCDB, 0xFCDC, 0xFCDD, 0xFCDE, 0xFCDF, 0xFCE0,
0xFCE1, 0xFCE2, 0xFCE3, 0xFCE4, 0xFCE5, 0xFCE6, 0xFCE7, 0xFCE8, 0xFCE9,
0xFCEA, 0xFCEB, 0xFCEC, 0xFCED, 0xFCEE, 0xFCEF, 0xFCF0, 0xFCF1, 0xFCF2,
0xFCF3, 0xFCF4, 0xFCF5, 0xFCF6, 0xFCF7, 0xFCF8, 0xFCF9, 0xFCFA, 0xFCFB,
0xFCFC, 0xFCFD, 0xFCFE, 0xFCFF, 0xFD00, 0xFD01, 0xFD02, 0xFD03, 0xFD04,
0xFD05, 0xFD06, 0xFD07, 0xFD08, 0xFD09, 0xFD0A, 0xFD0B, 0xFD0C, 0xFD0D,
0xFD0E, 0xFD0F, 0xFD10, 0xFD11, 0xFD12, 0xFD13, 0xFD14, 0xFD15, 0xFD16,
0xFD17, 0xFD18, 0xFD19, 0xFD1A, 0xFD1B, 0xFD1C, 0xFD1D, 0xFD1E, 0xFD1F,
0xFD20, 0xFD21, 0xFD22, 0xFD23, 0xFD24, 0xFD25, 0xFD26, 0xFD27, 0xFD28,
0xFD29, 0xFD2A, 0xFD2B, 0xFD2C, 0xFD2D, 0xFD2E, 0xFD2F, 0xFD30, 0xFD31,
0xFD32, 0xFD33, 0xFD34, 0xFD35, 0xFD36, 0xFD37, 0xFD38, 0xFD39, 0xFD3A,
0xFD3B, 0xFD3C, 0xFD3D, 0xFD50, 0xFD51, 0xFD52, 0xFD53, 0xFD54, 0xFD55,
0xFD56, 0xFD57, 0xFD58, 0xFD59, 0xFD5A, 0xFD5B, 0xFD5C, 0xFD5D, 0xFD5E,
0xFD5F, 0xFD60, 0xFD61, 0xFD62, 0xFD63, 0xFD64, 0xFD65, 0xFD66, 0xFD67,
0xFD68, 0xFD69, 0xFD6A, 0xFD6B, 0xFD6C, 0xFD6D, 0xFD6E, 0xFD6F, 0xFD70,
0xFD71, 0xFD72, 0xFD73, 0xFD74, 0xFD75, 0xFD76, 0xFD77, 0xFD78, 0xFD79,
0xFD7A, 0xFD7B, 0xFD7C, 0xFD7D, 0xFD7E, 0xFD7F, 0xFD80, 0xFD81, 0xFD82,
0xFD83, 0xFD84, 0xFD85, 0xFD86, 0xFD87, 0xFD88, 0xFD89, 0xFD8A, 0xFD8B,
0xFD8C, 0xFD8D, 0xFD8E, 0xFD8F, 0xFD92, 0xFD93, 0xFD94, 0xFD95, 0xFD96,
0xFD97, 0xFD98, 0xFD99, 0xFD9A, 0xFD9B, 0xFD9C, 0xFD9D, 0xFD9E, 0xFD9F,
0xFDA0, 0xFDA1, 0xFDA2, 0xFDA3, 0xFDA4, 0xFDA5, 0xFDA6, 0xFDA7, 0xFDA8,
0xFDA9, 0xFDAA, 0xFDAB, 0xFDAC, 0xFDAD, 0xFDAE, 0xFDAF, 0xFDB0, 0xFDB1,
0xFDB2, 0xFDB3, 0xFDB4, 0xFDB5, 0xFDB6, 0xFDB7, 0xFDB8, 0xFDB9, 0xFDBA,
0xFDBB, 0xFDBC, 0xFDBD, 0xFDBE, 0xFDBF, 0xFDC0, 0xFDC1, 0xFDC2, 0xFDC3,
0xFDC4, 0xFDC5, 0xFDC6, 0xFDC7, 0xFDF0, 0xFDF1, 0xFDF2, 0xFDF3, 0xFDF4,
0xFDF5, 0xFDF6, 0xFDF7, 0xFDF8, 0xFDF9, 0xFDFA, 0xFDFB, 0xFDFC, 0xFE70,
0xFE71, 0xFE72, 0xFE73, 0xFE74, 0xFE76, 0xFE77, 0xFE78, 0xFE79, 0xFE7A,
0xFE7B, 0xFE7C, 0xFE7D, 0xFE7E, 0xFE7F, 0xFE80, 0xFE81, 0xFE82, 0xFE83,
0xFE84, 0xFE85, 0xFE86, 0xFE87, 0xFE88, 0xFE89, 0xFE8A, 0xFE8B, 0xFE8C,
0xFE8D, 0xFE8E, 0xFE8F, 0xFE90, 0xFE91, 0xFE92, 0xFE93, 0xFE94, 0xFE95,
0xFE96, 0xFE97, 0xFE98, 0xFE99, 0xFE9A, 0xFE9B, 0xFE9C, 0xFE9D, 0xFE9E,
0xFE9F, 0xFEA0, 0xFEA1, 0xFEA2, 0xFEA3, 0xFEA4, 0xFEA5, 0xFEA6, 0xFEA7,
0xFEA8, 0xFEA9, 0xFEAA, 0xFEAB, 0xFEAC, 0xFEAD, 0xFEAE, 0xFEAF, 0xFEB0,
0xFEB1, 0xFEB2, 0xFEB3, 0xFEB4, 0xFEB5, 0xFEB6, 0xFEB7, 0xFEB8, 0xFEB9,
0xFEBA, 0xFEBB, 0xFEBC, 0xFEBD, 0xFEBE, 0xFEBF, 0xFEC0, 0xFEC1, 0xFEC2,
0xFEC3, 0xFEC4, 0xFEC5, 0xFEC6, 0xFEC7, 0xFEC8, 0xFEC9, 0xFECA, 0xFECB,
0xFECC, 0xFECD, 0xFECE, 0xFECF, 0xFED0, 0xFED1, 0xFED2, 0xFED3, 0xFED4,
0xFED5, 0xFED6, 0xFED7, 0xFED8, 0xFED9, 0xFEDA, 0xFEDB, 0xFEDC, 0xFEDD,
0xFEDE, 0xFEDF, 0xFEE0, 0xFEE1, 0xFEE2, 0xFEE3, 0xFEE4, 0xFEE5, 0xFEE6,
0xFEE7, 0xFEE8, 0xFEE9, 0xFEEA, 0xFEEB, 0xFEEC, 0xFEED, 0xFEEE, 0xFEEF,
0xFEF0, 0xFEF1, 0xFEF2, 0xFEF3, 0xFEF4, 0xFEF5, 0xFEF6, 0xFEF7, 0xFEF8,
0xFEF9, 0xFEFA, 0xFEFB, 0xFEFC, 0x10800, 0x10801, 0x10802, 0x10803,
0x10804, 0x10805, 0x10808, 0x1080A, 0x1080B, 0x1080C, 0x1080D, 0x1080E,
0x1080F, 0x10810, 0x10811, 0x10812, 0x10813, 0x10814, 0x10815, 0x10816,
0x10817, 0x10818, 0x10819, 0x1081A, 0x1081B, 0x1081C, 0x1081D, 0x1081E,
0x1081F, 0x10820, 0x10821, 0x10822, 0x10823, 0x10824, 0x10825, 0x10826,
0x10827, 0x10828, 0x10829, 0x1082A, 0x1082B, 0x1082C, 0x1082D, 0x1082E,
0x1082F, 0x10830, 0x10831, 0x10832, 0x10833, 0x10834, 0x10835, 0x10837,
0x10838, 0x1083C, 0x1083F, 0x10840, 0x10841, 0x10842, 0x10843, 0x10844,
0x10845, 0x10846, 0x10847, 0x10848, 0x10849, 0x1084A, 0x1084B, 0x1084C,
0x1084D, 0x1084E, 0x1084F, 0x10850, 0x10851, 0x10852, 0x10853, 0x10854,
0x10855, 0x10857, 0x10858, 0x10859, 0x1085A, 0x1085B, 0x1085C, 0x1085D,
0x1085E, 0x1085F, 0x10900, 0x10901, 0x10902, 0x10903, 0x10904, 0x10905,
0x10906, 0x10907, 0x10908, 0x10909, 0x1090A, 0x1090B, 0x1090C, 0x1090D,
0x1090E, 0x1090F, 0x10910, 0x10911, 0x10912, 0x10913, 0x10914, 0x10915,
0x10916, 0x10917, 0x10918, 0x10919, 0x1091A, 0x1091B, 0x10920, 0x10921,
0x10922, 0x10923, 0x10924, 0x10925, 0x10926, 0x10927, 0x10928, 0x10929,
0x1092A, 0x1092B, 0x1092C, 0x1092D, 0x1092E, 0x1092F, 0x10930, 0x10931,
0x10932, 0x10933, 0x10934, 0x10935, 0x10936, 0x10937, 0x10938, 0x10939,
0x1093F, 0x10980, 0x10981, 0x10982, 0x10983, 0x10984, 0x10985, 0x10986,
0x10987, 0x10988, 0x10989, 0x1098A, 0x1098B, 0x1098C, 0x1098D, 0x1098E,
0x1098F, 0x10990, 0x10991, 0x10992, 0x10993, 0x10994, 0x10995, 0x10996,
0x10997, 0x10998, 0x10999, 0x1099A, 0x1099B, 0x1099C, 0x1099D, 0x1099E,
0x1099F, 0x109A0, 0x109A1, 0x109A2, 0x109A3, 0x109A4, 0x109A5, 0x109A6,
0x109A7, 0x109A8, 0x109A9, 0x109AA, 0x109AB, 0x109AC, 0x109AD, 0x109AE,
0x109AF, 0x109B0, 0x109B1, 0x109B2, 0x109B3, 0x109B4, 0x109B5, 0x109B6,
0x109B7, 0x109BE, 0x109BF, 0x10A00, 0x10A10, 0x10A11, 0x10A12, 0x10A13,
0x10A15, 0x10A16, 0x10A17, 0x10A19, 0x10A1A, 0x10A1B, 0x10A1C, 0x10A1D,
0x10A1E, 0x10A1F, 0x10A20, 0x10A21, 0x10A22, 0x10A23, 0x10A24, 0x10A25,
0x10A26, 0x10A27, 0x10A28, 0x10A29, 0x10A2A, 0x10A2B, 0x10A2C, 0x10A2D,
0x10A2E, 0x10A2F, 0x10A30, 0x10A31, 0x10A32, 0x10A33, 0x10A40, 0x10A41,
0x10A42, 0x10A43, 0x10A44, 0x10A45, 0x10A46, 0x10A47, 0x10A50, 0x10A51,
0x10A52, 0x10A53, 0x10A54, 0x10A55, 0x10A56, 0x10A57, 0x10A58, 0x10A60,
0x10A61, 0x10A62, 0x10A63, 0x10A64, 0x10A65, 0x10A66, 0x10A67, 0x10A68,
0x10A69, 0x10A6A, 0x10A6B, 0x10A6C, 0x10A6D, 0x10A6E, 0x10A6F, 0x10A70,
0x10A71, 0x10A72, 0x10A73, 0x10A74, 0x10A75, 0x10A76, 0x10A77, 0x10A78,
0x10A79, 0x10A7A, 0x10A7B, 0x10A7C, 0x10A7D, 0x10A7E, 0x10A7F, 0x10B00,
0x10B01, 0x10B02, 0x10B03, 0x10B04, 0x10B05, 0x10B06, 0x10B07, 0x10B08,
0x10B09, 0x10B0A, 0x10B0B, 0x10B0C, 0x10B0D, 0x10B0E, 0x10B0F, 0x10B10,
0x10B11, 0x10B12, 0x10B13, 0x10B14, 0x10B15, 0x10B16, 0x10B17, 0x10B18,
0x10B19, 0x10B1A, 0x10B1B, 0x10B1C, 0x10B1D, 0x10B1E, 0x10B1F, 0x10B20,
0x10B21, 0x10B22, 0x10B23, 0x10B24, 0x10B25, 0x10B26, 0x10B27, 0x10B28,
0x10B29, 0x10B2A, 0x10B2B, 0x10B2C, 0x10B2D, 0x10B2E, 0x10B2F, 0x10B30,
0x10B31, 0x10B32, 0x10B33, 0x10B34, 0x10B35, 0x10B40, 0x10B41, 0x10B42,
0x10B43, 0x10B44, 0x10B45, 0x10B46, 0x10B47, 0x10B48, 0x10B49, 0x10B4A,
0x10B4B, 0x10B4C, 0x10B4D, 0x10B4E, 0x10B4F, 0x10B50, 0x10B51, 0x10B52,
0x10B53, 0x10B54, 0x10B55, 0x10B58, 0x10B59, 0x10B5A, 0x10B5B, 0x10B5C,
0x10B5D, 0x10B5E, 0x10B5F, 0x10B60, 0x10B61, 0x10B62, 0x10B63, 0x10B64,
0x10B65, 0x10B66, 0x10B67, 0x10B68, 0x10B69, 0x10B6A, 0x10B6B, 0x10B6C,
0x10B6D, 0x10B6E, 0x10B6F, 0x10B70, 0x10B71, 0x10B72, 0x10B78, 0x10B79,
0x10B7A, 0x10B7B, 0x10B7C, 0x10B7D, 0x10B7E, 0x10B7F, 0x10C00, 0x10C01,
0x10C02, 0x10C03, 0x10C04, 0x10C05, 0x10C06, 0x10C07, 0x10C08, 0x10C09,
0x10C0A, 0x10C0B, 0x10C0C, 0x10C0D, 0x10C0E, 0x10C0F, 0x10C10, 0x10C11,
0x10C12, 0x10C13, 0x10C14, 0x10C15, 0x10C16, 0x10C17, 0x10C18, 0x10C19,
0x10C1A, 0x10C1B, 0x10C1C, 0x10C1D, 0x10C1E, 0x10C1F, 0x10C20, 0x10C21,
0x10C22, 0x10C23, 0x10C24, 0x10C25, 0x10C26, 0x10C27, 0x10C28, 0x10C29,
0x10C2A, 0x10C2B, 0x10C2C, 0x10C2D, 0x10C2E, 0x10C2F, 0x10C30, 0x10C31,
0x10C32, 0x10C33, 0x10C34, 0x10C35, 0x10C36, 0x10C37, 0x10C38, 0x10C39,
0x10C3A, 0x10C3B, 0x10C3C, 0x10C3D, 0x10C3E, 0x10C3F, 0x10C40, 0x10C41,
0x10C42, 0x10C43, 0x10C44, 0x10C45, 0x10C46, 0x10C47, 0x10C48, 0x1EE00,
0x1EE01, 0x1EE02, 0x1EE03, 0x1EE05, 0x1EE06, 0x1EE07, 0x1EE08, 0x1EE09,
0x1EE0A, 0x1EE0B, 0x1EE0C, 0x1EE0D, 0x1EE0E, 0x1EE0F, 0x1EE10, 0x1EE11,
0x1EE12, 0x1EE13, 0x1EE14, 0x1EE15, 0x1EE16, 0x1EE17, 0x1EE18, 0x1EE19,
0x1EE1A, 0x1EE1B, 0x1EE1C, 0x1EE1D, 0x1EE1E, 0x1EE1F, 0x1EE21, 0x1EE22,
0x1EE24, 0x1EE27, 0x1EE29, 0x1EE2A, 0x1EE2B, 0x1EE2C, 0x1EE2D, 0x1EE2E,
0x1EE2F, 0x1EE30, 0x1EE31, 0x1EE32, 0x1EE34, 0x1EE35, 0x1EE36, 0x1EE37,
0x1EE39, 0x1EE3B, 0x1EE42, 0x1EE47, 0x1EE49, 0x1EE4B, 0x1EE4D, 0x1EE4E,
0x1EE4F, 0x1EE51, 0x1EE52, 0x1EE54, 0x1EE57, 0x1EE59, 0x1EE5B, 0x1EE5D,
0x1EE5F, 0x1EE61, 0x1EE62, 0x1EE64, 0x1EE67, 0x1EE68, 0x1EE69, 0x1EE6A,
0x1EE6C, 0x1EE6D, 0x1EE6E, 0x1EE6F, 0x1EE70, 0x1EE71, 0x1EE72, 0x1EE74,
0x1EE75, 0x1EE76, 0x1EE77, 0x1EE79, 0x1EE7A, 0x1EE7B, 0x1EE7C, 0x1EE7E,
0x1EE80, 0x1EE81, 0x1EE82, 0x1EE83, 0x1EE84, 0x1EE85, 0x1EE86, 0x1EE87,
0x1EE88, 0x1EE89, 0x1EE8B, 0x1EE8C, 0x1EE8D, 0x1EE8E, 0x1EE8F, 0x1EE90,
0x1EE91, 0x1EE92, 0x1EE93, 0x1EE94, 0x1EE95, 0x1EE96, 0x1EE97, 0x1EE98,
0x1EE99, 0x1EE9A, 0x1EE9B, 0x1EEA1, 0x1EEA2, 0x1EEA3, 0x1EEA5, 0x1EEA6,
0x1EEA7, 0x1EEA8, 0x1EEA9, 0x1EEAB, 0x1EEAC, 0x1EEAD, 0x1EEAE, 0x1EEAF,
0x1EEB0, 0x1EEB1, 0x1EEB2, 0x1EEB3, 0x1EEB4, 0x1EEB5, 0x1EEB6, 0x1EEB7,
0x1EEB8, 0x1EEB9, 0x1EEBA, 0x1EEBB, 0x10FFFD];
function determineBidi(cueDiv) {
var nodeStack = [],
text = "",
charCode;
if (!cueDiv || !cueDiv.childNodes) {
return "ltr";
}
function pushNodes(nodeStack, node) {
for (var i = node.childNodes.length - 1; i >= 0; i--) {
nodeStack.push(node.childNodes[i]);
}
}
function nextTextNode(nodeStack) {
if (!nodeStack || !nodeStack.length) {
return null;
}
var node = nodeStack.pop(),
text = node.textContent || node.innerText;
if (text) {
// TODO: This should match all unicode type B characters (paragraph
// separator characters). See issue #115.
var m = text.match(/^.*(\n|\r)/);
if (m) {
nodeStack.length = 0;
return m[0];
}
return text;
}
if (node.tagName === "ruby") {
return nextTextNode(nodeStack);
}
if (node.childNodes) {
pushNodes(nodeStack, node);
return nextTextNode(nodeStack);
}
}
pushNodes(nodeStack, cueDiv);
while ((text = nextTextNode(nodeStack))) {
for (var i = 0; i < text.length; i++) {
charCode = text.charCodeAt(i);
for (var j = 0; j < strongRTLChars.length; j++) {
if (strongRTLChars[j] === charCode) {
return "rtl";
}
}
}
}
return "ltr";
}
function computeLinePos(cue) {
if (typeof cue.line === "number" &&
(cue.snapToLines || (cue.line >= 0 && cue.line <= 100))) {
return cue.line;
}
if (!cue.track || !cue.track.textTrackList ||
!cue.track.textTrackList.mediaElement) {
return -1;
}
var track = cue.track,
trackList = track.textTrackList,
count = 0;
for (var i = 0; i < trackList.length && trackList[i] !== track; i++) {
if (trackList[i].mode === "showing") {
count++;
}
}
return ++count * -1;
}
function StyleBox() {
}
// Apply styles to a div. If there is no div passed then it defaults to the
// div on 'this'.
StyleBox.prototype.applyStyles = function(styles, div) {
div = div || this.div;
for (var prop in styles) {
if (styles.hasOwnProperty(prop)) {
div.style[prop] = styles[prop];
}
}
};
StyleBox.prototype.formatStyle = function(val, unit) {
return val === 0 ? 0 : val + unit;
};
// Constructs the computed display state of the cue (a div). Places the div
// into the overlay which should be a block level element (usually a div).
function CueStyleBox(window, cue, styleOptions) {
var isIE8 = (/MSIE\s8\.0/).test(navigator.userAgent);
var color = "rgba(255, 255, 255, 1)";
var backgroundColor = "rgba(0, 0, 0, 0.8)";
if (isIE8) {
color = "rgb(255, 255, 255)";
backgroundColor = "rgb(0, 0, 0)";
}
StyleBox.call(this);
this.cue = cue;
// Parse our cue's text into a DOM tree rooted at 'cueDiv'. This div will
// have inline positioning and will function as the cue background box.
this.cueDiv = parseContent(window, cue.text);
var styles = {
color: color,
backgroundColor: backgroundColor,
position: "relative",
left: 0,
right: 0,
top: 0,
bottom: 0,
display: "inline"
};
if (!isIE8) {
styles.writingMode = cue.vertical === "" ? "horizontal-tb"
: cue.vertical === "lr" ? "vertical-lr"
: "vertical-rl";
styles.unicodeBidi = "plaintext";
}
this.applyStyles(styles, this.cueDiv);
// Create an absolutely positioned div that will be used to position the cue
// div. Note, all WebVTT cue-setting alignments are equivalent to the CSS
// mirrors of them except "middle" which is "center" in CSS.
this.div = window.document.createElement("div");
styles = {
textAlign: cue.align === "middle" ? "center" : cue.align,
font: styleOptions.font,
whiteSpace: "pre-line",
position: "absolute"
};
if (!isIE8) {
styles.direction = determineBidi(this.cueDiv);
styles.writingMode = cue.vertical === "" ? "horizontal-tb"
: cue.vertical === "lr" ? "vertical-lr"
: "vertical-rl".
stylesunicodeBidi = "plaintext";
}
this.applyStyles(styles);
this.div.appendChild(this.cueDiv);
// Calculate the distance from the reference edge of the viewport to the text
// position of the cue box. The reference edge will be resolved later when
// the box orientation styles are applied.
var textPos = 0;
switch (cue.positionAlign) {
case "start":
textPos = cue.position;
break;
case "middle":
textPos = cue.position - (cue.size / 2);
break;
case "end":
textPos = cue.position - cue.size;
break;
}
// Horizontal box orientation; textPos is the distance from the left edge of the
// area to the left edge of the box and cue.size is the distance extending to
// the right from there.
if (cue.vertical === "") {
this.applyStyles({
left: this.formatStyle(textPos, "%"),
width: this.formatStyle(cue.size, "%")
});
// Vertical box orientation; textPos is the distance from the top edge of the
// area to the top edge of the box and cue.size is the height extending
// downwards from there.
} else {
this.applyStyles({
top: this.formatStyle(textPos, "%"),
height: this.formatStyle(cue.size, "%")
});
}
this.move = function(box) {
this.applyStyles({
top: this.formatStyle(box.top, "px"),
bottom: this.formatStyle(box.bottom, "px"),
left: this.formatStyle(box.left, "px"),
right: this.formatStyle(box.right, "px"),
height: this.formatStyle(box.height, "px"),
width: this.formatStyle(box.width, "px")
});
};
}
CueStyleBox.prototype = _objCreate(StyleBox.prototype);
CueStyleBox.prototype.constructor = CueStyleBox;
// Represents the co-ordinates of an Element in a way that we can easily
// compute things with such as if it overlaps or intersects with another Element.
// Can initialize it with either a StyleBox or another BoxPosition.
function BoxPosition(obj) {
var isIE8 = (/MSIE\s8\.0/).test(navigator.userAgent);
// Either a BoxPosition was passed in and we need to copy it, or a StyleBox
// was passed in and we need to copy the results of 'getBoundingClientRect'
// as the object returned is readonly. All co-ordinate values are in reference
// to the viewport origin (top left).
var lh, height, width, top;
if (obj.div) {
height = obj.div.offsetHeight;
width = obj.div.offsetWidth;
top = obj.div.offsetTop;
var rects = (rects = obj.div.childNodes) && (rects = rects[0]) &&
rects.getClientRects && rects.getClientRects();
obj = obj.div.getBoundingClientRect();
// In certain cases the outter div will be slightly larger then the sum of
// the inner div's lines. This could be due to bold text, etc, on some platforms.
// In this case we should get the average line height and use that. This will
// result in the desired behaviour.
lh = rects ? Math.max((rects[0] && rects[0].height) || 0, obj.height / rects.length)
: 0;
}
this.left = obj.left;
this.right = obj.right;
this.top = obj.top || top;
this.height = obj.height || height;
this.bottom = obj.bottom || (top + (obj.height || height));
this.width = obj.width || width;
this.lineHeight = lh !== undefined ? lh : obj.lineHeight;
if (isIE8 && !this.lineHeight) {
this.lineHeight = 13;
}
}
// Move the box along a particular axis. Optionally pass in an amount to move
// the box. If no amount is passed then the default is the line height of the
// box.
BoxPosition.prototype.move = function(axis, toMove) {
toMove = toMove !== undefined ? toMove : this.lineHeight;
switch (axis) {
case "+x":
this.left += toMove;
this.right += toMove;
break;
case "-x":
this.left -= toMove;
this.right -= toMove;
break;
case "+y":
this.top += toMove;
this.bottom += toMove;
break;
case "-y":
this.top -= toMove;
this.bottom -= toMove;
break;
}
};
// Check if this box overlaps another box, b2.
BoxPosition.prototype.overlaps = function(b2) {
return this.left < b2.right &&
this.right > b2.left &&
this.top < b2.bottom &&
this.bottom > b2.top;
};
// Check if this box overlaps any other boxes in boxes.
BoxPosition.prototype.overlapsAny = function(boxes) {
for (var i = 0; i < boxes.length; i++) {
if (this.overlaps(boxes[i])) {
return true;
}
}
return false;
};
// Check if this box is within another box.
BoxPosition.prototype.within = function(container) {
return this.top >= container.top &&
this.bottom <= container.bottom &&
this.left >= container.left &&
this.right <= container.right;
};
// Check if this box is entirely within the container or it is overlapping
// on the edge opposite of the axis direction passed. For example, if "+x" is
// passed and the box is overlapping on the left edge of the container, then
// return true.
BoxPosition.prototype.overlapsOppositeAxis = function(container, axis) {
switch (axis) {
case "+x":
return this.left < container.left;
case "-x":
return this.right > container.right;
case "+y":
return this.top < container.top;
case "-y":
return this.bottom > container.bottom;
}
};
// Find the percentage of the area that this box is overlapping with another
// box.
BoxPosition.prototype.intersectPercentage = function(b2) {
var x = Math.max(0, Math.min(this.right, b2.right) - Math.max(this.left, b2.left)),
y = Math.max(0, Math.min(this.bottom, b2.bottom) - Math.max(this.top, b2.top)),
intersectArea = x * y;
return intersectArea / (this.height * this.width);
};
// Convert the positions from this box to CSS compatible positions using
// the reference container's positions. This has to be done because this
// box's positions are in reference to the viewport origin, whereas, CSS
// values are in referecne to their respective edges.
BoxPosition.prototype.toCSSCompatValues = function(reference) {
return {
top: this.top - reference.top,
bottom: reference.bottom - this.bottom,
left: this.left - reference.left,
right: reference.right - this.right,
height: this.height,
width: this.width
};
};
// Get an object that represents the box's position without anything extra.
// Can pass a StyleBox, HTMLElement, or another BoxPositon.
BoxPosition.getSimpleBoxPosition = function(obj) {
var height = obj.div ? obj.div.offsetHeight : obj.tagName ? obj.offsetHeight : 0;
var width = obj.div ? obj.div.offsetWidth : obj.tagName ? obj.offsetWidth : 0;
var top = obj.div ? obj.div.offsetTop : obj.tagName ? obj.offsetTop : 0;
obj = obj.div ? obj.div.getBoundingClientRect() :
obj.tagName ? obj.getBoundingClientRect() : obj;
var ret = {
left: obj.left,
right: obj.right,
top: obj.top || top,
height: obj.height || height,
bottom: obj.bottom || (top + (obj.height || height)),
width: obj.width || width
};
return ret;
};
// Move a StyleBox to its specified, or next best, position. The containerBox
// is the box that contains the StyleBox, such as a div. boxPositions are
// a list of other boxes that the styleBox can't overlap with.
function moveBoxToLinePosition(window, styleBox, containerBox, boxPositions) {
// Find the best position for a cue box, b, on the video. The axis parameter
// is a list of axis, the order of which, it will move the box along. For example:
// Passing ["+x", "-x"] will move the box first along the x axis in the positive
// direction. If it doesn't find a good position for it there it will then move
// it along the x axis in the negative direction.
function findBestPosition(b, axis) {
var bestPosition,
specifiedPosition = new BoxPosition(b),
percentage = 1; // Highest possible so the first thing we get is better.
for (var i = 0; i < axis.length; i++) {
while (b.overlapsOppositeAxis(containerBox, axis[i]) ||
(b.within(containerBox) && b.overlapsAny(boxPositions))) {
b.move(axis[i]);
}
// We found a spot where we aren't overlapping anything. This is our
// best position.
if (b.within(containerBox)) {
return b;
}
var p = b.intersectPercentage(containerBox);
// If we're outside the container box less then we were on our last try
// then remember this position as the best position.
if (percentage > p) {
bestPosition = new BoxPosition(b);
percentage = p;
}
// Reset the box position to the specified position.
b = new BoxPosition(specifiedPosition);
}
return bestPosition || specifiedPosition;
}
var boxPosition = new BoxPosition(styleBox),
cue = styleBox.cue,
linePos = computeLinePos(cue),
axis = [];
// If we have a line number to align the cue to.
if (cue.snapToLines) {
var size;
switch (cue.vertical) {
case "":
axis = [ "+y", "-y" ];
size = "height";
break;
case "rl":
axis = [ "+x", "-x" ];
size = "width";
break;
case "lr":
axis = [ "-x", "+x" ];
size = "width";
break;
}
var step = boxPosition.lineHeight,
position = step * Math.round(linePos),
maxPosition = containerBox[size] + step,
initialAxis = axis[0];
// If the specified intial position is greater then the max position then
// clamp the box to the amount of steps it would take for the box to
// reach the max position.
if (Math.abs(position) > maxPosition) {
position = position < 0 ? -1 : 1;
position *= Math.ceil(maxPosition / step) * step;
}
// If computed line position returns negative then line numbers are
// relative to the bottom of the video instead of the top. Therefore, we
// need to increase our initial position by the length or width of the
// video, depending on the writing direction, and reverse our axis directions.
if (linePos < 0) {
position += cue.vertical === "" ? containerBox.height : containerBox.width;
axis = axis.reverse();
}
// Move the box to the specified position. This may not be its best
// position.
boxPosition.move(initialAxis, position);
} else {
// If we have a percentage line value for the cue.
var calculatedPercentage = (boxPosition.lineHeight / containerBox.height) * 100;
switch (cue.lineAlign) {
case "middle":
linePos -= (calculatedPercentage / 2);
break;
case "end":
linePos -= calculatedPercentage;
break;
}
// Apply initial line position to the cue box.
switch (cue.vertical) {
case "":
styleBox.applyStyles({
top: styleBox.formatStyle(linePos, "%")
});
break;
case "rl":
styleBox.applyStyles({
left: styleBox.formatStyle(linePos, "%")
});
break;
case "lr":
styleBox.applyStyles({
right: styleBox.formatStyle(linePos, "%")
});
break;
}
axis = [ "+y", "-x", "+x", "-y" ];
// Get the box position again after we've applied the specified positioning
// to it.
boxPosition = new BoxPosition(styleBox);
}
var bestPosition = findBestPosition(boxPosition, axis);
styleBox.move(bestPosition.toCSSCompatValues(containerBox));
}
function WebVTT() {
// Nothing
}
// Helper to allow strings to be decoded instead of the default binary utf8 data.
WebVTT.StringDecoder = function() {
return {
decode: function(data) {
if (!data) {
return "";
}
if (typeof data !== "string") {
throw new Error("Error - expected string data.");
}
return decodeURIComponent(encodeURIComponent(data));
}
};
};
WebVTT.convertCueToDOMTree = function(window, cuetext) {
if (!window || !cuetext) {
return null;
}
return parseContent(window, cuetext);
};
var FONT_SIZE_PERCENT = 0.05;
var FONT_STYLE = "sans-serif";
var CUE_BACKGROUND_PADDING = "1.5%";
// Runs the processing model over the cues and regions passed to it.
// @param overlay A block level element (usually a div) that the computed cues
// and regions will be placed into.
WebVTT.processCues = function(window, cues, overlay) {
if (!window || !cues || !overlay) {
return null;
}
// Remove all previous children.
while (overlay.firstChild) {
overlay.removeChild(overlay.firstChild);
}
var paddedOverlay = window.document.createElement("div");
paddedOverlay.style.position = "absolute";
paddedOverlay.style.left = "0";
paddedOverlay.style.right = "0";
paddedOverlay.style.top = "0";
paddedOverlay.style.bottom = "0";
paddedOverlay.style.margin = CUE_BACKGROUND_PADDING;
overlay.appendChild(paddedOverlay);
// Determine if we need to compute the display states of the cues. This could
// be the case if a cue's state has been changed since the last computation or
// if it has not been computed yet.
function shouldCompute(cues) {
for (var i = 0; i < cues.length; i++) {
if (cues[i].hasBeenReset || !cues[i].displayState) {
return true;
}
}
return false;
}
// We don't need to recompute the cues' display states. Just reuse them.
if (!shouldCompute(cues)) {
for (var i = 0; i < cues.length; i++) {
paddedOverlay.appendChild(cues[i].displayState);
}
return;
}
var boxPositions = [],
containerBox = BoxPosition.getSimpleBoxPosition(paddedOverlay),
fontSize = Math.round(containerBox.height * FONT_SIZE_PERCENT * 100) / 100;
var styleOptions = {
font: fontSize + "px " + FONT_STYLE
};
(function() {
var styleBox, cue;
for (var i = 0; i < cues.length; i++) {
cue = cues[i];
// Compute the intial position and styles of the cue div.
styleBox = new CueStyleBox(window, cue, styleOptions);
paddedOverlay.appendChild(styleBox.div);
// Move the cue div to it's correct line position.
moveBoxToLinePosition(window, styleBox, containerBox, boxPositions);
// Remember the computed div so that we don't have to recompute it later
// if we don't have too.
cue.displayState = styleBox.div;
boxPositions.push(BoxPosition.getSimpleBoxPosition(styleBox));
}
})();
};
WebVTT.Parser = function(window, vttjs, decoder) {
if (!decoder) {
decoder = vttjs;
vttjs = {};
}
if (!vttjs) {
vttjs = {};
}
this.window = window;
this.vttjs = vttjs;
this.state = "INITIAL";
this.buffer = "";
this.decoder = decoder || new TextDecoder("utf8");
this.regionList = [];
};
WebVTT.Parser.prototype = {
// If the error is a ParsingError then report it to the consumer if
// possible. If it's not a ParsingError then throw it like normal.
reportOrThrowError: function(e) {
if (e instanceof ParsingError) {
this.onparsingerror && this.onparsingerror(e);
} else {
throw e;
}
},
parse: function (data) {
var self = this;
// If there is no data then we won't decode it, but will just try to parse
// whatever is in buffer already. This may occur in circumstances, for
// example when flush() is called.
if (data) {
// Try to decode the data that we received.
self.buffer += self.decoder.decode(data, {stream: true});
}
function collectNextLine() {
var buffer = self.buffer;
var pos = 0;
while (pos < buffer.length && buffer[pos] !== '\r' && buffer[pos] !== '\n') {
++pos;
}
var line = buffer.substr(0, pos);
// Advance the buffer early in case we fail below.
if (buffer[pos] === '\r') {
++pos;
}
if (buffer[pos] === '\n') {
++pos;
}
self.buffer = buffer.substr(pos);
return line;
}
// 3.4 WebVTT region and WebVTT region settings syntax
function parseRegion(input) {
var settings = new Settings();
parseOptions(input, function (k, v) {
switch (k) {
case "id":
settings.set(k, v);
break;
case "width":
settings.percent(k, v);
break;
case "lines":
settings.integer(k, v);
break;
case "regionanchor":
case "viewportanchor":
var xy = v.split(',');
if (xy.length !== 2) {
break;
}
// We have to make sure both x and y parse, so use a temporary
// settings object here.
var anchor = new Settings();
anchor.percent("x", xy[0]);
anchor.percent("y", xy[1]);
if (!anchor.has("x") || !anchor.has("y")) {
break;
}
settings.set(k + "X", anchor.get("x"));
settings.set(k + "Y", anchor.get("y"));
break;
case "scroll":
settings.alt(k, v, ["up"]);
break;
}
}, /=/, /\s/);
// Create the region, using default values for any values that were not
// specified.
if (settings.has("id")) {
var region = new (self.vttjs.VTTRegion || self.window.VTTRegion)();
region.width = settings.get("width", 100);
region.lines = settings.get("lines", 3);
region.regionAnchorX = settings.get("regionanchorX", 0);
region.regionAnchorY = settings.get("regionanchorY", 100);
region.viewportAnchorX = settings.get("viewportanchorX", 0);
region.viewportAnchorY = settings.get("viewportanchorY", 100);
region.scroll = settings.get("scroll", "");
// Register the region.
self.onregion && self.onregion(region);
// Remember the VTTRegion for later in case we parse any VTTCues that
// reference it.
self.regionList.push({
id: settings.get("id"),
region: region
});
}
}
// 3.2 WebVTT metadata header syntax
function parseHeader(input) {
parseOptions(input, function (k, v) {
switch (k) {
case "Region":
// 3.3 WebVTT region metadata header syntax
parseRegion(v);
break;
}
}, /:/);
}
// 5.1 WebVTT file parsing.
try {
var line;
if (self.state === "INITIAL") {
// We can't start parsing until we have the first line.
if (!/\r\n|\n/.test(self.buffer)) {
return this;
}
line = collectNextLine();
var m = line.match(/^WEBVTT([ \t].*)?$/);
if (!m || !m[0]) {
throw new ParsingError(ParsingError.Errors.BadSignature);
}
self.state = "HEADER";
}
var alreadyCollectedLine = false;
while (self.buffer) {
// We can't parse a line until we have the full line.
if (!/\r\n|\n/.test(self.buffer)) {
return this;
}
if (!alreadyCollectedLine) {
line = collectNextLine();
} else {
alreadyCollectedLine = false;
}
switch (self.state) {
case "HEADER":
// 13-18 - Allow a header (metadata) under the WEBVTT line.
if (/:/.test(line)) {
parseHeader(line);
} else if (!line) {
// An empty line terminates the header and starts the body (cues).
self.state = "ID";
}
continue;
case "NOTE":
// Ignore NOTE blocks.
if (!line) {
self.state = "ID";
}
continue;
case "ID":
// Check for the start of NOTE blocks.
if (/^NOTE($|[ \t])/.test(line)) {
self.state = "NOTE";
break;
}
// 19-29 - Allow any number of line terminators, then initialize new cue values.
if (!line) {
continue;
}
self.cue = new (self.vttjs.VTTCue || self.window.VTTCue)(0, 0, "");
self.state = "CUE";
// 30-39 - Check if self line contains an optional identifier or timing data.
if (line.indexOf("-->") === -1) {
self.cue.id = line;
continue;
}
// Process line as start of a cue.
/*falls through*/
case "CUE":
// 40 - Collect cue timings and settings.
try {
parseCue(line, self.cue, self.regionList);
} catch (e) {
self.reportOrThrowError(e);
// In case of an error ignore rest of the cue.
self.cue = null;
self.state = "BADCUE";
continue;
}
self.state = "CUETEXT";
continue;
case "CUETEXT":
var hasSubstring = line.indexOf("-->") !== -1;
// 34 - If we have an empty line then report the cue.
// 35 - If we have the special substring '-->' then report the cue,
// but do not collect the line as we need to process the current
// one as a new cue.
if (!line || hasSubstring && (alreadyCollectedLine = true)) {
// We are done parsing self cue.
self.oncue && self.oncue(self.cue);
self.cue = null;
self.state = "ID";
continue;
}
if (self.cue.text) {
self.cue.text += "\n";
}
self.cue.text += line;
continue;
case "BADCUE": // BADCUE
// 54-62 - Collect and discard the remaining cue.
if (!line) {
self.state = "ID";
}
continue;
}
}
} catch (e) {
self.reportOrThrowError(e);
// If we are currently parsing a cue, report what we have.
if (self.state === "CUETEXT" && self.cue && self.oncue) {
self.oncue(self.cue);
}
self.cue = null;
// Enter BADWEBVTT state if header was not parsed correctly otherwise
// another exception occurred so enter BADCUE state.
self.state = self.state === "INITIAL" ? "BADWEBVTT" : "BADCUE";
}
return this;
},
flush: function () {
var self = this;
try {
// Finish decoding the stream.
self.buffer += self.decoder.decode();
// Synthesize the end of the current cue or region.
if (self.cue || self.state === "HEADER") {
self.buffer += "\n\n";
self.parse();
}
// If we've flushed, parsed, and we're still on the INITIAL state then
// that means we don't have enough of the stream to parse the first
// line.
if (self.state === "INITIAL") {
throw new ParsingError(ParsingError.Errors.BadSignature);
}
} catch(e) {
self.reportOrThrowError(e);
}
self.onflush && self.onflush();
return this;
}
};
global.WebVTT = WebVTT;
}(this, (this.vttjs || {})));
|
app/javascript/mastodon/features/status/components/detailed_status.js
|
NS-Kazuki/mastodon
|
import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import Avatar from '../../../components/avatar';
import DisplayName from '../../../components/display_name';
import StatusContent from '../../../components/status_content';
import MediaGallery from '../../../components/media_gallery';
import AttachmentList from '../../../components/attachment_list';
import { Link } from 'react-router-dom';
import { FormattedDate, FormattedNumber } from 'react-intl';
import Card from './card';
import ImmutablePureComponent from 'react-immutable-pure-component';
import Video from '../../video';
export default class DetailedStatus extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object,
};
static propTypes = {
status: ImmutablePropTypes.map.isRequired,
onOpenMedia: PropTypes.func.isRequired,
onOpenVideo: PropTypes.func.isRequired,
onToggleHidden: PropTypes.func.isRequired,
};
handleAccountClick = (e) => {
if (e.button === 0 && !(e.ctrlKey || e.metaKey)) {
e.preventDefault();
this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
}
e.stopPropagation();
}
handleOpenVideo = (media, startTime) => {
this.props.onOpenVideo(media, startTime);
}
handleExpandedToggle = () => {
this.props.onToggleHidden(this.props.status);
}
render () {
const status = this.props.status.get('reblog') ? this.props.status.get('reblog') : this.props.status;
let media = '';
let applicationLink = '';
let reblogLink = '';
let reblogIcon = 'retweet';
if (status.get('media_attachments').size > 0) {
if (status.get('media_attachments').some(item => item.get('type') === 'unknown')) {
media = <AttachmentList media={status.get('media_attachments')} />;
} else if (status.getIn(['media_attachments', 0, 'type']) === 'video') {
const video = status.getIn(['media_attachments', 0]);
media = (
<Video
preview={video.get('preview_url')}
src={video.get('url')}
alt={video.get('description')}
width={300}
height={150}
inline
onOpenVideo={this.handleOpenVideo}
sensitive={status.get('sensitive')}
/>
);
} else {
media = (
<MediaGallery
standalone
sensitive={status.get('sensitive')}
media={status.get('media_attachments')}
height={300}
onOpenMedia={this.props.onOpenMedia}
/>
);
}
} else if (status.get('spoiler_text').length === 0) {
media = <Card onOpenMedia={this.props.onOpenMedia} card={status.get('card', null)} />;
}
if (status.get('application')) {
applicationLink = <span> · <a className='detailed-status__application' href={status.getIn(['application', 'website'])} target='_blank' rel='noopener'>{status.getIn(['application', 'name'])}</a></span>;
}
if (status.get('visibility') === 'direct') {
reblogIcon = 'envelope';
} else if (status.get('visibility') === 'private') {
reblogIcon = 'lock';
}
if (status.get('visibility') === 'private') {
reblogLink = <i className={`fa fa-${reblogIcon}`} />;
} else {
reblogLink = (<Link to={`/statuses/${status.get('id')}/reblogs`} className='detailed-status__link'>
<i className={`fa fa-${reblogIcon}`} />
<span className='detailed-status__reblogs'>
<FormattedNumber value={status.get('reblogs_count')} />
</span>
</Link>);
}
return (
<div className='detailed-status'>
<a href={status.getIn(['account', 'url'])} onClick={this.handleAccountClick} className='detailed-status__display-name'>
<div className='detailed-status__display-avatar'><Avatar account={status.get('account')} size={48} /></div>
<DisplayName account={status.get('account')} />
</a>
<StatusContent status={status} expanded={!status.get('hidden')} onExpandedToggle={this.handleExpandedToggle} />
{media}
<div className='detailed-status__meta'>
<a className='detailed-status__datetime' href={status.get('url')} target='_blank' rel='noopener'>
<FormattedDate value={new Date(status.get('created_at'))} hour12={false} year='numeric' month='short' day='2-digit' hour='2-digit' minute='2-digit' />
</a>{applicationLink} · {reblogLink} · <Link to={`/statuses/${status.get('id')}/favourites`} className='detailed-status__link'>
<i className='fa fa-star' />
<span className='detailed-status__favorites'>
<FormattedNumber value={status.get('favourites_count')} />
</span>
</Link>
</div>
</div>
);
}
}
|
src/views/AboutView.js
|
octavioturra/pet-patinhas-react
|
import React from 'react';
import { Link } from 'react-router';
const AboutView = () => (
<div className='container text-center'>
<h1>This is the about view!</h1>
<hr />
<Link to='/'>Back To Home View</Link>
</div>
);
export default AboutView;
|
app/scripts/components/FilterBar.js
|
DDDas/reactjs-datagrid-widgets
|
import React from 'react';
import OrderAppStore from '../stores/alt/OrderAppStore';
import OrderAppActions from '../actions/alt/OrderAppActions';
class FilterBar extends React.Component {
constructor(props) {
super(props);
this.state = OrderAppStore.getState();
this._handleRadioChange = this._handleRadioChange.bind(this);
this._handleChange = this._handleChange.bind(this);
this._handleSearch = this._handleSearch.bind(this);
this._handleReset = this._handleReset.bind(this);
}
componentDidMount() {
}
_handleRadioChange() {
if(this.refs.orderTypeDineIn.checked)
{
this.state.filters.orderType = this.refs.orderTypeDineIn.value;
}
else if(this.refs.orderTypeTakeout.checked)
{
this.state.filters.orderType = this.refs.orderTypeTakeout.value;
}
OrderAppActions.updateFilters(this.state.filters);
OrderAppActions.getGridData(this.state.filters);
}
_handleChange(event) {
var fieldValue = event.target.value;
var fieldName = event.target.name;
this.state.filters[fieldName] = fieldValue;
OrderAppActions.updateFilters(this.state.filters);
OrderAppActions.getGridData(this.state.filters);
}
_handleReset() {
//Needs to be component
this.refs.orderTypeDineIn.parentNode.className = 'btn btn-default';
this.refs.orderTypeTakeout.parentNode.className = 'btn btn-default';
this.refs.paymentType.selectedIndex =0;
this.props.onReset();
}
_handleSearch(event) {
var fieldValue = event.target.value;
this.props.onSearch(fieldValue);
}
render() {
return (
<nav className="navbar navbar-default">
<div className="container-fluid">
<div className="navbar-header">
<button type="button" className="navbar-toggle collapsed" data-toggle="collapse" data-target="#navMenuBar" aria-expanded="false">
<span className="sr-only">Toggle navigation</span>
<span className="icon-bar"></span>
<span className="icon-bar"></span>
<span className="icon-bar"></span>
</button>
</div>
<div className="collapse navbar-collapse" id="navMenuBar">
<div className="navbar-form navbar-left">
<div className="form-group">
<label className="control-label">
<span>Order </span>
<div className="btn-group" data-toggle="buttons">
<label className="btn btn-default" onClick={this._handleRadioChange}>
<input type="radio" name="orderType" ref="orderTypeDineIn" autoComplete="off" value='DINEIN' onChange={this._handleRadioChange}/>DINEIN
</label>
<label className="btn btn-default" onClick={this._handleRadioChange}>
<input type="radio" name="orderType" ref="orderTypeTakeout" autoComplete="off" value='TAKEOUT' onChange={this._handleRadioChange}/>TAKEOUT
</label>
</div>
</label>
</div>
</div>
<div className="navbar-form navbar-left">
<div className="form-group">
<label className="control-label">
<span>Payment Type </span>
<select className="form-control" name="paymentType" ref="paymentType" onChange={this._handleChange} ref="paymentType">
<option value='0'>Choose...</option>
<option value='VISA'>VISA</option>
<option value='MASTERCARD'>MASTERCARD</option>
<option value='OTHER'>{this.state.filters.orderType === 'RESTAURANT' ? 'DISCOVER' : 'AMEX'}</option>
</select>
</label>
</div>
</div>
<div className="navbar-form navbar-left">
<div className="form-group">
<label className="control-label">
<span>
<input type='text' name="searchQuery" placeholder="Search" onChange={this._handleSearch} className='form-control'/>
</span>
</label>
</div>
</div>
<div className="navbar-form navbar-right">
<button type="button" className="btn btn-primary" disabled={this.props.isSubmitButtonEnabled} onClick={this._handleReset} style={{fontWeight:'bold'}}>Reset</button>
</div>
</div>
</div>
</nav>
);
}
}
export default FilterBar;
|
public/js/components/ajaxloader.js
|
gonzochic/inox
|
import React from 'react';
export default class AjaxLoader extends React.Component {
constructor(props) {
super(props)
}
render() {
const style = {paddingLeft: '50%'};
return (
<div className = "row">
<div className = "col-xs-12">
<img style={style} src="/public/img/ajax-loader.gif" alt ="loading" />
</div>
</div>
);
}
}
|
app/javascript/mastodon/features/standalone/hashtag_timeline/index.js
|
primenumber/mastodon
|
import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { expandHashtagTimeline } from 'mastodon/actions/timelines';
import Masonry from 'react-masonry-infinite';
import { List as ImmutableList } from 'immutable';
import DetailedStatusContainer from 'mastodon/features/status/containers/detailed_status_container';
import { debounce } from 'lodash';
import LoadingIndicator from 'mastodon/components/loading_indicator';
const mapStateToProps = (state, { hashtag }) => ({
statusIds: state.getIn(['timelines', `hashtag:${hashtag}`, 'items'], ImmutableList()),
isLoading: state.getIn(['timelines', `hashtag:${hashtag}`, 'isLoading'], false),
hasMore: state.getIn(['timelines', `hashtag:${hashtag}`, 'hasMore'], false),
});
export default @connect(mapStateToProps)
class HashtagTimeline extends React.PureComponent {
static propTypes = {
dispatch: PropTypes.func.isRequired,
statusIds: ImmutablePropTypes.list.isRequired,
isLoading: PropTypes.bool.isRequired,
hasMore: PropTypes.bool.isRequired,
hashtag: PropTypes.string.isRequired,
local: PropTypes.bool.isRequired,
};
static defaultProps = {
local: false,
};
componentDidMount () {
const { dispatch, hashtag, local } = this.props;
dispatch(expandHashtagTimeline(hashtag, { local }));
}
handleLoadMore = () => {
const { dispatch, hashtag, local, statusIds } = this.props;
const maxId = statusIds.last();
if (maxId) {
dispatch(expandHashtagTimeline(hashtag, { maxId, local }));
}
}
setRef = c => {
this.masonry = c;
}
handleHeightChange = debounce(() => {
if (!this.masonry) {
return;
}
this.masonry.forcePack();
}, 50)
render () {
const { statusIds, hasMore, isLoading } = this.props;
const sizes = [
{ columns: 1, gutter: 0 },
{ mq: '415px', columns: 1, gutter: 10 },
{ mq: '640px', columns: 2, gutter: 10 },
{ mq: '960px', columns: 3, gutter: 10 },
{ mq: '1255px', columns: 3, gutter: 10 },
];
const loader = (isLoading && statusIds.isEmpty()) ? <LoadingIndicator key={0} /> : undefined;
return (
<Masonry ref={this.setRef} className='statuses-grid' hasMore={hasMore} loadMore={this.handleLoadMore} sizes={sizes} loader={loader}>
{statusIds.map(statusId => (
<div className='statuses-grid__item' key={statusId}>
<DetailedStatusContainer
id={statusId}
compact
measureHeight
onHeightChange={this.handleHeightChange}
/>
</div>
)).toArray()}
</Masonry>
);
}
}
|
src/components/decorators/withViewport.js
|
DenisIzmaylov/react-starter-kit
|
/*! 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 'react/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 {
static displayName = (ComposedComponent.displayName && ComposedComponent.displayName.indexOf('.') !== -1 ?
ComposedComponent.displayName.substr(0, ComposedComponent.displayName.indexOf('.')) :
ComposedComponent.name) + '.' + WithViewport.name;
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', 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});
}
};
}
export default { withViewport };
|
ajax/libs/flocks.js/0.14.7/flocks.js
|
kirbyfan64/cdnjs
|
/** @jsx React.DOM */
/* jshint node: true, browser: true, newcap: false */
/**
* The Flocks library module.
*
* @module Flocks
* @main Flocks
*/
// if it's in a <script> it's defined already
// otherwise assume commonjs
if (typeof React === 'undefined') {
var React = require('react');
}
// wrap the remainder
(function() {
'use strict';
var initialized = false,
updateBlocks = 0,
dirty = false,
tagtype = undefined,
handler = function(Ignored) { return true; },
finalizer = function() { return true; },
prevFCtx = {},
nextFCtx = {},
flocks2_ctxs = { flocks2context: React.PropTypes.object };
function flocksLog(Level, Message) {
if (typeof Level === 'string') {
if (member(Level, ['warn','debug','error','log','info','exception','assert'])) {
console[Level]('Flocks2 [' + Level + '] ' + Message.toString());
} else {
console.log('Flocks2 [Unknown level] ' + Message.toString());
}
} else if (nextFCtx.flocks_config === undefined) {
console.log('Flocks2 pre-config [' + Level.toString() + '] ' + Message.toString());
} else if (nextFCtx.flocks_config.log_level >= Level) {
console.log('Flocks2 [' + Level.toString() + '] ' + Message.toString());
}
}
function enforceString(On, Label) {
Label = Label || 'Argument must be a string';
if (typeof On !== 'string') {
throw Label;
}
}
function isArray(maybeArray) {
return (Object.prototype.toString.call(maybeArray) === '[object Array]');
}
function isNonArrayObject(maybeArray) {
if (typeof maybeArray !== 'object') { return false; }
if (Object.prototype.toString.call(maybeArray) === '[object Array]') { return false; }
return true;
}
function setByKey(Key, MaybeValue) {
enforceString(Key, "Flocks2 set/2 must take a string for its key");
nextFCtx[Key] = MaybeValue;
flocksLog(1, " - Flocks2 setByKey \"" + Key + "\"");
attemptUpdate();
}
// function setByPath(Key, MaybeValue) { flocksLog(0, ' - Flocks2 setByPath stub' ); attemptUpdate(); }
// function setByObject(Key, MaybeValue) { flocksLog(0, ' - Flocks2 setByObject stub'); attemptUpdate(); }
function set(Key, MaybeValue) {
flocksLog(3, ' - Flocks2 multi-set');
if (typeof Key === 'string') { setByKey(Key, MaybeValue); }
// else if (isArray(Key)) { setByPath(Key, MaybeValue); }
// else if (isNonArrayObject(Key)) { setByObject(Key); }
else { throw 'Flocks2 set/1,2 key must be a string or an array'; }
}
function clone(obj) {
if ((null === obj) || ('object' != typeof obj)) { return obj; }
var copy = obj.constructor();
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) { copy[attr] = obj[attr]; }
}
return copy;
}
// ... lol
function member(Item, Array) {
return (!!(~( Array.indexOf(Item, 0) )));
}
function attemptUpdate() {
flocksLog(3, ' - Flocks2 attempting update');
dirty = true;
if (!(initialized)) {
flocksLog(1, ' x Flocks2 skipped update: root is not initialized');
return null;
}
if (updateBlocks) {
flocksLog(1, ' x Flocks2 skipped update: lock count updateBlocks is non-zero');
return null;
}
/* whargarbl see issue #9 https://github.com/StoneCypher/flocks.js/issues/9
if (deepCompare(nextFCtx, prevFCtx)) {
flocksLog(2, ' x Flocks2 skipped update: no update to state');
return true;
}
*/
if (!(handler(nextFCtx))) {
flocksLog(0, ' ! Flocks2 rolling back update: handler rejected propset');
nextFCtx = prevFCtx;
dirty = false;
return null;
}
prevFCtx = nextFCtx;
flocksLog(3, ' - Flocks2 update passed');
React.render( React.createFactory(tagtype)( { flocks2context: nextFCtx } ), document.body );
dirty = false;
flocksLog(3, ' - Flocks2 update complete; finalizing');
finalizer();
return true;
}
function create(iFlocksConfig, iFlocksData) {
var FlocksConfig = iFlocksConfig || {},
FlocksData = iFlocksData || {},
target = FlocksConfig.target || document.body,
stub = function() { window.alert('whargarbl stub'); attemptUpdate(); },
updater = { get: stub, set: set, override: stub, clear: stub, update: stub, lock: stub, unlock: stub };
FlocksConfig.log_level = FlocksConfig.log_level || -1;
tagtype = FlocksConfig.control;
FlocksData.flocks_config = FlocksConfig;
nextFCtx = FlocksData;
flocksLog(1, 'Flocks2 root creation begins');
if (!(tagtype)) { throw 'Flocks2 fatal error: must provide a control in create/2 FlocksConfig'; }
if (FlocksConfig.handler) { handler = FlocksConfig.handler; flocksLog(3, ' - Flocks2 handler assigned' ); }
if (FlocksConfig.finalizer) { finalizer = FlocksConfig.finalizer; flocksLog(3, ' - Flocks2 finalizer assigned'); }
if (FlocksConfig.preventAutoContext) {
flocksLog(2, ' - Flocks2 skipping auto-context');
} else {
flocksLog(2, ' - Flocks2 engaging auto-context');
this.fctx = clone(nextFCtx);
}
flocksLog(3, 'Flocks2 creation finished; initializing');
initialized = true;
attemptUpdate();
flocksLog(3, 'Flocks2 expose updater');
this.fupd = updater;
this.fset = updater.set;
flocksLog(3, 'Flocks2 initialization finished');
return updater;
}
var Mixin = {
contextTypes : flocks2_ctxs,
childContextTypes : flocks2_ctxs,
componentWillMount: function() {
flocksLog(1, ' - Flocks2 component will mount: ' + this.constructor.displayName);
flocksLog(3, typeof this.props.flocks2context === 'undefined'? ' - No F2 Context Prop' : ' - F2 Context Prop found');
flocksLog(3, typeof this.context.flocks2context === 'undefined'? ' - No F2 Context' : ' - F2 Context found');
if (this.props.flocks2context) {
this.context.flocks2context = this.props.flocks2context;
}
this.fset = function(X,Y) { set(X,Y); };
this.fctx = this.context.flocks2context;
},
getChildContext: function() {
return this.context;
}
};
var exports = {
member : Mixin,
create : create,
clone : clone,
isArray : isArray,
isNonArrayObject : isNonArrayObject,
enforceString : enforceString
/*
enforceArray : enforceArray,
enforceNonArrayObject : enforceNonArrayObject,
member : member
*/
};
if (typeof module !== 'undefined') {
module.exports = exports;
} else {
window.flocks = exports;
}
}());
|
src/RelativeSize.js
|
dunnock/react-sigma
|
// @flow
import React from 'react'
import '../sigma/plugins.relativeSize'
type Props = {
initialSize: number,
sigma?: sigma
};
/**
RelativeSize component, interface for RelativeSize sigma plugin.
It supposes that sigma graph is already in place, therefore component should not be
mounted until graph is available. It can be used within Sigma component if graph is
preloaded, or within loader component, like NeoCypher.
Sets nodes sizes corresponding its degree.
@param {number} initialSize start size for every node, will be multiplied by Math.sqrt(node.degree)
**/
class RelativeSize extends React.Component<Props> {
constructor(props: Props) {
super(props)
sigma.plugins.relativeSize(this.props.sigma, this.props.initialSize)
}
render = () => null
}
export default RelativeSize;
|
Sencha/App6.0/workspace/ext/classic/classic/test/specs/button/Segmented.js
|
Webcampak/ui
|
describe("Ext.button.Segmented", function() {
var button;
function makeButton(cfg) {
button = Ext.create(Ext.apply({
xtype: 'segmentedbutton',
renderTo: document.body
}, cfg));
}
function clickButton(index) {
jasmine.fireMouseEvent(button.items.getAt(index).el, 'click');
}
afterEach(function() {
button.destroy();
});
describe("value", function() {
// TODO change event
describe("allowMultiple:false", function() {
function makeButton(cfg) {
button = Ext.create(Ext.apply({
xtype: 'segmentedbutton',
renderTo: document.body,
items: [
{ text: 'Foo', value: 'foo' },
{ text: 'Bar' }
]
}, cfg));
}
it("should initialize with a null value", function() {
makeButton();
expect(button.getValue()).toBeNull();
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(false);
});
it("should initialize with a value", function() {
makeButton({
value: 'foo'
});
expect(button.getValue()).toBe('foo');
expect(button.items.getAt(0).pressed).toBe(true);
expect(button.items.getAt(1).pressed).toBe(false);
});
it("should initialize with an index value", function() {
makeButton({
value: 1
});
expect(button.getValue()).toBe(1);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(true);
});
it("should set a null value", function() {
makeButton({
value: 'foo'
});
button.setValue(null);
expect(button.getValue()).toBe(null);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(false);
});
it("should set a value", function() {
makeButton();
button.setValue('foo');
expect(button.getValue()).toBe('foo');
expect(button.items.getAt(0).pressed).toBe(true);
expect(button.items.getAt(1).pressed).toBe(false);
});
it("should set an index value", function() {
makeButton();
button.setValue(1);
expect(button.getValue()).toBe(1);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(true);
});
it("should set the value if a button is initialized with pressed:true", function() {
makeButton({
items: [{
text: 'Foo',
value: 'foo',
pressed: true
}]
});
expect(button.getValue()).toBe('foo');
expect(button.items.getAt(0).pressed).toBe(true);
});
it("should set the index value if a button with no value is initialized with pressed:true", function() {
makeButton({
items: [{
text: 'Foo'
}, {
text: 'Bar',
pressed: true
}]
});
expect(button.getValue()).toBe(1);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(true);
});
it("should set the value when a button is pressed by the user", function() {
makeButton();
clickButton(0);
expect(button.getValue()).toBe('foo');
expect(button.items.getAt(0).pressed).toBe(true);
expect(button.items.getAt(1).pressed).toBe(false);
clickButton(1);
expect(button.getValue()).toBe(1);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(true);
});
it("should transform an index into a value if button value is available", function() {
makeButton();
// button at index 0 has a value of 'foo' so 0 will be transformed to 'foo'
button.setValue(0);
expect(button.getValue()).toBe('foo');
expect(button.items.getAt(0).pressed).toBe(true);
expect(button.items.getAt(1).pressed).toBe(false);
});
it("should throw an error if multiple values are set", function() {
makeButton();
expect(function () {
button.setValue(['foo', 1]);
}).toThrow("Cannot set multiple values when allowMultiple is false");
});
it("should throw an error if no button value is matched", function() {
makeButton({
id: 'my-button'
});
expect(function () {
button.setValue('blah');
}).toThrow("Invalid value 'blah' for segmented button: 'my-button'");
});
it("should thow an error if index value is out of bounds", function() {
makeButton({
id: 'my-button'
});
expect(function () {
button.setValue(2);
}).toThrow("Invalid value '2' for segmented button: 'my-button'");
});
it("should error if multiple items have the same value", function() {
makeButton({
id: 'my-button'
});
expect(function() {
button.add({
text: 'Foo2',
value: 'foo'
});
}).toThrow("Segmented button 'my-button' cannot contain multiple items with value: 'foo'");
Ext.resumeLayouts();
});
describe("allowDepress:true", function() {
it("should set the value to null when a button is depressed", function() {
makeButton({
allowDepress: true,
items: [{
text: 'Foo',
pressed: true
}]
});
clickButton(0);
expect(button.getValue()).toBe(null);
expect(button.items.getAt(0).pressed).toBe(false);
});
});
});
describe("allowMultiple:true", function() {
function makeButton(cfg) {
button = Ext.create(Ext.apply({
xtype: 'segmentedbutton',
allowMultiple: true,
renderTo: document.body,
items: [
{ text: 'Seg', value: 'seg' },
{ text: 'Men' },
{ text: 'Ted', value: 'ted' }
]
}, cfg));
}
it("should initialize with a null value", function() {
makeButton();
expect(button.getValue()).toEqual([]);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(false);
expect(button.items.getAt(2).pressed).toBe(false);
});
it("should initialize with an empty array", function() {
makeButton({
value: []
});
expect(button.getValue()).toEqual([]);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(false);
expect(button.items.getAt(2).pressed).toBe(false);
});
it("should initialize with a single value", function() {
makeButton({
value: ['seg']
});
expect(button.getValue()).toEqual(['seg']);
expect(button.items.getAt(0).pressed).toBe(true);
expect(button.items.getAt(1).pressed).toBe(false);
expect(button.items.getAt(2).pressed).toBe(false);
});
it("should initialize with a single index value", function() {
makeButton({
value: [1]
});
expect(button.getValue()).toEqual([1]);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(true);
expect(button.items.getAt(2).pressed).toBe(false);
});
it("should initialize with multiple values", function() {
makeButton({
value: ['seg', 'ted']
});
expect(button.getValue()).toEqual(['seg', 'ted']);
expect(button.items.getAt(0).pressed).toBe(true);
expect(button.items.getAt(1).pressed).toBe(false);
expect(button.items.getAt(2).pressed).toBe(true);
});
it("should initialize with multiple index values", function() {
makeButton({
value: [0, 1]
});
expect(button.getValue()).toEqual(['seg', 1]);
expect(button.items.getAt(0).pressed).toBe(true);
expect(button.items.getAt(1).pressed).toBe(true);
expect(button.items.getAt(2).pressed).toBe(false);
});
it("should set a null value", function() {
makeButton({
value: ['seg', 'ted']
});
button.setValue(null);
expect(button.getValue()).toEqual([]);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(false);
expect(button.items.getAt(2).pressed).toBe(false);
});
it("should set the value to emtpy array", function() {
makeButton({
value: ['seg', 'ted']
});
button.setValue([]);
expect(button.getValue()).toEqual([]);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(false);
expect(button.items.getAt(2).pressed).toBe(false);
});
it("should set a single value", function() {
makeButton();
button.setValue(['ted']);
expect(button.getValue()).toEqual(['ted']);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(false);
expect(button.items.getAt(2).pressed).toBe(true);
});
it("should set a single index value", function() {
makeButton();
button.setValue([1]);
expect(button.getValue()).toEqual([1]);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(true);
expect(button.items.getAt(2).pressed).toBe(false);
});
it("should set multiple values", function() {
makeButton();
button.setValue(['seg', 'ted']);
expect(button.getValue()).toEqual(['seg', 'ted']);
expect(button.items.getAt(0).pressed).toBe(true);
expect(button.items.getAt(1).pressed).toBe(false);
expect(button.items.getAt(2).pressed).toBe(true);
});
it("should set multiple index values", function() {
makeButton();
button.setValue([1, 2]);
expect(button.getValue()).toEqual([1, 'ted']);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(true);
expect(button.items.getAt(2).pressed).toBe(true);
});
it("should set values for buttons that are initialized with pressed:true", function() {
makeButton({
items: [{
text: 'Seg',
value: 'seg',
pressed: true
}, {
text: 'Men',
pressed: true
}, {
text: 'Ted',
value: 'ted'
}]
});
expect(button.getValue()).toEqual(['seg', 1]);
expect(button.items.getAt(0).pressed).toBe(true);
expect(button.items.getAt(1).pressed).toBe(true);
expect(button.items.getAt(2).pressed).toBe(false);
});
it("should set the value when a button is pressed by the user", function() {
makeButton();
clickButton(0);
expect(button.getValue()).toEqual(['seg']);
expect(button.items.getAt(0).pressed).toBe(true);
expect(button.items.getAt(1).pressed).toBe(false);
expect(button.items.getAt(2).pressed).toBe(false);
clickButton(1);
expect(button.getValue()).toEqual(['seg', 1]);
expect(button.items.getAt(0).pressed).toBe(true);
expect(button.items.getAt(1).pressed).toBe(true);
expect(button.items.getAt(2).pressed).toBe(false);
clickButton(0);
expect(button.getValue()).toEqual([1]);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(true);
expect(button.items.getAt(2).pressed).toBe(false);
clickButton(1);
expect(button.getValue()).toEqual([]);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(false);
expect(button.items.getAt(2).pressed).toBe(false);
});
it("should accept a non-array value", function() {
makeButton({
value: 'seg'
});
expect(button.getValue()).toEqual(['seg']);
expect(button.items.getAt(0).pressed).toBe(true);
expect(button.items.getAt(1).pressed).toBe(false);
expect(button.items.getAt(2).pressed).toBe(false);
});
it("should accept a non-array index value", function() {
makeButton({
value: 2
});
expect(button.getValue()).toEqual(['ted']);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(false);
expect(button.items.getAt(2).pressed).toBe(true);
});
it("should throw an error if no button value is matched", function() {
makeButton({
id: 'my-button'
});
expect(function () {
button.setValue(['seg', 'blah']);
}).toThrow("Invalid value 'blah' for segmented button: 'my-button'");
});
it("should thow an error if an index value is out of bounds", function() {
makeButton({
id: 'my-button'
});
expect(function () {
button.setValue(['seg', 3, 'ted']);
}).toThrow("Invalid value '3' for segmented button: 'my-button'");
});
it("should not mutate a passed value", function() {
var arr = ['seg'];
makeButton({
value: arr
});
clickButton(2);
expect(arr).toEqual(['seg']);
});
it("should fire a change event", function() {
var newValues = [],
oldValues = [];
makeButton({
listeners: {
change: function(b, newValue, oldValue) {
// Do not use push because that pushes the value array *contents*, not the array itself.
newValues[newValues.length] = newValue;
oldValues[oldValues.length] = oldValue;
}
}
});
// Listener will fire when button is created
oldValues.length = newValues.length = 0;
button.setValue([1, 2]);
expect(button.getValue()).toEqual([1, 'ted']);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(true);
expect(button.items.getAt(2).pressed).toBe(true);
clickButton(1);
expect(button.getValue()).toEqual(['ted']);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(false);
expect(button.items.getAt(2).pressed).toBe(true);
expect(newValues[0]).toEqual([1, 'ted']);
expect(oldValues[0]).toEqual([]);
expect(newValues[1]).toEqual(['ted']);
expect(oldValues[1]).toEqual([1, 'ted']);
});
describe('forceSelection', function() {
it("should initialize with the value of the first button if none configured pressed", function() {
makeButton({
forceSelection: true
});
expect(button.getValue()).toEqual(['seg']);
expect(button.items.getAt(0).pressed).toBe(true);
expect(button.items.getAt(1).pressed).toBe(false);
expect(button.items.getAt(2).pressed).toBe(false);
// This gesture should be vetoed because of forceSelection: true
clickButton(0);
expect(button.getValue()).toEqual(['seg']);
expect(button.items.getAt(0).pressed).toBe(true);
expect(button.items.getAt(1).pressed).toBe(false);
expect(button.items.getAt(2).pressed).toBe(false);
});
});
});
describe("with a viewmodel", function() {
function makeButton(cfg) {
button = Ext.create(Ext.apply({
xtype: 'segmentedbutton',
renderTo: document.body,
items: [{
text: 'Foo',
value: 'foo'
}, {
text: 'Bar',
value: 'bar'
}, {
text: 'Baz',
value: 'baz'
}]
}, cfg));
}
it("should have the defaultBindProperty be value", function() {
makeButton();
expect(button.defaultBindProperty).toBe('value');
});
it("should be able to set an initial value from the view model", function() {
var vm = new Ext.app.ViewModel({
data: {
value: 'baz'
}
});
makeButton({
viewModel: vm,
bind: '{value}'
});
vm.notify();
expect(button.getValue()).toBe('baz');
});
it("should react to view model changes", function() {
var vm = new Ext.app.ViewModel();
makeButton({
viewModel: vm,
bind: '{value}'
});
vm.set('value', 'foo');
vm.notify();
expect(button.getValue()).toBe('foo');
});
it("should update the value in the view model", function() {
var vm = new Ext.app.ViewModel();
makeButton({
viewModel: vm,
bind: '{value}'
});
button.setValue('bar');
expect(vm.get('value')).toBe('bar');
});
});
});
describe("the toggle event", function() {
var handler;
beforeEach(function() {
handler = jasmine.createSpy();
makeButton({
allowMultiple: true,
items: [
{ text: 'Seg' },
{ text: 'Men' },
{ text: 'Ted', pressed: true }
],
listeners: {
toggle: handler
}
});
});
it("should fire the toggle event when a child button is pressed", function() {
var item = button.items.getAt(1);
item.setPressed(true);
expect(handler.callCount).toBe(1);
expect(handler.mostRecentCall.args[0]).toBe(button);
expect(handler.mostRecentCall.args[1]).toBe(item);
expect(handler.mostRecentCall.args[2]).toBe(true);
});
it("should fire the toggle event when a child button is depressed", function() {
var item = button.items.getAt(2);
item.setPressed(false);
expect(handler.callCount).toBe(1);
expect(handler.mostRecentCall.args[0]).toBe(button);
expect(handler.mostRecentCall.args[1]).toBe(item);
expect(handler.mostRecentCall.args[2]).toBe(false);
});
});
describe("allowToggle", function() {
it("should allow buttons to be toggled when allowToggle is true", function() {
makeButton({
items: [
{ text: 'Seg' },
{ text: 'Men' },
{ text: 'Ted' }
]
});
expect(button.items.getAt(0).enableToggle).toBe(true);
expect(button.items.getAt(1).enableToggle).toBe(true);
expect(button.items.getAt(2).enableToggle).toBe(true);
clickButton(0);
expect(button.items.getAt(0).pressed).toBe(true);
clickButton(1);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(true);
});
it("should not allow toggling when allowToggle is false", function() {
makeButton({
allowToggle: false,
items: [
{ text: 'Seg' },
{ text: 'Men' },
{ text: 'Ted' }
]
});
expect(button.items.getAt(0).enableToggle).toBe(false);
expect(button.items.getAt(1).enableToggle).toBe(false);
expect(button.items.getAt(2).enableToggle).toBe(false);
clickButton(0);
expect(button.items.getAt(0).pressed).toBe(false);
});
});
describe("allowMultiple", function() {
describe("when false", function() {
it("should use a toggleGroup", function() {
makeButton({
items: [
{ text: 'Seg' },
{ text: 'Men' },
{ text: 'Ted' }
]
});
expect(button.items.getAt(0).toggleGroup).toBe(button.getId());
expect(button.items.getAt(1).toggleGroup).toBe(button.getId());
expect(button.items.getAt(2).toggleGroup).toBe(button.getId());
});
it("should not use a toggleGroup when allowToggle is false", function() {
makeButton({
allowToggle: false,
items: [
{ text: 'Seg' },
{ text: 'Men' },
{ text: 'Ted' }
]
});
expect(button.items.getAt(0).toggleGroup).toBeUndefined();
expect(button.items.getAt(1).toggleGroup).toBeUndefined();
expect(button.items.getAt(2).toggleGroup).toBeUndefined();
});
it("should only allow one button to be pressed at a time", function() {
makeButton({
items: [
{ text: 'Seg' },
{ text: 'Men' }
]
});
clickButton(0);
expect(button.items.getAt(0).pressed).toBe(true);
expect(button.items.getAt(1).pressed).toBe(false);
clickButton(1);
expect(button.items.getAt(0).pressed).toBe(false);
expect(button.items.getAt(1).pressed).toBe(true);
});
it("should not allow buttons to be depressed", function() {
makeButton({
items: [
{ text: 'Seg' },
{ text: 'Men' }
]
});
clickButton(0);
expect(button.items.getAt(0).pressed).toBe(true);
clickButton(0);
expect(button.items.getAt(0).pressed).toBe(true);
});
});
describe("when true", function() {
beforeEach(function() {
makeButton({
allowMultiple: true,
items: [
{ text: 'Seg' },
{ text: 'Men' }
]
});
});
it("should not use a toggleGroup", function() {
expect(button.items.getAt(0).toggleGroup).toBeUndefined();
expect(button.items.getAt(1).toggleGroup).toBeUndefined();
});
it("should allow multiple buttons to be pressed", function() {
clickButton(0);
expect(button.items.getAt(0).pressed).toBe(true);
expect(button.items.getAt(1).pressed).toBe(false);
clickButton(1);
expect(button.items.getAt(0).pressed).toBe(true);
expect(button.items.getAt(1).pressed).toBe(true);
});
it("should allow buttons to be depressed", function() {
clickButton(0);
expect(button.items.getAt(0).pressed).toBe(true);
clickButton(0);
expect(button.items.getAt(0).pressed).toBe(false);
});
});
});
describe("allowDepress", function() {
function makeButton(cfg) {
button = Ext.create(Ext.apply({
xtype: 'segmentedbutton',
renderTo: document.body,
items: [
{ text: 'Seg' },
{ text: 'Men' },
{ text: 'Ted' }
]
}, cfg));
}
describe("when true", function() {
it("should allow buttons to be depressed", function() {
makeButton({
allowDepress: true
});
clickButton(0);
expect(button.items.getAt(0).pressed).toBe(true);
clickButton(0);
expect(button.items.getAt(0).pressed).toBe(false);
});
});
describe("when false", function() {
it("should not allow buttons to be depressed", function() {
makeButton();
clickButton(0);
expect(button.items.getAt(0).pressed).toBe(true);
clickButton(0);
expect(button.items.getAt(0).pressed).toBe(true);
});
it("should have no effect when allowMultiple is true", function() {
makeButton({
allowMultiple: true,
allowDepress: false
});
clickButton(0);
expect(button.items.getAt(0).pressed).toBe(true);
clickButton(0);
expect(button.items.getAt(0).pressed).toBe(false);
});
});
});
describe("disable/enable", function() {
it("should disable the child buttons when disable() is called", function() {
makeButton({
items: [
{ text: 'foo' },
{ text: 'bar' }
]
});
expect(button.items.getAt(0).disabled).toBe(false);
expect(button.items.getAt(1).disabled).toBe(false);
button.disable();
expect(button.items.getAt(0).disabled).toBe(true);
expect(button.items.getAt(1).disabled).toBe(true);
});
it("should enable the child buttons when enable() is called", function() {
makeButton({
disabled: true,
items: [
{ text: 'foo' },
{ text: 'bar' }
]
});
expect(button.items.getAt(0).disabled).toBe(true);
expect(button.items.getAt(1).disabled).toBe(true);
button.enable();
expect(button.items.getAt(0).disabled).toBe(false);
expect(button.items.getAt(1).disabled).toBe(false);
});
it("should not mask the element when disabled", function() {
makeButton();
expect(button.maskOnDisable).toBe(false);
});
});
describe("defaultUI", function() {
it("should default to 'default'", function() {
makeButton({
items: [{
text: 'Foo'
}]
});
expect(button.getDefaultUI()).toBe('default');
expect(button.items.getAt(0).ui).toBe('default-small');
});
it("should allow buttons to configure their own UI", function() {
makeButton({
items: [{
text: 'Foo',
ui: 'bar'
}]
});
expect(button.getDefaultUI()).toBe('default');
expect(button.items.getAt(0).ui).toBe('bar-small');
});
it("should use the defaultUI as the UI of the items", function() {
makeButton({
defaultUI: 'bob',
items: [{
text: 'Foo'
}]
});
expect(button.items.getAt(0).ui).toBe('bob-small');
});
it("should not use the defaultUI for items that have a ui on the item instance", function() {
makeButton({
defaultUI: 'bob',
items: [{
text: 'Foo',
ui: 'hooray'
}]
});
expect(button.items.getAt(0).ui).toBe('hooray-small');
});
it("should not use the defaultUI for items that have a ui on the item class", function() {
Ext.define('spec.Btn', {
extend: 'Ext.button.Button',
ui: 'baz'
});
makeButton({
defaultUI: 'bob',
items: [{
xclass: 'spec.Btn',
text: 'Foo'
}]
});
expect(button.items.getAt(0).ui).toBe('baz-small');
Ext.undefine('spec.Btn');
});
it("should not use the defaultUI for items that have a ui of 'default' on the item instance", function() {
makeButton({
defaultUI: 'bob',
items: [{
text: 'Foo',
ui: 'default'
}]
});
expect(button.items.getAt(0).ui).toBe('default-small');
});
});
describe("item classes", function() {
var firstCls = 'x-segmented-button-first',
middleCls = 'x-segmented-button-middle',
lastCls = 'x-segmented-button-last';
// expects all of the items to have correct classes
function expectClasses(items) {
var itemCount, el;
items = items || button.items.items;
itemCount = items.length;
if (itemCount === 1) {
el = items[0].getEl();
expect(el.hasCls(firstCls)).toBe(false);
expect(el.hasCls(middleCls)).toBe(false);
expect(el.hasCls(lastCls)).toBe(false);
} else {
Ext.each(items, function(item, index) {
el = item.getEl();
if (index === 0) {
expect(el.hasCls(firstCls)).toBe(true);
expect(el.hasCls(middleCls)).toBe(false);
expect(el.hasCls(lastCls)).toBe(false);
} else if (index === itemCount - 1) {
expect(el.hasCls(firstCls)).toBe(false);
expect(el.hasCls(middleCls)).toBe(false);
expect(el.hasCls(lastCls)).toBe(true);
} else {
expect(el.hasCls(firstCls)).toBe(false);
expect(el.hasCls(middleCls)).toBe(true);
expect(el.hasCls(lastCls)).toBe(false);
}
});
}
}
it("should have the correct classes when there is only one item", function() {
makeButton({
items: [
{ text: 'Seg' }
]
});
expectClasses();
});
it("should have the correct classes when there are two items", function() {
makeButton({
items: [
{ text: 'Seg' },
{ text: 'Men' }
]
});
expectClasses();
});
it("should have the correct classes when there are three items", function() {
makeButton({
items: [
{ text: 'Seg' },
{ text: 'Men' },
{ text: 'Ted' }
]
});
expectClasses();
});
it("should have the correct classes when there are four items", function() {
makeButton({
items: [
{ text: 'Seg' },
{ text: 'Men' },
{ text: 'Ted' },
{ text: 'Btn' }
]
});
expectClasses();
});
it("should have the correct classes when items are added or removed", function () {
makeButton({
items: [
{ text: 'Seg' }
]
});
// add button at the end
button.add({ text: 'Men' });
expectClasses();
// insert button before first
button.insert(0, { text: 'Ted' });
expectClasses();
// insert button in middle
button.insert(1, { text: 'Btn' });
expectClasses();
// remove button from middle
button.remove(2);
expectClasses();
// remove button from end
button.remove(2);
expectClasses();
// remove first button
button.remove(0);
expectClasses();
});
it("should have the correct classes when items are shown or hidden", function () {
makeButton({
items: [
{ text: 'Seg', hidden: true },
{ text: 'Men' },
{ text: 'Ted', hidden: true },
{ text: 'Btn', hidden: true }
]
});
var items = button.items;
items.getAt(3).show();
expectClasses([
items.getAt(1),
items.getAt(3)
]);
items.getAt(0).show();
expectClasses([
items.getAt(0),
items.getAt(1),
items.getAt(3)
]);
items.getAt(2).show();
expectClasses([
items.getAt(0),
items.getAt(1),
items.getAt(2),
items.getAt(3)
]);
items.getAt(1).hide();
expectClasses([
items.getAt(0),
items.getAt(2),
items.getAt(3)
]);
items.getAt(3).hide();
expectClasses([
items.getAt(0),
items.getAt(2)
]);
items.getAt(0).hide();
expectClasses([
items.getAt(2)
]);
});
});
describe("layout", function() {
var dimensions = {
1: 'width',
2: 'height',
3: 'width and height'
},
sizeStyle = {
0: '',
1: 'width:87px;',
2: 'height:94px;',
3: 'width:87px;height:94px;'
},
sizeStyleVert = {
0: '',
1: 'width:86px;',
2: 'height:95px;',
3: 'width:86px;height:95px;'
},
sizeStyleFirst = {
0: '',
1: 'width:86px;',
2: 'height:94px;',
3: 'width:86px;height:94px;'
},
sizeStyleFirstVert = {
0: '',
1: 'width:86px;',
2: 'height:94px;',
3: 'width:86px;height:94px;'
};
function makeLayoutSuite(shrinkWrap) {
function makeButton(cfg) {
var vertical = cfg.vertical,
itemText = '<div style="display:inline-block;background:red;' +
(vertical ? sizeStyleVert : sizeStyle)[shrinkWrap] + '"> </div>',
itemTextFirst = '<div style="display:inline-block;background:red;' +
(vertical ? sizeStyleFirstVert : sizeStyleFirst)[shrinkWrap] + '"> </div>';
button = Ext.create(Ext.apply({
xtype: 'segmentedbutton',
renderTo: document.body,
width: (shrinkWrap & 1) ? null : vertical ? 100 : 300,
height: (shrinkWrap & 2) ? null : vertical ? 300 : 100,
items: [
{ text: itemTextFirst },
{ text: itemText },
{ text: itemText }
]
}, cfg));
}
describe((shrinkWrap ? ("shrink wrap " + dimensions[shrinkWrap]) : "fixed width and height"), function() {
it("should layout horizontal", function() {
makeButton({});
expect(button).toHaveLayout({
el: {
w: 300,
h: 100
},
items: {
0: {
el: {
x: 0,
y: 0,
w: 100,
h: 100
}
},
1: {
el: {
x: 100,
y: 0,
w: 100,
h: 100
}
},
2: {
el: {
x: 200,
y: 0,
w: 100,
h: 100
}
}
}
});
});
it("should layout vertical", function() {
makeButton({
vertical: true
});
var shrinkHeight = (shrinkWrap & 2);
// This layout matcher contains ranges for heights and y positions because
// fixed height table is subject to rounding errors in non-webkit browsers
// when the cells have borders.
expect(button).toHaveLayout({
el: {
w: 100,
h: 300
},
items: {
0: {
el: {
x: 0,
y: 0,
w: 100,
h: shrinkHeight ? 100 : [100, 104]
}
},
1: {
el: {
x: 0,
y: shrinkHeight ? 100 : [100, 103],
w: 100,
h: shrinkHeight ? 100 : [98, 100]
}
},
2: {
el: {
x: 0,
y: shrinkHeight ? 200 : [200, 202],
w: 100,
h: shrinkHeight ? 100 : [98, 100]
}
}
}
});
});
});
}
makeLayoutSuite(0); // fixed width and height
makeLayoutSuite(1); // shrinkWrap width
makeLayoutSuite(2); // shrinkWrap height
makeLayoutSuite(3); // shrinkWrap both
describe("horizontal", function() {
it("should divide width evenly among non-widthed items", function() {
makeButton({
width: 300,
height: 100,
items: [
{ text: 'Seg', width: 50 },
{ text: 'Men' },
{ text: 'Ted' }
]
});
expect(button).toHaveLayout({
el: {
w: 300,
h: 100
},
items: {
0: {
el: {
x: 0,
y: 0,
w: 50,
h: 100
}
},
1: {
el: {
x: 50,
y: 0,
w: 125,
h: 100
}
},
2: {
el: {
x: 175,
y: 0,
w: 125,
h: 100
}
}
}
});
});
it("should stretch all items to the height of the largest item", function() {
makeButton({
width: 300,
items: [
{ text: 'Seg', height: 100 },
{ text: 'Men' },
{ text: 'Ted' }
]
});
expect(button).toHaveLayout({
el: {
w: 300,
h: 100
},
items: {
0: {
el: {
x: 0,
y: 0,
w: 100,
h: 100
}
},
1: {
el: {
x: 100,
y: 0,
w: 100,
h: 100
}
},
2: {
el: {
x: 200,
y: 0,
w: 100,
h: 100
}
}
}
});
});
if (!Ext.supports.CSS3BorderRadius) {
it("should stretch the frameBody when the width of the segmented button is stretched", function() {
makeButton({
width: 300,
items: [
{ text: 'Foo' },
{ text: 'Bar' }
]
});
var btn = button.items.getAt(1);
expect(btn.frameBody.getWidth()).toBe(150 - btn.getFrameInfo().right);
});
}
});
describe("vertical", function() {
it("should divide height evenly among non-heighted items", function() {
makeButton({
vertical: true,
width: 100,
height: 300,
items: [
{ text: 'Seg', height: 50 },
{ text: 'Men' },
{ text: 'Ted' }
]
});
expect(button).toHaveLayout({
el: {
w: 100,
h: 300
},
items: {
0: {
el: {
x: 0,
y: 0,
w: 100,
h: Ext.isIE8 ? 51 : 50
}
},
1: {
el: {
x: 0,
y: Ext.isIE8 ? 51 : 50,
w: 100,
h: 125
}
},
2: {
el: {
x: 0,
y: 175,
w: 100,
h: 125
}
}
}
});
});
it("should stretch all items to the width of the largest item", function() {
makeButton({
vertical: true,
items: [
{ text: 'Seg', width: 100 },
{ text: 'Men' },
{ text: 'Ted' }
]
});
expect(button).toHaveLayout({
el: {
w: 100
},
items: {
0: {
el: {
x: 0,
y: 0,
w: 100,
h: 22
}
},
1: {
el: {
x: 0,
y: 22,
w: 100,
h: 21
}
},
2: {
el: {
x: 0,
y: 43,
w: 100,
h: 21
}
}
}
});
});
});
});
});
|
EviersLavabos/Lavabos/LeroyMerlin/Vasque à poser basalte Diam.40.6 cm gris anthracite Amelie | Leroy Merlin_fichiers/jquery.js
|
orlammd/StBH
|
/*! jQuery v1.8.3 jquery.com | jquery.org/license */
(function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r<i;r++)v.event.add(t,n,u[n][r])}o.data&&(o.data=v.extend({},o.data))}function Ot(e,t){var n;if(t.nodeType!==1)return;t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),n==="object"?(t.parentNode&&(t.outerHTML=e.outerHTML),v.support.html5Clone&&e.innerHTML&&!v.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):n==="input"&&Et.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):n==="option"?t.selected=e.defaultSelected:n==="input"||n==="textarea"?t.defaultValue=e.defaultValue:n==="script"&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(v.expando)}function Mt(e){return typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName("*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll("*"):[]}function _t(e){Et.test(e.type)&&(e.defaultChecked=e.checked)}function Qt(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Jt.length;while(i--){t=Jt[i]+n;if(t in e)return t}return r}function Gt(e,t){return e=t||e,v.css(e,"display")==="none"||!v.contains(e.ownerDocument,e)}function Yt(e,t){var n,r,i=[],s=0,o=e.length;for(;s<o;s++){n=e[s];if(!n.style)continue;i[s]=v._data(n,"olddisplay"),t?(!i[s]&&n.style.display==="none"&&(n.style.display=""),n.style.display===""&&Gt(n)&&(i[s]=v._data(n,"olddisplay",nn(n.nodeName)))):(r=Dt(n,"display"),!i[s]&&r!=="none"&&v._data(n,"olddisplay",r))}for(s=0;s<o;s++){n=e[s];if(!n.style)continue;if(!t||n.style.display==="none"||n.style.display==="")n.style.display=t?i[s]||"":"none"}return e}function Zt(e,t,n){var r=Rt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function en(e,t,n,r){var i=n===(r?"border":"content")?4:t==="width"?1:0,s=0;for(;i<4;i+=2)n==="margin"&&(s+=v.css(e,n+$t[i],!0)),r?(n==="content"&&(s-=parseFloat(Dt(e,"padding"+$t[i]))||0),n!=="margin"&&(s-=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0)):(s+=parseFloat(Dt(e,"padding"+$t[i]))||0,n!=="padding"&&(s+=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0));return s}function tn(e,t,n){var r=t==="width"?e.offsetWidth:e.offsetHeight,i=!0,s=v.support.boxSizing&&v.css(e,"boxSizing")==="border-box";if(r<=0||r==null){r=Dt(e,t);if(r<0||r==null)r=e.style[t];if(Ut.test(r))return r;i=s&&(v.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+en(e,t,n||(s?"border":"content"),i)+"px"}function nn(e){if(Wt[e])return Wt[e];var t=v("<"+e+">").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write("<!doctype html><html><body>"),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u<a;u++)r=o[u],s=/^\+/.test(r),s&&(r=r.substr(1)||"*"),i=e[r]=e[r]||[],i[s?"unshift":"push"](n)}}function kn(e,n,r,i,s,o){s=s||n.dataTypes[0],o=o||{},o[s]=!0;var u,a=e[s],f=0,l=a?a.length:0,c=e===Sn;for(;f<l&&(c||!u);f++)u=a[f](n,r,i),typeof u=="string"&&(!c||o[u]?u=t:(n.dataTypes.unshift(u),u=kn(e,n,r,i,u,o)));return(c||!u)&&!o["*"]&&(u=kn(e,n,r,i,"*",o)),u}function Ln(e,n){var r,i,s=v.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((s[r]?e:i||(i={}))[r]=n[r]);i&&v.extend(!0,e,i)}function An(e,n,r){var i,s,o,u,a=e.contents,f=e.dataTypes,l=e.responseFields;for(s in l)s in r&&(n[l[s]]=r[s]);while(f[0]==="*")f.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("content-type"));if(i)for(s in a)if(a[s]&&a[s].test(i)){f.unshift(s);break}if(f[0]in r)o=f[0];else{for(s in r){if(!f[0]||e.converters[s+" "+f[0]]){o=s;break}u||(u=s)}o=o||u}if(o)return o!==f[0]&&f.unshift(o),r[o]}function On(e,t){var n,r,i,s,o=e.dataTypes.slice(),u=o[0],a={},f=0;e.dataFilter&&(t=e.dataFilter(t,e.dataType));if(o[1])for(n in e.converters)a[n.toLowerCase()]=e.converters[n];for(;i=o[++f];)if(i!=="*"){if(u!=="*"&&u!==i){n=a[u+" "+i]||a["* "+i];if(!n)for(r in a){s=r.split(" ");if(s[1]===i){n=a[u+" "+s[0]]||a["* "+s[0]];if(n){n===!0?n=a[r]:a[r]!==!0&&(i=s[0],o.splice(f--,0,i));break}}}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(l){return{state:"parsererror",error:n?l:"No conversion from "+u+" to "+i}}}u=i}return{state:"success",data:t}}function Fn(){try{return new e.XMLHttpRequest}catch(t){}}function In(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function $n(){return setTimeout(function(){qn=t},0),qn=v.now()}function Jn(e,t){v.each(t,function(t,n){var r=(Vn[t]||[]).concat(Vn["*"]),i=0,s=r.length;for(;i<s;i++)if(r[i].call(e,t,n))return})}function Kn(e,t,n){var r,i=0,s=0,o=Xn.length,u=v.Deferred().always(function(){delete a.elem}),a=function(){var t=qn||$n(),n=Math.max(0,f.startTime+f.duration-t),r=n/f.duration||0,i=1-r,s=0,o=f.tweens.length;for(;s<o;s++)f.tweens[s].run(i);return u.notifyWith(e,[f,i,n]),i<1&&o?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:v.extend({},t),opts:v.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:qn||$n(),duration:n.duration,tweens:[],createTween:function(t,n,r){var i=v.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(i),i},stop:function(t){var n=0,r=t?f.tweens.length:0;for(;n<r;n++)f.tweens[n].run(1);return t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]),this}}),l=f.props;Qn(l,f.opts.specialEasing);for(;i<o;i++){r=Xn[i].call(f,e,l,f.opts);if(r)return r}return Jn(f,l),v.isFunction(f.opts.start)&&f.opts.start.call(e,f),v.fx.timer(v.extend(a,{anim:f,queue:f.opts.queue,elem:e})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function Qn(e,t){var n,r,i,s,o;for(n in e){r=v.camelCase(n),i=t[r],s=e[n],v.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=v.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function Gn(e,t,n){var r,i,s,o,u,a,f,l,c,h=this,p=e.style,d={},m=[],g=e.nodeType&&Gt(e);n.queue||(l=v._queueHooks(e,"fx"),l.unqueued==null&&(l.unqueued=0,c=l.empty.fire,l.empty.fire=function(){l.unqueued||c()}),l.unqueued++,h.always(function(){h.always(function(){l.unqueued--,v.queue(e,"fx").length||l.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],v.css(e,"display")==="inline"&&v.css(e,"float")==="none"&&(!v.support.inlineBlockNeedsLayout||nn(e.nodeName)==="inline"?p.display="inline-block":p.zoom=1)),n.overflow&&(p.overflow="hidden",v.support.shrinkWrapBlocks||h.done(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t){s=t[r];if(Un.exec(s)){delete t[r],a=a||s==="toggle";if(s===(g?"hide":"show"))continue;m.push(r)}}o=m.length;if(o){u=v._data(e,"fxshow")||v._data(e,"fxshow",{}),"hidden"in u&&(g=u.hidden),a&&(u.hidden=!g),g?v(e).show():h.done(function(){v(e).hide()}),h.done(function(){var t;v.removeData(e,"fxshow",!0);for(t in d)v.style(e,t,d[t])});for(r=0;r<o;r++)i=m[r],f=h.createTween(i,g?u[i]:0),d[i]=u[i]||v.style(e,i),i in u||(u[i]=f.start,g&&(f.end=f.start,f.start=i==="width"||i==="height"?1:0))}}function Yn(e,t,n,r,i){return new Yn.prototype.init(e,t,n,r,i)}function Zn(e,t){var n,r={height:e},i=0;t=t?1:0;for(;i<4;i+=2-t)n=$t[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function tr(e){return v.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n,r,i=e.document,s=e.location,o=e.navigator,u=e.jQuery,a=e.$,f=Array.prototype.push,l=Array.prototype.slice,c=Array.prototype.indexOf,h=Object.prototype.toString,p=Object.prototype.hasOwnProperty,d=String.prototype.trim,v=function(e,t){return new v.fn.init(e,t,n)},m=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,g=/\S/,y=/\s+/,b=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,w=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a<f;a++)if((e=arguments[a])!=null)for(n in e){r=u[n],i=e[n];if(u===i)continue;l&&i&&(v.isPlainObject(i)||(s=v.isArray(i)))?(s?(s=!1,o=r&&v.isArray(r)?r:[]):o=r&&v.isPlainObject(r)?r:{},u[n]=v.extend(l,o,i)):i!==t&&(u[n]=i)}return u},v.extend({noConflict:function(t){return e.$===v&&(e.$=a),t&&e.jQuery===v&&(e.jQuery=u),v},isReady:!1,readyWait:1,holdReady:function(e){e?v.readyWait++:v.ready(!0)},ready:function(e){if(e===!0?--v.readyWait:v.isReady)return;if(!i.body)return setTimeout(v.ready,1);v.isReady=!0;if(e!==!0&&--v.readyWait>0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")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(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s<o;)if(n.apply(e[s++],r)===!1)break}else if(u){for(i in e)if(n.call(e[i],i,e[i])===!1)break}else for(;s<o;)if(n.call(e[s],s,e[s++])===!1)break;return e},trim:d&&!d.call("\ufeff\u00a0")?function(e){return e==null?"":d.call(e)}:function(e){return e==null?"":(e+"").replace(b,"")},makeArray:function(e,t){var n,r=t||[];return e!=null&&(n=v.type(e),e.length==null||n==="string"||n==="function"||n==="regexp"||v.isWindow(e)?f.call(r,e):v.merge(r,e)),r},inArray:function(e,t,n){var r;if(t){if(c)return c.call(t,e,n);r=t.length,n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,s=0;if(typeof r=="number")for(;s<r;s++)e[i++]=n[s];else while(n[s]!==t)e[i++]=n[s++];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length;n=!!n;for(;s<o;s++)r=!!t(e[s],s),n!==r&&i.push(e[s]);return i},map:function(e,n,r){var i,s,o=[],u=0,a=e.length,f=e instanceof v||a!==t&&typeof a=="number"&&(a>0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u<a;u++)i=n(e[u],u,r),i!=null&&(o[o.length]=i);else for(s in e)i=n(e[s],s,r),i!=null&&(o[o.length]=i);return o.concat.apply([],o)},guid:1,proxy:function(e,n){var r,i,s;return typeof n=="string"&&(r=e[n],n=e,e=r),v.isFunction(e)?(i=l.call(arguments,2),s=function(){return e.apply(n,i.concat(l.call(arguments)))},s.guid=e.guid=e.guid||v.guid++,s):t},access:function(e,n,r,i,s,o,u){var a,f=r==null,l=0,c=e.length;if(r&&typeof r=="object"){for(l in r)v.access(e,n,l,r[l],1,o,i);s=1}else if(i!==t){a=u===t&&v.isFunction(i),f&&(a?(a=n,n=function(e,t,n){return a.call(v(e),n)}):(n.call(e,i),n=null));if(n)for(;l<c;l++)n(e[l],r,a?i.call(e[l],l,n(e[l],r)):i,u);s=1}return s?e:f?n.call(e):c?n(e[0],r):o},now:function(){return(new Date).getTime()}}),v.ready.promise=function(t){if(!r){r=v.Deferred();if(i.readyState==="complete")setTimeout(v.ready,1);else if(i.addEventListener)i.addEventListener("DOMContentLoaded",A,!1),e.addEventListener("load",v.ready,!1);else{i.attachEvent("onreadystatechange",A),e.attachEvent("onload",v.ready);var n=!1;try{n=e.frameElement==null&&i.documentElement}catch(s){}n&&n.doScroll&&function o(){if(!v.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}v.ready()}}()}}return r.promise(t)},v.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){O["[object "+t+"]"]=t.toLowerCase()}),n=v(i);var M={};v.Callbacks=function(e){e=typeof e=="string"?M[e]||_(e):v.extend({},e);var n,r,i,s,o,u,a=[],f=!e.once&&[],l=function(t){n=e.memory&&t,r=!0,u=s||0,s=0,o=a.length,i=!0;for(;a&&u<o;u++)if(a[u].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}i=!1,a&&(f?f.length&&l(f.shift()):n?a=[]:c.disable())},c={add:function(){if(a){var t=a.length;(function r(t){v.each(t,function(t,n){var i=v.type(n);i==="function"?(!e.unique||!c.has(n))&&a.push(n):n&&n.length&&i!=="string"&&r(n)})})(arguments),i?o=a.length:n&&(s=t,l(n))}return this},remove:function(){return a&&v.each(arguments,function(e,t){var n;while((n=v.inArray(t,a,n))>-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t<r;t++)n[t]&&v.isFunction(n[t].promise)?n[t].promise().done(o(t,f,n)).fail(s.reject).progress(o(t,a,u)):--i}return i||s.resolveWith(f,n),s.promise()}}),v.support=function(){var t,n,r,s,o,u,a,f,l,c,h,p=i.createElement("div");p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="<table><tr><td></td><td>t</td></tr></table>",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.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=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="<div></div>",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i<s;i++)delete r[t[i]];if(!(n?B:v.isEmptyObject)(r))return}}if(!n){delete u[a].data;if(!B(u[a]))return}o?v.cleanData([e],!0):v.support.deleteExpando||u!=u.window?delete u[a]:u[a]=null},_data:function(e,t,n){return v.data(e,t,n,!0)},acceptData:function(e){var t=e.nodeName&&v.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),v.fn.extend({data:function(e,n){var r,i,s,o,u,a=this[0],f=0,l=null;if(e===t){if(this.length){l=v.data(a);if(a.nodeType===1&&!v._data(a,"parsedAttrs")){s=a.attributes;for(u=s.length;f<u;f++)o=s[f].name,o.indexOf("data-")||(o=v.camelCase(o.substring(5)),H(a,o,l[o]));v._data(a,"parsedAttrs",!0)}}return l}return typeof e=="object"?this.each(function(){v.data(this,e)}):(r=e.split(".",2),r[1]=r[1]?"."+r[1]:"",i=r[1]+"!",v.access(this,function(n){if(n===t)return l=this.triggerHandler("getData"+i,[r[0]]),l===t&&a&&(l=v.data(a,e),l=H(a,e,l)),l===t&&r[1]?this.data(r[0]):l;r[1]=n,this.each(function(){var t=v(this);t.triggerHandler("setData"+i,r),v.data(this,e,n),t.triggerHandler("changeData"+i,r)})},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length<r?v.queue(this[0],e):n===t?this:this.each(function(){var t=v.queue(this,e,n);v._queueHooks(this,e),e==="fx"&&t[0]!=="inprogress"&&v.dequeue(this,e)})},dequeue:function(e){return this.each(function(){v.dequeue(this,e)})},delay:function(e,t){return e=v.fx?v.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,s=v.Deferred(),o=this,u=this.length,a=function(){--i||s.resolveWith(o,[o])};typeof e!="string"&&(n=e,e=t),e=e||"fx";while(u--)r=v._data(o[u],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(a));return a(),s.promise(n)}});var j,F,I,q=/[\t\r\n]/g,R=/\r/g,U=/^(?:button|input)$/i,z=/^(?:button|input|object|select|textarea)$/i,W=/^a(?:rea|)$/i,X=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,V=v.support.getSetAttribute;v.fn.extend({attr:function(e,t){return v.access(this,v.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n<r;n++){i=this[n];if(i.nodeType===1)if(!i.className&&t.length===1)i.className=e;else{s=" "+i.className+" ";for(o=0,u=t.length;o<u;o++)s.indexOf(" "+t[o]+" ")<0&&(s+=t[o]+" ");i.className=v.trim(s)}}}return this},removeClass:function(e){var n,r,i,s,o,u,a;if(v.isFunction(e))return this.each(function(t){v(this).removeClass(e.call(this,t,this.className))});if(e&&typeof e=="string"||e===t){n=(e||"").split(y);for(u=0,a=this.length;u<a;u++){i=this[u];if(i.nodeType===1&&i.className){r=(" "+i.className+" ").replace(q," ");for(s=0,o=n.length;s<o;s++)while(r.indexOf(" "+n[s]+" ")>=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(q," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.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,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a<u;a++){n=r[a];if((n.selected||a===i)&&(v.support.optDisabled?!n.disabled:n.getAttribute("disabled")===null)&&(!n.parentNode.disabled||!v.nodeName(n.parentNode,"optgroup"))){t=v(n).val();if(s)return t;o.push(t)}}return o},set:function(e,t){var n=v.makeArray(t);return v(e).find("option").each(function(){this.selected=v.inArray(v(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o<r.length;o++)i=r[o],i&&(n=v.propFix[i]||i,s=X.test(i),s||v.attr(e,i,""),e.removeAttribute(V?i:n),s&&n in e&&(e[n]=!1))}},attrHooks:{type:{set:function(e,t){if(U.test(e.nodeName)&&e.parentNode)v.error("type property can't be changed");else if(!v.support.radioValue&&t==="radio"&&v.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return j&&v.nodeName(e,"button")?j.get(e,t):t in e?e.value:null},set:function(e,t,n){if(j&&v.nodeName(e,"button"))return j.set(e,t,n);e.value=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,s,o,u=e.nodeType;if(!e||u===3||u===8||u===2)return;return o=u!==1||!v.isXMLDoc(e),o&&(n=v.propFix[n]||n,s=v.propHooks[n]),r!==t?s&&"set"in s&&(i=s.set(e,r,n))!==t?i:e[n]=r:s&&"get"in s&&(i=s.get(e,n))!==null?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):z.test(e.nodeName)||W.test(e.nodeName)&&e.href?0:t}}}}),F={get:function(e,n){var r,i=v.prop(e,n);return i===!0||typeof i!="boolean"&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?v.removeAttr(e,n):(r=v.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},V||(I={name:!0,id:!0,coords:!0},j=v.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(I[n]?r.value!=="":r.specified)?r.value:t},set:function(e,t,n){var r=e.getAttributeNode(n);return r||(r=i.createAttribute(n),e.setAttributeNode(r)),r.value=t+""}},v.each(["width","height"],function(e,t){v.attrHooks[t]=v.extend(v.attrHooks[t],{set:function(e,n){if(n==="")return e.setAttribute(t,"auto"),n}})}),v.attrHooks.contenteditable={get:j.get,set:function(e,t,n){t===""&&(t="false"),j.set(e,t,n)}}),v.support.hrefNormalized||v.each(["href","src","width","height"],function(e,n){v.attrHooks[n]=v.extend(v.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return r===null?t:r}})}),v.support.style||(v.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=t+""}}),v.support.optSelected||(v.propHooks.selected=v.extend(v.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),v.support.enctype||(v.propFix.enctype="encoding"),v.support.checkOn||v.each(["radio","checkbox"],function(){v.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}}),v.each(["radio","checkbox"],function(){v.valHooks[this]=v.extend(v.valHooks[this],{set:function(e,t){if(v.isArray(t))return e.checked=v.inArray(v(e).val(),t)>=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f<n.length;f++){l=J.exec(n[f])||[],c=l[1],h=(l[2]||"").split(".").sort(),g=v.event.special[c]||{},c=(s?g.delegateType:g.bindType)||c,g=v.event.special[c]||{},p=v.extend({type:c,origType:l[1],data:i,handler:r,guid:r.guid,selector:s,needsContext:s&&v.expr.match.needsContext.test(s),namespace:h.join(".")},d),m=a[c];if(!m){m=a[c]=[],m.delegateCount=0;if(!g.setup||g.setup.call(e,i,h,u)===!1)e.addEventListener?e.addEventListener(c,u,!1):e.attachEvent&&e.attachEvent("on"+c,u)}g.add&&(g.add.call(e,p),p.handler.guid||(p.handler.guid=r.guid)),s?m.splice(m.delegateCount++,0,p):m.push(p),v.event.global[c]=!0}e=null},global:{},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,m,g=v.hasData(e)&&v._data(e);if(!g||!(h=g.events))return;t=v.trim(Z(t||"")).split(" ");for(s=0;s<t.length;s++){o=J.exec(t[s])||[],u=a=o[1],f=o[2];if(!u){for(u in h)v.event.remove(e,u+t[s],n,r,!0);continue}p=v.event.special[u]||{},u=(r?p.delegateType:p.bindType)||u,d=h[u]||[],l=d.length,f=f?new RegExp("(^|\\.)"+f.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(c=0;c<d.length;c++)m=d[c],(i||a===m.origType)&&(!n||n.guid===m.guid)&&(!f||f.test(m.namespace))&&(!r||r===m.selector||r==="**"&&m.selector)&&(d.splice(c--,1),m.selector&&d.delegateCount--,p.remove&&p.remove.call(e,m));d.length===0&&l!==d.length&&((!p.teardown||p.teardown.call(e,f,g.handle)===!1)&&v.removeEvent(e,u,g.handle),delete h[u])}v.isEmptyObject(h)&&(delete g.handle,v.removeData(e,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,s,o){if(!s||s.nodeType!==3&&s.nodeType!==8){var u,a,f,l,c,h,p,d,m,g,y=n.type||n,b=[];if(Y.test(y+v.event.triggered))return;y.indexOf("!")>=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f<m.length&&!n.isPropagationStopped();f++)l=m[f][0],n.type=m[f][1],d=(v._data(l,"events")||{})[n.type]&&v._data(l,"handle"),d&&d.apply(l,r),d=h&&l[h],d&&v.acceptData(l)&&d.apply&&d.apply(l,r)===!1&&n.preventDefault();return n.type=y,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(s.ownerDocument,r)===!1)&&(y!=="click"||!v.nodeName(s,"a"))&&v.acceptData(s)&&h&&s[y]&&(y!=="focus"&&y!=="blur"||n.target.offsetWidth!==0)&&!v.isWindow(s)&&(c=s[h],c&&(s[h]=null),v.event.triggered=y,s[y](),v.event.triggered=t,c&&(s[h]=c)),n.result}return},dispatch:function(n){n=v.event.fix(n||e.event);var r,i,s,o,u,a,f,c,h,p,d=(v._data(this,"events")||{})[n.type]||[],m=d.delegateCount,g=l.call(arguments),y=!n.exclusive&&!n.namespace,b=v.event.special[n.type]||{},w=[];g[0]=n,n.delegateTarget=this;if(b.preDispatch&&b.preDispatch.call(this,n)===!1)return;if(m&&(!n.button||n.type!=="click"))for(s=n.target;s!=this;s=s.parentNode||this)if(s.disabled!==!0||n.type!=="click"){u={},f=[];for(r=0;r<m;r++)c=d[r],h=c.selector,u[h]===t&&(u[h]=c.needsContext?v(h,this).index(s)>=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r<w.length&&!n.isPropagationStopped();r++){a=w[r],n.currentTarget=a.elem;for(i=0;i<a.matches.length&&!n.isImmediatePropagationStopped();i++){c=a.matches[i];if(y||!n.namespace&&!c.namespace||n.namespace_re&&n.namespace_re.test(c.namespace))n.data=c.data,n.handleObj=c,o=((v.event.special[c.origType]||{}).handle||c.handler).apply(a.elem,g),o!==t&&(n.result=o,o===!1&&(n.preventDefault(),n.stopPropagation()))}}return b.postDispatch&&b.postDispatch.call(this,n),n.result},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(e,t){return e.which==null&&(e.which=t.charCode!=null?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,s,o,u=n.button,a=n.fromElement;return e.pageX==null&&n.clientX!=null&&(r=e.target.ownerDocument||i,s=r.documentElement,o=r.body,e.pageX=n.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=n.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?n.toElement:a),!e.which&&u!==t&&(e.which=u&1?1:u&2?3:u&4?2:0),e}},fix:function(e){if(e[v.expando])return e;var t,n,r=e,s=v.event.fixHooks[e.type]||{},o=s.props?this.props.concat(s.props):this.props;e=v.Event(r);for(t=o.length;t;)n=o[--t],e[n]=r[n];return e.target||(e.target=r.srcElement||i),e.target.nodeType===3&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,r):e},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){v.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var i=v.extend(new v.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?v.event.trigger(i,null,t):v.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},v.event.handle=v.event.dispatch,v.removeEvent=i.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]=="undefined"&&(e[r]=null),e.detachEvent(r,n))},v.Event=function(e,t){if(!(this instanceof v.Event))return new v.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?tt:et):this.type=e,t&&v.extend(this,t),this.timeStamp=e&&e.timeStamp||v.now(),this[v.expando]=!0},v.Event.prototype={preventDefault:function(){this.isDefaultPrevented=tt;var e=this.originalEvent;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=tt;var e=this.originalEvent;if(!e)return;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=tt,this.stopPropagation()},isDefaultPrevented:et,isPropagationStopped:et,isImmediatePropagationStopped:et},v.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){v.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj,o=s.selector;if(!i||i!==r&&!v.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),v.support.submitBubbles||(v.event.special.submit={setup:function(){if(v.nodeName(this,"form"))return!1;v.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=v.nodeName(n,"input")||v.nodeName(n,"button")?n.form:t;r&&!v._data(r,"_submit_attached")&&(v.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),v._data(r,"_submit_attached",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&v.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){if(v.nodeName(this,"form"))return!1;v.event.remove(this,"._submit")}}),v.support.changeBubbles||(v.event.special.change={setup:function(){if($.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")v.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),v.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),v.event.simulate("change",this,e,!0)});return!1}v.event.add(this,"beforeactivate._change",function(e){var t=e.target;$.test(t.nodeName)&&!v._data(t,"_change_attached")&&(v.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&v.event.simulate("change",this.parentNode,e,!0)}),v._data(t,"_change_attached",!0))})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){return v.event.remove(this,"._change"),!$.test(this.nodeName)}}),v.support.focusinBubbles||v.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){v.event.simulate(t,e.target,v.event.fix(e),!0)};v.event.special[t]={setup:function(){n++===0&&i.addEventListener(e,r,!0)},teardown:function(){--n===0&&i.removeEventListener(e,r,!0)}}}),v.fn.extend({on:function(e,n,r,i,s){var o,u;if(typeof e=="object"){typeof n!="string"&&(r=r||n,n=t);for(u in e)this.on(u,n,r,e[u],s);return this}r==null&&i==null?(i=n,r=n=t):i==null&&(typeof n=="string"?(i=r,r=t):(i=r,r=n,n=t));if(i===!1)i=et;else if(!i)return this;return s===1&&(o=i,i=function(e){return v().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=v.guid++)),this.each(function(){v.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,s;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,v(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if(typeof e=="object"){for(s in e)this.off(s,n,e[s]);return this}if(n===!1||typeof n=="function")r=n,n=t;return r===!1&&(r=et),this.each(function(){v.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)},live:function(e,t,n){return v(this.context).on(e,this.selector,t,n),this},die:function(e,t){return v(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){v.event.trigger(e,t,this)})},triggerHandler:function(e,t){if(this[0])return v.event.trigger(e,t,this[0],!0)},toggle:function(e){var t=arguments,n=e.guid||v.guid++,r=0,i=function(n){var i=(v._data(this,"lastToggle"+e.guid)||0)%r;return v._data(this,"lastToggle"+e.guid,i+1),n.preventDefault(),t[i].apply(this,arguments)||!1};i.guid=n;while(r<t.length)t[r++].guid=n;return this.click(i)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),v.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){v.fn[t]=function(e,n){return n==null&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(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 lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u<a;u++)if(s=e[u])if(!n||n(s,r,i))o.push(s),f&&t.push(u);return o}function ct(e,t,n,r,i,s){return r&&!r[d]&&(r=ct(r)),i&&!i[d]&&(i=ct(i,s)),N(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||dt(t||"*",u.nodeType?[u]:u,[]),m=e&&(s||!t)?lt(v,h,e,u,a):v,g=n?i||(s?e:d||r)?[]:o:m;n&&n(m,g,u,a);if(r){f=lt(g,p),r(f,[],u,a),l=f.length;while(l--)if(c=f[l])g[p[l]]=!(m[p[l]]=c)}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?T.call(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a<s;a++)if(n=i.relative[e[a].type])h=[at(ft(h),n)];else{n=i.filter[e[a].type].apply(null,e[a].matches);if(n[d]){r=++a;for(;r<s;r++)if(i.relative[e[r].type])break;return ct(a>1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a<r&&ht(e.slice(a,r)),r<s&&ht(e=e.slice(r)),r<s&&e.join(""))}h.push(n)}return ft(h)}function pt(e,t){var r=t.length>0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r<i;r++)nt(e,t[r],n);return n}function vt(e,t,n,r,s){var o,u,f,l,c,h=ut(e),p=h.length;if(!r&&h.length===1){u=h[0]=h[0].slice(0);if(u.length>2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;t<n;t++)if(this[t]===e)return t;return-1},N=function(e,t){return e[d]=t==null||t,e},C=function(){var e={},t=[];return N(function(n,r){return t.push(n)>i.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="<a name='"+d+"'></a><div name='"+d+"'></div>",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:st(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:st(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}},f=y.compareDocumentPosition?function(e,t){return e===t?(l=!0,0):(!e.compareDocumentPosition||!t.compareDocumentPosition?e.compareDocumentPosition:e.compareDocumentPosition(t)&4)?-1:1}:function(e,t){if(e===t)return l=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,i=[],s=[],o=e.parentNode,u=t.parentNode,a=o;if(o===u)return ot(e,t);if(!o)return-1;if(!u)return 1;while(a)i.unshift(a),a=a.parentNode;a=u;while(a)s.unshift(a),a=a.parentNode;n=i.length,r=s.length;for(var f=0;f<n&&f<r;f++)if(i[f]!==s[f])return ot(i[f],s[f]);return f===n?ot(e,s[f],-1):ot(i[f],t,1)},[0,0].sort(f),h=!l,nt.uniqueSort=function(e){var t,n=[],r=1,i=0;l=h,e.sort(f);if(l){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e},nt.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},a=nt.compile=function(e,t){var n,r=[],i=[],s=A[d][e+" "];if(!s){t||(t=ut(e)),n=t.length;while(n--)s=ht(t[n]),s[d]?r.push(s):i.push(s);s=A(e,pt(i,r))}return s},g.querySelectorAll&&function(){var e,t=vt,n=/'|\\/g,r=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,i=[":focus"],s=[":active"],u=y.matchesSelector||y.mozMatchesSelector||y.webkitMatchesSelector||y.oMatchesSelector||y.msMatchesSelector;K(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'/>",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t<n;t++)if(v.contains(u[t],this))return!0});o=this.pushStack("","find",e);for(t=0,n=this.length;t<n;t++){r=o.length,v.find(e,this[t],o);if(t>0)for(i=r;i<o.length;i++)for(s=0;s<r;s++)if(o[s]===o[i]){o.splice(i--,1);break}}return o},has:function(e){var t,n=v(e,this),r=n.length;return this.filter(function(){for(t=0;t<r;t++)if(v.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1),"not",e)},filter:function(e){return this.pushStack(ft(this,e,!0),"filter",e)},is:function(e){return!!e&&(typeof e=="string"?st.test(e)?v(e,this.context).index(this[0])>=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r<i;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&n.nodeType!==11){if(o?o.index(n)>-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/<tbody/i,gt=/<|&#?\w+;/,yt=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,wt=new RegExp("<(?:"+ct+")[\\s/>]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Nt={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,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X<div>","</div>"]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1></$2>");try{for(;r<i;r++)n=this[r]||{},n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(s){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return ut(this[0])?this.length?this.pushStack(v(v.isFunction(e)?e():e),"replaceWith",e):this:v.isFunction(e)?this.each(function(t){var n=v(this),r=n.html();n.replaceWith(e.call(this,t,r))}):(typeof e!="string"&&(e=v(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;v(this).remove(),t?v(t).before(e):v(n).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=[].concat.apply([],e);var i,s,o,u,a=0,f=e[0],l=[],c=this.length;if(!v.support.checkClone&&c>1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a<c;a++)r.call(n&&v.nodeName(this[a],"table")?Lt(this[a],"tbody"):this[a],a===u?o:v.clone(o,!0,!0))}o=s=null,l.length&&v.each(l,function(e,t){t.src?v.ajax?v.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):v.error("no ajax"):v.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Tt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),v.buildFragment=function(e,n,r){var s,o,u,a=e[0];return n=n||i,n=!n.nodeType&&n[0]||n,n=n.ownerDocument||n,e.length===1&&typeof a=="string"&&a.length<512&&n===i&&a.charAt(0)==="<"&&!bt.test(a)&&(v.support.checkClone||!St.test(a))&&(v.support.html5Clone||!wt.test(a))&&(o=!0,s=v.fragments[a],u=s!==t),s||(s=n.createDocumentFragment(),v.clean(e,n,s,r),o&&(v.fragments[a]=u&&s)),{fragment:s,cacheable:o}},v.fragments={},v.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){v.fn[e]=function(n){var r,i=0,s=[],o=v(n),u=o.length,a=this.length===1&&this[0].parentNode;if((a==null||a&&a.nodeType===11&&a.childNodes.length===1)&&u===1)return o[t](this[0]),this;for(;i<u;i++)r=(i>0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1></$2>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]==="<table>"&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.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=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("<div>").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===ln[1]&&a[2]===ln[2]&&(a[3]||(a[1]==="http:"?80:443))==(ln[3]||(ln[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(p){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++)n=e[r],Vn[n]=Vn[n]||[],Vn[n].unshift(t)},prefilter:function(e,t){t?Xn.unshift(e):Xn.push(e)}}),v.Tween=Yn,Yn.prototype={constructor:Yn,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(v.cssNumber[n]?"":"px")},cur:function(){var e=Yn.propHooks[this.prop];return e&&e.get?e.get(this):Yn.propHooks._default.get(this)},run:function(e){var t,n=Yn.propHooks[this.prop];return this.options.duration?this.pos=t=v.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=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):Yn.propHooks._default.set(this),this}},Yn.prototype.init.prototype=Yn.prototype,Yn.propHooks={_default:{get:function(e){var t;return e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null?(t=v.css(e.elem,e.prop,!1,""),!t||t==="auto"?0:t):e.elem[e.prop]},set:function(e){v.fx.step[e.prop]?v.fx.step[e.prop](e):e.elem.style&&(e.elem.style[v.cssProps[e.prop]]!=null||v.cssHooks[e.prop])?v.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Yn.propHooks.scrollTop=Yn.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},v.each(["toggle","show","hide"],function(e,t){var n=v.fn[t];v.fn[t]=function(r,i,s){return r==null||typeof r=="boolean"||!e&&v.isFunction(r)&&v.isFunction(i)?n.apply(this,arguments):this.animate(Zn(t,!0),r,i,s)}}),v.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Gt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=v.isEmptyObject(e),s=v.speed(t,n,r),o=function(){var t=Kn(this,v.extend({},e),s);i&&t.stop(!0)};return i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return typeof e!="string"&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=e!=null&&e+"queueHooks",s=v.timers,o=v._data(this);if(n)o[n]&&o[n].stop&&i(o[n]);else for(n in o)o[n]&&o[n].stop&&Wn.test(n)&&i(o[n]);for(n=s.length;n--;)s[n].elem===this&&(e==null||s[n].queue===e)&&(s[n].anim.stop(r),t=!1,s.splice(n,1));(t||!r)&&v.dequeue(this,e)})}}),v.each({slideDown:Zn("show"),slideUp:Zn("hide"),slideToggle:Zn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){v.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),v.speed=function(e,t,n){var r=e&&typeof e=="object"?v.extend({},e):{complete:n||!n&&t||v.isFunction(e)&&e,duration:e,easing:n&&t||t&&!v.isFunction(t)&&t};r.duration=v.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in v.fx.speeds?v.fx.speeds[r.duration]:v.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){v.isFunction(r.old)&&r.old.call(this),r.queue&&v.dequeue(this,r.queue)},r},v.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},v.timers=[],v.fx=Yn.prototype.init,v.fx.tick=function(){var e,n=v.timers,r=0;qn=v.now();for(;r<n.length;r++)e=n[r],!e()&&n[r]===e&&n.splice(r--,1);n.length||v.fx.stop(),qn=t},v.fx.timer=function(e){e()&&v.timers.push(e)&&!Rn&&(Rn=setInterval(v.fx.tick,v.fx.interval))},v.fx.interval=13,v.fx.stop=function(){clearInterval(Rn),Rn=null},v.fx.speeds={slow:600,fast:200,_default:400},v.fx.step={},v.expr&&v.expr.filters&&(v.expr.filters.animated=function(e){return v.grep(v.timers,function(t){return e===t.elem}).length});var er=/^(?:body|html)$/i;v.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){v.offset.setOffset(this,e,t)});var n,r,i,s,o,u,a,f={top:0,left:0},l=this[0],c=l&&l.ownerDocument;if(!c)return;return(r=c.body)===l?v.offset.bodyOffset(l):(n=c.documentElement,v.contains(n,l)?(typeof l.getBoundingClientRect!="undefined"&&(f=l.getBoundingClientRect()),i=tr(c),s=n.clientTop||r.clientTop||0,o=n.clientLeft||r.clientLeft||0,u=i.pageYOffset||n.scrollTop,a=i.pageXOffset||n.scrollLeft,{top:f.top+u-s,left:f.left+a-o}):f)},v.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return v.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(v.css(e,"marginTop"))||0,n+=parseFloat(v.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=v.css(e,"position");r==="static"&&(e.style.position="relative");var i=v(e),s=i.offset(),o=v.css(e,"top"),u=v.css(e,"left"),a=(r==="absolute"||r==="fixed")&&v.inArray("auto",[o,u])>-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})})(window);
|
app/components/Calendar/Calendar.js
|
zchen9/DonutTab
|
import React from 'react';
import Weather from '../Weather/Weather.js';
require('./Calendar.scss');
const WEEKS = ['Sun', 'Mon', 'Tues', 'Wed', 'Thur', 'Fri', 'Sat'];
const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
export default class Calendar extends React.Component {
constructor(props) {
super(props);
this.state = {
curDateVal: this._getDateVal(),
curWeeks: [],
pickWeek: this._getDateVal().week
};
}
componentDidMount() {
let curWeeks = this._genCurWeek(this._getDateVal());
this.setState({
curWeeks: curWeeks,
pickWeek: this._getDateVal().week
});
}
weekClick(ev) {
let pickWeek = +ev.target.getAttribute('data-week');
this.weekChange(pickWeek);
}
weekChange(week) {
this.setState({
pickWeek: week
});
}
_getDateVal() {
var self = this,
curTime = new Date(),
day = curTime.getDate(),
month = curTime.getMonth(),
year = curTime.getFullYear(),
week = curTime.getDay();
return {
year: year,
month: month,
day: day,
week: week
};
}
_getMonthLen(month, year) {
switch(month + 1) {
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
return 31;
break;
case 4:
case 6:
case 9:
case 11:
return 30;
break;
case 2:
if ((year % 100 === 0 && year % 400 === 0)
|| (year % 100 !== 0 && year % 4 === 0)) {
return 29;
} else {
return 28;
}
break;
}
}
_genCurWeek(time) {
var weekLen = 7,
curDay = time.day || this._getDateVal().day,
curWeek = +(time.week + '' || this._getDateVal().week),
curMonth = +(time.month + '' || this._getDateVal().month),
curYear = time.year || this._getDateVal().year,
weekArr = [],
beforeDay = curDay - curWeek,
afterDay = curDay,
firstDay = 1,
lastDay = this._getMonthLen(curMonth, curYear);
for (var i = 0; i < weekLen; i++) {
if (i < curWeek) {
if (beforeDay > 0) {
weekArr.push(beforeDay);
beforeDay += 1;
} else {
weekArr.push('');
beforeDay += 1;
}
}
else if (i > curWeek) {
if (afterDay < lastDay) {
afterDay += 1;
weekArr.push(afterDay);
} else {
weekArr.push(firstDay++);
}
}
}
weekArr.splice(curWeek, 0, curDay);
return weekArr;
}
_convertTime(time, type) {
var timeTmp = '';
switch(type) {
case 'week':
timeTmp = WEEKS[time];
break;
case 'month':
timeTmp = MONTHS[time];
break;
case 'hour':
case 'min':
case 'sec':
default:
timeTmp = time >= 10 ? time : '0' + time;
break;
}
return timeTmp;
}
render() {
var self = this,
curDateVal = this.state.curDateVal,
curWeeks = this.state.curWeeks,
pickWeek = this.state.pickWeek;
return (
<div className="calendar-container">
<h3 className="calendar-head">
<i className="fa fa-fw fa-calendar-o"></i>
<span className="calendar-title"> {curDateVal.year} {this._convertTime(curDateVal.month, 'month')} <small>{this._convertTime(curDateVal.day, 'day')}</small></span>
</h3>
<ul className="calendar-week clearfix">
{WEEKS.map((item, idx) => {
return (
<li key={idx}>{item}</li>
)
})}
</ul>
<ul className="calendar-week clearfix">
{curWeeks.map((item, idx) => {
return (
<li key={idx}>
{item
? (<span className={pickWeek === idx ? 'active' : ''} data-week={idx} onClick={self.weekClick.bind(self)}>{item}</span>)
: item
}
</li>
)
})}
</ul>
<Weather pickIndex={pickWeek - curDateVal.week} />
</div>
);
}
}
|
app/reactions/client/methods/setReaction.js
|
inoio/Rocket.Chat
|
import { Meteor } from 'meteor/meteor';
import _ from 'underscore';
import { Messages, Rooms, Subscriptions, EmojiCustom } from '../../../models';
import { callbacks } from '../../../callbacks';
import { emoji } from '../../../emoji';
Meteor.methods({
setReaction(reaction, messageId) {
if (!Meteor.userId()) {
throw new Meteor.Error(203, 'User_logged_out');
}
const user = Meteor.user();
const message = Messages.findOne({ _id: messageId });
const room = Rooms.findOne({ _id: message.rid });
if (room.ro && !room.reactWhenReadOnly) {
if (!Array.isArray(room.unmuted) || room.unmuted.indexOf(user.username) === -1) {
return false;
}
}
if (Array.isArray(room.muted) && room.muted.indexOf(user.username) !== -1) {
return false;
}
if (!Subscriptions.findOne({ rid: message.rid })) {
return false;
}
if (message.private) {
return false;
}
if (!emoji.list[reaction] && EmojiCustom.findByNameOrAlias(reaction).count() === 0) {
return false;
}
if (message.reactions && message.reactions[reaction] && message.reactions[reaction].usernames.indexOf(user.username) !== -1) {
message.reactions[reaction].usernames.splice(message.reactions[reaction].usernames.indexOf(user.username), 1);
if (message.reactions[reaction].usernames.length === 0) {
delete message.reactions[reaction];
}
if (_.isEmpty(message.reactions)) {
delete message.reactions;
Messages.unsetReactions(messageId);
callbacks.run('unsetReaction', messageId, reaction);
} else {
Messages.setReactions(messageId, message.reactions);
callbacks.run('setReaction', messageId, reaction);
}
} else {
if (!message.reactions) {
message.reactions = {};
}
if (!message.reactions[reaction]) {
message.reactions[reaction] = {
usernames: [],
};
}
message.reactions[reaction].usernames.push(user.username);
Messages.setReactions(messageId, message.reactions);
callbacks.run('setReaction', messageId, reaction);
}
},
});
|
src/DetailsComponent.js
|
taskcluster/migration
|
import moment from 'moment';
import React from 'react';
import Panel from 'react-bootstrap/lib/Panel';
import Col from 'react-bootstrap/lib/Col';
import Row from 'react-bootstrap/lib/Row';
import Button from 'react-bootstrap/lib/Button';
import Alert from 'react-bootstrap/lib/Alert';
import WorkItem from './WorkItem';
import GraphDisplay from './GraphDisplay';
import ReactGantt from 'react-gantt';
import { Link, IndexLink } from 'react-router';
import './details.css';
export const DetailsGantt = React.createClass({
contextTypes: {
graph: React.PropTypes.object.isRequired,
},
render() {
const times = this.context.graph.calculateTimes({
readyDelay: 0,
defaultDuration: 5,
});
// calculate a date, applying a factor of 7.5/5 to convert
// work days to calendar days (discounting weekends and holidays)
let leftBound = new Date();
let rightBound = new Date();
const date = days => {
const d = moment().add(days * 1.5, 'days').startOf('day').toDate();
if (d < leftBound) {
leftBound = d;
}
if (d > rightBound) {
rightBound = d;
}
return d;
};
let rows = [];
Object.keys(times).forEach(n => {
const { start, end } = times[n];
// skip zero-duration nodes
if (start === end) {
return;
}
const node = this.context.graph.byName[n];
const startDate = date(start);
const climaxDate = date(node.state === 'inProgress' ? ((start + end) / 2) : (start + 1));
const endDate = date(end);
rows.push({
title: node.name,
startDate,
climaxDate,
endDate,
});
});
rows = rows.sort((a, b) => {
if (a.startDate < b.startDate) {
return -1;
} else if (a.startDate > b.startDate) {
return 1;
} else if (a.endDate < b.endDate) {
return -1;
} else if (a.endDate > b.endDate) {
return 1;
} else if (a.climaxDate > b.climaxDate) {
return -1;
} else if (a.climaxDate < b.climaxDate) {
return 1;
}
return 0;
});
return (
<Row>
<Col xs={12}>
<div id="gantt-chart">
<ReactGantt options={{
leftBound,
rightBound,
bootstraped: true, // sic.
showBorders: false,
labelWidth: '200px',
}} rows={rows} />
</div>
</Col>
</Row>
);
},
});
export const DetailsGraph = React.createClass({
contextTypes: {
graph: React.PropTypes.object.isRequired,
},
getInitialState() {
return {
showDone: true,
selectedNode: null,
};
},
handleNodeSelected(name) {
this.setState({ selectedNode: name });
},
renderNodeInfo() {
const node = this.context.graph.byName[this.state.selectedNode];
if (!node) {
return (
<Alert bsStyle="info">
<p>Select a node in the graph to see details about it</p>
</Alert>
);
}
return <WorkItem node={node} detailed />;
},
render() {
return (
<Row>
<Col className="hidden-xs hidden-sm" md={7}>
<GraphDisplay
root={this.props.params.rootWorkItem}
onSelect={this.handleNodeSelected}
showDone={this.state.showDone} />
<div className="pull-right">
<Button bsStyle="info" bsSize="small"
onClick={() => this.setState({ showDone: !this.state.showDone })}>
{this.state.showDone ? 'Hide' : 'Show'} completed
</Button>
</div>
</Col>
<Col className="hidden-md hidden-lg" xs={6}>
<ul>
{this.context.graph.nodes.map(node => (
<li key={node.name} onClick={() => this.handleNodeSelected(node.name)}>
{node.name}
</li>
))}
</ul>
</Col>
<Col xs={6} md={5}>
{this.renderNodeInfo()}
</Col>
</Row>
);
},
});
export const DetailsKanban = React.createClass({
contextTypes: {
graph: React.PropTypes.object.isRequired,
},
getInitialState() {
return {
visible: {
blocked: false,
inProgress: true,
ready: true,
done: false,
},
};
},
toggleVisible(state) {
const update = {};
update[state] = !this.state.visible[state];
this.setState({
visible: { ...this.state.visible, ...update },
});
},
render() {
const graph = this.context.graph;
const distances = graph.rootDistances(this.props.params.rootWorkItem);
const byState = { blocked: [], inProgress: [], ready: [], done: [] };
graph.nodes.forEach(node => byState[node.state].push(node));
const listItems = (state, title) => {
const visible = this.state.visible[state];
const nodes = byState[state];
// sort the longest distances first
nodes.sort((a, b) => distances[b.name] - distances[a.name]);
const header = (
<h2 onClick={() => this.toggleVisible(state)}>
{title}
</h2>
);
const className = `wi-${state}`;
if (!nodes.length) {
return (
<Panel collapsible expanded={visible} header={header}>
<span className="text-muted">no items</span>
</Panel>
);
}
return <Panel collapsible className={className} expanded={visible} header={header}>
<Row>
{
nodes.map(node => (
<Col key={node.name} xs={12}>
<WorkItem node={node} />
</Col>
))
}
</Row>
</Panel>;
};
return <div className="container-fluid">
{listItems('blocked', 'Blocked')}
{listItems('inProgress', 'In Progress')}
{listItems('ready', 'Ready')}
{listItems('done', 'Done')}
</div>;
},
});
const Tab = React.createClass({
// see http://brandonlehr.com/bootstrap-tabs-react-router-and-the-active-class/
contextTypes: {
router: React.PropTypes.object.isRequired,
},
propTypes: {
to: React.PropTypes.string,
onlyActiveOnIndex: React.PropTypes.bool,
children: React.PropTypes.node,
},
render() {
const isActive = this.context.router.isActive(this.props.to, this.props.onlyActiveOnIndex);
const LinkComponent = this.props.onlyActiveOnIndex ? IndexLink : Link;
const className = isActive ? 'active' : '';
return (
<li className={className}>
<LinkComponent to={this.props.to}>{this.props.children}</LinkComponent>
</li>
);
},
});
export const DetailsComponent = React.createClass({
contextTypes: {
graph: React.PropTypes.object.isRequired,
},
childContextTypes: {
graph: React.PropTypes.object,
},
getChildContext() {
// limit the graph to work items rooted at rootWorkItem and pass that along as
// the graph context
const graph = this.props.params.rootWorkItem === 'all' ?
this.context.graph :
this.context.graph.subgraph(this.props.params.rootWorkItem);
return { graph };
},
render() {
const root = `/details/${this.props.params.rootWorkItem}`;
return (
<div>
<nav>
<ul className="nav nav-tabs">
<Tab to={root} onlyActiveOnIndex>Graph</Tab>
<Tab to={`${root}/kanban`}>Kanban</Tab>
<Tab to={`${root}/gantt`}>Gantt</Tab>
</ul>
</nav>
<div className="details-pane">
{this.props.children}
</div>
</div>
);
},
});
|
lib/templates/src/routes.js
|
tomgrooffer/basenji
|
import React from 'react'
import { Route } from 'react-router'
import Index from 'views/Index/Index'
export default function getRoutes (history, store, callback) {
callback(
<Route path='/' component={Index} />
)
}
|
node_modules/reactify/node_modules/react-tools/src/browser/server/ReactServerRenderingTransaction.js
|
SFDevLabs/wholeocean
|
/**
* Copyright 2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in 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 = require('PooledClass');
var CallbackQueue = require('CallbackQueue');
var ReactPutListenerQueue = require('ReactPutListenerQueue');
var Transaction = require('Transaction');
var assign = require('Object.assign');
var emptyFunction = require('emptyFunction');
/**
* 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;
|
src/js/admin/article-edit/operation-div/operation-div.js
|
ucev/blog
|
import React from 'react'
import LabelBar from '../label-bar'
import ButtonBar from '../button-bar'
import './operation-div.style.scss'
export default () => (
<div id="op-div">
<LabelBar />
<ButtonBar />
</div>
)
|
clients/packages/admin-client/src/components/grids/float-layout.spec.js
|
nossas/bonde-client
|
/* eslint-disable no-unused-expressions */
import React from 'react';
import { shallow } from 'enzyme';
import { expect } from 'chai';
import { FloatLayout } from '../../components/grids';
describe('client/components/grids/float-layout', () => {
let wrapper;
const text = 'foo bar';
beforeEach(() => {
wrapper = shallow(<FloatLayout>{text}</FloatLayout>);
});
describe('#render', () => {
it('should render without crash', () => {
expect(wrapper).to.be.ok;
});
it('should render with text properly', () => {
expect(wrapper.text()).to.be.equal(text);
});
it('should render with floatTopRight className properly', () => {
const position = 'floatTopRight';
wrapper.setProps({ position });
expect(wrapper.props().className).to.be.equal(position);
});
it('should render with floatTopLeft className properly', () => {
const position = 'floatTopLeft';
wrapper.setProps({ position });
expect(wrapper.props().className).to.be.equal(position);
});
});
});
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.